From 9ad7d16a1789ce00f7ba209485668424a9dd375d Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Sat, 16 May 2026 21:42:28 +0700 Subject: [PATCH] feat: expand activeTab options in SharedUIState to include messages, media, and review --- src/routes/uiStateRoutes.ts | 2 +- src/webserver.ts | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/routes/uiStateRoutes.ts b/src/routes/uiStateRoutes.ts index 0fb2780..4bceda0 100644 --- a/src/routes/uiStateRoutes.ts +++ b/src/routes/uiStateRoutes.ts @@ -9,7 +9,7 @@ export interface SharedUIState { selectedVoiceChannel: string; selectedTextGuild: string; selectedTextChannel: string; - activeTab: "voice" | "text"; + activeTab: "voice" | "messages" | "media" | "review"; isListening: boolean; isStreaming: boolean; } diff --git a/src/webserver.ts b/src/webserver.ts index c95ade3..a95a14a 100644 --- a/src/webserver.ts +++ b/src/webserver.ts @@ -54,7 +54,7 @@ interface SharedUIState { selectedVoiceChannel: string; selectedTextGuild: string; selectedTextChannel: string; - activeTab: "voice" | "text"; + activeTab: "voice" | "messages" | "media" | "review"; isListening: boolean; isStreaming: boolean; } @@ -84,7 +84,11 @@ export function normalizeSharedUIState( selectedVoiceChannel: value.selectedVoiceChannel ?? "", selectedTextGuild: value.selectedTextGuild ?? guild, selectedTextChannel: value.selectedTextChannel ?? "", - activeTab: value.activeTab === "text" ? "text" : "voice", + activeTab: (["voice", "messages", "media", "review"].includes( + value.activeTab ?? "", + ) + ? value.activeTab + : "voice") as "voice" | "messages" | "media" | "review", isListening: value.isListening ?? false, isStreaming: value.isStreaming ?? false, }; @@ -117,8 +121,12 @@ function patchSharedUIState(patch: SharedUIStatePatch) { if (typeof patch.selectedTextChannel === "string") { sharedUIState.selectedTextChannel = patch.selectedTextChannel; } - if (patch.activeTab === "voice" || patch.activeTab === "text") { - sharedUIState.activeTab = patch.activeTab; + if (["voice", "messages", "media", "review"].includes(patch.activeTab ?? "")) { + sharedUIState.activeTab = patch.activeTab as + | "voice" + | "messages" + | "media" + | "review"; } if (typeof patch.isListening === "boolean") { sharedUIState.isListening = patch.isListening;