refactor: 移除经营健康度模块
算法仅基于案卡风险扣分,三个维度实质同源,不具备真实参考价值。 移除健康度卡片、概览数字、RingProgress 组件,时间线改为独占一行。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import {
|
import {
|
||||||
ClipboardCheck, MessageSquare, Activity, ArrowRight,
|
ClipboardCheck, MessageSquare, ArrowRight,
|
||||||
Radar, ShieldCheck, Scale, TrendingUp, Heart, Plus, ChevronRight,
|
Radar, ShieldCheck, Scale, TrendingUp, Heart, Plus, ChevronRight,
|
||||||
Sparkles, Clock, CircleAlert,
|
Sparkles, Clock, CircleAlert,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
@@ -25,32 +25,6 @@ import { api } from '@/lib/api'
|
|||||||
import { greeting, formatRelative, SCENE_LABELS, RISK_LABELS, MATTER_STATUS_LABELS, cn } from '@/lib/utils'
|
import { greeting, formatRelative, SCENE_LABELS, RISK_LABELS, MATTER_STATUS_LABELS, cn } from '@/lib/utils'
|
||||||
import type { DashboardToday, DashboardSummary, TimelineItem, RiskAlert, Scene } from '@/types'
|
import type { DashboardToday, DashboardSummary, TimelineItem, RiskAlert, Scene } from '@/types'
|
||||||
|
|
||||||
/** 环形进度条 */
|
|
||||||
function RingProgress({ value, label, color }: { value: number; label: string; color: string }) {
|
|
||||||
const radius = 28
|
|
||||||
const circumference = 2 * Math.PI * radius
|
|
||||||
const offset = circumference - (value / 100) * circumference
|
|
||||||
return (
|
|
||||||
<div className="flex flex-col items-center gap-1">
|
|
||||||
<div className="relative h-20 w-20">
|
|
||||||
<svg className="h-full w-full -rotate-90" viewBox="0 0 64 64">
|
|
||||||
<circle cx="32" cy="32" r={radius} fill="none" stroke="currentColor" strokeWidth="5" className="text-muted/30" />
|
|
||||||
<circle
|
|
||||||
cx="32" cy="32" r={radius} fill="none" stroke="currentColor" strokeWidth="5"
|
|
||||||
strokeDasharray={circumference} strokeDashoffset={offset}
|
|
||||||
strokeLinecap="round" className={color}
|
|
||||||
style={{ transition: 'stroke-dashoffset 0.6s ease' }}
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div className="absolute inset-0 flex items-center justify-center">
|
|
||||||
<span className="text-lg font-bold text-foreground">{value}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span className="text-xs text-muted-foreground">{label}</span>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const SCENE_ICONS: Record<Scene, typeof Scale> = {
|
const SCENE_ICONS: Record<Scene, typeof Scale> = {
|
||||||
legal: Scale,
|
legal: Scale,
|
||||||
decision: TrendingUp,
|
decision: TrendingUp,
|
||||||
@@ -247,7 +221,7 @@ export function Dashboard() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 概览数字 */}
|
{/* 概览数字 */}
|
||||||
<div className="grid grid-cols-2 gap-3 sm:grid-cols-4">
|
<div className="grid grid-cols-3 gap-3">
|
||||||
<button
|
<button
|
||||||
onClick={() => riskCount > 0 && navigate('/matters')}
|
onClick={() => riskCount > 0 && navigate('/matters')}
|
||||||
className={cn(
|
className={cn(
|
||||||
@@ -289,16 +263,6 @@ export function Dashboard() {
|
|||||||
</div>
|
</div>
|
||||||
<p className={cn('mt-1 text-2xl font-bold', replyCount > 0 ? 'text-emerald-700' : 'text-muted-foreground')}>{replyCount}</p>
|
<p className={cn('mt-1 text-2xl font-bold', replyCount > 0 ? 'text-emerald-700' : 'text-muted-foreground')}>{replyCount}</p>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div className="rounded-xl border border-border bg-card p-3">
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Activity className="h-4 w-4 text-primary" />
|
|
||||||
<span className="text-xs text-muted-foreground">健康度</span>
|
|
||||||
</div>
|
|
||||||
<p className="mt-1 text-2xl font-bold text-primary">
|
|
||||||
{Math.round((data.health_score.legal + data.health_score.operation + data.health_score.compliance) / 3)}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 快捷入口 */}
|
{/* 快捷入口 */}
|
||||||
@@ -324,7 +288,7 @@ export function Dashboard() {
|
|||||||
<EmptyState
|
<EmptyState
|
||||||
title="今天暂无要事"
|
title="今天暂无要事"
|
||||||
description="有新的事项或风险时会在这里提醒你"
|
description="有新的事项或风险时会在这里提醒你"
|
||||||
icon={Activity}
|
icon={Radar}
|
||||||
action={<Button onClick={() => navigate('/legal')}><Plus className="mr-1 h-4 w-4" />开始咨询</Button>}
|
action={<Button onClick={() => navigate('/legal')}><Plus className="mr-1 h-4 w-4" />开始咨询</Button>}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -381,11 +345,9 @@ export function Dashboard() {
|
|||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 时间线 + 健康度(两列) */}
|
{/* 时间线 */}
|
||||||
<div className="grid gap-4 lg:grid-cols-3">
|
{timeline.length > 0 && (
|
||||||
{/* 时间线(占 2 列) */}
|
<Card>
|
||||||
{timeline.length > 0 && (
|
|
||||||
<Card className="lg:col-span-2">
|
|
||||||
<CardContent className="p-4">
|
<CardContent className="p-4">
|
||||||
<div className="mb-3 flex items-center gap-2">
|
<div className="mb-3 flex items-center gap-2">
|
||||||
<Clock className="h-5 w-5 text-muted-foreground" />
|
<Clock className="h-5 w-5 text-muted-foreground" />
|
||||||
@@ -407,22 +369,6 @@ export function Dashboard() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 经营健康度 */}
|
|
||||||
<Card>
|
|
||||||
<CardContent className="p-4">
|
|
||||||
<div className="mb-4 flex items-center gap-2">
|
|
||||||
<Activity className="h-5 w-5 text-primary" />
|
|
||||||
<span className="font-semibold text-foreground">经营健康度</span>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center justify-around">
|
|
||||||
<RingProgress value={data.health_score.legal} label="法务" color="text-blue-500" />
|
|
||||||
<RingProgress value={data.health_score.operation} label="经营" color="text-violet-500" />
|
|
||||||
<RingProgress value={data.health_score.compliance} label="合规" color="text-emerald-500" />
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</div>
|
|
||||||
</PageLayout>
|
</PageLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user