From 44e2641656fe06b1773ae5baf3476c74133fd0a1 Mon Sep 17 00:00:00 2001 From: FTCHD <144691102+FTCHD@users.noreply.github.com> Date: Thu, 18 Sep 2025 13:45:54 +0200 Subject: [PATCH] templates store Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com> --- lib/store.ts | 5 +++++ types/template.d.ts | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 types/template.d.ts 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 +}