feat(admin, i18n): enhance reports, draws, config, and player workflows
This commit is contained in:
@@ -13,6 +13,38 @@ import { useAdminDateTimeFormatter } from "@/hooks/use-admin-datetime-formatter"
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { DrawCurrentSnapshot } from "@/types/api/public-draw";
|
||||
|
||||
function formatDashboardDrawStatus(
|
||||
status: string,
|
||||
t: (key: string, options?: Record<string, unknown>) => string,
|
||||
): string {
|
||||
const lower = status.trim().toLowerCase();
|
||||
|
||||
switch (lower) {
|
||||
case "pending":
|
||||
return t("statusOptions.pending", { ns: "draws" });
|
||||
case "open":
|
||||
return t("statusOptions.open", { ns: "draws" });
|
||||
case "closing":
|
||||
return t("statusOptions.closing", { ns: "draws" });
|
||||
case "closed":
|
||||
return t("statusOptions.closed", { ns: "draws" });
|
||||
case "drawing":
|
||||
return t("statusOptions.drawing", { ns: "draws" });
|
||||
case "review":
|
||||
return t("statusOptions.review", { ns: "draws" });
|
||||
case "cooldown":
|
||||
return t("statusOptions.cooldown", { ns: "draws" });
|
||||
case "settling":
|
||||
return t("statusOptions.settling", { ns: "draws" });
|
||||
case "settled":
|
||||
return t("statusOptions.settled", { ns: "draws" });
|
||||
case "cancelled":
|
||||
return t("statusOptions.cancelled", { ns: "draws" });
|
||||
default:
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
function isOpenLikeStatus(status: string): boolean {
|
||||
const lower = status.toLowerCase();
|
||||
return lower.includes("open") || lower.includes("sale");
|
||||
@@ -29,7 +61,7 @@ export function DashboardCurrentDrawCard({
|
||||
drawId,
|
||||
loading = false,
|
||||
}: DashboardCurrentDrawCardProps): ReactElement {
|
||||
const { t } = useTranslation("dashboard");
|
||||
const { t } = useTranslation(["dashboard", "draws"]);
|
||||
const formatDt = useAdminDateTimeFormatter();
|
||||
|
||||
if (loading) {
|
||||
@@ -54,6 +86,7 @@ export function DashboardCurrentDrawCard({
|
||||
}
|
||||
|
||||
const openLike = isOpenLikeStatus(hall.status);
|
||||
const statusLabel = formatDashboardDrawStatus(hall.status, t);
|
||||
|
||||
return (
|
||||
<Card className="admin-list-card overflow-hidden border-primary/15 py-0 shadow-sm">
|
||||
@@ -95,7 +128,7 @@ export function DashboardCurrentDrawCard({
|
||||
openLike ? "bg-emerald-500" : "bg-muted-foreground/70",
|
||||
)}
|
||||
/>
|
||||
{hall.status}
|
||||
{statusLabel}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user