From ee322b45eb503201868ef5907cd0e6f94b1b4dd3 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Mon, 11 Nov 2024 11:49:33 -0800 Subject: [PATCH] Incognito: visual indicator --- src/apps/chat/AppChat.tsx | 4 ++++ src/apps/chat/components/layout-drawer/ChatDrawerItem.tsx | 7 +++++-- src/common/chat-overlay/ConversationHandler.ts | 4 ++++ src/common/stores/chat/store-chats.ts | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/apps/chat/AppChat.tsx b/src/apps/chat/AppChat.tsx index ad818a8ea..b2643f171 100644 --- a/src/apps/chat/AppChat.tsx +++ b/src/apps/chat/AppChat.tsx @@ -560,6 +560,7 @@ export function AppChat() { const _paneIsFocused = idx === focusedPaneIndex; const _paneConversationId = pane.conversationId; const _paneChatHandler = paneHandlers[idx] ?? null; + const _paneIsIncognito = _paneChatHandler?.isIncognito() ?? false; const _paneBeamStoreApi = paneBeamStores[idx] ?? null; const _paneBeamIsOpen = !!beamsOpens?.[idx] && !!_paneBeamStoreApi; const _panesCount = chatPanes.length; @@ -603,6 +604,9 @@ export function AppChat() { // it was optional before: https://github.com/bvaughn/react-resizable-panels/issues/241 pointerEvents: 'auto', }), + ...((_paneIsIncognito && { + backgroundColor: theme.palette.background.level3, + })), }} > diff --git a/src/apps/chat/components/layout-drawer/ChatDrawerItem.tsx b/src/apps/chat/components/layout-drawer/ChatDrawerItem.tsx index 679f23af0..823de4e78 100644 --- a/src/apps/chat/components/layout-drawer/ChatDrawerItem.tsx +++ b/src/apps/chat/components/layout-drawer/ChatDrawerItem.tsx @@ -11,6 +11,7 @@ import FileUploadOutlinedIcon from '@mui/icons-material/FileUploadOutlined'; import FolderIcon from '@mui/icons-material/Folder'; import FolderOutlinedIcon from '@mui/icons-material/FolderOutlined'; import TelegramIcon from '@mui/icons-material/Telegram'; +import VisibilityOffIcon from '@mui/icons-material/VisibilityOff'; import { SystemPurposeId, SystemPurposes } from '../../../../data'; @@ -207,9 +208,11 @@ function ChatDrawerItem(props: { const titleRowComponent = React.useMemo(() => <> {/* Symbol, if globally enabled */} - {props.showSymbols && ( + {(props.showSymbols || isIncognito) && ( - {(beingGenerated && props.showSymbols === 'gif') ? ( + {isIncognito ? ( + + ) : (beingGenerated && props.showSymbols === 'gif') ? ( DConversationId; // within a conversation + isIncognito: (cId: DConversationId) => boolean | undefined; setAbortController: (cId: DConversationId, _abortController: AbortController | null, debugScope: string) => void; abortConversationTemp: (cId: DConversationId) => void; historyReplace: (cId: DConversationId, messages: DMessage[]) => void; @@ -175,6 +176,9 @@ export const useChatStore = create()(/*devtools(*/ ), })), + isIncognito: (conversationId: DConversationId): boolean | undefined => + _get().conversations.find(_c => _c.id === conversationId)?._isIncognito ?? undefined, + setAbortController: (conversationId: DConversationId, _nextController: AbortController | null, debugScope: string) => _get()._editConversation(conversationId, ({ _abortController: _currentController }) => { // [DEV] Debug state management of controllers - FIXME: migrate away from a per-chat, unless done properly (cascade triggering)