From 4fd7f3c6cf1ab59876c32307351abc3bb6af2458 Mon Sep 17 00:00:00 2001 From: elpatron Date: Sat, 6 Jun 2026 21:59:25 +0200 Subject: [PATCH] feat(journal): wrap Crew an diesem Reisetag card inside a collapsible accordion defaulting to collapsed --- client/src/components/EntryCrewSection.tsx | 113 +++++++++++++-------- 1 file changed, 69 insertions(+), 44 deletions(-) diff --git a/client/src/components/EntryCrewSection.tsx b/client/src/components/EntryCrewSection.tsx index b576355..9f3d50e 100644 --- a/client/src/components/EntryCrewSection.tsx +++ b/client/src/components/EntryCrewSection.tsx @@ -1,6 +1,6 @@ import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -import { Users } from 'lucide-react' +import { Users, ChevronDown, ChevronUp } from 'lucide-react' import type { EntryCrewFields, PersonSnapshot } from '../types/person.js' import { loadPersonPool } from '../services/personPool.js' import { loadLogbookCrewSelection } from '../services/logbookCrewSelection.js' @@ -24,6 +24,7 @@ export default function EntryCrewSection({ preloadedPool }: EntryCrewSectionProps) { const { t } = useTranslation() + const [collapsed, setCollapsed] = useState(true) const [pool, setPool] = useState>(preloadedPool ?? new Map()) useEffect(() => { @@ -90,54 +91,78 @@ export default function EntryCrewSection({ return (
-
- -

{t('entry_crew.title')}

-
-

{t('entry_crew.subtitle')}

- -
- - {skippers.length === 0 ? ( -

{t('entry_crew.no_skipper')}

+
setCollapsed(!collapsed)} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault() + setCollapsed(!collapsed) + } + }} + role="button" + aria-expanded={!collapsed} + tabIndex={0} + > +
+ +

{t('entry_crew.title')}

+
+ {collapsed ? ( + ) : ( -
- {skippers.map(([id, data]) => ( - - ))} -
+ )}
-
- - {crewEntries.length === 0 ? ( -

{t('entry_crew.no_crew')}

- ) : ( -
- {crewEntries.map(([id, data]) => ( - - ))} + {!collapsed && ( + <> +

{t('entry_crew.subtitle')}

+ +
+ + {skippers.length === 0 ? ( +

{t('entry_crew.no_skipper')}

+ ) : ( +
+ {skippers.map(([id, data]) => ( + + ))} +
+ )}
- )} -
+ +
+ + {crewEntries.length === 0 ? ( +

{t('entry_crew.no_crew')}

+ ) : ( +
+ {crewEntries.map(([id, data]) => ( + + ))} +
+ )} +
+ + )}
) }