feat(app): wire set_group/delete_group bridge commands
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -245,3 +245,13 @@ pub async fn set_workspace_meta(state: BridgeState<'_>, workspace_id: String, na
|
|||||||
pub async fn create_group(state: BridgeState<'_>, name: String, color: String) -> Result<Value, String> {
|
pub async fn create_group(state: BridgeState<'_>, name: String, color: String) -> Result<Value, String> {
|
||||||
data_of(state.request(Cmd::CreateGroup { name, color }).await.map_err(|e| e.to_string())?)
|
data_of(state.request(Cmd::CreateGroup { name, color }).await.map_err(|e| e.to_string())?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn set_group(state: BridgeState<'_>, group_id: String, name: Option<String>, color: Option<String>, order: Option<u32>) -> Result<Value, String> {
|
||||||
|
data_of(state.request(Cmd::SetGroup { group_id: GroupId(group_id), name, color, order }).await.map_err(|e| e.to_string())?)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn delete_group(state: BridgeState<'_>, group_id: String) -> Result<Value, String> {
|
||||||
|
data_of(state.request(Cmd::DeleteGroup { group_id: GroupId(group_id) }).await.map_err(|e| e.to_string())?)
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ pub fn run() {
|
|||||||
bridge::close_workspace,
|
bridge::close_workspace,
|
||||||
bridge::set_workspace_meta,
|
bridge::set_workspace_meta,
|
||||||
bridge::create_group,
|
bridge::create_group,
|
||||||
|
bridge::set_group,
|
||||||
|
bridge::delete_group,
|
||||||
])
|
])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running spacesh");
|
.expect("error while running spacesh");
|
||||||
|
|||||||
@@ -130,6 +130,14 @@ export async function createGroup(name: string, color: string): Promise<string>
|
|||||||
return data.group_id;
|
return data.group_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function setGroup(groupId: string, meta: { name?: string; color?: string; order?: number }): Promise<void> {
|
||||||
|
await invoke("set_group", { groupId, name: meta.name ?? null, color: meta.color ?? null, order: meta.order ?? null });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteGroup(groupId: string): Promise<void> {
|
||||||
|
await invoke("delete_group", { groupId });
|
||||||
|
}
|
||||||
|
|
||||||
export async function closeSurfaceCmd(surfaceId: string): Promise<void> {
|
export async function closeSurfaceCmd(surfaceId: string): Promise<void> {
|
||||||
await invoke("close_surface", { surfaceId });
|
await invoke("close_surface", { surfaceId });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user