Skip to content

Commit 53ab7b9

Browse files
committed
Fix color of implementations, citation bib
1 parent 2611b4a commit 53ab7b9

File tree

2 files changed

+44
-6
lines changed

2 files changed

+44
-6
lines changed

catalog/components/repository-card.tsx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"use client";
22

33
import { motion } from "framer-motion";
4-
import { ExternalLink, FileText, BookOpen, Code2, Database } from "lucide-react";
4+
import { ExternalLink, FileText, BookOpen, Code2, Database, Check } from "lucide-react";
55
import type { Repository } from "@/types/repository";
6+
import { useState } from "react";
67

78
interface RepositoryCardProps {
89
repository: Repository;
@@ -12,6 +13,28 @@ interface RepositoryCardProps {
1213
export default function RepositoryCard({ repository, index = 0 }: RepositoryCardProps) {
1314
const repoUrl = repository.github_url || `https://github.com/${repository.repo_id}`;
1415
const repoSlug = repository.name.toLowerCase().replace(/[^a-z0-9]+/g, '-');
16+
const [copied, setCopied] = useState(false);
17+
18+
const handleCiteCopy = async () => {
19+
if (!repository.bibtex) return;
20+
21+
try {
22+
const response = await fetch('/data/papers.bib');
23+
const bibtexContent = await response.text();
24+
25+
// Parse the bibtex file to find the specific entry
26+
const entryRegex = new RegExp(`@\\w+\\{${repository.bibtex},[\\s\\S]*?\\n\\}`, 'i');
27+
const match = bibtexContent.match(entryRegex);
28+
29+
if (match) {
30+
await navigator.clipboard.writeText(match[0]);
31+
setCopied(true);
32+
setTimeout(() => setCopied(false), 2000);
33+
}
34+
} catch (error) {
35+
console.error('Failed to copy citation:', error);
36+
}
37+
};
1538

1639
const typeColors = {
1740
"tool": "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/30",
@@ -76,13 +99,13 @@ export default function RepositoryCard({ repository, index = 0 }: RepositoryCard
7699
href={impl.url}
77100
target="_blank"
78101
rel="noopener noreferrer"
79-
className="inline-flex items-center gap-1 bg-gray-100 dark:bg-gray-700/50 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 text-xs font-medium px-3 py-1.5 rounded-lg transition-all hover:scale-105"
102+
className="inline-flex items-center gap-1 bg-cyan-100 dark:bg-cyan-900/30 hover:bg-cyan-200 dark:hover:bg-cyan-900/50 text-cyan-700 dark:text-cyan-300 text-xs font-medium px-3 py-1.5 rounded-lg transition-all hover:scale-105"
80103
>
81104
{impl.name}
82105
<ExternalLink className="w-3 h-3" />
83106
</a>
84107
) : (
85-
<span className="inline-block bg-gray-100 dark:bg-gray-700/50 text-gray-700 dark:text-gray-200 text-xs font-medium px-3 py-1.5 rounded-lg">
108+
<span className="inline-block bg-cyan-100 dark:bg-cyan-900/30 text-cyan-700 dark:text-cyan-300 text-xs font-medium px-3 py-1.5 rounded-lg">
86109
{impl.name}
87110
</span>
88111
)}
@@ -139,11 +162,12 @@ export default function RepositoryCard({ repository, index = 0 }: RepositoryCard
139162
)}
140163
{repository.bibtex && (
141164
<button
165+
onClick={handleCiteCopy}
142166
className="inline-flex items-center gap-2 text-sm bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 px-4 py-2 rounded-lg transition-all hover:scale-105"
143-
title="Citation available"
167+
title={copied ? "Copied!" : "Copy citation to clipboard"}
144168
>
145-
<BookOpen className="w-4 h-4" />
146-
Cite
169+
{copied ? <Check className="w-4 h-4" /> : <BookOpen className="w-4 h-4" />}
170+
{copied ? "Copied!" : "Cite"}
147171
</button>
148172
)}
149173
{repository.platform_url && (

catalog/public/data/papers.bib

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@inproceedings{dige2024can,
2+
title={Can Machine Unlearning Reduce Social Bias in Language Models?},
3+
author={Dige, Omkar and Arneja, Diljot and Yau, Tsz Fung and Zhang, Qixuan and Bolandraftar, Mohammad and Zhu, Xiaodan and Khattak, Faiza},
4+
booktitle={Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: Industry Track},
5+
pages={954--969},
6+
year={2024}
7+
}
8+
9+
@article{baghbanzadeh2025advancing,
10+
title={Advancing medical representation learning through high-quality data},
11+
author={Baghbanzadeh, Negin and Fallahpour, Adibvafa and Parhizkar, Yasaman and Ogidi, Franklin and Roy, Shuvendu and Ashkezari, Sajad and Khazaie, Vahid Reza and Colacci, Michael and Etemad, Ali and Afkanpour, Arash and others},
12+
journal={arXiv preprint arXiv:2503.14377},
13+
year={2025}
14+
}

0 commit comments

Comments
 (0)