tahamajs's picture
download
raw
5.22 kB
import { Link } from "react-router-dom";
import { motion } from "framer-motion";
import type { PaperMetadata } from "@/types/publication";
import { Calendar, Clock, Users, Globe, Lock, FileText, ExternalLink, CheckCircle2, AlertTriangle } from "lucide-react";
interface PaperHeaderProps {
paper: PaperMetadata;
}
const STATUS_BADGES: Record<string, { icon: typeof CheckCircle2; color: string; label: string }> = {
preprint: { icon: FileText, color: "bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400", label: "Preprint" },
published: { icon: CheckCircle2, color: "bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400", label: "Published" },
under_review: { icon: Clock, color: "bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400", label: "Under Review" },
accepted: { icon: CheckCircle2, color: "bg-green-100 dark:bg-green-900/30 text-green-700", label: "Accepted" },
retracted: { icon: AlertTriangle, color: "bg-red-100 dark:bg-red-900/30 text-red-700", label: "Retracted" },
};
export function PaperHeader({ paper }: PaperHeaderProps) {
const status = STATUS_BADGES[paper.status] ?? STATUS_BADGES.preprint;
const StatusIcon = status.icon;
return (
<motion.div initial={{ opacity: 0, y: -10 }} animate={{ opacity: 1, y: 0 }}
className="glass rounded-2xl border border-white/20 dark:border-white/10 p-6">
<div className="flex flex-wrap items-center gap-2 mb-3">
<span className={`inline-flex items-center gap-1.5 text-xs px-3 py-1 rounded-full font-medium ${status.color}`}>
<StatusIcon className="w-3.5 h-3.5" /> {status.label}
</span>
<span className="inline-flex items-center gap-1.5 text-xs px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400">
{paper.access === "open_access" ? <Globe className="w-3.5 h-3.5 text-green-500" /> : <Lock className="w-3.5 h-3.5" />}
{paper.access === "open_access" ? "Open Access" : "Subscription"}
</span>
<span className="text-xs text-gray-400 uppercase">{paper.license}</span>
</div>
<h1 className="text-2xl md:text-3xl font-extrabold text-gray-900 dark:text-white leading-tight mb-4">
{paper.title}
</h1>
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 mb-4">
{paper.authors.sort((a, b) => a.order - b.order).map((author, i) => (
<span key={author.username} className="inline-flex items-center">
<Link to={`/users/${author.username}`} className="text-sm font-semibold text-primary hover:underline">
{author.fullName}
</Link>
{author.isCorresponding && <span className="text-[10px] text-gray-400 ml-1">✉️</span>}
{i < paper.authors.length - 1 && <span className="text-gray-300 mx-1">,</span>}
</span>
))}
</div>
<p className="text-xs text-gray-500 mb-4">
{[...new Set(paper.authors.map(a => a.affiliation).filter(Boolean))].slice(0, 3).join(" · ")}
</p>
<div className="flex flex-wrap items-center gap-4 text-xs text-gray-500">
{paper.journal && (
<span className="flex items-center gap-1.5">
<FileText className="w-3.5 h-3.5" />
<span className="font-medium italic">{paper.journal}</span>
{paper.volume && `, ${paper.volume}`}{paper.issue && `(${paper.issue})`}{paper.pages && `, ${paper.pages}`}
</span>
)}
<span className="flex items-center gap-1.5">
<Calendar className="w-3.5 h-3.5" />
Published: {new Date(paper.publishedDate).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })}
</span>
{paper.doi && (
<a href={`https://doi.org/${paper.doi}`} target="_blank" rel="noopener noreferrer" className="flex items-center gap-1.5 text-primary hover:underline">
<ExternalLink className="w-3.5 h-3.5" /> DOI: {paper.doi}
</a>
)}
</div>
<div className="flex flex-wrap gap-1.5 mt-4">
{paper.keywords.map(kw => (
<Link key={kw} to={`/search?q=${encodeURIComponent(kw)}`}
className="text-[10px] bg-primary/10 text-primary hover:bg-primary/20 px-2.5 py-1 rounded-full transition">
{kw}
</Link>
))}
</div>
{paper.updates.length > 1 && (
<details className="mt-4 text-xs text-gray-500">
<summary className="cursor-pointer hover:text-primary">Version History ({paper.updates.length} versions)</summary>
<div className="mt-2 space-y-1 pl-4 border-l-2 border-primary/20">
{paper.updates.map(update => (
<div key={update.id} className="flex items-center gap-2">
<span className="w-16 text-gray-400">{new Date(update.date).toLocaleDateString()}</span>
<span className="font-medium capitalize">{update.type.replace(/_/g, " ")}</span>
<span>— v{update.version}</span>
<span className="text-gray-400">{update.description}</span>
</div>
))}
</div>
</details>
)}
</motion.div>
);
}

Xet Storage Details

Size:
5.22 kB
·
Xet hash:
d881adf622d9516c2d0bd0c7a0efec2e89c2b5d25f4b10d85f69c7a4579ff834

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.