Skip to documentation

Design system / Sources & standards

Current repository source

reviewAssignmentOverview.tsx

src/components/reviews/reviewAssignmentOverview.tsx

This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.

import Link from "next/link";
import { Clock3 } from "lucide-react";
import { ImageCtaBanner } from "@/components/editorial/imageCtaBanner";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { EmptyStateCard } from "@/components/ui/empty-state-card";
import { Text } from "@/components/ui/text";
import type { ReviewerRoundSummary } from "@/lib/domains/console/reviews/contracts";

/** Review-owned server organism; the route supplies authorized data and paths. */
export function ReviewAssignmentOverview({
  assignments,
  reviewPath,
}: {
  assignments: ReviewerRoundSummary[];
  reviewPath: (assignment: ReviewerRoundSummary) => string;
}) {
  const editions = new Map<string, ReviewerRoundSummary[]>();
  for (const assignment of assignments) {
    const key = `${assignment.programCode}/${assignment.editionCode}`;
    const rounds = editions.get(key) ?? [];
    rounds.push(assignment);
    editions.set(key, rounds);
  }

  return (
    <div className="space-y-8 md:space-y-12">
      {!assignments.some((assignment) => assignment.isOpen) && (
        <EmptyStateCard icon={<Clock3 className="size-5" aria-hidden />} title="No review rounds are open">
          You have review assignments, but no review rounds are currently open. Contact the Program or Edition Manager if you expect a round to be available.
        </EmptyStateCard>
      )}
      {Array.from(editions, ([key, rounds]) => (
        <section key={key} aria-label={`${rounds[0].programTitle} / ${rounds[0].editionTitle}`}>
          <ImageCtaBanner
            headingLevel={2}
            eyebrow={`Review invitation / ${rounds[0].programTitle}`}
            title={rounds[0].editionTitle}
            description="Your assigned review rounds and current progress."
            status={<Badge variant="outline">{rounds.filter((round) => round.isOpen).length} open</Badge>}
            imageUrl={rounds[0].bannerImageUrl}
            action={
              <ul className="divide-y border-t">
                {rounds.map((assignment) => (
                  <li key={assignment.roundId} className="space-y-3 py-5 first:pt-5 last:pb-0">
                    <div className="flex flex-wrap items-center gap-3">
                      <h3 className="min-w-0 break-words text-title font-semibold">{assignment.roundName}</h3>
                      <Badge variant={assignment.isOpen ? "secondary" : "outline"}>
                        {assignment.isOpen ? "Open" : assignment.status === "active" && assignment.completedCount > 0 ? "Editing available" : "Not open"}
                      </Badge>
                    </div>
                    <Text variant="supporting" className="text-text-muted">
                      {assignment.assignedCategories.length
                        ? `${assignment.assignedCategories.length} assigned ${assignment.assignedCategories.length === 1 ? "category" : "categories"}`
                        : "All categories assigned"}
                    </Text>
                    <Text>{assignment.pendingCount} pending · {assignment.completedCount} completed</Text>
                    {assignment.isOpen || assignment.completedCount > 0 ? (
                      <Button asChild variant="outline">
                        <Link href={reviewPath(assignment)} aria-label={`View reviews for ${assignment.roundName}`}>
                          View reviews
                        </Link>
                      </Button>
                    ) : (
                      <Text variant="supporting" className="text-text-muted">Reviewing is unavailable for this round.</Text>
                    )}
                  </li>
                ))}
              </ul>
            }
          />
        </section>
      ))}
    </div>
  );
}
All sources and standards
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.