make secondary for sql not appear

This commit is contained in:
Nate Kelley 2025-03-29 22:01:07 -06:00
parent 9fa8c6a2d3
commit 9a4d32ce7a
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
6 changed files with 30 additions and 16 deletions

View File

@ -18,7 +18,7 @@ export const ChatHeaderTitle: React.FC<{
chatTitle: string; chatTitle: string;
chatId: string; chatId: string;
isCompletedStream: boolean; isCompletedStream: boolean;
}> = React.memo(({ chatTitle, chatId }) => { }> = React.memo(({ chatTitle, chatId, isCompletedStream }) => {
const { mutateAsync: updateChat } = useUpdateChat(); const { mutateAsync: updateChat } = useUpdateChat();
if (!chatTitle) return <div></div>; if (!chatTitle) return <div></div>;
@ -26,7 +26,7 @@ export const ChatHeaderTitle: React.FC<{
return ( return (
<AnimatePresence mode="wait" initial={false}> <AnimatePresence mode="wait" initial={false}>
<motion.div <motion.div
{...animation} {...(isCompletedStream ? animation : {})}
key={chatTitle} key={chatTitle}
className="flex w-full items-center overflow-hidden"> className="flex w-full items-center overflow-hidden">
<EditableTitle <EditableTitle

View File

@ -8,7 +8,6 @@ export type FileViewConfig = Partial<
FileView, FileView,
{ {
secondaryView: FileViewSecondary; secondaryView: FileViewSecondary;
renderView?: boolean; //this is really just used for metric because it has a vertical view and we don't want to render a right panel. undefined defaults to true
} }
> >
>; >;

View File

@ -10,6 +10,7 @@ import type { SelectedFile } from '../../interfaces';
import { timeout } from '@/lib'; import { timeout } from '@/lib';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
import { BusterRoutes, createBusterRoute } from '@/routes'; import { BusterRoutes, createBusterRoute } from '@/routes';
import { SelectedFileSecondaryRenderRecord } from '../../FileContainer/FileContainerSecondary/secondaryPanelsConfig';
export const useLayoutConfig = ({ export const useLayoutConfig = ({
selectedFile, selectedFile,
@ -48,24 +49,31 @@ export const useLayoutConfig = ({
}, [selectedFileViewConfig, selectedFileId, selectedFileView]); }, [selectedFileViewConfig, selectedFileId, selectedFileView]);
const selectedFileViewRenderSecondary: boolean = useMemo(() => { const selectedFileViewRenderSecondary: boolean = useMemo(() => {
if (!selectedFileId || !selectedFileViewConfig || !selectedFileView) return false; if (!selectedFileViewSecondary || !selectedFileType) return false;
if (selectedFileViewConfig?.[selectedFileView]?.secondaryView) { if (
return selectedFileViewConfig?.[selectedFileView]?.renderView !== false; selectedFileType in SelectedFileSecondaryRenderRecord &&
SelectedFileSecondaryRenderRecord[selectedFileType as FileType]?.[
selectedFileViewSecondary
] !== undefined
) {
return (
SelectedFileSecondaryRenderRecord[selectedFileType as FileType]?.[
selectedFileViewSecondary
] ?? false
);
} }
return false; return true;
}, [selectedFileViewConfig]); }, [selectedFileViewConfig, selectedFileId, selectedFileView, selectedFileType]);
const onSetFileView = useMemoizedFn( const onSetFileView = useMemoizedFn(
async ({ async ({
fileView, fileView,
fileId: fileIdProp, fileId: fileIdProp,
secondaryView, secondaryView
renderView
}: { }: {
fileView?: FileView; fileView?: FileView;
fileId?: string | undefined; fileId?: string | undefined;
secondaryView?: FileViewSecondary; secondaryView?: FileViewSecondary;
renderView?: boolean;
}) => { }) => {
const fileId = fileIdProp ?? selectedFileId; const fileId = fileIdProp ?? selectedFileId;
if (!fileId) return; if (!fileId) return;
@ -102,8 +110,7 @@ export const useLayoutConfig = ({
draft[fileId].fileViewConfig[usedFileView] = { draft[fileId].fileViewConfig[usedFileView] = {
...(draft[fileId].fileViewConfig[usedFileView] || {}), ...(draft[fileId].fileViewConfig[usedFileView] || {}),
secondaryView, secondaryView
renderView
}; };
} }
}); });

View File

@ -17,8 +17,7 @@ export const MetricContainerHeaderSegment: React.FC<FileContainerSegmentProps> =
const onSetFileView = useChatLayoutContextSelector((x) => x.onSetFileView); const onSetFileView = useChatLayoutContextSelector((x) => x.onSetFileView);
const onChange = useMemoizedFn((fileView: SegmentedItem<FileView>) => { const onChange = useMemoizedFn((fileView: SegmentedItem<FileView>) => {
const renderView = fileView.value === 'results' ? false : true; onSetFileView({ fileView: fileView.value });
onSetFileView({ fileView: fileView.value, renderView });
}); });
return ( return (

View File

@ -1,7 +1,7 @@
import type { FileType } from '@/api/asset_interfaces/chat'; import type { FileType } from '@/api/asset_interfaces/chat';
import type { FileContainerSecondaryProps } from '../interfaces'; import type { FileContainerSecondaryProps } from '../interfaces';
import React from 'react'; import React from 'react';
import { MetricSecondaryRecord } from './metricPanels'; import { MetricSecondaryRecord, MetrucSecondaryRenderRecord } from './metricPanels';
import { DashboardSecondaryRecord } from './dashboardPanels'; import { DashboardSecondaryRecord } from './dashboardPanels';
export const SelectedFileSecondaryRecord: Record< export const SelectedFileSecondaryRecord: Record<
@ -12,3 +12,8 @@ export const SelectedFileSecondaryRecord: Record<
dashboard: DashboardSecondaryRecord, dashboard: DashboardSecondaryRecord,
reasoning: {} reasoning: {}
}; };
export const SelectedFileSecondaryRenderRecord: Partial<Record<FileType, Record<string, boolean>>> =
{
metric: MetrucSecondaryRenderRecord
};

View File

@ -32,3 +32,7 @@ export const MetricSecondaryRecord: Record<
<VersionHistoryPanel assetId={selectedFile?.id || ''} type="metric" /> <VersionHistoryPanel assetId={selectedFile?.id || ''} type="metric" />
) )
}; };
export const MetrucSecondaryRenderRecord: Partial<Record<MetricFileViewSecondary, boolean>> = {
'sql-edit': false //we don't want to render the sql edit view in the secondary view because it is vertical
};