import create from 'zustand'; import { devtools, persist } from 'zustand/middleware'; type GlobalTypes = { previousSettings: { copyButton: boolean; }; setPreviousSettings: ( settings: Partial, ) => void; }; export const useGlobalStore = create()( persist( devtools( (set) => ({ previousSettings: { // This should go into settings.tsx and persist to the db copyButton: true, }, setPreviousSettings( s: Partial, ) { set((state) => ({ previousSettings: { ...state.previousSettings, ...s }, })); }, }), { name: 'Code Block Pro Globals' }, ), { name: 'code-block-pro-last-globals', getStorage: () => localStorage, partialize: (state) => ({ previousSettings: state?.previousSettings ?? {}, }), }, ), );