diff --git a/src/apps/chat/components/applayout/ChatDrawerItems.tsx b/src/apps/chat/components/applayout/ChatDrawerItems.tsx index b3ce23936a..559062e17c 100644 --- a/src/apps/chat/components/applayout/ChatDrawerItems.tsx +++ b/src/apps/chat/components/applayout/ChatDrawerItems.tsx @@ -7,7 +7,7 @@ import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import FileUploadIcon from '@mui/icons-material/FileUpload'; import { OpenAIIcon } from '~/common/components/icons/OpenAIIcon'; -import { closeLayoutDrawerMenu } from '~/common/layout/store-applayout'; +import { closeLayoutDrawer } from '~/common/layout/store-applayout'; import { useChatStore } from '~/common/state/store-chats'; import { useUIPreferencesStore } from '~/common/state/store-ui'; @@ -51,13 +51,13 @@ export function ChatDrawerItems(props: { setActiveConversationId(topNewConversationId); else createConversation(); - closeLayoutDrawerMenu(); + closeLayoutDrawer(); }; const handleConversationActivate = React.useCallback((conversationId: string, closeMenu: boolean) => { setActiveConversationId(conversationId); if (closeMenu) - closeLayoutDrawerMenu(); + closeLayoutDrawer(); }, [setActiveConversationId]); const handleConversationDelete = React.useCallback((conversationId: string) => { diff --git a/src/apps/chat/components/applayout/ChatMenuItems.tsx b/src/apps/chat/components/applayout/ChatMenuItems.tsx index 480af698e4..4488ab8dbf 100644 --- a/src/apps/chat/components/applayout/ChatMenuItems.tsx +++ b/src/apps/chat/components/applayout/ChatMenuItems.tsx @@ -10,7 +10,7 @@ import FileDownloadIcon from '@mui/icons-material/FileDownload'; import ForkRightIcon from '@mui/icons-material/ForkRight'; import SettingsSuggestIcon from '@mui/icons-material/SettingsSuggest'; -import { setLayoutMenuAnchor } from '~/common/layout/store-applayout'; +import { closeLayoutMenu } from '~/common/layout/store-applayout'; import { useUICounter, useUIPreferencesStore } from '~/common/state/store-ui'; @@ -32,32 +32,30 @@ export function ChatMenuItems(props: { // derived state const disabled = !props.conversationId || props.isConversationEmpty; - const closeContextMenu = () => setLayoutMenuAnchor(null); - const handleSystemMessagesToggle = () => setShowSystemMessages(!showSystemMessages); const handleConversationExport = (e: React.MouseEvent) => { e.stopPropagation(); - closeContextMenu(); + closeLayoutMenu(); props.onExportConversation(!disabled ? props.conversationId : null); shareTouch(); }; const handleConversationDuplicate = (e: React.MouseEvent) => { e.stopPropagation(); - closeContextMenu(); + closeLayoutMenu(); props.conversationId && props.onDuplicateConversation(props.conversationId); }; const handleConversationFlatten = (e: React.MouseEvent) => { e.stopPropagation(); - closeContextMenu(); + closeLayoutMenu(); props.conversationId && props.onFlattenConversation(props.conversationId); }; const handleToggleMessageSelectionMode = (e: React.MouseEvent) => { e.stopPropagation(); - closeContextMenu(); + closeLayoutMenu(); props.setIsMessageSelectionMode(!props.isMessageSelectionMode); }; diff --git a/src/apps/chat/components/applayout/useLLMDropdown.tsx b/src/apps/chat/components/applayout/useLLMDropdown.tsx index e8fe71c5a4..0d78448cab 100644 --- a/src/apps/chat/components/applayout/useLLMDropdown.tsx +++ b/src/apps/chat/components/applayout/useLLMDropdown.tsx @@ -1,14 +1,15 @@ import * as React from 'react'; import { shallow } from 'zustand/shallow'; -import { ListItemButton, ListItemDecorator } from '@mui/joy'; +import { ListItemButton, ListItemDecorator, Tooltip } from '@mui/joy'; import BuildCircleIcon from '@mui/icons-material/BuildCircle'; import SettingsIcon from '@mui/icons-material/Settings'; import { DLLM, DLLMId, DModelSourceId, useModelsStore } from '~/modules/llms/store-llms'; import { AppBarDropdown, DropdownItems } from '~/common/layout/AppBarDropdown'; -import { useUIStateStore } from '~/common/state/store-ui'; +import { KeyStroke } from '~/common/components/KeyStroke'; +import { openLayoutLLMOptions, openLayoutModelsSetup } from '~/common/layout/store-applayout'; function AppBarLLMDropdown(props: { @@ -34,9 +35,8 @@ function AppBarLLMDropdown(props: { const handleChatLLMChange = (_event: any, value: DLLMId | null) => value && props.setLlmId(value); - const handleOpenLLMOptions = () => props.llmId && useUIStateStore.getState().openLLMOptions(props.llmId); + const handleOpenLLMOptions = () => props.llmId && openLayoutLLMOptions(props.llmId); - const handleOpenModelsSetup = () => useUIStateStore.getState().openModelsSetup(); return ( )} - - - Models - + }> + + + Models + + } /> diff --git a/src/apps/chat/components/composer/Composer.tsx b/src/apps/chat/components/composer/Composer.tsx index e8dfe8646c..820636d179 100644 --- a/src/apps/chat/components/composer/Composer.tsx +++ b/src/apps/chat/components/composer/Composer.tsx @@ -21,16 +21,18 @@ import { ContentReducer } from '~/modules/aifn/summarize/ContentReducer'; import { LLMOptionsOpenAI } from '~/modules/llms/vendors/openai/openai.vendor'; import { useChatLLM } from '~/modules/llms/store-llms'; +import { KeyStroke } from '~/common/components/KeyStroke'; import { SpeechResult, useSpeechRecognition } from '~/common/components/useSpeechRecognition'; import { countModelTokens } from '~/common/util/token-counter'; import { extractFilePathsWithCommonRadix } from '~/common/util/dropTextUtils'; import { hideOnDesktop, hideOnMobile } from '~/common/theme'; import { htmlTableToMarkdown } from '~/common/util/htmlTableToMarkdown'; import { launchAppCall } from '~/common/routes'; +import { openLayoutPreferences } from '~/common/layout/store-applayout'; import { pdfToText } from '~/common/util/pdfToText'; import { useChatStore } from '~/common/state/store-chats'; import { useGlobalShortcut } from '~/common/components/useGlobalShortcut'; -import { useUIPreferencesStore, useUIStateStore } from '~/common/state/store-ui'; +import { useUIPreferencesStore } from '~/common/state/store-ui'; import { CameraCaptureButton } from './CameraCaptureButton'; import { ChatModeId, useComposerStartupText } from './store-composer'; @@ -88,11 +90,11 @@ const pasteClipboardLegend = Paste as 📚 Markdown attachment
Also converts Code and Tables
- Ctrl + Shift + V +
; const MicButton = (props: { variant: VariantProp, color: ColorPaletteProp, onClick: () => void, sx?: SxProps }) => - + } placement='top'> @@ -189,7 +191,7 @@ export function Composer(props: { const handleCallClicked = () => props.conversationId && systemPurposeId && launchAppCall(props.conversationId, systemPurposeId); - const handleDrawOptionsClicked = () => useUIStateStore.getState().openSettings(2); + const handleDrawOptionsClicked = () => openLayoutPreferences(2); const handleToggleChatMode = (event: React.MouseEvent) => diff --git a/src/apps/link/AppChatLinkDrawerItems.tsx b/src/apps/link/AppChatLinkDrawerItems.tsx index c8fcb3dc48..086edb5ac7 100644 --- a/src/apps/link/AppChatLinkDrawerItems.tsx +++ b/src/apps/link/AppChatLinkDrawerItems.tsx @@ -8,7 +8,7 @@ import { useChatLinkItems } from '../chat/trade/store-sharing'; import { Brand } from '~/common/brand'; import { Link } from '~/common/components/Link'; -import { closeLayoutDrawerMenu } from '~/common/layout/store-applayout'; +import { closeLayoutDrawer } from '~/common/layout/store-applayout'; import { getChatLinkRelativePath, getHomeLink } from '~/common/routes'; @@ -27,7 +27,7 @@ export function AppChatLinkDrawerItems() { return <> diff --git a/src/apps/models-modal/LLMOptionsModal.tsx b/src/apps/models-modal/LLMOptionsModal.tsx index 4b5a682aea..863a9157ed 100644 --- a/src/apps/models-modal/LLMOptionsModal.tsx +++ b/src/apps/models-modal/LLMOptionsModal.tsx @@ -9,7 +9,7 @@ import VisibilityOffIcon from '@mui/icons-material/VisibilityOff'; import { DLLMId, useModelsStore } from '~/modules/llms/store-llms'; import { GoodModal } from '~/common/components/GoodModal'; -import { useUIStateStore } from '~/common/state/store-ui'; +import { closeLayoutLLMOptions } from '~/common/layout/store-applayout'; import { VendorLLMOptions } from './VendorLLMOptions'; @@ -20,7 +20,6 @@ export function LLMOptionsModal(props: { id: DLLMId }) { const [showDetails, setShowDetails] = React.useState(false); // external state - const closeLLMOptions = useUIStateStore(state => state.closeLLMOptions); const { llm, removeLLM, updateLLM, @@ -49,14 +48,14 @@ export function LLMOptionsModal(props: { id: DLLMId }) { const handleLlmDelete = () => { removeLLM(llm.id); - closeLLMOptions(); + closeLayoutLLMOptions(); }; return ( {llm.label} options} - open={!!props.id} onClose={closeLLMOptions} + open={!!props.id} onClose={closeLayoutLLMOptions} startButton={