File size: 767 Bytes
c0a9bce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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),
}));