Incognito: visual indicator

This commit is contained in:
Enrico Ros
2024-11-11 11:49:33 -08:00
parent c472fbad1c
commit ee322b45eb
4 changed files with 17 additions and 2 deletions
+4
View File
@@ -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,
})),
}}
>
@@ -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) && (
<ListItemDecorator>
{(beingGenerated && props.showSymbols === 'gif') ? (
{isIncognito ? (
<VisibilityOffIcon sx={{ fontSize: 'xl' }} />
) : (beingGenerated && props.showSymbols === 'gif') ? (
<Avatar
alt='chat activity'
variant='plain'
@@ -118,6 +118,10 @@ export class ConversationHandler {
_chatStoreActions.setAbortController(this.conversationId, null, debugScope);
}
isIncognito(): boolean | undefined {
return _chatStoreActions.isIncognito(this.conversationId);
}
// Message Management
+4
View File
@@ -35,6 +35,7 @@ export interface ChatActions {
deleteConversations: (cIds: DConversationId[], newConversationPersonaId?: SystemPurposeId) => 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<ConversationsStore>()(/*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)