From 0e9fe6811012e4a0a61f16e0a0fbadcb31208900 Mon Sep 17 00:00:00 2001 From: balibabu Date: Thu, 22 Jan 2026 09:48:44 +0800 Subject: [PATCH] Feat: Adjust the icons in the chat page's collapsible panel. (#12755) ### What problem does this PR solve? Feat: Adjust the icons in the chat page's collapsible panel. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .../chat/app-settings/chat-settings.tsx | 33 +++++++++++-- web/src/pages/next-chats/chat/index.tsx | 19 ++------ web/src/pages/next-chats/chat/sessions.tsx | 48 +++++++------------ 3 files changed, 49 insertions(+), 51 deletions(-) diff --git a/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx b/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx index 9f715500d..fb5493278 100644 --- a/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx +++ b/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx @@ -2,6 +2,7 @@ import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; import { Separator } from '@/components/ui/separator'; import { DatasetMetadata } from '@/constants/chat'; +import { useSetModalState } from '@/hooks/common-hooks'; import { useFetchDialog, useSetDialog } from '@/hooks/use-chat-request'; import { removeUselessFieldsFromValues, @@ -9,7 +10,7 @@ import { } from '@/utils/form'; import { zodResolver } from '@hookform/resolvers/zod'; import { isEmpty, omit } from 'lodash'; -import { X } from 'lucide-react'; +import { PanelRightClose, Settings } from 'lucide-react'; import { useEffect } from 'react'; import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; @@ -21,14 +22,18 @@ import { ChatPromptEngine } from './chat-prompt-engine'; import { SavingButton } from './saving-button'; import { useChatSettingSchema } from './use-chat-setting-schema'; -type ChatSettingsProps = { switchSettingVisible(): void }; -export function ChatSettings({ switchSettingVisible }: ChatSettingsProps) { +type ChatSettingsProps = { hasSingleChatBox: boolean }; + +export function ChatSettings({ hasSingleChatBox }: ChatSettingsProps) { const formSchema = useChatSettingSchema(); const { data } = useFetchDialog(); const { setDialog, loading } = useSetDialog(); const { id } = useParams(); const { t } = useTranslation(); + const { visible: settingVisible, switchVisible: switchSettingVisible } = + useSetModalState(true); + type FormSchemaType = z.infer; const form = useForm({ @@ -94,11 +99,29 @@ export function ChatSettings({ switchSettingVisible }: ChatSettingsProps) { } }, [data, form]); + if (settingVisible) { + return ( +
+ +
+ ); + } + return ( -
+
{t('chat.chatSetting')} - +
+
@@ -135,13 +132,9 @@ export default function Chat() {
- + - + - {settingVisible && ( - - )} +
diff --git a/web/src/pages/next-chats/chat/sessions.tsx b/web/src/pages/next-chats/chat/sessions.tsx index 34519b32d..8ce21d993 100644 --- a/web/src/pages/next-chats/chat/sessions.tsx +++ b/web/src/pages/next-chats/chat/sessions.tsx @@ -12,13 +12,7 @@ import { useRemoveConversation, } from '@/hooks/use-chat-request'; import { cn } from '@/lib/utils'; -import { - Check, - PanelLeftClose, - PanelRightClose, - Plus, - Trash2, -} from 'lucide-react'; +import { Check, PanelLeftClose, Plus, Trash2 } from 'lucide-react'; import { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useHandleClickConversationCard } from '../hooks/use-click-card'; @@ -28,12 +22,8 @@ import { ConversationDropdown } from './conversation-dropdown'; type SessionProps = Pick< ReturnType, 'handleConversationCardClick' -> & { switchSettingVisible(): void; hasSingleChatBox: boolean }; -export function Sessions({ - hasSingleChatBox, - handleConversationCardClick, - switchSettingVisible, -}: SessionProps) { +>; +export function Sessions({ handleConversationCardClick }: SessionProps) { const { t } = useTranslation(); const { list: conversationList, @@ -115,15 +105,19 @@ export function Sessions({ if (!visible) { return ( - +
+ +
); } return ( -
+
-
- -
); }