import type { AppInfo, LibInfo } from "akanjs"; export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { appName: string }) { return `import { store } from "akanjs/store"; import { fetch, msg, sig } from "../useClient"; // ===== task.store.ts ===== // Convention: .store.ts — client-side state management for a database module. // Extends store(sig., ...) from akanjs/store — binds to the signal to auto-generate model states/actions. // Auto-generated by akan sync (do not write manually): // taskForm — form state bound to model fields (create + edit) // setTitleOnTask, setContentOnTask, setDueOnTask — auto-setters for form fields // createTask(data), updateTask(id, data), removeTask(id) — CRUD actions // task (cached model), taskLoading, taskModal — model display states // Manual below: custom actions wrapping auto-generated fetch with toast feedback. // Registered by akan sync into st.ts barrel. export class TaskStore extends store(sig.task, () => ({})) { async startTask(taskId: string) { msg.loading("task.startTaskLoading", { key: "startTask" }); const task = await fetch.startTask(taskId); msg.success("task.startTaskSuccess", { key: "startTask" }); this.setTask(task); } async completeTask(taskId: string) { msg.loading("task.completeTaskLoading", { key: "completeTask" }); const task = await fetch.completeTask(taskId); msg.success("task.completeTaskSuccess", { key: "completeTask" }); this.setTask(task); } } // ---- Expandable additional fields: ---- // Custom state (if needed): // export class TaskStore extends store(sig.task, () => ({ // filterKeyword: "", // })) { ... } // The auto-generated taskForm handles title, content, due states automatically. `; }