Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Metropolitan Number to Display #401

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/fragmentarium/domain/Fragment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const config: Parameters<typeof Fragment['create']>[0] = {
urOnlineNumber: '123',
hilprechtJenaNumber: '123',
hilprechtHeidelbergNumber: '123',
metropolitanNumber: '123',
},
projects: [],
}
Expand Down
11 changes: 11 additions & 0 deletions src/fragmentarium/ui/info/ExternalNumberLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ export function HilprechtHeidelbergLink({
/>
)
}

export function MetropolitanLink({ number }: { number: string }): JSX.Element {
return (
<ExternalNumberLink
number={number}
baseUrl={'https://www.metmuseum.org/art/collection/search/'}
label={'The Metropolitan Museum of Art'}
/>
)
}

export function YalePeabodyLink({ number }: { number: string }): JSX.Element {
return (
<ExternalNumberLink
Expand Down
7 changes: 7 additions & 0 deletions src/fragmentarium/ui/info/ExternalResources.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const archibabNumber = 'A38'
const urOnlineNumber = 'U5'
const hilprechtJenaNumber = 'H42'
const hilprechtHeidelbergNumber = 'H007'
const metropolitanNumber = 'M123'
const yalePeabodyNumber = 'y123'
let fragment: Fragment
let container: HTMLElement
Expand All @@ -33,6 +34,7 @@ describe('external resources', () => {
urOnlineNumber,
hilprechtJenaNumber,
hilprechtHeidelbergNumber,
metropolitanNumber,
yalePeabodyNumber,
}),
},
Expand Down Expand Up @@ -61,6 +63,11 @@ describe('external resources', () => {
'https://doi.org/10.11588/heidicon/',
hilprechtHeidelbergNumber,
],
[
'The Metropolitan Museum of Art',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add 'The Metropolitan Museum of Art' below in the test.each block starting at line 98 to ensure the label is not shown when the number is missing.

'https://www.metmuseum.org/art/collection/search/',
metropolitanNumber,
],
[
'Yale Babylonian Collection',
'https://collections.peabody.yale.edu/search/Record/YPM-',
Expand Down
2 changes: 2 additions & 0 deletions src/fragmentarium/ui/info/ExternalResources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
UrOnlineLink,
HilprechtJenaLink,
HilprechtHeidelbergLink,
MetropolitanLink,
BmIdLink,
YalePeabodyLink,
OraccLinks,
Expand All @@ -29,6 +30,7 @@ export default function ExternalResources({
[fragment.urOnlineNumber, UrOnlineLink],
[fragment.hilprechtJenaNumber, HilprechtJenaLink],
[fragment.hilprechtHeidelbergNumber, HilprechtHeidelbergLink],
[fragment.metropolitanNumber, MetropolitanLink],
[fragment.yalePeabodyNumber, YalePeabodyLink],
]
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ exports[`external resources Snapshot 1`] = `
</a>
)
</li>
<li>
The Metropolitan Museum of Art (
<a
aria-label="The Metropolitan Museum of Art text M123"
href="https://www.metmuseum.org/art/collection/search/M123"
rel="noopener noreferrer"
target="_blank"
>
M123
</a>
)
</li>
<li>
Yale Babylonian Collection (
<a
Expand Down
1 change: 1 addition & 0 deletions src/test-support/test-fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const externalNumbers = {
urOnlineNumber: '123',
hilprechtJenaNumber: '123',
hilprechtHeidelbergNumber: '123',
metropolitanNumber: '123',
}

export const lines: readonly TextLineDto[] = [
Expand Down
Loading