File tree Expand file tree Collapse file tree 5 files changed +46
-1
lines changed
Expand file tree Collapse file tree 5 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ import { getTranslations } from " @backend/i18n" ;
3+ import _ from ' underscore' ;
4+ import { getAuthorityURL } from " @root/src/utils/webAuthorities" ;
5+
6+ const { record } = Astro .props
7+
8+ const lang = Astro .currentLocale ;
9+ const { t } = await getTranslations (lang );
10+ ---
11+ { record .web_identifiers && (
12+ <>
13+ <div class = " py-6" >
14+ <h2 class = " capitalize text-lg font-semibold" >{ t (' webAuthorities' )} </h2 >
15+ <div class = " text-neutral-800 break-words flex flex-col gap-2 pt-4" >
16+ { _ .map (record .web_identifiers , (auth ) => {
17+ const url = getAuthorityURL (auth .web_authority ?.source_type , auth .identifier );
18+ return url ? (
19+ <a href = { url } class = " underline" target = " _blank" >{ ` ${auth .web_authority ?.source_type }: ${auth .identifier } ` } </a >
20+ ) : (
21+ <span >{ ` ${auth .web_authority ?.source_type }: ${auth .identifier } ` } </span >
22+ )
23+ })}
24+ </div >
25+ </div >
26+ </>
27+ )}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import MediaContents from "./MediaContents";
66import PlaceMap from " ./PlaceMap" ;
77import Relations from " ./Relations.astro" ;
88import UserDefined from " ./UserDefined.astro" ;
9+ import Identifiers from " ./Identifiers.astro" ;
910
1011interface Props {
1112 coverUrl? : string ;
@@ -85,6 +86,9 @@ for (const modelType of Object.keys(record.relatedRecords)) {
8586 record ={ record }
8687 excludes ={ excludes }
8788 />
89+ <Identifiers
90+ record ={ record }
91+ />
8892 { relations .manifests && (
8993 <MediaContents
9094 client :only = " react"
Original file line number Diff line number Diff line change 358358 "saveSearchContent" : {
359359 "tinaLabel" : " Saved Search (Content)" ,
360360 "defaultValue" : " Your search has been saved. Navigate to the \" Saved\" list to view your saved search."
361+ },
362+ "webAuthorities" : {
363+ "tinaLabel" : " Web Authorities" ,
364+ "defaultValue" : " Web Authorities"
361365 }
362366}
Original file line number Diff line number Diff line change 1+ export const getAuthorityURL = ( sourceType : string , identifier : string ) => {
2+ switch ( sourceType ) {
3+ case 'wikidata' :
4+ return `https://www.wikidata.org/wiki/${ identifier } ` ;
5+ case 'viaf' :
6+ return `https://viaf.org/en/viaf/${ identifier } ` ;
7+ default :
8+ return null ;
9+ }
10+ }
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments