Skip to content

Commit aa91322

Browse files
committed
changed publication links (doi as main, then europepmc, then pubmed)
1 parent 67c310f commit aa91322

File tree

3 files changed

+15
-33
lines changed

3 files changed

+15
-33
lines changed

src/components/PublicationsTabs.tsx

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "@/components/ui/pagination";
1313
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
1414
import type { Publication } from "@/types/types";
15-
import { BookOpen, ExternalLink, FileText, Link2 } from 'lucide-react';
15+
import { ExternalLink, FileText, Link2 } from 'lucide-react';
1616
import { useState } from 'react';
1717

1818
interface PublicationsTabsLoadedProps {
@@ -100,19 +100,19 @@ export default function PublicationsTabsLoaded({ publications, featuredPmids }:
100100
<CardFooter className="pt-0">
101101
<div className="flex flex-wrap gap-4 items-center justify-between w-full">
102102
<div className="flex flex-wrap gap-4">
103-
{publication.link && (
103+
{publication.doi && (
104104
<Button variant="secondary" size="sm" asChild className="border">
105-
<a href={publication.link} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
105+
<a href={`https://doi.org/${publication.doi}`} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
106106
<ExternalLink className="h-4 w-4" />
107107
<span>View Publication</span>
108108
</a>
109109
</Button>
110110
)}
111-
{publication.doi && (
111+
{publication.europePmc && (
112112
<Button variant="outline" size="sm" asChild className="border">
113-
<a href={`https://doi.org/${publication.doi}`} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
113+
<a href={publication.europePmc} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
114114
<Link2 className="h-4 w-4" />
115-
<span>DOI</span>
115+
<span>EuropePMC</span>
116116
</a>
117117
</Button>
118118
)}
@@ -124,14 +124,6 @@ export default function PublicationsTabsLoaded({ publications, featuredPmids }:
124124
</a>
125125
</Button>
126126
)}
127-
{publication.pmcid && (
128-
<Button variant="outline" size="sm" asChild className="border">
129-
<a href={`https://www.ncbi.nlm.nih.gov/pmc/articles/${publication.pmcid}`} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
130-
<BookOpen className="h-4 w-4" />
131-
<span>PMC</span>
132-
</a>
133-
</Button>
134-
)}
135127
</div>
136128
<div className="text-sm text-muted-foreground italic">
137129
{publication.journal !== "Unknown Journal" && (
@@ -187,19 +179,19 @@ export default function PublicationsTabsLoaded({ publications, featuredPmids }:
187179
<CardFooter className="pt-0">
188180
<div className="flex flex-wrap gap-4 items-center justify-between w-full">
189181
<div className="flex flex-wrap gap-4">
190-
{publication.link && (
182+
{publication.doi && (
191183
<Button variant="secondary" size="sm" asChild className="border">
192-
<a href={publication.link} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
184+
<a href={`https://doi.org/${publication.doi}`} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
193185
<ExternalLink className="h-4 w-4" />
194186
<span>View Publication</span>
195187
</a>
196188
</Button>
197189
)}
198-
{publication.doi && (
190+
{publication.europePmc && (
199191
<Button variant="outline" size="sm" asChild className="border">
200-
<a href={`https://doi.org/${publication.doi}`} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
192+
<a href={publication.europePmc} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
201193
<Link2 className="h-4 w-4" />
202-
<span>DOI</span>
194+
<span>EuropePMC</span>
203195
</a>
204196
</Button>
205197
)}
@@ -211,14 +203,6 @@ export default function PublicationsTabsLoaded({ publications, featuredPmids }:
211203
</a>
212204
</Button>
213205
)}
214-
{publication.pmcid && (
215-
<Button variant="outline" size="sm" asChild className="border">
216-
<a href={`https://www.ncbi.nlm.nih.gov/pmc/articles/${publication.pmcid}`} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
217-
<BookOpen className="h-4 w-4" />
218-
<span>PMC</span>
219-
</a>
220-
</Button>
221-
)}
222206
</div>
223207
<div className="text-sm text-muted-foreground italic">
224208
{publication.journal !== "Unknown Journal" && (

src/content/loaders/pmc.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function pmcLoader(options: { orcid: string }): Loader {
4141
date: z.string(),
4242
year: z.number(),
4343
journal: z.string(),
44-
link: z.string().url(),
44+
europePmc: z.string().optional(),
4545
isPreprint: z.boolean(),
4646
isReview: z.boolean(),
4747
pmid: z.string().optional(),
@@ -98,11 +98,9 @@ export function pmcLoader(options: { orcid: string }): Loader {
9898
date: publicationDate,
9999
year: year,
100100
journal: pub.journalTitle || 'Unknown Journal',
101-
link: pub.source && pub.id
101+
europePmc: pub.source && pub.id
102102
? `http://europepmc.org/abstract/${pub.source}/${pub.id}`
103-
: pub.doi
104-
? `https://doi.org/${pub.doi}`
105-
: '',
103+
: undefined,
106104
isPreprint: pubTypeString.includes('preprint'),
107105
isReview: pubTypeString.includes('review') || titleString.includes('review'),
108106
pmid: pub.pmid,

src/types/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export interface Publication {
6060
isOpenAccess?: boolean;
6161
isPreprint?: boolean;
6262
isReview?: boolean;
63-
link?: string;
6463
doi?: string;
6564
pmid?: string;
6665
pmcid?: string;
66+
europePmc?: string;
6767
}

0 commit comments

Comments
 (0)