Add analytics, formatting

This commit is contained in:
2025-08-27 10:02:41 +02:00
parent 07b71cdac9
commit fd73dde4cd
16 changed files with 57896 additions and 165 deletions
+7 -7
View File
@@ -1,16 +1,16 @@
import Link from 'next/link'
import Link from "next/link";
export default function NotFound() {
return (
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-200px)]">
<h2 className="text-3xl font-bold mb-4">404 - Not Found</h2>
<div className="flex min-h-[calc(100vh-200px)] flex-col items-center justify-center">
<h2 className="mb-4 text-3xl font-bold">404 - Not Found</h2>
<p className="mb-6">Could not find the requested resource</p>
<Link
<Link
href="/"
className="px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90"
className="rounded-md bg-primary px-4 py-2 text-primary-foreground hover:bg-primary/90"
>
Return Home
</Link>
</div>
)
}
);
}
+53
View File
@@ -21,6 +21,11 @@ import { Skeleton } from "~/components/ui/skeleton";
import { CardSkeleton } from "~/components/ui/skeletons";
import type { Publication } from "~/lib/bibtex";
import { parseBibtex } from "~/lib/bibtex";
import {
trackPdfView,
trackDoiClick,
trackBibtexDownload,
} from "~/lib/analytics";
export default function PublicationsPage() {
const [publications, setPublications] = useState<Publication[]>([]);
@@ -38,6 +43,15 @@ export default function PublicationsPage() {
}, []);
const downloadBibtex = (pub: Publication) => {
// Track the BibTeX download
trackBibtexDownload({
publicationTitle: pub.title,
publicationType: pub.type,
publicationYear: pub.year,
citationKey: pub.citationKey,
venue: pub.venue,
});
const {
title,
authors,
@@ -79,6 +93,41 @@ export default function PublicationsPage() {
URL.revokeObjectURL(url);
};
const handlePaperClick = (pub: Publication) => {
trackPdfView({
publicationTitle: pub.title,
publicationType: pub.type,
publicationYear: pub.year,
citationKey: pub.citationKey,
venue: pub.venue,
pdfType: "paper",
});
};
const handlePosterClick = (pub: Publication) => {
trackPdfView({
publicationTitle: pub.title,
publicationType: pub.type,
publicationYear: pub.year,
citationKey: pub.citationKey,
venue: pub.venue,
pdfType: "poster",
});
};
const handleDoiClick = (pub: Publication) => {
if (pub.doi) {
trackDoiClick({
publicationTitle: pub.title,
publicationType: pub.type,
publicationYear: pub.year,
citationKey: pub.citationKey,
venue: pub.venue,
doi: pub.doi,
});
}
};
return (
<div className="space-y-6">
<section className="animate-fade-in-up prose prose-zinc dark:prose-invert max-w-none">
@@ -118,6 +167,7 @@ export default function PublicationsPage() {
target="_blank"
rel="noopener noreferrer"
className="text-muted-foreground hover:text-primary sm:flex-shrink-0"
onClick={() => handlePaperClick(pub)}
>
<ArrowUpRight className="h-5 w-5" />
</Link>
@@ -157,6 +207,7 @@ export default function PublicationsPage() {
href={`https://doi.org/${pub.doi}`}
target="_blank"
rel="noopener noreferrer"
onClick={() => handleDoiClick(pub)}
>
<Badge variant="secondary" className="capitalize">
<ArrowUpRight className="mr-1 h-3 w-3" />
@@ -169,6 +220,7 @@ export default function PublicationsPage() {
href={pub.paperUrl}
target="_blank"
rel="noopener noreferrer"
onClick={() => handlePaperClick(pub)}
>
<Badge variant="secondary" className="capitalize">
<FileText className="mr-1 h-3 w-3" />
@@ -181,6 +233,7 @@ export default function PublicationsPage() {
href={pub.posterUrl}
target="_blank"
rel="noopener noreferrer"
onClick={() => handlePosterClick(pub)}
>
<Badge variant="secondary" className="capitalize">
<Presentation className="mr-1 h-3 w-3" />