add better export settings

This commit is contained in:
Nate Kelley 2025-08-08 17:27:28 -06:00
parent 40454d2519
commit 8feff47f4c
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
5 changed files with 12 additions and 18 deletions

View File

@ -5,5 +5,5 @@ export default async function Page(props: { params: Promise<{ reportId: string }
const { reportId } = params; const { reportId } = params;
return <ReportPageController reportId={reportId} />; return <ReportPageController reportId={reportId} mode="default" />;
} }

View File

@ -10,13 +10,13 @@ export const MetricContent = React.memo(
({ ({
metricId, metricId,
metricVersionNumber, metricVersionNumber,
isBaseElement = false, isExportMode = false,
readOnly = false readOnly = false
}: { }: {
metricId: string; metricId: string;
metricVersionNumber: number | undefined; metricVersionNumber: number | undefined;
readOnly?: boolean; readOnly?: boolean;
isBaseElement?: boolean; isExportMode?: boolean;
}) => { }) => {
const chatId = useChatLayoutContextSelector((x) => x.chatId); const chatId = useChatLayoutContextSelector((x) => x.chatId);
const reportId = useChatLayoutContextSelector((x) => x.reportId) || ''; const reportId = useChatLayoutContextSelector((x) => x.reportId) || '';
@ -24,7 +24,7 @@ export const MetricContent = React.memo(
const ref = useRef<HTMLDivElement>(null); const ref = useRef<HTMLDivElement>(null);
const [inViewport] = useInViewport(ref, { const [inViewport] = useInViewport(ref, {
threshold: isBaseElement ? 0 : 0.33 threshold: isExportMode ? 0 : 0.33
}); });
const renderChart = inViewport; const renderChart = inViewport;
@ -73,7 +73,7 @@ export const MetricContent = React.memo(
return ( return (
<MetricCard <MetricCard
metricLink={link} metricLink={link}
animate={!isBaseElement} animate={!isExportMode}
metricId={metricId} metricId={metricId}
readOnly={readOnly} readOnly={readOnly}
isDragOverlay={false} isDragOverlay={false}

View File

@ -30,18 +30,15 @@ export const MetricElement = withHOC(
const metricId = props.element.metricId; const metricId = props.element.metricId;
const metricVersionNumber = props.element.metricVersionNumber; const metricVersionNumber = props.element.metricVersionNumber;
const readOnly = useReadOnly(); const readOnly = useReadOnly();
console.log(props.editor.getOptionsStore(GlobalVariablePlugin));
console.log(props.editor.getOptions(GlobalVariablePlugin));
const mode = props.editor.getOption(GlobalVariablePlugin, 'mode'); const mode = props.editor.getOption(GlobalVariablePlugin, 'mode');
console.log('mode', mode);
const content = metricId ? ( const content = metricId ? (
<MetricResizeContainer> <MetricResizeContainer>
<MetricContent <MetricContent
metricId={metricId} metricId={metricId}
metricVersionNumber={metricVersionNumber} metricVersionNumber={metricVersionNumber}
readOnly={readOnly} readOnly={readOnly}
isExportMode={mode === 'export'}
/> />
</MetricResizeContainer> </MetricResizeContainer>
) : ( ) : (

View File

@ -5,13 +5,12 @@ import { useEditorRef, usePlateEditor, type TPlateEditor } from 'platejs/react';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { EditorKit } from './editor-kit'; import { EditorKit } from './editor-kit';
import { FIXED_TOOLBAR_KIT_KEY } from './plugins/fixed-toolbar-kit'; import { FIXED_TOOLBAR_KIT_KEY } from './plugins/fixed-toolbar-kit';
import { CUSTOM_KEYS } from './config/keys';
import { GlobalVariablePlugin } from './plugins/global-variable-kit'; import { GlobalVariablePlugin } from './plugins/global-variable-kit';
export const useReportEditor = ({ export const useReportEditor = ({
value, value,
disabled, disabled,
mode, mode = 'default',
useFixedToolbarKit = false useFixedToolbarKit = false
}: { }: {
value: Value; value: Value;
@ -27,13 +26,11 @@ export const useReportEditor = ({
return [ return [
...EditorKit, ...EditorKit,
GlobalVariablePlugin.configurePlugin(GlobalVariablePlugin, { GlobalVariablePlugin.configure({
options: { options: { mode }
mode
}
}) })
]; ].filter((p) => !filteredKeys.includes(p.key));
}, []); }, [useFixedToolbarKit, mode]);
return usePlateEditor({ return usePlateEditor({
plugins, plugins,

View File

@ -2,7 +2,7 @@
import { useGetReport, useUpdateReport } from '@/api/buster_rest/reports'; import { useGetReport, useUpdateReport } from '@/api/buster_rest/reports';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
import React, { useEffect } from 'react'; import React from 'react';
import { ReportPageHeader } from './ReportPageHeader'; import { ReportPageHeader } from './ReportPageHeader';
import { useMemoizedFn } from '@/hooks/useMemoizedFn'; import { useMemoizedFn } from '@/hooks/useMemoizedFn';
import { useDebounceFn } from '@/hooks/useDebounce'; import { useDebounceFn } from '@/hooks/useDebounce';