Skip to content

Commit

Permalink
Update SEAL Links
Browse files Browse the repository at this point in the history
  • Loading branch information
ejimsan committed Apr 30, 2024
1 parent 2f7ae99 commit f7d0ee7
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 53 deletions.
1 change: 0 additions & 1 deletion src/fragmentarium/domain/Fragment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ const config: Parameters<typeof Fragment['create']>[0] = {
alalahHpmNumber: '123',
australianinstituteofarchaeologyNumber: '123',
philadelphiaNumber: '123',
sealNumber: '123',
},
projects: [],
}
Expand Down
2 changes: 1 addition & 1 deletion src/fragmentarium/domain/FragmentDtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ export const ExternalNumberTypes = [
'australianinstituteofarchaeologyNumber',
'philadelphiaNumber',
'yalePeabodyNumber',
'sealNumber',
] as const
export type ExternalNumber = typeof ExternalNumberTypes[number]

export type ExternalNumbers = {
[K in ExternalNumber]?: string
} & {
oraccNumbers?: readonly string[]
sealNumbers?: readonly string[]
}

export default interface FragmentDto {
Expand Down
4 changes: 4 additions & 0 deletions src/fragmentarium/domain/fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,13 @@ export class Fragment {
get oraccNumbers(): readonly string[] {
return this.externalNumbers['oraccNumbers'] || []
}
get sealNumbers(): readonly string[] {
return this.externalNumbers['sealNumbers'] || []
}
get hasExternalResources(): boolean {
return _.some([
...this.oraccNumbers,
...this.sealNumbers,
...ExternalNumberTypes.map((number) =>
this.getExternalNumber(number as ExternalNumber)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ exports[`Snapshot 1`] = `
</p>
<p>
Excavation no.:
ed.1
ucotes.1
</p>
<p>
Provenance:
Alalakh
Adab
</p>
</small>
</div>
Expand Down Expand Up @@ -5852,27 +5852,27 @@ exports[`Snapshot 1`] = `
class="fragment-result__fragment-number"
>
<a
href="/fragmentarium/etkoclo.2"
href="/fragmentarium/ke.2"
>
etkoclo.2
ke.2
</a>
(JN)
(Ur3)
</h4>
<div
class="fragment-result__archaeology-info"
>
<small>
<p>
Accession no.:
baj.2
wugutkoc.2
</p>
<p>
Excavation no.:
jil.2
jozi.2
</p>
<p>
Provenance:
Maškan-šāpir
Mari
</p>
</small>
</div>
Expand All @@ -5881,6 +5881,11 @@ exports[`Snapshot 1`] = `
class="text-secondary fragment-result__genre col-sm-4 col-12"
>
<ul>
<ul>
<small>
ARCHIVE ➝ Administrative ➝ Lists
</small>
</ul>
<ul>
<small>
Other ➝ Fake ➝ Certain
Expand All @@ -5897,7 +5902,17 @@ exports[`Snapshot 1`] = `
<li
class="Record__entry"
>
No record
Romolini
(
Transliteration
,
<time
datetime="2108-01-21"
>
21/1/2108
</time>
)
</li>
</ol>
</div>
Expand Down Expand Up @@ -5942,9 +5957,9 @@ exports[`Snapshot 1`] = `
<span
class="reference-popover__citation"
>
Checcucci & Tomlinson, 2026: 4727451873705984-8024100712742912
Garrido & Tinti, 2055: 5928983864541184-7552106621829120
[
l. 3'., 1.
l. 4'.2., 1.
]
<span
class="type-abbreviation"
Expand All @@ -5961,9 +5976,9 @@ exports[`Snapshot 1`] = `
<span
class="reference-popover__citation"
>
Chirici & Borchi, 2066: 1964069523292160-4777479967342592
Dong & Ducci, 2026: 3794580308754432-4010327748378624
[
l. 4'.2., 2.
l. 3'., 4'.2.
]
<span
class="type-abbreviation"
Expand Down
28 changes: 28 additions & 0 deletions src/fragmentarium/ui/info/ExternalNumberLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ function OraccLink({
</ExternalLink>
)
}
function SealLink({ number }: { number: string }): JSX.Element {
const baseUrl = 'https://seal.huji.ac.il/node/'
return (
<ExternalLink
href={`${baseUrl}${encodeURIComponent(number)}`}
aria-label={`Seal text ${number}`}
></ExternalLink>
)
}

export function OraccLinks({
projects,
Expand All @@ -217,3 +226,22 @@ export function OraccLinks({
</>
)
}

export function SealLinks({
projects,
}: {
projects: readonly string[]
}): JSX.Element {
return (
<>
{'SEAL ('}
{projects.map((project, index) => (
<Fragment key={index}>
{index !== 0 && ', '}
<SealLink number={number} />
</Fragment>
))}
{')'}
</>
)
}
3 changes: 0 additions & 3 deletions src/fragmentarium/ui/info/ExternalResources.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const alalahHpmNumber = 'L123'
const australianinstituteofarchaeologyNumber = 'L123'
const philadelphiaNumber = 'P123'
const yalePeabodyNumber = 'y123'
const sealNumber = 'L123'
let fragment: Fragment
let container: HTMLElement

Expand All @@ -49,7 +48,6 @@ describe('external resources', () => {
australianinstituteofarchaeologyNumber,
philadelphiaNumber,
yalePeabodyNumber,
sealNumber,
}),
},
}
Expand Down Expand Up @@ -113,7 +111,6 @@ describe('external resources', () => {
'https://collections.peabody.yale.edu/search/Record/YPM-',
yalePeabodyNumber,
],
['SEAL Number', 'https://seal.huji.ac.il/node/', sealNumber],
])('%s number is shown', async (label, link, number) => {
expect(screen.getByLabelText(`${label} text ${number}`)).toHaveAttribute(
'href',
Expand Down
8 changes: 6 additions & 2 deletions src/fragmentarium/ui/info/ExternalResources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
BmIdLink,
YalePeabodyLink,
OraccLinks,
sealLink,
SealLinks,
} from './ExternalNumberLink'
import _ from 'lodash'

Expand Down Expand Up @@ -59,7 +59,6 @@ export default function ExternalResources({
],
[fragment.getExternalNumber('philadelphiaNumber'), PhiladelphiaLink],
[fragment.getExternalNumber('yalePeabodyNumber'), YalePeabodyLink],
[fragment.getExternalNumber('sealNumber'), sealLink],
]

return (
Expand All @@ -79,6 +78,11 @@ export default function ExternalResources({
/>
</li>
)}
{!_.isEmpty(fragment.sealNumbers) && (
<li>
<SealLinks number={fragment.sealNumbers} />
</li>
)}
</ul>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,6 @@ exports[`external resources Snapshot 1`] = `
</a>
)
</li>
<li>
SEAL Number (
<a
aria-label="SEAL Number text L123"
href="https://seal.huji.ac.il/node/L123"
rel="noopener noreferrer"
target="_blank"
>
L123
</a>
)
</li>
</ul>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -788,27 +788,27 @@ exports[`Searching fragments by transliteration Displays corpus results when cli
class="fragment-result__fragment-number"
>
<a
href="/fragmentarium/hohoru.9"
href="/fragmentarium/uc.9"
>
hohoru.9
uc.9
</a>
(Par)
(Hit)
</h4>
<div
class="fragment-result__archaeology-info"
>
<small>
<p>
Accession no.:
id.9
titeba.9
</p>
<p>
Excavation no.:
ovhun.9
jora.9
</p>
<p>
Provenance:
Kiš
Lagaš
</p>
</small>
</div>
Expand All @@ -817,6 +817,11 @@ exports[`Searching fragments by transliteration Displays corpus results when cli
class="text-secondary fragment-result__genre col-sm-4 col-12"
>
<ul>
<ul>
<small>
ARCHIVE ➝ Administrative ➝ Lists
</small>
</ul>
<ul>
<small>
Other ➝ Fake ➝ Certain
Expand Down Expand Up @@ -868,14 +873,14 @@ exports[`Searching fragments by transliteration Displays corpus results when cli
<span
class="reference-popover__citation"
>
Duran & Boon, 2075: 1233275364311040-5892501091123200
Giles & Alvarez, 2087: 5582194326110208-1406653725409280
[
l. 4'.2., 1.
l. 1., 3'.
]
<span
class="type-abbreviation"
>
(E)
(C)
</span>
</span>
</li>
Expand All @@ -887,14 +892,14 @@ exports[`Searching fragments by transliteration Displays corpus results when cli
<span
class="reference-popover__citation"
>
Hansen & van Ommen, 2050: 522493473325056-5682457787498496
Shaw & Robert, 2046: 6150545542742016-5917511180615680
[
l. 4'.2., 1.
l. 2., 1.
]
<span
class="type-abbreviation"
>
(D)
(P)
</span>
</span>
</li>
Expand Down Expand Up @@ -6598,9 +6603,9 @@ exports[`Searching fragments by transliteration Displays corpus results when cli
class="fragment-result__fragment-number"
>
<a
href="/fragmentarium/lezajo.10"
href="/fragmentarium/mi.10"
>
lezajo.10
mi.10
</a>
(Uruk4)
</h4>
Expand All @@ -6610,7 +6615,7 @@ exports[`Searching fragments by transliteration Displays corpus results when cli
<small>
<p>
Accession no.:
siti.10
kuvina.10
</p>
<p>
Excavation no.:
Expand Down Expand Up @@ -6678,29 +6683,29 @@ exports[`Searching fragments by transliteration Displays corpus results when cli
<span
class="reference-popover__citation"
>
Biliotti & van Rijn, 2036: 1960181967618048-447775313494016
Sanna & Vivoli, 2086: 6039983651553280-8222076427042816
[
l. 4'.2., 2.
]
<span
class="type-abbreviation"
>
(P)
(C)
</span>
</span>
</li>
<li>
<span
class="reference-popover__citation"
>
Duval & Burrows, 2077: 6062190752694272-6966757507989504
Waters & Faure, 2073: 3028366718402560-7932536841830400
[
l. 3'., 4'.2.
]
<span
class="type-abbreviation"
>
(P)
(C)
</span>
</span>
</li>
Expand Down
1 change: 0 additions & 1 deletion src/test-support/fragment-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export const externalNumbersFactory = Factory.define<ExternalNumbers>(
associations.australianinstituteofarchaeologyNumber ?? chance.string(),
philadelphiaNumber: associations.philadelphiaNumber ?? chance.string(),
yalePeabodyNumber: associations.yalePeabodyNumber ?? chance.string(),
sealNumber: associations.sealNumber ?? chance.string(),
}
}
)
Expand Down
Loading

0 comments on commit f7d0ee7

Please sign in to comment.