From fca42d46d962bb79c1a92e4fb0e9ed6cdeda180d Mon Sep 17 00:00:00 2001 From: Maurice Date: Sun, 18 Oct 2026 22:36:57 +0200 Subject: [PATCH] refactor(journey): the phone's trip access list as its own component The list of who a linked trip lets in took MJourneySettingsSheet past the 300-line limit for a component (max-lines-per-function), which turned the client lint on dev red. It is MTripAccessList beside it now; the markup is unchanged. --- .../screens/journey/MJourneySettingsSheet.tsx | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx index fe2f56f12..727c865c9 100644 --- a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx +++ b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx @@ -5,7 +5,7 @@ import MIconBtn from '../../components/MIconBtn' import MToggle from '../../components/MToggle' import ConfirmDialog from '../../../components/shared/ConfirmDialog' import { useTranslation } from '../../../i18n' -import type { JourneyDetail } from '../../../store/journeyStore' +import type { JourneyDetail, JourneyTripAccess } from '../../../store/journeyStore' import { useJourneySettings, useJourneyTripLinking } from '../../../components/Journey/useJourneySettings' import { useJourneyShareLink } from '../../../components/Journey/useJourneyShareLink' import { pickGradient } from '../../../pages/journeyDetail/JourneyDetailPage.helpers' @@ -234,25 +234,7 @@ export default function MJourneySettingsSheet({ {t('journey.contributors.invite')} - {/* Through a trip's linked journal (#2683): shown, but changed in that trip. */} - {!!journey.trip_access?.length && ( - <> -
{t('journey.contributors.viaTrips')}
-

{t('journey.contributors.viaTripsHint')}

- {journey.trip_access.map(a => ( -
- - - {a.username} - {t('journey.contributors.viaTrip', { trip: a.trip_title })} - - - {a.role} - -
- ))} - - )} + {/* Public share */}
{t('journey.share.publicShare')}
@@ -350,3 +332,27 @@ export default function MJourneySettingsSheet({ ) } + +/** Who a trip's linked journal lets in (#2683): shown under the contributors, but changed in that trip. */ +function MTripAccessList({ access, eyebrow }: { access: JourneyTripAccess[] | undefined; eyebrow: string }) { + const { t } = useTranslation() + if (!access?.length) return null + return ( + <> +
{t('journey.contributors.viaTrips')}
+

{t('journey.contributors.viaTripsHint')}

+ {access.map(a => ( +
+ + + {a.username} + {t('journey.contributors.viaTrip', { trip: a.trip_title })} + + + {a.role} + +
+ ))} + + ) +}