23 lines · 924 BRaw
| 1 | import type { Route } from "./+types/tasks"; |
| 2 | import { AppShell, PageHeader } from "../components/shell"; |
| 3 | import { TaskList } from "@refs/design-system"; |
| 4 | import { signedIn, nowSeconds } from "../lib/session"; |
| 5 | |
| 6 | export const meta: Route.MetaFunction = () => [{ title: "Tasks · refs" }]; |
| 7 | |
| 8 | export async function loader({ request, context }: Route.LoaderArgs) { |
| 9 | const params = new URL(request.url).searchParams; |
| 10 | const status = params.get("state") === "closed" ? ("closed" as const) : ("open" as const); |
| 11 | const label = params.get("label") || null; |
| 12 | const list = await signedIn(context).tasks({ status, label: label ?? undefined }); |
| 13 | return { status, label, now: nowSeconds(), ...list }; |
| 14 | } |
| 15 | |
| 16 | export default function Tasks({ loaderData }: Route.ComponentProps) { |
| 17 | return ( |
| 18 | <AppShell> |
| 19 | <PageHeader title="Tasks" /> |
| 20 | <TaskList {...loaderData} base="/tasks" showRepo newHref="/tasks/new" /> |
| 21 | </AppShell> |
| 22 | ); |
| 23 | } |