feat: add channel canvas frontend support (#130)

This commit is contained in:
Wes
2026-03-20 11:22:28 -07:00
committed by GitHub
parent a6fd68f9c0
commit e70d31eabf
10 changed files with 279 additions and 1 deletions
+38
View File
@@ -3,6 +3,7 @@ import { invoke as tauriInvoke } from "@tauri-apps/api/core";
import type {
AddChannelMembersInput,
AddChannelMembersResult,
CanvasResponse,
Channel,
ChannelDetail,
ChannelMember,
@@ -23,6 +24,8 @@ import type {
SearchMessagesInput,
SearchMessagesResponse,
SendChannelMessageResult,
SetCanvasInput,
SetCanvasResult,
SetPresenceResult,
SetChannelPurposeInput,
SetChannelTopicInput,
@@ -280,6 +283,17 @@ type RawManagedAgentPrereqs = {
mcp: RawCommandAvailability;
};
type RawCanvasResponse = {
content: string | null;
updated_at: number | null;
author: string | null;
};
type RawSetCanvasResult = {
ok: boolean;
event_id: string;
};
function toTauriError(error: unknown): Error {
if (error instanceof Error) {
return error;
@@ -588,6 +602,30 @@ export async function leaveChannel(channelId: string): Promise<void> {
await invokeTauri("leave_channel", { channelId });
}
export async function getCanvas(channelId: string): Promise<CanvasResponse> {
const response = await invokeTauri<RawCanvasResponse>("get_canvas", {
channelId,
});
return {
content: response.content,
updatedAt: response.updated_at,
author: response.author,
};
}
export async function setCanvas(
input: SetCanvasInput,
): Promise<SetCanvasResult> {
const response = await invokeTauri<RawSetCanvasResult>("set_canvas", {
channelId: input.channelId,
content: input.content,
});
return {
ok: response.ok,
eventId: response.event_id,
};
}
export async function getHomeFeed(
input: GetHomeFeedInput = {},
): Promise<HomeFeedResponse> {
+16
View File
@@ -65,6 +65,22 @@ export type SetChannelPurposeInput = {
purpose: string;
};
export type CanvasResponse = {
content: string | null;
updatedAt: number | null;
author: string | null;
};
export type SetCanvasInput = {
channelId: string;
content: string;
};
export type SetCanvasResult = {
ok: boolean;
eventId: string;
};
export type AddChannelMembersInput = {
channelId: string;
pubkeys: string[];