Files
audi-rednote/audi-content-portal/src/components/settings/SystemSettings.tsx
2026-04-15 17:08:17 +08:00

264 lines
11 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import * as React from "react"
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>
<Badge variant="outline" className="w-fit"></Badge>
</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 text-sm">
<div className="grid gap-2">
<span className="text-muted-foreground">访</span>
<Input defaultValue="https://portal.audi-private-cloud.example" />
</div>
<div className="grid gap-2">
<span className="text-muted-foreground"></span>
<Input defaultValue="按角色开通账号,最小权限访问" />
</div>
<div className="flex items-center justify-between rounded-lg border p-3">
<span></span>
<Badge variant="outline" className="bg-emerald-50 text-emerald-700 border-emerald-200"></Badge>
</div>
</CardContent>
</Card>
<Card className="border-none shadow-sm bg-white">
<CardHeader>
<CardTitle className="text-lg font-bold"></CardTitle>
<CardDescription> Audi </CardDescription>
</CardHeader>
<CardContent className="space-y-3 text-sm">
<div className="flex items-center justify-between rounded-lg border p-3">
<span></span>
<Badge variant="outline" className="bg-emerald-50 text-emerald-700 border-emerald-200"></Badge>
</div>
<div className="flex items-center justify-between rounded-lg border p-3">
<span></span>
<Badge variant="outline" className="bg-emerald-50 text-emerald-700 border-emerald-200"></Badge>
</div>
<div className="flex items-center justify-between rounded-lg border p-3">
<span></span>
<Badge variant="outline" className="bg-emerald-50 text-emerald-700 border-emerald-200"></Badge>
</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">
<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>
)
}