import type { AppInfo, LibInfo } from "akanjs"; export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { appName: string }) { return { filename: "Task.View.tsx", content: `import { type cnst, usePage } from "@apps/${dict.appName}/client"; import { clsx } from "akanjs/client"; // ===== Task.View.tsx ===== // Convention: lib// — PascalCase .tsx, View suffix = detail display component. // View receives the Full Model (cnst.Task) as props — gives access to all defined fields. // Uses usePage().l() for i18n — the framework convention for dictionary-based translations. // Invoked by Akan's data-loading zone chain: Task.Zone → Load.View → Task.View. interface GeneralProps { className?: string; task: cnst.Task; } export const General = ({ className, task }: GeneralProps) => { const { l } = usePage(); const statusColor = { todo: "text-base-content/50", inProgress: "text-primary", completed: "text-success", }[task.status]; return (

{task.title}

{l(\`taskStatus.\${task.status}\`)}
{task.content && (

{task.content}

)}
{l("task.taskDueLabel")} {task.due ? task.due.toDate().toLocaleDateString() : l("task.taskNoDue")}
{task.workHistory && task.workHistory.length > 0 && (

{l("task.taskWorkHistoryTitle")}

    {task.workHistory.map((entry, i) => (
  • {l(\`workHistoryAction.\${entry.action}\`)}
    {entry.at.toDate().toLocaleString()} {entry.note && {entry.note}}
  • ))}
)}
); }; // ---- Expandable additional fields: ---- // Compact: for narrow spaces like sidebars or modals // export const Compact = ({ className, task }: CompactProps) => ( //
// {task.title} // {task.due && Due: {new Date(task.due).toLocaleDateString()}} //
// ); `, }; }