Files
audi-rednote/audi-content-portal/src/components/settings/SystemSettings.tsx

240 lines
9.2 KiB
TypeScript
Raw Normal View History

2026-04-13 20:28:09 +08:00
import { Settings2 } from "lucide-react"
import type { RoleView, WorkflowConfig } from "@/App"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
type SystemSettingsProps = {
roleView: RoleView
onRoleViewChange: (role: RoleView) => void
workflowConfig: WorkflowConfig
onWorkflowConfigChange: (next: WorkflowConfig) => void
auditLogs: string[]
}
export function SystemSettings({
roleView,
onRoleViewChange,
workflowConfig,
onWorkflowConfigChange,
auditLogs,
}: SystemSettingsProps) {
return (
<div className="flex flex-col gap-6 p-8">
<div className="flex flex-col gap-1">
<h1 className="text-3xl font-bold tracking-tight"></h1>
<p className="text-muted-foreground"></p>
</div>
<div className="grid gap-6 lg:grid-cols-2">
<Card className="border-none shadow-sm bg-white">
<CardHeader>
<CardTitle className="text-lg font-bold"></CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent className="flex flex-wrap gap-2">
<Button
variant={roleView === "content-ops" ? "default" : "outline"}
onClick={() => onRoleViewChange("content-ops")}
>
</Button>
<Button
variant={roleView === "biz-market" ? "default" : "outline"}
onClick={() => onRoleViewChange("biz-market")}
>
/
</Button>
<Button
variant={roleView === "pm-ops" ? "default" : "outline"}
onClick={() => onRoleViewChange("pm-ops")}
>
</Button>
</CardContent>
</Card>
<Card className="border-none shadow-sm bg-white">
<CardHeader>
<CardTitle className="text-lg font-bold"></CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent className="space-y-3 text-sm">
<div className="flex items-center justify-between rounded-lg border p-3">
<span></span>
<Button
size="sm"
variant={workflowConfig.enablePrePublish ? "default" : "outline"}
onClick={() =>
onWorkflowConfigChange({
...workflowConfig,
enablePrePublish: !workflowConfig.enablePrePublish,
})
}
>
{workflowConfig.enablePrePublish ? "已开启" : "已关闭"}
</Button>
</div>
<div className="flex items-center justify-between rounded-lg border p-3">
<span></span>
<Button
size="sm"
variant={workflowConfig.allowRecall ? "default" : "outline"}
onClick={() =>
onWorkflowConfigChange({
...workflowConfig,
allowRecall: !workflowConfig.allowRecall,
})
}
>
{workflowConfig.allowRecall ? "已开启" : "已关闭"}
</Button>
</div>
<div className="flex items-center justify-between rounded-lg border p-3">
<span></span>
<div className="flex gap-2">
<Button
size="sm"
variant={workflowConfig.publishStrategy === "manual" ? "default" : "outline"}
onClick={() =>
onWorkflowConfigChange({ ...workflowConfig, publishStrategy: "manual" })
}
>
</Button>
<Button
size="sm"
variant={workflowConfig.publishStrategy === "scheduled" ? "default" : "outline"}
onClick={() =>
onWorkflowConfigChange({ ...workflowConfig, publishStrategy: "scheduled" })
}
>
</Button>
</div>
</div>
{workflowConfig.publishStrategy === "scheduled" && (
<div className="grid gap-2 rounded-lg border p-3">
<span className="text-muted-foreground"></span>
<Input
type="time"
value={workflowConfig.defaultPublishTime}
onChange={(e) =>
onWorkflowConfigChange({
...workflowConfig,
defaultPublishTime: e.target.value,
})
}
/>
</div>
)}
</CardContent>
</Card>
<Card className="border-none shadow-sm bg-white">
<CardHeader>
<CardTitle className="text-lg font-bold"></CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent className="space-y-3 text-sm">
<div className="grid gap-2">
<span className="text-muted-foreground"></span>
<div className="flex gap-2">
<Button
size="sm"
variant={workflowConfig.syncFrequency === "daily" ? "default" : "outline"}
onClick={() =>
onWorkflowConfigChange({ ...workflowConfig, syncFrequency: "daily" })
}
>
</Button>
<Button
size="sm"
variant={workflowConfig.syncFrequency === "weekly" ? "default" : "outline"}
onClick={() =>
onWorkflowConfigChange({ ...workflowConfig, syncFrequency: "weekly" })
}
>
</Button>
</div>
</div>
<div className="grid gap-2">
<span className="text-muted-foreground"></span>
<Input
type="time"
value={workflowConfig.syncExecutionTime}
onChange={(e) =>
onWorkflowConfigChange({
...workflowConfig,
syncExecutionTime: e.target.value,
})
}
/>
</div>
<div className="grid gap-2">
<span className="text-muted-foreground"></span>
<Input
type="number"
min={0}
max={5}
value={workflowConfig.retryCount}
onChange={(e) =>
onWorkflowConfigChange({
...workflowConfig,
retryCount: Number(e.target.value || 0),
})
}
/>
</div>
<div className="flex items-center justify-between rounded-lg border p-3">
<span></span>
<Button
size="sm"
variant={workflowConfig.manualConfirmSync ? "default" : "outline"}
onClick={() =>
onWorkflowConfigChange({
...workflowConfig,
manualConfirmSync: !workflowConfig.manualConfirmSync,
})
}
>
{workflowConfig.manualConfirmSync ? "需要确认" : "自动通过"}
</Button>
</div>
<p className="text-xs text-muted-foreground">
</p>
</CardContent>
</Card>
<Card className="border-none shadow-sm bg-white">
<CardHeader>
<CardTitle className="text-lg font-bold"></CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent className="space-y-3">
<div className="flex items-center gap-2">
<Settings2 className="h-4 w-4 text-audi-red" />
<span className="text-sm font-medium"> 12 </span>
<Badge variant="outline" className="ml-auto">
{auditLogs.length}
</Badge>
</div>
<div className="space-y-2">
{auditLogs.map((item, idx) => (
<div key={`${item}-${idx}`} className="rounded-lg border px-3 py-2 text-sm text-muted-foreground">
{item}
</div>
))}
</div>
</CardContent>
</Card>
</div>
</div>
)
}