Files
lotteryAdmin/src/components/admin/admin-loading-state.tsx
kang b15e377187 feat(api, i18n): add agent_node_id to various admin queries and enhance multi-language support
Introduced the agent_node_id field in AdminDrawListQuery, AdminPlayerListQuery, AdminSettlementBatchListQuery, TicketItemsListQuery, and TransferOrderListQuery to improve filtering capabilities. Updated the admin-breadcrumb and admin-sidebar components to include new translations for agent-related terms in English, Nepali, and Chinese, enhancing the overall user experience and multi-language support across the admin interface.
2026-06-02 14:37:08 +08:00

95 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import type { ReactElement } from "react";
import { useTranslation } from "react-i18next";
import {
LoadingDots,
type LoadingDotsSize,
} from "@/components/ui/loading-dots";
import { TableCell, TableRow } from "@/components/ui/table";
import { cn } from "@/lib/utils";
/** 区块居中加载(列表、表单、详情页等) */
export function AdminLoadingState({
className,
label,
size = "md",
showLabel = false,
minHeight = "4rem",
}: {
className?: string;
label?: string;
size?: LoadingDotsSize;
showLabel?: boolean;
minHeight?: string | number;
}): ReactElement {
const { t } = useTranslation("common");
const resolvedLabel = label ?? t("states.loading");
return (
<div
className={cn(
"flex w-full items-center justify-center py-8 text-muted-foreground",
className,
)}
style={{ minHeight: typeof minHeight === "number" ? `${minHeight}px` : minHeight }}
>
<LoadingDots size={size} label={resolvedLabel} showLabel={showLabel} />
</div>
);
}
/** 下拉、弹层等紧凑区域 */
export function AdminLoadingInline({
className,
label,
size = "sm",
}: {
className?: string;
label?: string;
size?: LoadingDotsSize;
}): ReactElement {
const { t } = useTranslation("common");
const resolvedLabel = label ?? t("states.loading");
return (
<div
className={cn("flex justify-center py-3 text-muted-foreground", className)}
role="status"
aria-live="polite"
aria-busy="true"
>
<LoadingDots size={size} label={resolvedLabel} />
</div>
);
}
/** 表格内加载行colSpan 对齐列数) */
export function AdminTableLoadingRow({
colSpan,
label,
size = "md",
className,
cellClassName,
}: {
colSpan: number;
label?: string;
size?: LoadingDotsSize;
className?: string;
cellClassName?: string;
}): ReactElement {
const { t } = useTranslation("common");
const resolvedLabel = label ?? t("states.loading");
return (
<TableRow className={className}>
<TableCell colSpan={colSpan} className={cn("py-10", cellClassName)}>
<div className="flex justify-center">
<LoadingDots size={size} label={resolvedLabel} />
</div>
</TableCell>
</TableRow>
);
}