diff --git a/lib/store.ts b/lib/store.ts index f614cdd..78e36ef 100644 --- a/lib/store.ts +++ b/lib/store.ts @@ -4,6 +4,7 @@ import { create } from 'zustand' import { type StateStorage, createJSONStorage, persist } from 'zustand/middleware' import type { ConfigFile } from '../types/config' import type { ScheduledTask } from '../types/task' +import type { Template } from '../types/template' // const { LazyStore } = window.__TAURI__.store const store = new LazyStore('store.json') @@ -110,6 +111,8 @@ interface PersistedState { removeScheduledTask: (id: string) => void updateScheduledTask: (id: string, task: Partial) => void + templates: Template[] + configFiles: ConfigFile[] addConfigFile: (configFile: ConfigFile) => void removeConfigFile: (id: string) => void @@ -249,6 +252,8 @@ export const usePersistedStore = create()( ), })), + templates: [], + configFiles: [], addConfigFile: (configFile: ConfigFile) => set((state) => ({ diff --git a/types/template.d.ts b/types/template.d.ts new file mode 100644 index 0000000..b4c3090 --- /dev/null +++ b/types/template.d.ts @@ -0,0 +1,6 @@ +export interface Template { + id: string + name: string + operation: 'copy' | 'sync' | 'move' | 'delete' | 'purge' + options: Record +}