Files
oranguru/.storybook/previewDecorator.tsx
Hein f737b1d11d feat(globalStateStore): implement global state management with persistence
- refactor state structure to include app, layout, navigation, owner, program, session, and user
- add slices for managing program, session, owner, user, layout, navigation, and app states
- create context provider for global state with automatic fetching and throttling
- implement persistence using IndexedDB with localStorage fallback
- add comprehensive README documentation for usage and API
2026-02-07 20:03:27 +02:00

41 lines
1.1 KiB
TypeScript

import '@mantine/core/styles.css';
import type { Decorator } from '@storybook/react-vite';
import { MantineProvider } from '@mantine/core';
import { ModalsProvider } from '@mantine/modals';
import { GlobalStateStoreProvider } from '../src/GlobalStateStore';
export const PreviewDecorator: Decorator = (Story, context) => {
const { parameters } = context;
// Allow stories to opt-out of GlobalStateStore provider
const useGlobalStore = parameters.globalStore !== false;
// Use 100% for fullscreen layout, 100vh otherwise
const isFullscreen = parameters.layout === 'fullscreen';
const containerStyle = {
height: isFullscreen ? '100%' : '100vh',
width: isFullscreen ? '100%' : '100vw',
};
return (
<MantineProvider>
<ModalsProvider>
{useGlobalStore ? (
<GlobalStateStoreProvider fetchOnMount={false}>
<div style={containerStyle}>
<Story />
</div>
</GlobalStateStoreProvider>
) : (
<div style={containerStyle}>
<Story />
</div>
)}
</ModalsProvider>
</MantineProvider>
);
};