|
1 | 1 | "use client"; |
2 | 2 |
|
3 | 3 | import { useState, useMemo, useEffect, Suspense } from "react"; |
4 | | -import { ChevronDown, ChevronRight, CheckCircle2, XCircle, Clock, Cpu, Search, AlertTriangle, ArrowUpDown, ArrowUp, ArrowDown, Filter, Coins, X } from "lucide-react"; |
| 4 | +import { CheckCircle2, XCircle, Search, AlertTriangle, ArrowUpDown, ArrowUp, ArrowDown, Filter, X } from "lucide-react"; |
5 | 5 | import Link from "next/link"; |
6 | 6 | import { useRouter, useSearchParams, usePathname } from "next/navigation"; |
7 | 7 | import { clsx, type ClassValue } from "clsx"; |
@@ -39,43 +39,6 @@ const tasksData = Object.entries(tasksDataRaw).map(([taskName, trials]) => { |
39 | 39 | const allModels = Array.from(new Set(tasksData.flatMap(t => t.trials.map(tr => tr.model)))); |
40 | 40 | const allAgents = Array.from(new Set(tasksData.flatMap(t => t.trials.map(tr => tr.agent)))); |
41 | 41 |
|
42 | | -function BackToTop() { |
43 | | - const [isVisible, setIsVisible] = useState(false); |
44 | | - |
45 | | - useEffect(() => { |
46 | | - const toggleVisibility = () => { |
47 | | - if (window.scrollY > 300) { |
48 | | - setIsVisible(true); |
49 | | - } else { |
50 | | - setIsVisible(false); |
51 | | - } |
52 | | - }; |
53 | | - |
54 | | - window.addEventListener("scroll", toggleVisibility); |
55 | | - return () => window.removeEventListener("scroll", toggleVisibility); |
56 | | - }, []); |
57 | | - |
58 | | - const scrollToTop = () => { |
59 | | - window.scrollTo({ |
60 | | - top: 0, |
61 | | - behavior: "smooth" |
62 | | - }); |
63 | | - }; |
64 | | - |
65 | | - if (!isVisible) return null; |
66 | | - |
67 | | - return ( |
68 | | - <button |
69 | | - type="button" |
70 | | - onClick={scrollToTop} |
71 | | - className="fixed bottom-8 right-8 p-3 bg-secondary text-foreground rounded-full shadow-lg border border-border hover:bg-secondary/80 transition-all z-50 flex items-center justify-center group backdrop-blur-sm" |
72 | | - aria-label="Back to top" |
73 | | - > |
74 | | - <ArrowUp className="w-5 h-5 group-hover:-translate-y-1 transition-transform" /> |
75 | | - </button> |
76 | | - ); |
77 | | -} |
78 | | - |
79 | 42 | function TasksContent() { |
80 | 43 | const router = useRouter(); |
81 | 44 | const pathname = usePathname(); |
@@ -442,3 +405,40 @@ export default function TasksPage() { |
442 | 405 | </div> |
443 | 406 | ); |
444 | 407 | } |
| 408 | + |
| 409 | +function BackToTop() { |
| 410 | + const [isVisible, setIsVisible] = useState(false); |
| 411 | + |
| 412 | + useEffect(() => { |
| 413 | + const toggleVisibility = () => { |
| 414 | + if (window.scrollY > 300) { |
| 415 | + setIsVisible(true); |
| 416 | + } else { |
| 417 | + setIsVisible(false); |
| 418 | + } |
| 419 | + }; |
| 420 | + |
| 421 | + window.addEventListener("scroll", toggleVisibility); |
| 422 | + return () => window.removeEventListener("scroll", toggleVisibility); |
| 423 | + }, []); |
| 424 | + |
| 425 | + const scrollToTop = () => { |
| 426 | + window.scrollTo({ |
| 427 | + top: 0, |
| 428 | + behavior: "smooth" |
| 429 | + }); |
| 430 | + }; |
| 431 | + |
| 432 | + if (!isVisible) return null; |
| 433 | + |
| 434 | + return ( |
| 435 | + <button |
| 436 | + type="button" |
| 437 | + onClick={scrollToTop} |
| 438 | + className="fixed bottom-8 right-8 p-3 bg-secondary text-foreground rounded-full shadow-lg border border-border hover:bg-secondary/80 transition-all z-50 flex items-center justify-center group backdrop-blur-sm" |
| 439 | + aria-label="Back to top" |
| 440 | + > |
| 441 | + <ArrowUp className="w-5 h-5 group-hover:-translate-y-1 transition-transform" /> |
| 442 | + </button> |
| 443 | + ); |
| 444 | +} |
0 commit comments