refactor(layout, i18n, admin): 优化布局结构与多语言支持
调整 AdminShell 组件的子组件顺序,提升代码可读性。更新 admin-breadcrumb 组件,简化导航标签翻译逻辑,确保多语言支持的一致性。重构 admin-language-switcher 组件,优化语言切换的用户体验,增强界面交互性。更新多语言配置,新增登录界面的副标题,提升用户体验。
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { KeyRound, Pencil, Trash2 } from "lucide-react";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useConfirmAction } from "@/hooks/use-confirm-action";
|
||||
import { useExportLabels } from "@/hooks/use-export-labels";
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
putAdminUserRoles,
|
||||
} from "@/api/admin-users";
|
||||
import { AdminListPaginationFooter } from "@/components/admin/admin-list-pagination-footer";
|
||||
import { AdminRowActionsMenu } from "@/components/admin/admin-row-actions-menu";
|
||||
import { AdminTableExportButton } from "@/components/admin/admin-table-export-button";
|
||||
import { AdminStatusBadge } from "@/components/admin/admin-status-badge";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
@@ -371,7 +373,7 @@ export function AdminUsersConsole(): React.ReactElement {
|
||||
<TableHead className="w-20 whitespace-nowrap">{t("table.status")}</TableHead>
|
||||
<TableHead>{t("table.roles")}</TableHead>
|
||||
<TableHead>{t("table.effective")}</TableHead>
|
||||
<TableHead className="w-[15rem] whitespace-nowrap text-center">{t("table.actions")}</TableHead>
|
||||
<TableHead className="w-14 whitespace-nowrap text-center">{t("table.actions")}</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
@@ -412,44 +414,34 @@ export function AdminUsersConsole(): React.ReactElement {
|
||||
</TableCell>
|
||||
<TableCell className="tabular-nums">{row.effective_permissions.length}</TableCell>
|
||||
<TableCell className="text-center">
|
||||
<div className="flex w-full flex-nowrap justify-center gap-1 whitespace-nowrap">
|
||||
{canManageUsers ? (
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
variant={permissionOpen && selectedId === row.id ? "default" : "outline"}
|
||||
onClick={() => openPermissionEditor(row)}
|
||||
>
|
||||
{t("actions.permissions")}
|
||||
</Button>
|
||||
) : null}
|
||||
{canManageUsers ? (
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
variant={accountOpen && editingAccountId === row.id ? "secondary" : "outline"}
|
||||
onClick={() => openEditAccount(row)}
|
||||
>
|
||||
{t("actions.edit")}
|
||||
</Button>
|
||||
) : null}
|
||||
{canManageUsers ? (
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
variant="destructive"
|
||||
disabled={profile?.id === row.id}
|
||||
title={
|
||||
profile?.id === row.id
|
||||
? t("delete.currentUserBlocked")
|
||||
: t("delete.rowActionTitle")
|
||||
}
|
||||
onClick={() => setDeleteTarget(row)}
|
||||
>
|
||||
{t("actions.delete")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
{canManageUsers ? (
|
||||
<AdminRowActionsMenu
|
||||
actions={[
|
||||
{
|
||||
key: "permissions",
|
||||
label: t("actions.permissions"),
|
||||
icon: KeyRound,
|
||||
onClick: () => openPermissionEditor(row),
|
||||
},
|
||||
{
|
||||
key: "edit",
|
||||
label: t("actions.edit"),
|
||||
icon: Pencil,
|
||||
onClick: () => openEditAccount(row),
|
||||
},
|
||||
{
|
||||
key: "delete",
|
||||
label: t("actions.delete"),
|
||||
icon: Trash2,
|
||||
destructive: true,
|
||||
disabled: profile?.id === row.id,
|
||||
onClick: () => setDeleteTarget(row),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
) : (
|
||||
<span className="text-xs text-muted-foreground">—</span>
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user