File size: 27,405 Bytes
d328b13 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
"use client"
import { useState, useMemo, useEffect, useRef } from "react"
import { Search, ExternalLink, Mail, FileText, X, ChevronDown } from "lucide-react"
import { Input } from "@/components/ui/input"
import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuCheckboxItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog"
import { DatasetStatistics } from "@/components/dataset-statistics"
import { ScrollToTop } from "@/components/scroll-to-top"
interface Dataset {
Name: string
Category: string
Description: string
Task: string
Data_Type: string
Source: string
"Paper link": string
Availability: string
Contact: string
}
function getCategoryColor(category: string): { bg: string; text: string; hover: string } {
const colors = [
{ bg: "bg-blue-100 dark:bg-blue-950", text: "text-blue-700 dark:text-blue-300", hover: "hover:bg-blue-200 dark:hover:bg-blue-900" },
{ bg: "bg-emerald-100 dark:bg-emerald-950", text: "text-emerald-700 dark:text-emerald-300", hover: "hover:bg-emerald-200 dark:hover:bg-emerald-900" },
{ bg: "bg-amber-100 dark:bg-amber-950", text: "text-amber-700 dark:text-amber-300", hover: "hover:bg-amber-200 dark:hover:bg-amber-900" },
{ bg: "bg-rose-100 dark:bg-rose-950", text: "text-rose-700 dark:text-rose-300", hover: "hover:bg-rose-200 dark:hover:bg-rose-900" },
{ bg: "bg-cyan-100 dark:bg-cyan-950", text: "text-cyan-700 dark:text-cyan-300", hover: "hover:bg-cyan-200 dark:hover:bg-cyan-900" },
]
const hash = category.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0)
return colors[hash % colors.length]
}
function getDataTypeColor(dataType: string): { bg: string; text: string; hover: string } {
const colors = [
{ bg: "bg-indigo-100 dark:bg-indigo-950", text: "text-indigo-700 dark:text-indigo-300", hover: "hover:bg-indigo-200 dark:hover:bg-indigo-900" },
{ bg: "bg-teal-100 dark:bg-teal-950", text: "text-teal-700 dark:text-teal-300", hover: "hover:bg-teal-200 dark:hover:bg-teal-900" },
{ bg: "bg-orange-100 dark:bg-orange-950", text: "text-orange-700 dark:text-orange-300", hover: "hover:bg-orange-200 dark:hover:bg-orange-900" },
{ bg: "bg-pink-100 dark:bg-pink-950", text: "text-pink-700 dark:text-pink-300", hover: "hover:bg-pink-200 dark:hover:bg-pink-900" },
{ bg: "bg-lime-100 dark:bg-lime-950", text: "text-lime-700 dark:text-lime-300", hover: "hover:bg-lime-200 dark:hover:bg-lime-900" },
{ bg: "bg-sky-100 dark:bg-sky-950", text: "text-sky-700 dark:text-sky-300", hover: "hover:bg-sky-200 dark:hover:bg-sky-900" },
]
const hash = dataType.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0)
return colors[hash % colors.length]
}
function getCategoryHoverClasses(category: string): string {
const sets = [
{ bg: "hover:!bg-blue-50 dark:hover:!bg-blue-950/40", text: "hover:!text-blue-700 dark:hover:!text-blue-300" },
{ bg: "hover:!bg-indigo-50 dark:hover:!bg-indigo-950/40", text: "hover:!text-indigo-700 dark:hover:!text-indigo-300" },
{ bg: "hover:!bg-violet-50 dark:hover:!bg-violet-950/40", text: "hover:!text-violet-700 dark:hover:!text-violet-300" },
{ bg: "hover:!bg-emerald-50 dark:hover:!bg-emerald-950/40", text: "hover:!text-emerald-700 dark:hover:!text-emerald-300" },
{ bg: "hover:!bg-amber-50 dark:hover:!bg-amber-950/40", text: "hover:!text-amber-700 dark:hover:!text-amber-300" },
{ bg: "hover:!bg-rose-50 dark:hover:!bg-rose-950/40", text: "hover:!text-rose-700 dark:hover:!text-rose-300" },
] as const
const hash = category.split("").reduce((acc, ch) => acc + ch.charCodeAt(0), 0)
const c = sets[hash % sets.length]
return `${c.bg} ${c.text}`
}
/* ---------- Share-link + CSV helpers ---------- */
function buildShareUrl(opts: {
searchQuery: string
selectedCategory: string
selectedTasks: string[]
selectedDataTypes: string[]
}) {
const u = new URL(window.location.href)
const p = u.searchParams
p.set("q", opts.searchQuery || "")
p.set("cat", opts.selectedCategory || "all")
p.set("tasks", opts.selectedTasks.join(","))
p.set("types", opts.selectedDataTypes.join(","))
u.search = p.toString()
return u.toString()
}
function downloadCSV(rows: any[], filename = "datasets_filtered.csv") {
if (!rows.length) {
alert("Nothing to export — adjust your filters first.")
return
}
const headers = Object.keys(rows[0])
const esc = (v: any) => `"${String(v ?? "").replace(/"/g, '""')}"`
const csv = [headers.join(","), ...rows.map(r => headers.map(h => esc(r[h])).join(","))].join("\n")
const blob = new Blob([csv], { type: "text/csv;charset=utf-8" })
const url = URL.createObjectURL(blob)
const a = document.createElement("a")
a.href = url
a.download = filename
document.body.appendChild(a)
a.click()
a.remove()
URL.revokeObjectURL(url)
}
export function DatasetAtlas() {
const [datasets, setDatasets] = useState<Dataset[]>([])
const [searchQuery, setSearchQuery] = useState("")
const [selectedCategory, setSelectedCategory] = useState<string>("all")
const [selectedTasks, setSelectedTasks] = useState<string[]>([])
const [selectedDataTypes, setSelectedDataTypes] = useState<string[]>([])
const [loading, setLoading] = useState(true)
const [selectedDataset, setSelectedDataset] = useState<Dataset | null>(null)
const taskTriggerRef = useRef<HTMLButtonElement | null>(null)
const dataTypeTriggerRef = useRef<HTMLButtonElement | null>(null)
const [taskMenuWidth, setTaskMenuWidth] = useState<number | null>(null)
const [dataTypeMenuWidth, setDataTypeMenuWidth] = useState<number | null>(null)
// Chart filters passed to <DatasetStatistics />
const [chartFilterCategory, setChartFilterCategory] = useState<string | null>(null)
const [chartFilterDataType, setChartFilterDataType] = useState<string | null>(null)
const [chartFilterAvailability, setChartFilterAvailability] = useState<string | null>(null)
useEffect(() => {
async function fetchData() {
try {
const response = await fetch(
"https://blobs.vusercontent.net/blob/Awesome%20food%20allergy%20datasets%20-%20Copia%20di%20Full%20view%20%281%29-nbq61oXBgltNRiIJIq8djoMoqX7ItK.tsv",
)
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`)
const text = await response.text()
const parsed = parseTSV(text)
setDatasets(parsed)
} catch (error) {
console.error("[v0] Error fetching datasets:", error)
} finally {
setLoading(false)
}
}
fetchData()
}, [])
useEffect(() => {
function updateWidths() {
if (taskTriggerRef.current) setTaskMenuWidth(Math.round(taskTriggerRef.current.getBoundingClientRect().width))
if (dataTypeTriggerRef.current) setDataTypeMenuWidth(Math.round(dataTypeTriggerRef.current.getBoundingClientRect().width))
}
updateWidths()
window.addEventListener("resize", updateWidths)
return () => window.removeEventListener("resize", updateWidths)
}, [])
function parseTSV(text: string): Dataset[] {
const lines = text.split("\n")
const headers = lines[0].split("\t").map((h) => h.trim().replace(/^"|"$/g, ""))
return lines
.slice(1)
.filter((line) => line.trim())
.map((line) => {
const values = line.split("\t").map((v) => v.trim())
const dataset: any = {}
headers.forEach((header, index) => (dataset[header] = values[index] || ""))
return dataset as Dataset
})
}
const categories = useMemo(() => {
const cats = new Set(datasets.map((d) => d.Category).filter(Boolean))
return ["all", ...Array.from(cats).sort()]
}, [datasets])
const tasks = useMemo(() => {
const set = new Set<string>()
datasets.forEach((d) => {
if (d.Task) d.Task.split(",").map((t) => t.trim()).forEach((t) => t && set.add(t))
})
return Array.from(set).sort()
}, [datasets])
const dataTypes = useMemo(() => {
const set = new Set(datasets.map((d) => d.Data_Type).filter(Boolean))
return Array.from(set).sort()
}, [datasets])
const filteredDatasets = useMemo(() => {
return datasets.filter((d) => {
const q = searchQuery.toLowerCase()
const matchesSearch =
d.Name?.toLowerCase().includes(q) ||
d.Description?.toLowerCase().includes(q) ||
d.Category?.toLowerCase().includes(q) ||
d.Task?.toLowerCase().includes(q) ||
d.Data_Type?.toLowerCase().includes(q)
const matchesCategory = selectedCategory === "all" || d.Category === selectedCategory
const matchesTask =
selectedTasks.length === 0 ||
d.Task.split(",").map((t) => t.trim()).some((t) => selectedTasks.includes(t))
const matchesDataType = selectedDataTypes.length === 0 || selectedDataTypes.includes(d.Data_Type)
const matchesChartCategory = !chartFilterCategory || d.Category === chartFilterCategory
const matchesChartDataType = !chartFilterDataType || d.Data_Type === chartFilterDataType
const matchesChartAvailability = !chartFilterAvailability || d.Availability === chartFilterAvailability
return matchesSearch && matchesCategory && matchesTask && matchesDataType &&
matchesChartCategory && matchesChartDataType && matchesChartAvailability
})
}, [datasets, searchQuery, selectedCategory, selectedTasks, selectedDataTypes, chartFilterCategory, chartFilterDataType, chartFilterAvailability])
const toggleTask = (task: string) =>
setSelectedTasks((prev) => (prev.includes(task) ? prev.filter((t) => t !== task) : [...prev, task]))
const removeTask = (task: string) => setSelectedTasks((prev) => prev.filter((t) => t !== task))
const clearAllTasks = () => setSelectedTasks([])
const toggleDataType = (dataType: string) =>
setSelectedDataTypes((prev) => (prev.includes(dataType) ? prev.filter((t) => t !== dataType) : [...prev, dataType]))
const removeDataType = (dataType: string) => setSelectedDataTypes((prev) => prev.filter((t) => t !== dataType))
const clearAllDataTypes = () => setSelectedDataTypes([])
const handleCategoryChartClick = (category: string) =>
setChartFilterCategory((prev) => (prev === category ? null : category))
const handleDataTypeChartClick = (dataType: string) =>
setChartFilterDataType((prev) => (prev === dataType ? null : dataType))
const handleAvailabilityChartClick = (availability: string) =>
setChartFilterAvailability((prev) => (prev === availability ? null : availability))
return (
<div className="min-h-screen bg-background">
{/* Header */}
<header className="border-b border-border bg-card">
<div className="container mx-auto px-4 py-6 md:py-8">
<h1 className="text-3xl md:text-4xl font-bold text-balance mb-2">Awesome Food Allergy Research Datasets</h1>
<p className="text-muted-foreground text-lg text-pretty">
A curated collection of datasets for advancing food allergy research
</p>
</div>
</header>
<div className="container mx-auto px-4 py-8">
{/* Search and Filters */}
<div className="mb-6 space-y-4">
<div className="relative">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground" />
<Input
type="text"
placeholder="Search datasets by name, description, category, task, or data type..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="pl-10 h-12 text-base"
/>
</div>
{/* --- Actions bar (Share + Export) — right under search --- */}
<div className="flex flex-wrap items-center gap-2">
<Button
variant="outline"
size="sm"
onClick={() => {
const url = buildShareUrl({
searchQuery,
selectedCategory,
selectedTasks,
selectedDataTypes,
})
if (navigator.clipboard?.writeText) {
navigator.clipboard.writeText(url)
.then(() => alert("Shareable link copied to clipboard!"))
.catch(() => prompt("Copy this link:", url))
} else {
prompt("Copy this link:", url)
}
}}
>
Share this view (copy link)
</Button>
<Button
variant="outline"
size="sm"
onClick={() => {
const rows = filteredDatasets.map(d => ({
Name: d.Name,
Category: d.Category,
"Data Type": d.Data_Type,
Task: d.Task,
Availability: d.Availability,
"Access URL": d.Source,
"Paper URL": d["Paper link"],
Contact: d.Contact,
Description: d.Description,
}))
downloadCSV(rows)
}}
>
Export current list (CSV)
</Button>
</div>
<div className="flex flex-col gap-4 pt-2">
<div>
<label className="text-sm font-medium mb-2 block">Filter by Category</label>
<div className="flex flex-wrap gap-2">
{categories.map((category) => (
<Button
key={category}
variant={selectedCategory === category ? "default" : "outline"}
size="sm"
onClick={() => setSelectedCategory(category)}
className={`capitalize transition-colors ${getCategoryHoverClasses(category)}`}
>
{category}
</Button>
))}
</div>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label className="text-sm font-medium mb-2 block">Filter by Task</label>
<div className="space-y-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button ref={taskTriggerRef} variant="outline" className="w-full justify-between bg-transparent">
<span>
{selectedTasks.length === 0
? "Select tasks..."
: `${selectedTasks.length} task${selectedTasks.length > 1 ? "s" : ""} selected`}
</span>
<ChevronDown className="h-4 w-4 opacity-50" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="max-h-[300px] overflow-y-auto" style={{ width: taskMenuWidth ?? undefined }}>
{tasks.map((task) => (
<DropdownMenuCheckboxItem key={task} checked={selectedTasks.includes(task)} onCheckedChange={() => toggleTask(task)}>
{task}
</DropdownMenuCheckboxItem>
))}
</DropdownMenuContent>
</DropdownMenu>
{selectedTasks.length > 0 && (
<div className="flex flex-wrap gap-2">
{selectedTasks.map((task) => (
<Badge key={task} variant="secondary" className="pl-2 pr-1 py-1 text-xs shadow-none">
{task}
<button onClick={() => removeTask(task)} className="ml-1 hover:bg-muted rounded-full p-0.5">
<X className="h-3 w-3" />
</button>
</Badge>
))}
<Button variant="ghost" size="sm" onClick={clearAllTasks} className="h-6 px-2 text-xs">
Clear all
</Button>
</div>
)}
</div>
</div>
<div>
<label className="text-sm font-medium mb-2 block">Filter by Data Type</label>
<div className="space-y-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button ref={dataTypeTriggerRef} variant="outline" className="w-full justify-between bg-transparent">
<span>
{selectedDataTypes.length === 0
? "Select data types..."
: `${selectedDataTypes.length} type${selectedDataTypes.length > 1 ? "s" : ""} selected`}
</span>
<ChevronDown className="h-4 w-4 opacity-50" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="max-h-[300px] overflow-y-auto" style={{ width: dataTypeMenuWidth ?? undefined }}>
{dataTypes.map((dataType) => (
<DropdownMenuCheckboxItem key={dataType} checked={selectedDataTypes.includes(dataType)} onCheckedChange={() => toggleDataType(dataType)}>
{dataType}
</DropdownMenuCheckboxItem>
))}
</DropdownMenuContent>
</DropdownMenu>
{selectedDataTypes.length > 0 && (
<div className="flex flex-wrap gap-2">
{selectedDataTypes.map((dataType) => (
<Badge key={dataType} variant="secondary" className="pl-2 pr-1 py-1 text-xs shadow-none">
{dataType}
<button onClick={() => removeDataType(dataType)} className="ml-1 hover:bg-muted rounded-full p-0.5">
<X className="h-3 w-3" />
</button>
</Badge>
))}
<Button variant="ghost" size="sm" onClick={clearAllDataTypes} className="h-6 px-2 text-xs">
Clear all
</Button>
</div>
)}
</div>
</div>
</div>
</div>
</div>
{/* Statistics Charts */}
{!loading && datasets.length > 0 && (
<DatasetStatistics
datasets={datasets}
selectedCategory={chartFilterCategory}
selectedDataType={chartFilterDataType}
selectedAvailability={chartFilterAvailability}
onCategoryClick={handleCategoryChartClick}
onDataTypeClick={handleDataTypeChartClick}
onAvailabilityClick={handleAvailabilityChartClick}
/>
)}
{/* Results Count */}
<div className="mb-6">
<p className="text-sm text-muted-foreground">
Showing <span className="font-semibold text-foreground">{filteredDatasets.length}</span> of{" "}
<span className="font-semibold text-foreground">{datasets.length}</span> datasets
</p>
</div>
{/* Dataset Grid */}
{loading ? (
<div className="text-center py-12">
<p className="text-muted-foreground">Loading datasets...</p>
</div>
) : filteredDatasets.length === 0 ? (
<div className="text-center py-12">
<p className="text-muted-foreground">No datasets found matching your criteria.</p>
</div>
) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{filteredDatasets.map((dataset, index) => {
const categoryColors = getCategoryColor(dataset.Category)
const dataTypeColors = getDataTypeColor(dataset.Data_Type)
return (
<Card key={index} className="flex flex-col hover:shadow-lg transition-shadow cursor-pointer h-[480px]" onClick={() => setSelectedDataset(dataset)}>
<CardHeader className="pb-3">
<div className="flex gap-2 mb-3 flex-wrap">
{dataset.Category && (
<Badge className={`text-xs border-0 shadow-none ${categoryColors.bg} ${categoryColors.text} ${categoryColors.hover}`}>
{dataset.Category}
</Badge>
)}
{dataset.Data_Type && (
<Badge className={`text-xs border-0 shadow-none ${dataTypeColors.bg} ${dataTypeColors.text} ${dataTypeColors.hover}`}>
{dataset.Data_Type}
</Badge>
)}
{dataset.Availability && (
<Badge variant={dataset.Availability.toLowerCase().includes("open") ? "default" : "outline"} className="text-xs shadow-none">
{dataset.Availability}
</Badge>
)}
</div>
<CardTitle className="text-xl text-balance leading-tight">{dataset.Name}</CardTitle>
{dataset.Task && (
<CardDescription className="text-sm font-medium line-clamp-2">
Task: {dataset.Task}
</CardDescription>
)}
</CardHeader>
<CardContent className="flex-1 pb-3">
<p className="text-sm text-muted-foreground text-pretty leading-relaxed line-clamp-4">
{dataset.Description}
</p>
</CardContent>
<CardFooter className="flex flex-col gap-2 items-stretch pt-3 pb-5">
{dataset.Source && (
<Button variant="default" size="sm" asChild className="w-full" onClick={(e) => e.stopPropagation()}>
<a href={dataset.Source} target="_blank" rel="noopener noreferrer">
<ExternalLink className="h-4 w-4 mr-2" />
Access Dataset
</a>
</Button>
)}
<div className="flex gap-2">
{dataset["Paper link"] && (
<Button variant="outline" size="sm" asChild className="flex-1 bg-transparent" onClick={(e) => e.stopPropagation()}>
<a href={dataset["Paper link"]} target="_blank" rel="noopener noreferrer">
<FileText className="h-4 w-4 mr-2" />
Paper
</a>
</Button>
)}
{dataset.Contact && (
<Button variant="outline" size="sm" asChild className="flex-1 bg-transparent" onClick={(e) => e.stopPropagation()}>
<a href={`mailto:${dataset.Contact}`}>
<Mail className="h-4 w-4 mr-2" />
Contact
</a>
</Button>
)}
</div>
</CardFooter>
</Card>
)
})}
</div>
)}
</div>
{/* Modal Dialog for Expanded Dataset View */}
<Dialog open={!!selectedDataset} onOpenChange={(open) => !open && setSelectedDataset(null)}>
<DialogContent className="max-w-2xl max-h-[80vh] overflow-y-auto">
{selectedDataset && (
<>
<DialogHeader>
<div className="flex gap-2 mb-3 flex-wrap">
{selectedDataset.Category && (
<Badge className={`text-xs border-0 shadow-none ${getCategoryColor(selectedDataset.Category).bg} ${getCategoryColor(selectedDataset.Category).text} ${getCategoryColor(selectedDataset.Category).hover}`}>
{selectedDataset.Category}
</Badge>
)}
{selectedDataset.Data_Type && (
<Badge className={`text-xs border-0 shadow-none ${getDataTypeColor(selectedDataset.Data_Type).bg} ${getDataTypeColor(selectedDataset.Data_Type).text} ${getDataTypeColor(selectedDataset.Data_Type).hover}`}>
{selectedDataset.Data_Type}
</Badge>
)}
{selectedDataset.Availability && (
<Badge variant={selectedDataset.Availability.toLowerCase().includes("open") ? "default" : "outline"} className="text-xs shadow-none">
{selectedDataset.Availability}
</Badge>
)}
</div>
<DialogTitle className="text-2xl text-balance">{selectedDataset.Name}</DialogTitle>
{selectedDataset.Task && (
<DialogDescription className="text-base font-medium text-foreground">
Task: {selectedDataset.Task}
</DialogDescription>
)}
</DialogHeader>
<div className="space-y-6 mt-4">
<div>
<h3 className="font-semibold mb-2 text-sm uppercase tracking-wide text-muted-foreground">Description</h3>
<p className="text-sm leading-relaxed">{selectedDataset.Description}</p>
</div>
<div className="flex flex-col gap-3">
{selectedDataset.Source && (
<Button variant="default" size="default" asChild className="w-full">
<a href={selectedDataset.Source} target="_blank" rel="noopener noreferrer">
<ExternalLink className="h-4 w-4 mr-2" />
Access Dataset
</a>
</Button>
)}
<div className="flex gap-3">
{selectedDataset["Paper link"] && (
<Button variant="outline" size="default" asChild className="flex-1 bg-transparent">
<a href={selectedDataset["Paper link"]} target="_blank" rel="noopener noreferrer">
<FileText className="h-4 w-4 mr-2" />
Read Paper
</a>
</Button>
)}
{selectedDataset.Contact && (
<Button variant="outline" size="default" asChild className="flex-1 bg-transparent">
<a href={`mailto:${selectedDataset.Contact}`}>
<Mail className="h-4 w-4 mr-2" />
Contact
</a>
</Button>
)}
</div>
</div>
</div>
</>
)}
</DialogContent>
</Dialog>
<ScrollToTop />
</div>
)
}
|