This commit is contained in:
MarkLo 2025-12-03 02:59:12 +08:00
parent 4f2327f5c2
commit 6ffe348ac0
1 changed files with 36 additions and 22 deletions

View File

@ -5,11 +5,12 @@
"use client"; "use client";
import { useState } from "react"; import { useState } from "react";
import { Download, FileDown } from "lucide-react"; import { Download, FileDown, CheckIcon } from "lucide-react";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Checkbox } from "@/components/ui/checkbox"; import { Checkbox } from "@/components/ui/checkbox";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { cn } from "@/lib/utils";
interface AnalystInfo { interface AnalystInfo {
key: string; key: string;
@ -161,30 +162,43 @@ export function DownloadReports({
</div> </div>
{/* Analyst List */} {/* Analyst List */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3"> <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
{availableAnalysts.map(analyst => ( {availableAnalysts.map(analyst => {
<div const isSelected = selectedAnalysts.includes(analyst.key);
key={analyst.key} return (
className="flex items-start space-x-2 p-3 rounded-lg border hover:bg-accent/50 transition-colors" <div
> key={analyst.key}
<Checkbox onClick={() => handleToggleAnalyst(analyst.key)}
id={`analyst-${analyst.key}`} className={cn(
checked={selectedAnalysts.includes(analyst.key)} "relative flex cursor-pointer flex-col gap-2 rounded-lg border-2 p-4 transition-all hover:bg-accent",
onCheckedChange={() => handleToggleAnalyst(analyst.key)} isSelected
/> ? "border-primary bg-primary/5 text-primary"
<div className="flex-1"> : "border-muted-foreground/25 bg-card text-muted-foreground"
<Label )}
htmlFor={`analyst-${analyst.key}`} >
className="text-sm font-medium cursor-pointer" <div className="flex items-start gap-3">
> <div
{analyst.label} className={cn(
</Label> "flex h-5 w-5 shrink-0 items-center justify-center rounded-sm border transition-colors",
<p className="text-xs text-muted-foreground mt-1"> isSelected
? "border-primary bg-primary text-primary-foreground"
: "border-muted-foreground"
)}
>
{isSelected && <CheckIcon className="h-3.5 w-3.5" />}
</div>
<div className="flex-1">
<p className="text-sm font-medium select-none">
{analyst.label}
</p>
</div>
</div>
<p className="text-xs text-muted-foreground pl-8">
{analyst.description} {analyst.description}
</p> </p>
</div> </div>
</div> );
))} })}
</div> </div>
{/* Download Button */} {/* Download Button */}