Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
khoidt committed Jan 25, 2024
2 parents be23064 + 4ecc42d commit 0cb26ed
Show file tree
Hide file tree
Showing 14 changed files with 225 additions and 109 deletions.
1 change: 1 addition & 0 deletions src/fragmentarium/domain/Fragment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const config: Parameters<typeof Fragment['create']>[0] = {
nabuccoNumber: '123',
metropolitanNumber: '123',
louvreNumber: '123',
australianinstituteofarchaeologyNumber: '123',
philadelphiaNumber: '123',
},
projects: [],
Expand Down
1 change: 1 addition & 0 deletions src/fragmentarium/domain/FragmentDtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const ExternalNumberTypes = [
'nabuccoNumber',
'metropolitanNumber',
'louvreNumber',
'australianinstituteofarchaeologyNumber',
'philadelphiaNumber',
'yalePeabodyNumber',
] as const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,24 @@ exports[`Snapshot 1`] = `
</a>
(PElam)
</h4>
<small>
<p
class="fragment-result__accession"
>
Accession no.:
kuljulom.1
</p>
<p>
Excavation no.:
radjo.1
</p>
</small>
<div
class="fragment-result__archaeology-info"
>
<small>
<p>
Accession no.:
kuljulom.1
</p>
<p>
Excavation no.:
noj.1
</p>
<p>
Provenance:
Ešnunna
</p>
</small>
</div>
</div>
<div
class="text-secondary fragment-result__genre col-sm-4 col-12"
Expand Down Expand Up @@ -5834,24 +5840,30 @@ exports[`Snapshot 1`] = `
class="fragment-result__fragment-number"
>
<a
href="/fragmentarium/rikeluco.2"
href="/fragmentarium/cowjofke.2"
>
rikeluco.2
cowjofke.2
</a>
(Ur3)
(JN)
</h4>
<small>
<p
class="fragment-result__accession"
>
Accession no.:
jofkeku.2
</p>
<p>
Excavation no.:
wu.2
</p>
</small>
<div
class="fragment-result__archaeology-info"
>
<small>
<p>
Accession no.:
ed.2
</p>
<p>
Excavation no.:
pov.2
</p>
<p>
Provenance:
Anšan
</p>
</small>
</div>
</div>
<div
class="text-secondary fragment-result__genre col-sm-4 col-12"
Expand Down Expand Up @@ -5906,14 +5918,14 @@ exports[`Snapshot 1`] = `
<span
class="reference-popover__citation"
>
White & Manca, 2071: 6525764484726784-1000123435843584
Checcucci & Tomlinson, 2026: 4727451873705984-8024100712742912
[
l. 3'., 2.
l. 3'., 1.
]
<span
class="type-abbreviation"
>
(T)
(C)
</span>
</span>
</li>
Expand All @@ -5925,14 +5937,14 @@ exports[`Snapshot 1`] = `
<span
class="reference-popover__citation"
>
Martinez & Robin, 2113: 5946678584541184-5595938733162496
Chirici & Borchi, 2109: 7541452181602304-6009873588289536
[
l. 3'., 4'.2.
]
<span
class="type-abbreviation"
>
(D)
(E)
</span>
</span>
</li>
Expand Down
28 changes: 26 additions & 2 deletions src/fragmentarium/ui/info/Details.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Fragment } from 'fragmentarium/domain/fragment'
import Promise from 'bluebird'
import { Genres } from 'fragmentarium/domain/Genres'
import {
archaeologyFactory,
externalNumbersFactory,
fragmentFactory,
measuresFactory,
Expand Down Expand Up @@ -140,17 +141,34 @@ describe('All details', () => {

it('Renders accession', () => {
expect(
screen.getByText(`Accession: ${fragment.accession}`)
screen.getByText(`Accession no.: ${fragment.accession}`)
).toBeInTheDocument()
})
it('Renders excavation', () => {
expect(
screen.getByText(
`Excavation no.: ${fragment.archaeology?.excavationNumber}`
)
).toBeInTheDocument()
})
it('Renders provenance', () => {
expect(
screen.getByText(`Provenance: ${fragment.archaeology?.site?.name}`)
).toBeInTheDocument()
})
})

describe('Missing details', () => {
beforeEach(async () => {
const archaeology = archaeologyFactory.build({
excavationNumber: undefined,
site: undefined,
})
fragment = fragmentFactory.build(
{
collection: '',
accession: '',
archaeology,
},
{
associations: {
Expand Down Expand Up @@ -189,7 +207,13 @@ describe('Missing details', () => {
})

it('Renders dash for accession', () => {
expect(screen.getByText('Accession: -')).toBeInTheDocument()
expect(screen.getByText('Accession no.: -')).toBeInTheDocument()
})
it('Renders dash for excavation', () => {
expect(screen.getByText('Excavation no.: -')).toBeInTheDocument()
})
it('Renders dash for provenance', () => {
expect(screen.getByText('Provenance: -')).toBeInTheDocument()
})
})

Expand Down
16 changes: 15 additions & 1 deletion src/fragmentarium/ui/info/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,15 @@ function Measurements({ fragment: { measures } }: Props): JSX.Element {
}

function Accession({ fragment }: Props): JSX.Element {
return <>Accession: {fragment.accession || '-'}</>
return <>Accession no.: {fragment.accession || '-'}</>
}

function Excavation({ fragment }: Props): JSX.Element {
return <>Excavation no.: {fragment.archaeology?.excavationNumber || '-'}</>
}

function Provenance({ fragment }: Props): JSX.Element {
return <>Provenance: {fragment.archaeology?.site?.name || '-'}</>
}

interface DetailsProps {
Expand Down Expand Up @@ -121,6 +129,12 @@ function Details({
<li className="Details__item">
<Accession fragment={fragment} />
</li>
<li className="Details__item">
<Excavation fragment={fragment} />
</li>
<li className="Details__item">
<Provenance fragment={fragment} />
</li>
<li className="Details__item">
<GenreSelection
fragment={fragment}
Expand Down
13 changes: 13 additions & 0 deletions src/fragmentarium/ui/info/ExternalNumberLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ export function LouvreLink({ number }: { number: string }): JSX.Element {
/>
)
}
export function australianinstituteofarchaeologyLink({
number,
}: {
number: string
}): JSX.Element {
return (
<ExternalNumberLink
number={number}
baseUrl={'https://aiarch.pedestal3d.com/r/'}
label={'Australian Institute of Archaeology'}
/>
)
}
export function PhiladelphiaLink({ number }: { number: string }): JSX.Element {
return (
<ExternalNumberLink
Expand Down
8 changes: 8 additions & 0 deletions src/fragmentarium/ui/info/ExternalResources.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const achemenetNumber = 'H00744'
const nabuccoNumber = 'H00765'
const metropolitanNumber = 'M123'
const louvreNumber = 'L123'
const australianinstituteofarchaeologyNumber = 'L123'
const philadelphiaNumber = 'P123'
const yalePeabodyNumber = 'y123'
let fragment: Fragment
Expand All @@ -42,6 +43,7 @@ describe('external resources', () => {
nabuccoNumber,
metropolitanNumber,
louvreNumber,
australianinstituteofarchaeologyNumber,
philadelphiaNumber,
yalePeabodyNumber,
}),
Expand Down Expand Up @@ -87,6 +89,11 @@ describe('external resources', () => {
metropolitanNumber,
],
['Louvre', 'https://collections.louvre.fr/ark:/53355/', louvreNumber],
[
'Australian Institute of Archaeology',
'https://aiarch.pedestal3d.com/r/',
australianinstituteofarchaeologyNumber,
],
[
'Penn Museum',
'https://www.penn.museum/collections/object/',
Expand Down Expand Up @@ -131,6 +138,7 @@ describe('missing external resources', () => {
'NaBuCCo',
'The Metropolitan Museum of Art',
'Louvre',
'Australian Institute of Archaeology',
'Penn Museum',
'Yale Babylonian Collection',
])('Mising %s number is not shown', async (label) => {
Expand Down
5 changes: 5 additions & 0 deletions src/fragmentarium/ui/info/ExternalResources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
NabuccoLink,
MetropolitanLink,
LouvreLink,
australianinstituteofarchaeologyLink,
PhiladelphiaLink,
BmIdLink,
YalePeabodyLink,
Expand Down Expand Up @@ -49,6 +50,10 @@ export default function ExternalResources({
[fragment.getExternalNumber('nabuccoNumber'), NabuccoLink],
[fragment.getExternalNumber('metropolitanNumber'), MetropolitanLink],
[fragment.getExternalNumber('louvreNumber'), LouvreLink],
[
fragment.getExternalNumber('australianinstituteofarchaeologyNumber'),
australianinstituteofarchaeologyLink,
],
[fragment.getExternalNumber('philadelphiaNumber'), PhiladelphiaLink],
[fragment.getExternalNumber('yalePeabodyNumber'), YalePeabodyLink],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ exports[`external resources Snapshot 1`] = `
</a>
)
</li>
<li>
Australian Institute of Archaeology (
<a
aria-label="Australian Institute of Archaeology text L123"
href="https://aiarch.pedestal3d.com/r/L123"
rel="noopener noreferrer"
target="_blank"
>
L123
</a>
)
</li>
<li>
Penn Museum (
<a
Expand Down
7 changes: 6 additions & 1 deletion src/fragmentarium/ui/search/FragmentariumSearchResult.sass
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
padding: 1em 0

.fragment-result
&__fragment-number, &__accession, &__record
&__fragment-number, &__record
margin-bottom: 0
&__record
.Record__entry
Expand All @@ -22,3 +22,8 @@

&__header
flex-wrap: wrap-reverse

&__archaeology-info
p
margin-bottom: 0
padding-bottom: 1em
26 changes: 16 additions & 10 deletions src/fragmentarium/ui/search/FragmentariumSearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,22 @@ export const FragmentLines = withData<
</FragmentLink>
{script}
</h4>
<small>
<p className={'fragment-result__accession'}>
{fragment.accession && 'Accession no.: '}
{fragment.accession}
</p>
<p>
{fragment.archaeology?.excavationNumber && 'Excavation no.: '}
{fragment.archaeology?.excavationNumber}
</p>
</small>
<div className="fragment-result__archaeology-info">
<small>
<p>
{fragment.accession && 'Accession no.: '}
{fragment.accession}
</p>
<p>
{fragment.archaeology?.excavationNumber && 'Excavation no.: '}
{fragment.archaeology?.excavationNumber}
</p>
<p>
{fragment.archaeology?.site?.name && 'Provenance: '}
{fragment.archaeology?.site?.name}
</p>
</small>
</div>
</ResponsiveCol>
<ResponsiveCol className={'text-secondary fragment-result__genre'}>
<GenresDisplay genres={fragment.genres} />
Expand Down
Loading

0 comments on commit 0cb26ed

Please sign in to comment.