forked from EduCraft/curriculum-project-hub
refactor(admin-web): polish Chinese UI and bits-ui controls
Map roles to Chinese labels, remove ADR/spec wording from the surface, and replace native selects/checkboxes/modals with bits-ui Select, Checkbox, Switch, Dialog, Label, and Collapsible.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
import {
|
||||
ORG_ROLE_LABELS,
|
||||
PERMISSION_ROLE_LABELS,
|
||||
type OrgRole,
|
||||
type PermissionRole
|
||||
} from './constants';
|
||||
|
||||
export function fmtDate(iso: string): string {
|
||||
if (!iso) return '—';
|
||||
const d = new Date(iso);
|
||||
@@ -26,3 +33,19 @@ export function fmtCost(usd: number | null): string {
|
||||
export function fmtNum(n: number): string {
|
||||
return n.toLocaleString();
|
||||
}
|
||||
|
||||
export function orgRoleLabel(role: string): string {
|
||||
const key = role.toUpperCase() as OrgRole;
|
||||
return ORG_ROLE_LABELS[key] ?? role;
|
||||
}
|
||||
|
||||
export function permissionRoleLabel(role: string): string {
|
||||
const key = role.toUpperCase() as PermissionRole;
|
||||
return PERMISSION_ROLE_LABELS[key] ?? role;
|
||||
}
|
||||
|
||||
export function providerModeLabel(mode: string): string {
|
||||
if (mode === 'BYOK') return '自带密钥';
|
||||
if (mode === 'PLATFORM_MANAGED') return '平台托管';
|
||||
return mode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user