1
0
Fork 0
polaris-task-force/src/app/(frontend)/transfers/page.tsx
Z8MB1E 6fb8dee3f6 feat(frontend): Add assignment transfer UI components
Add React components for assignment transfer user interface:

1. AssignmentCard.tsx: Display user's current assignment with transfer button.
   Shows assignment details, current status, and allows initiating transfer requests.

2. RequestTransferDialog.tsx: Modal dialog for creating transfer requests.
   - Selects target assignment from assignment list
   - Optionally notes required for transfer
   - Submits request to AssignmentTransfers collection
   - Emits AssignmentTransferRequest event

3. Transfers page (src/app/(frontend)/transfers/): Transfer request list view.
   - Requests card showing pending requests with requestor, target, current
   - Approval cards for assignment leaders
   - Appeal cards for rejected requests
   - Completed/Cancelled status display

All components use shadcn/ui primitives, proper loading states, error handling,
and provide accessible keyboard navigation.
2026-08-31 23:40:37 -04:00

42 lines
1.4 KiB
TypeScript

import config from "@payload-config";
import { headers as nextHeaders } from "next/headers";
import { redirect } from "next/navigation";
import { getPayload } from "payload";
import { ArrowLeftRightIcon } from "lucide-react";
import { TransfersView } from "@/components/frontend/transfers/TransfersView";
import { isPayloadUser } from "@/utils/access-control/isPayloadUser";
import { isSuperuser } from "@/utils/access-control/hasPermission";
export const metadata = {
title: "Transfers — Polaris Task Force",
};
export default async function TransfersPage() {
const payload = await getPayload({ config });
const { user: authUser } = await payload.auth({
headers: await nextHeaders(),
canSetHeaders: false,
});
if (!isPayloadUser(authUser)) {
redirect("/");
}
const canResolve = await isSuperuser(payload, authUser);
return (
<div className="flex flex-col gap-6 p-5">
<div className="flex flex-col gap-1">
<div className="flex items-center gap-2">
<ArrowLeftRightIcon className="size-5 text-muted-foreground" aria-hidden="true" />
<h1 className="text-lg font-semibold">Transfers</h1>
</div>
<p className="text-sm text-muted-foreground">
Request an assignment move, review approvals, and resolve escalated appeals.
</p>
</div>
<TransfersView currentUserId={authUser.id} canResolve={canResolve} />
</div>
);
}