11import { Popover } from "@/components/ui/popover" ;
2+ import { cn } from "@/utils/cn" ;
23import { open } from "@tauri-apps/plugin-shell" ;
3- import { ExternalLink , Heart , User } from "lucide-react" ;
4+ import { Calendar , ExternalLink , Heart , Server , User } from "lucide-react" ;
45import "./assets/font.css" ;
56
67interface DonationData {
@@ -10,7 +11,12 @@ interface DonationData {
1011 currency ?: string ;
1112}
1213
14+ // 新的在前
1315const donations : DonationData [ ] = [
16+ { user : "购买服务器" , note : "zty012" , amount : - 480 } ,
17+ { user : "域名 2y.nz" , note : "zty012" , amount : - 151.8 } ,
18+ // { user: "MacBook", note: "littlefean", amount: -7599.2 },
19+ { user : "域名 project-graph.top" , note : "zty012" , amount : - 13.66 } ,
1420 { user : "ShawnSnow" , note : "感谢PG" , amount : 40 } ,
1521 { user : "飞度" , note : "做的很酷,真的谢谢你们" , amount : 50 } ,
1622 { user : "鳕鱼" , note : "支持开源支持国产,加油" , amount : 70 } ,
@@ -94,9 +100,29 @@ export default function CreditsTab() {
94100 < div className = "bg-muted/50 flex flex-1 flex-col gap-2 rounded-lg border p-4" >
95101 < div className = "flex items-center justify-center gap-2" >
96102 < Heart className = "h-5 w-5" />
103+ < span className = "text-lg" > 合计</ span >
104+ </ div >
105+ < div
106+ className = { cn (
107+ "flex items-end justify-center gap-2 text-center *:font-[DINPro]" ,
108+ totalAmount < 0 ? "text-red-500" : "text-green-500" ,
109+ ) }
110+ >
111+ < span className = "text-3xl" > { totalAmount . toFixed ( 2 ) } </ span >
112+ < span className = "text-xl" > CNY</ span >
113+ </ div >
114+ </ div >
115+ < div className = "bg-muted/50 flex flex-1 flex-col gap-2 rounded-lg border p-4" >
116+ < div className = "flex items-center justify-center gap-2" >
117+ < Calendar className = "h-5 w-5" />
97118 < span className = "text-lg" > 平均每月</ span >
98119 </ div >
99- < div className = "flex items-end justify-center gap-2 text-center *:font-[DINPro]" >
120+ < div
121+ className = { cn (
122+ "flex items-end justify-center gap-2 text-center *:font-[DINPro]" ,
123+ averageMonthlyAmount < 0 ? "text-red-500" : "text-green-500" ,
124+ ) }
125+ >
100126 < span className = "text-3xl" > { averageMonthlyAmount . toFixed ( 2 ) } </ span >
101127 < span className = "text-xl" > CNY</ span >
102128 </ div >
@@ -146,11 +172,13 @@ function Donation({
146172} ) {
147173 return (
148174 < div
149- className = "bg-muted/50 mb-4 inline-flex w-full break-inside-avoid flex-col gap-2 rounded-lg border p-4"
150- style = { { pageBreakInside : "avoid" } }
175+ className = { cn (
176+ "bg-muted/50 mb-4 inline-flex w-full break-inside-avoid flex-col gap-2 rounded-lg border p-4" ,
177+ amount < 0 && "bg-destructive/25" ,
178+ ) }
151179 >
152180 < div className = "flex items-center gap-2" >
153- < User className = "h-4 w -4" />
181+ { amount < 0 ? < Server className = "size-4" /> : < User className = "size -4" /> }
154182 < span className = "text-sm font-medium" > { user || "匿名" } </ span >
155183 </ div >
156184
0 commit comments