diff --git a/src/fragmentarium/domain/Fragment.test.ts b/src/fragmentarium/domain/Fragment.test.ts index 386675882..8a6b57b6a 100644 --- a/src/fragmentarium/domain/Fragment.test.ts +++ b/src/fragmentarium/domain/Fragment.test.ts @@ -42,6 +42,7 @@ const config: Parameters[0] = { note: '', legacyData: '', isInFragmentarium: true, + isEnvelope: true, }, ], ], diff --git a/src/fragmentarium/domain/join.ts b/src/fragmentarium/domain/join.ts index 8b705e6a5..71dc7b502 100644 --- a/src/fragmentarium/domain/join.ts +++ b/src/fragmentarium/domain/join.ts @@ -6,6 +6,7 @@ export interface Join { readonly note: string readonly legacyData: string readonly isInFragmentarium: boolean + readonly isEnvelope: boolean } export type Joins = ReadonlyArray> diff --git a/src/fragmentarium/ui/info/Details.test.tsx b/src/fragmentarium/ui/info/Details.test.tsx index 350219f61..b3cafbfc7 100644 --- a/src/fragmentarium/ui/info/Details.test.tsx +++ b/src/fragmentarium/ui/info/Details.test.tsx @@ -77,6 +77,7 @@ describe('All details', () => { [ joinFactory.build({ isInFragmentarium: false }), joinFactory.build({ isInFragmentarium: true }), + joinFactory.build({ isEnvelope: true }), ], ], }, @@ -101,6 +102,12 @@ describe('All details', () => { ).toBeInTheDocument() }) + it(`Renders envelope icon for joins`, () => { + expect(screen.queryAllByLabelText('envelope icon').length).toBeGreaterThan( + 0 + ) + }) + it('Does not link to self', () => { fragment.joins .flat() diff --git a/src/fragmentarium/ui/info/Details.tsx b/src/fragmentarium/ui/info/Details.tsx index 5b8511514..698270428 100644 --- a/src/fragmentarium/ui/info/Details.tsx +++ b/src/fragmentarium/ui/info/Details.tsx @@ -44,14 +44,17 @@ function Joins({ fragment: { number, joins } }: Props): JSX.Element { className="Details-joins__join" key={`${groupIndex}-${index}`} > - {index > 0 ? ( - <> -
+{!join.isChecked && ?} - - ) : groupIndex > 0 ? ( + {index > 0 || groupIndex > 0 ? ( <>
- (+{!join.isChecked && ?}) + {join.isEnvelope ? ( + + ) : ( + <>+{!join.isChecked && ?} + )} ) : ( '' diff --git a/src/test-support/join-fixtures.ts b/src/test-support/join-fixtures.ts index 516f140e1..612a055be 100644 --- a/src/test-support/join-fixtures.ts +++ b/src/test-support/join-fixtures.ts @@ -21,6 +21,7 @@ export const joinDtoFactory = Factory.define< note: chance.sentence(), legacyData: chance.sentence(), isInFragmentarium: chance.bool(), + isEnvelope: chance.bool(), } }) @@ -32,4 +33,5 @@ export const joinFactory = Factory.define(({ sequence }) => ({ note: defaultChance.sentence(), legacyData: defaultChance.sentence(), isInFragmentarium: defaultChance.bool(), + isEnvelope: defaultChance.bool(), })) diff --git a/src/test-support/test-fragment.ts b/src/test-support/test-fragment.ts index 59dd5d457..fd65dbe91 100644 --- a/src/test-support/test-fragment.ts +++ b/src/test-support/test-fragment.ts @@ -342,6 +342,7 @@ export const fragmentDto: FragmentDto = { note: '', legacyData: '', isInFragmentarium: true, + isEnvelope: true, }, ], [ @@ -357,6 +358,7 @@ export const fragmentDto: FragmentDto = { note: '', legacyData: '', isInFragmentarium: false, + isEnvelope: true, }, ], ], @@ -439,6 +441,7 @@ export const fragment = new Fragment( note: '', legacyData: '', isInFragmentarium: true, + isEnvelope: true, }, ], [ @@ -450,6 +453,7 @@ export const fragment = new Fragment( note: '', legacyData: '', isInFragmentarium: false, + isEnvelope: true, }, ], ],