import type { AppInfo, LibInfo } from "akanjs"; export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { appName: string }) { return { filename: "Task.Util.tsx", content: `"use client"; import { fetch, st, usePage } from "@apps/${dict.appName}/client"; import { Model } from "akanjs/ui"; // ===== Task.Util.tsx ===== // Convention: lib// — PascalCase .tsx, Util suffix = action buttons/utility components. // "use client" directive required for onClick handlers. // Dispatches to store actions via st.do.xxx() — the Akan.js convention for invoking client-side operations. // Uses usePage().l() for i18n — the framework convention for dictionary-based translations. // Wraps destructive actions in Model.Remove from akanjs/ui — the framework convention for confirmation dialogs. interface StartProps { taskId: string; } export const Start = ({ taskId }: StartProps) => ( ); interface CompleteProps { taskId: string; } export const Complete = ({ taskId }: CompleteProps) => ( ); interface RemoveProps { taskId: string; } export const Remove = ({ taskId }: RemoveProps) => ( ); interface ToolboxProps { taskId: string; status: string; } export const Toolbox = ({ taskId, status }: ToolboxProps) => { const { l } = usePage(); return (
); }; // ---- Expandable additional fields: ---- // Edit Button: Model.Edit wrapper — triggers modal edit form // export const Edit = ({ taskId }: EditProps) => ( // // // // ); // // New Task Button: Model.NewWrapper — triggers new Task creation form // export const NewTask = () => ( // // // // ); `, }; }