refactor(panel): 抽取 10 个公共组件,消除 ~150 处重复代码
新增组件: - PageHeader: 统一页面头部(14 个页面) - StatCard: 统一数值统计卡片(6 个页面) - MessageLine: 统一错误/成功提示条(16 处) - ConfirmFooter: 统一 Dialog 底部按钮(8 个文件) - SearchInput: 统一搜索框(5 个页面) - SubmissionStatusBadge: 统一提交状态徽章 - RoleBadge / UserStatusBadge: 统一用户角色/状态徽章 - BackLink: 统一返回导航链接(5 个页面) - InlineConfirm: 统一二次确认交互(3 个 section) 修复: - Pagination 图标尺寸统一 h-4 w-4 - 右上角按钮统一 size=sm gap-1.5 - StatCard 默认值恢复 text-2xl(24px) States.tsx 新增 NotYours / NotRunning 通用状态组件 已有文件 -659 行,新组件 +353 行,净减 306 行
This commit is contained in:
32 files changed
+772
-1078
No files matched your search
@@ -1,11 +1,11 @@
|
||||
import { useState } from "react";
|
||||
import { Plus } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ConfirmFooter } from "@/components/ConfirmFooter";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
@@ -104,8 +104,9 @@ export function CreateServerDialog({ cfg, onCreated }: Props) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button>
|
||||
<Plus /> {t("create_server_btn")}
|
||||
<Button size="sm" className="gap-1.5">
|
||||
<Plus className="h-4 w-4" />
|
||||
{t("create_server_btn")}
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent>
|
||||
@@ -231,14 +232,15 @@ export function CreateServerDialog({ cfg, onCreated }: Props) {
|
||||
{error && <p className="text-sm text-destructive">{error}</p>}
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="ghost" onClick={() => setOpen(false)} disabled={submitting}>
|
||||
{t("create_server_cancel")}
|
||||
</Button>
|
||||
<Button onClick={submit} disabled={!canSubmit}>
|
||||
{submitting ? t("create_server_creating") : t("create_server_submit")}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
<ConfirmFooter
|
||||
onCancel={() => setOpen(false)}
|
||||
onConfirm={submit}
|
||||
disabled={!canSubmit}
|
||||
loading={submitting}
|
||||
cancelLabel={t("create_server_cancel")}
|
||||
confirmLabel={t("create_server_submit")}
|
||||
confirmVariant="default"
|
||||
/>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user