diff --git a/.changeset/modern-ties-enjoy.md b/.changeset/modern-ties-enjoy.md new file mode 100644 index 00000000..e13ebb75 --- /dev/null +++ b/.changeset/modern-ties-enjoy.md @@ -0,0 +1,5 @@ +--- +'xstate-viz-app': minor +--- + +Add a feature to change orientation of the visualizer diff --git a/src/App.tsx b/src/App.tsx index cfffc708..b301f7c9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -21,6 +21,7 @@ import { useInterpretCanvas } from './useInterpretCanvas'; import router, { useRouter } from 'next/router'; import { parseEmbedQuery, withoutEmbedQueryParams } from './utils'; import { registryLinks } from './registryLinks'; +import { VizOrientationProvider } from './visualizerOrientationContext'; const defaultHeadProps = { title: 'XState Visualizer', @@ -131,23 +132,20 @@ function App({ isEmbedded = false }: { isEmbedded?: boolean }) { - - {!(embed?.isEmbedded && embed.mode === EmbedMode.Panels) && ( - - - - )} - - - + + <> + {!( + embed?.isEmbedded && embed.mode === EmbedMode.Panels + ) && ( + + + + )} + + + + + diff --git a/src/PanelsView.tsx b/src/PanelsView.tsx index 9770c26e..7cfd9550 100644 --- a/src/PanelsView.tsx +++ b/src/PanelsView.tsx @@ -24,10 +24,12 @@ import { SpinnerWithText } from './SpinnerWithText'; import { StatePanel } from './StatePanel'; import { EmbedMode } from './types'; import { calculatePanelIndexByPanelName } from './utils'; +import { useVizOrientation } from './visualizerOrientationContext'; export const PanelsView = (props: BoxProps) => { const embed = useEmbed(); const simService = useSimulation(); + const vizOrientation = useVizOrientation(); const services = useSelector(simService, selectServices); const [sourceState, sendToSourceService] = useSourceActor(); const [activePanelIndex, setActiveTabIndex] = useState(() => @@ -40,10 +42,10 @@ export const PanelsView = (props: BoxProps) => { } }, [embed]); - return ( + return vizOrientation.orientation === 'full' ? null : (