Add TicketsView, TicketCard, TicketDetail, TicketTimeline, CreateTicketDialog, and TicketBadges components. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
import type { Ticket } from "@/payload-types";
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { cn } from "@/lib/utils";
|
|
import {
|
|
CATEGORY_LABEL,
|
|
CATEGORY_STYLES,
|
|
PRIORITY_LABEL,
|
|
PRIORITY_STYLES,
|
|
STATUS_LABEL,
|
|
STATUS_STYLES,
|
|
type TicketCategory,
|
|
type TicketPriority,
|
|
type TicketStatus,
|
|
} from "@/lib/tickets/ticketMeta";
|
|
|
|
interface TicketStatusBadgeProps {
|
|
readonly status: TicketStatus;
|
|
}
|
|
|
|
interface TicketPriorityBadgeProps {
|
|
readonly priority: TicketPriority;
|
|
}
|
|
|
|
interface TicketCategoryBadgeProps {
|
|
readonly category: TicketCategory;
|
|
}
|
|
|
|
interface TicketBadgesProps {
|
|
readonly ticket: Pick<Ticket, "status" | "priority">;
|
|
}
|
|
|
|
const badgeTextClass = "text-[10px] uppercase tracking-wide";
|
|
|
|
export function TicketStatusBadge({ status }: TicketStatusBadgeProps) {
|
|
return (
|
|
<Badge variant="outline" className={cn(badgeTextClass, STATUS_STYLES[status])}>
|
|
{STATUS_LABEL[status]}
|
|
</Badge>
|
|
);
|
|
}
|
|
|
|
export function TicketPriorityBadge({ priority }: TicketPriorityBadgeProps) {
|
|
return (
|
|
<Badge variant="outline" className={cn(badgeTextClass, PRIORITY_STYLES[priority])}>
|
|
{PRIORITY_LABEL[priority]}
|
|
</Badge>
|
|
);
|
|
}
|
|
|
|
export function TicketCategoryBadge({ category }: TicketCategoryBadgeProps) {
|
|
return (
|
|
<Badge variant="outline" className={cn(badgeTextClass, CATEGORY_STYLES[category])}>
|
|
{CATEGORY_LABEL[category]}
|
|
</Badge>
|
|
);
|
|
}
|
|
|
|
export function TicketBadges({ ticket }: TicketBadgesProps) {
|
|
return (
|
|
<div className="flex flex-wrap items-center gap-1.5">
|
|
<TicketStatusBadge status={ticket.status} />
|
|
<TicketPriorityBadge priority={ticket.priority} />
|
|
</div>
|
|
);
|
|
}
|