feat: 扩展开奖与结算管理,支持手动操作、导出和版本展示
This commit is contained in:
81
src/modules/config/config-version-actions.tsx
Normal file
81
src/modules/config/config-version-actions.tsx
Normal file
@@ -0,0 +1,81 @@
|
||||
"use client";
|
||||
|
||||
import { Plus, RefreshCw, Rocket, Save } from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type ConfigVersionActionsProps = {
|
||||
isDraft: boolean;
|
||||
loadingList?: boolean;
|
||||
loadingDetail?: boolean;
|
||||
saving?: boolean;
|
||||
publishLabel?: string;
|
||||
onRefresh: () => void;
|
||||
onNewDraft: () => void;
|
||||
onSaveDraft: () => void;
|
||||
onPublish: () => void;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export function ConfigVersionActions({
|
||||
isDraft,
|
||||
loadingList = false,
|
||||
loadingDetail = false,
|
||||
saving = false,
|
||||
publishLabel = "启用为当前版本",
|
||||
onRefresh,
|
||||
onNewDraft,
|
||||
onSaveDraft,
|
||||
onPublish,
|
||||
className,
|
||||
}: ConfigVersionActionsProps) {
|
||||
const draftActionBusy = saving || loadingDetail;
|
||||
|
||||
return (
|
||||
<div className={cn("flex flex-wrap items-center gap-2 lg:justify-end", className)}>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="h-9 border-slate-300 bg-white px-3 text-slate-700 hover:bg-slate-50 hover:text-slate-950"
|
||||
disabled={loadingList}
|
||||
onClick={onRefresh}
|
||||
>
|
||||
<RefreshCw className={loadingList ? "size-4 animate-spin" : "size-4"} aria-hidden />
|
||||
{loadingList ? "刷新中" : "刷新版本"}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
className="h-9 bg-slate-950 px-3 text-white hover:bg-slate-800"
|
||||
disabled={saving}
|
||||
onClick={onNewDraft}
|
||||
>
|
||||
<Plus className="size-4" aria-hidden />
|
||||
新建草稿
|
||||
</Button>
|
||||
{isDraft ? (
|
||||
<>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="h-9 border-amber-300 bg-amber-50 px-3 text-amber-900 hover:bg-amber-100 hover:text-amber-950"
|
||||
disabled={draftActionBusy}
|
||||
onClick={onSaveDraft}
|
||||
>
|
||||
<Save className="size-4" aria-hidden />
|
||||
保存草稿
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
className="h-9 bg-emerald-600 px-3 text-white hover:bg-emerald-700"
|
||||
disabled={draftActionBusy}
|
||||
onClick={onPublish}
|
||||
>
|
||||
<Rocket className="size-4" aria-hidden />
|
||||
{publishLabel}
|
||||
</Button>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user