Skip to content

An open source alternative to Tableau. Embeddable visual analytic

feat: add hide-nav config for web use (#365)

islxyqwe596c7b7e9b72
diff --git a/packages/graphic-walker/src/App.tsx b/packages/graphic-walker/src/App.tsx
index aa530412..cf8f4531 100644
--- a/packages/graphic-walker/src/App.tsx
+++ b/packages/graphic-walker/src/App.tsx
@@ -30,7 +30,7 @@ import { ErrorBoundary } from 'react-error-boundary';
import Errorpanel from './components/errorpanel';
import { useCurrentMediaTheme } from './utils/media';
import Painter from './components/painter';
-import { classNames, parseErrorMessage } from './utils';
+import { classNames, cn, parseErrorMessage } from './utils';
import { VizEmbedMenu } from './components/embedMenu';
import DataBoard from './components/dataBoard';
import SideResize from './components/side-resize';
@@ -176,10 +176,18 @@ export const VizApp = observer(function VizApp(props: BaseVizProps) {
</div>
</TabsContent>
<TabsContent value={ISegmentKey.vis}>
- <div className="px-2 mx-2 mt-2">
- <VisNav />
- </div>
- <div style={{ marginTop: '0em' }} className="m-4 p-4 border border-border rounded-md rounded-tl-none">
+ {!props.hideChartNav && (
+ <div className="px-2 mx-2 mt-2">
+ <VisNav />
+ </div>
+ )}
+ <div
+ style={{ marginTop: '0em' }}
+ className={cn(
+ 'm-4 p-4 border border-border rounded-md rounded-tl-none',
+ props.hideChartNav ? 'border-t-0 rounded-t-none' : ''
+ )}
+ >
{enhanceAPI?.features?.askviz && (
<AskViz
api={typeof enhanceAPI.features.askviz === 'boolean' ? '' : enhanceAPI.features.askviz}
diff --git a/packages/graphic-walker/src/interfaces.ts b/packages/graphic-walker/src/interfaces.ts
index cb1c6f0b..3a3d9535 100644
--- a/packages/graphic-walker/src/interfaces.ts
+++ b/packages/graphic-walker/src/interfaces.ts
@@ -8,7 +8,6 @@ import { GWGlobalConfig } from './vis/theme';
import { VizSpecStore } from './store/visualSpecStore';
import { CommonStore } from './store/commonStore';
import type { XOR } from 'ts-xor';
-import { ThemeConfig } from 'tailwindcss/types/config';
export type DeepReadonly<T extends Record<keyof any, any>> = {
readonly [K in keyof T]: T[K] extends Record<keyof any, any> ? DeepReadonly<T[K]> : T[K];
@@ -901,6 +900,8 @@ export interface IVizProps {
extra?: ToolbarItemProps[];
exclude?: string[];
};
+ /** hide the chart navigation so make user can only edit on the only chart. */
+ hideChartNav?: boolean;
geographicData?: IGeographicData & {
key: string;
};