mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-03-10 14:13:19 +00:00
33 lines
767 B
TypeScript
33 lines
767 B
TypeScript
|
import { create } from 'zustand';
|
||
|
|
||
|
export interface TabConfig {
|
||
|
id: string;
|
||
|
visible: boolean;
|
||
|
window: 'developer' | 'user';
|
||
|
order: number;
|
||
|
locked?: boolean;
|
||
|
}
|
||
|
|
||
|
interface TabConfigurationStore {
|
||
|
userTabs: TabConfig[];
|
||
|
developerTabs: TabConfig[];
|
||
|
get: () => { userTabs: TabConfig[]; developerTabs: TabConfig[] };
|
||
|
set: (config: { userTabs: TabConfig[]; developerTabs: TabConfig[] }) => void;
|
||
|
reset: () => void;
|
||
|
}
|
||
|
|
||
|
const DEFAULT_CONFIG = {
|
||
|
userTabs: [],
|
||
|
developerTabs: [],
|
||
|
};
|
||
|
|
||
|
export const tabConfigurationStore = create<TabConfigurationStore>((set, get) => ({
|
||
|
...DEFAULT_CONFIG,
|
||
|
get: () => ({
|
||
|
userTabs: get().userTabs,
|
||
|
developerTabs: get().developerTabs,
|
||
|
}),
|
||
|
set: (config) => set(config),
|
||
|
reset: () => set(DEFAULT_CONFIG),
|
||
|
}));
|