| @@ -1,49 +1,19 @@ | ||
| 1 | -import create from 'zustand'; | |
| 2 | -import { devtools, persist } from 'zustand/middleware'; | |
| 1 | +import { create } from 'zustand'; | |
| 2 | +import { devtools } from 'zustand/middleware'; | |
| 3 | 3 | |
| 4 | 4 | type GlobalTypes = { |
| 5 | - seenNotices: string[]; | |
| 6 | - setSeenNotice: (notice: string) => void; | |
| 7 | - previousSettings: { | |
| 8 | - copyButton: boolean; | |
| 9 | - }; | |
| 10 | - setPreviousSettings: ( | |
| 11 | - settings: Partial<GlobalTypes['previousSettings']>, | |
| 12 | - ) => void; | |
| 5 | + bringAttentionToPanel: false | string; | |
| 6 | + setBringAttentionToPanel: (b: false | string) => void; | |
| 13 | 7 | }; |
| 8 | + | |
| 14 | 9 | export const useGlobalStore = create<GlobalTypes>()( |
| 15 | - persist( | |
| 16 | - devtools( | |
| 17 | - (set) => ({ | |
| 18 | - seenNotices: [], | |
| 19 | - setSeenNotice(notice: string) { | |
| 20 | - set((state) => { | |
| 21 | - if (state.seenNotices.includes(notice)) return state; | |
| 22 | - return { seenNotices: [...state.seenNotices, notice] }; | |
| 23 | - }); | |
| 24 | - }, | |
| 25 | - // If any of these values have changed, we will use these for defaults. | |
| 26 | - // Themes and languages are handled separately. | |
| 27 | - previousSettings: { | |
| 28 | - copyButton: true, | |
| 29 | - }, | |
| 30 | - setPreviousSettings( | |
| 31 | - s: Partial<GlobalTypes['previousSettings']>, | |
| 32 | - ) { | |
| 33 | - set((state) => ({ | |
| 34 | - previousSettings: { ...state.previousSettings, ...s }, | |
| 35 | - })); | |
| 36 | - }, | |
| 37 | - }), | |
| 38 | - { name: 'Code Block Pro Globals' }, | |
| 39 | - ), | |
| 40 | - { | |
| 41 | - name: 'code-block-pro-last-globals', | |
| 42 | - getStorage: () => localStorage, | |
| 43 | - partialize: (state) => ({ | |
| 44 | - seenNotices: state?.seenNotices ?? [], | |
| 45 | - previousSettings: state?.previousSettings ?? {}, | |
| 46 | - }), | |
| 47 | - }, | |
| 10 | + devtools( | |
| 11 | + (set) => ({ | |
| 12 | + bringAttentionToPanel: false, | |
| 13 | + setBringAttentionToPanel: (bringAttentionToPanel) => { | |
| 14 | + set(() => ({ bringAttentionToPanel })); | |
| 15 | + }, | |
| 16 | + }), | |
| 17 | + { name: 'Code Block Pro Globals' }, | |
| 48 | 18 | ), |
| 49 | 19 | ); |