52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import React, { useEffect, useState } from "react";
|
|
import { useCitations } from "@/components/context-citation";
|
|
import { PublicationCard } from "./publication-card";
|
|
import { BookOpen } from "lucide-react";
|
|
|
|
export function ReferencesContainer() {
|
|
const { citedKeys, getPublicationByKey } = useCitations();
|
|
const [isClient, setIsClient] = useState(false);
|
|
|
|
useEffect(() => {
|
|
setIsClient(true);
|
|
}, []);
|
|
|
|
if (!isClient || citedKeys.size === 0) {
|
|
return null;
|
|
}
|
|
|
|
const sortedKeys = Array.from(citedKeys).sort();
|
|
|
|
return (
|
|
<div className="mt-8 pt-4 border-t">
|
|
<h2 className="text-2xl font-bold mb-2 flex items-center gap-2">
|
|
<BookOpen className="h-6 w-6" />
|
|
References
|
|
</h2>
|
|
<div className="not-prose space-y-4">
|
|
{sortedKeys.map((key) => {
|
|
const pub = getPublicationByKey(key);
|
|
if (!pub) return null;
|
|
return (
|
|
<PublicationCard
|
|
key={pub.key}
|
|
bibtexKey={pub.key}
|
|
title={pub.title}
|
|
authors={pub.authors}
|
|
journal={pub.journal}
|
|
year={pub.year}
|
|
url={pub.url}
|
|
pdfUrl={pub.pdfUrl}
|
|
bibtex={pub.bibtex}
|
|
pdfAvailable={pub.pdfAvailable}
|
|
className="cards cursor-pointer"
|
|
/>
|
|
);
|
|
})}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|