diff --git a/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/page.tsx b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/page.tsx index 8ce2ac231..fdeff9839 100644 --- a/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/page.tsx +++ b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/page.tsx @@ -1,7 +1,6 @@ 'use client'; import { FileIndeterminateLoader } from '@/components/features/FileIndeterminateLoader'; -import { StatusCard } from '@/components/ui/card/StatusCard'; import { ReasoningController } from '@/controllers/ReasoningController'; import { useChatIndividualContextSelector } from '@/layouts/ChatLayout/ChatContext'; @@ -15,12 +14,8 @@ export default function Page(params: { params: { chatId: string } }) { return ( <> - -
- +
+
); diff --git a/web/src/components/ui/inputs/InputTextAreaButton.tsx b/web/src/components/ui/inputs/InputTextAreaButton.tsx index 42549321c..c8c340673 100644 --- a/web/src/components/ui/inputs/InputTextAreaButton.tsx +++ b/web/src/components/ui/inputs/InputTextAreaButton.tsx @@ -13,7 +13,7 @@ const inputTextAreaButtonVariants = cva( variants: { variant: { default: - 'has-[textarea:hover]:border-foreground shadow has-[textarea:focus]:border-foreground has-[textarea:disabled]:border-border' + 'has-[textarea:hover]:border-foreground shadow bg-background has-[textarea:focus]:border-foreground has-[textarea:disabled]:border-border' } } } diff --git a/web/src/layouts/ChatLayout/ChatLayoutContext/ChatLayoutContext.tsx b/web/src/layouts/ChatLayout/ChatLayoutContext/ChatLayoutContext.tsx index e0a1f8995..bcf5895e9 100644 --- a/web/src/layouts/ChatLayout/ChatLayoutContext/ChatLayoutContext.tsx +++ b/web/src/layouts/ChatLayout/ChatLayoutContext/ChatLayoutContext.tsx @@ -44,9 +44,7 @@ export const useChatLayout = ({ appSplitterRef }: UseChatSplitterProps) => { renderViewLayoutKey } = useSelectedFileAndLayout({ animateOpenSplitter }); - const { onCollapseFileClick } = useLayoutCollapse({ - animateOpenSplitter - }); + const onCollapseFileClick = useLayoutCollapse({ onSetSelectedFile }); const fileLayoutContext = useChatFileLayout({ selectedFileId: selectedFile?.id, diff --git a/web/src/layouts/ChatLayout/hooks/useLayoutCollapse.tsx b/web/src/layouts/ChatLayout/hooks/useLayoutCollapse.tsx index 5daddfb4e..289197dd7 100644 --- a/web/src/layouts/ChatLayout/hooks/useLayoutCollapse.tsx +++ b/web/src/layouts/ChatLayout/hooks/useLayoutCollapse.tsx @@ -1,30 +1,16 @@ 'use client'; import { useMemoizedFn } from '@/hooks'; -import { useEffect, useMemo, useState } from 'react'; -import { SelectedFileParams } from './useSelectedFileAndLayout'; -import { ChatLayoutView } from '../interfaces'; +import { useSelectedFileAndLayout } from './useSelectedFileAndLayout'; export const useLayoutCollapse = ({ - animateOpenSplitter + onSetSelectedFile }: { - animateOpenSplitter: (side: 'left' | 'right' | 'both') => void; + onSetSelectedFile: ReturnType['onSetSelectedFile']; }) => { const onCollapseFileClick = useMemoizedFn((close?: boolean) => { - // if (selectedFile && selectedFile.type === 'reasoning') { - // animateOpenSplitter(!isCloseAction ? 'both' : 'left'); - // } else if (isFileLayout) { - // // For file layout, toggle between 'both' and 'right' - // animateOpenSplitter(!isCloseAction && selectedFile ? 'both' : 'right'); - // } else { - // // For other layouts, toggle between 'right' and 'both' - // animateOpenSplitter(isCloseAction ? 'left' : 'both'); - // } - - animateOpenSplitter('left'); + onSetSelectedFile(null); }); - return { - onCollapseFileClick - }; + return onCollapseFileClick; }; diff --git a/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/initializeSelectedFile.ts b/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/initializeSelectedFile.ts index 4e10820ff..f1f8eba2a 100644 --- a/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/initializeSelectedFile.ts +++ b/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/initializeSelectedFile.ts @@ -1,7 +1,7 @@ import type { SelectedFile } from '../../interfaces'; import type { ChatURLParsed } from './parsePathnameSegments'; -export const initializeSelectedFile = (params: ChatURLParsed): SelectedFile | undefined => { +export const initializeSelectedFile = (params: ChatURLParsed): SelectedFile | null => { const { metricId, collectionId, datasetId, dashboardId, chatId, messageId } = params; if (metricId) { @@ -25,5 +25,5 @@ export const initializeSelectedFile = (params: ChatURLParsed): SelectedFile | un }; } - return undefined; + return null; }; diff --git a/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/useSelectedFileAndLayout.ts b/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/useSelectedFileAndLayout.ts index c51ba5f57..59d5cba5d 100644 --- a/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/useSelectedFileAndLayout.ts +++ b/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/useSelectedFileAndLayout.ts @@ -5,11 +5,7 @@ import type { ChatLayoutView, SelectedFile } from '../../interfaces'; import { usePathname } from 'next/navigation'; import { parsePathnameSegments } from './parsePathnameSegments'; import { useMemoizedFn } from '@/hooks'; -import { - createChatAssetRoute, - createChatRoute, - createFileRoute -} from '../../ChatLayoutContext/helpers'; +import { createChatAssetRoute, createChatRoute } from '../../ChatLayoutContext/helpers'; import { useAppLayoutContextSelector } from '@/context/BusterAppLayout'; import { initializeSelectedFile } from './initializeSelectedFile'; import { BusterRoutes, createBusterRoute } from '@/routes'; @@ -26,7 +22,7 @@ export const useSelectedFileAndLayout = ({ const { chatId } = params; - const [selectedFile, setSelectedFile] = useState(() => + const [selectedFile, setSelectedFile] = useState(() => initializeSelectedFile(params) ); @@ -51,6 +47,7 @@ export const useSelectedFileAndLayout = ({ if (!file || !fileType || !fileId || !chatId) { if (chatId) { await onChangePage(createChatRoute(chatId)); + setSelectedFile(null); animateOpenSplitter('left'); } else { await onChangePage(createBusterRoute({ route: BusterRoutes.APP_HOME })); @@ -62,7 +59,7 @@ export const useSelectedFileAndLayout = ({ ? createChatRoute(chatId) : createChatAssetRoute({ chatId, assetId: fileId, type: fileType }); setRenderViewLayoutKey('both'); - setSelectedFile(isSameAsCurrentFile ? undefined : file); + setSelectedFile(isSameAsCurrentFile ? null : file); await onChangePage(route); startTransition(() => { onChangePage(route); //this is hack for now...