"use client" import { useState, useEffect } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { BarChart, Bar, XAxis, YAxis, CartesianGrid, ResponsiveContainer } from "recharts" import { TrendingUp, TrendingDown, Calendar, AlertTriangle, Target, Users, DollarSign, Activity, Zap, Award, } from "lucide-react" import { ChartContainer, ChartTooltip, ChartTooltipContent } from "@/components/ui/chart" // 使用真實資料庫數據 import { KPI } from '@/lib/database' // 預設 KPI 數據(當資料庫無數據時使用) const defaultKpiData = [ { id: '1', name: "營收成長率", current_value: 85, target_value: 100, category: "financial", weight: 30, color: "emerald" }, { id: '2', name: "團隊滿意度", current_value: 92, target_value: 90, category: "team", weight: 25, color: "blue" }, { id: '3', name: "市場佔有率", current_value: 68, target_value: 75, category: "operational", weight: 20, color: "purple" }, { id: '4', name: "創新指數", current_value: 45, target_value: 80, category: "innovation", weight: 25, color: "orange" }, ] const teamRankingData = [ { name: "業務部", performance: 95, color: "#10b981" }, { name: "行銷部", performance: 88, color: "#3b82f6" }, { name: "產品部", performance: 82, color: "#8b5cf6" }, { name: "營運部", performance: 76, color: "#f59e0b" }, { name: "人資部", performance: 71, color: "#ef4444" }, ] const reviewReminders = [ { id: 1, employee: "陳雅雯", role: "業務副總", dueDate: "2024-02-15", type: "季度審查", priority: "high", color: "red", }, { id: 2, employee: "王志明", role: "技術長", dueDate: "2024-02-18", type: "一對一面談", priority: "medium", color: "yellow", }, { id: 3, employee: "李美玲", role: "行銷長", dueDate: "2024-02-20", type: "目標設定", priority: "low", color: "green", }, ] const chartConfig = { performance: { label: "Performance %", color: "hsl(var(--chart-1))", }, } function CircularProgress({ value, size = 120, color = "blue" }: { value: number; size?: number; color?: string }) { const radius = (size - 20) / 2 const circumference = 2 * Math.PI * radius const strokeDasharray = circumference const strokeDashoffset = circumference - (value / 100) * circumference const colorMap = { emerald: value >= 70 ? "#10b981" : "#ef4444", blue: value >= 70 ? "#3b82f6" : "#ef4444", purple: value >= 70 ? "#8b5cf6" : "#ef4444", orange: value >= 70 ? "#f59e0b" : "#ef4444", } return (
策略導向 KPI 管理與審查系統
{review.employee}
{review.role}
{review.dueDate}