Skip to content
refs
23 lines · 924 BRaw
1import type { Route } from "./+types/tasks";
2import { AppShell, PageHeader } from "../components/shell";
3import { TaskList } from "@refs/design-system";
4import { signedIn, nowSeconds } from "../lib/session";
5
6export const meta: Route.MetaFunction = () => [{ title: "Tasks · refs" }];
7
8export 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
16export 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}