import { createFileRoute, Link } from '@tanstack/react-router' import { Title, Text, Card, Group, Stack, Badge, Table, Anchor, Box } from '@pikku/mantine/core' import { LayoutTemplate } from 'lucide-react' import { asI18n } from '@pikku/react' import { useLocale } from '@/i18n/config' import { m } from '@/i18n/messages' import { CreateTemplateForm } from '@/components/create-template-form' export const Route = createFileRoute('/_authenticated/tasks/templates')({ component: TaskTemplatesPage, }) const CATEGORY_COLORS: Record = { housekeeping: 'pink', kitchen: 'yellow', maintenance: 'orange', operations: 'blue', retreat: 'violet', transport: 'cyan', } interface TaskTemplate { templateId: string title: string description: string | null category: string isClaimable: boolean defaultLocation: string | null estimatedMinutes: number | null recurrenceCron: string | null } function TaskTemplatesPage() { useLocale() // There is no list-templates RPC; new templates are created via the form below. const templates: TaskTemplate[] = [] const error: string | null = null return (
{m.tasks_templates_back()} {m.tasks_templates_title()} {m.tasks_templates_description()}
{error && ( {error} )} {templates.length === 0 && !error ? ( {m.tasks_templates_empty()} ) : ( {/* Desktop table */} {m.tasks_templates_col_title()} {m.tasks_templates_col_category()} {m.tasks_templates_col_claimable()} {m.tasks_templates_col_recurrence()} {m.tasks_templates_col_duration()} {templates.map((t) => ( {asI18n(t.title)} {asI18n(t.category)} {t.isClaimable ? m.tasks_templates_yes() : m.tasks_templates_no()} {asI18n(t.recurrenceCron ?? m.tasks_templates_one_time())} {asI18n(t.estimatedMinutes ? m.tasks_templates_minutes({ minutes: t.estimatedMinutes }) : '--')} ))}
{/* Mobile cards */} {templates.map((t) => ( {asI18n(t.title)} {asI18n(t.category)} {t.isClaimable ? m.tasks_templates_claimable() : m.tasks_templates_not_claimable()} {t.recurrenceCron && ( {m.tasks_templates_recurring()} )} {t.estimatedMinutes && ( {m.tasks_templates_minutes({ minutes: t.estimatedMinutes })} )} ))}
)}
) }