TorbatYar/frontend/modules/workspace/components/StatusChip.tsx
Mortezakoohjani a483b47369 feat(workspace): complete production workspace and content operations
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:54:17 +03:30

44 lines
1.2 KiB
TypeScript

"use client";
import { Badge } from "@/components/ds";
import {
APPROVAL_STATUS,
CONTENT_STATUS,
PRIORITY,
PROJECT_STATUS,
TASK_STATUS,
labelOf,
} from "@/modules/workspace/labels";
const SUCCESS = new Set(["done", "approved", "published", "completed", "active"]);
const WARNING = new Set(["review", "internal_review", "client_review", "on_hold", "pending", "scheduled"]);
const DANGER = new Set(["rejected", "urgent", "archived", "changes_requested"]);
function toneFor(value?: string) {
if (!value) return "default" as const;
if (SUCCESS.has(value)) return "success" as const;
if (WARNING.has(value)) return "warning" as const;
if (DANGER.has(value)) return "danger" as const;
return "info" as const;
}
export function StatusChip({
value,
kind = "content",
}: {
value?: string | null;
kind?: "content" | "task" | "project" | "approval" | "priority";
}) {
const map =
kind === "task"
? TASK_STATUS
: kind === "project"
? PROJECT_STATUS
: kind === "approval"
? APPROVAL_STATUS
: kind === "priority"
? PRIORITY
: CONTENT_STATUS;
return <Badge tone={toneFor(value || undefined)}>{labelOf(map, value)}</Badge>;
}