diff --git a/client/scripts/theme-baseline.json b/client/scripts/theme-baseline.json index 3a2cbb297..3e7cb2314 100644 --- a/client/scripts/theme-baseline.json +++ b/client/scripts/theme-baseline.json @@ -190,7 +190,7 @@ "mobile/screens/journey/MJourneyCreateSheet.tsx": 10, "mobile/screens/journey/MJourneyDetail.tsx": 6, "mobile/screens/journey/MJourneyEntrySheet.tsx": 52, - "mobile/screens/journey/MJourneySettingsSheet.tsx": 31, + "mobile/screens/journey/MJourneySettingsSheet.tsx": 29, "mobile/screens/journey/mobileJourneyMeta.ts": 4, "mobile/screens/notifications/MNotificationRow.tsx": 4, "mobile/screens/notifications/MNotifications.tsx": 3, diff --git a/client/src/mobile/components/MLinkField.tsx b/client/src/mobile/components/MLinkField.tsx new file mode 100644 index 000000000..af9788b67 --- /dev/null +++ b/client/src/mobile/components/MLinkField.tsx @@ -0,0 +1,45 @@ +import { Check, Copy, Share as ShareIcon } from 'lucide-react'; +import { canShareLink, shareLink } from '../../native/shareLink'; + +/** The round icon buttons next to the link: copy and share, the same size. */ +const ACTION = 'flex h-[34px] w-[34px] flex-none items-center justify-center rounded-full bg-m-act text-m-actfg'; + +/** + * A link to hand on, read-only, with copy and (where the system has a share + * sheet) share next to it: the trip's share and invite links and a journey's + * public link all look the same. + */ +export default function MLinkField({ + url, + copied, + onCopy, + copyLabel, + copiedLabel, + shareLabel, +}: { + url: string; + copied: boolean; + onCopy: () => void; + copyLabel: string; + copiedLabel: string; + shareLabel: string; +}) { + return ( +
+ + + {canShareLink() && ( + + )} +
+ ); +} diff --git a/client/src/mobile/screens/collections/MCollections.tsx b/client/src/mobile/screens/collections/MCollections.tsx index 3e7a8d7b4..2a37f8941 100644 --- a/client/src/mobile/screens/collections/MCollections.tsx +++ b/client/src/mobile/screens/collections/MCollections.tsx @@ -73,16 +73,25 @@ export default function MCollections() { // The bottom-nav "+" hands off via the ?create= contract. const [searchParams, setSearchParams] = useSearchParams() const createParam = searchParams.get('create') - const { activeId, canEdit, setShowAddPlace, ownedLists } = c + const { activeId, canEdit, setShowAddPlace, ownedLists, setEditorTarget } = c + const listCount = c.collections.length + const listsLoading = c.loading useEffect(() => { if (createParam !== 'place' && createParam !== '1') return + // Wait for the lists: whether there is one decides what "+" means. + if (listsLoading) return const next = new URLSearchParams(searchParams) next.delete('create') setSearchParams(next, { replace: true }) + // Without a list yet, "+" starts the first one; places come after. + if (listCount === 0) { + setEditorTarget('new') + return + } // Open whenever the user can add somewhere: an editable active list, or at // least one owned list to pick as the target in the sheet. if ((typeof activeId === 'number' && canEdit) || ownedLists.length > 0) setShowAddPlace(true) - }, [createParam, searchParams, setSearchParams, activeId, canEdit, ownedLists.length, setShowAddPlace]) + }, [createParam, searchParams, setSearchParams, activeId, canEdit, ownedLists.length, setShowAddPlace, listsLoading, listCount, setEditorTarget]) // Close transient popovers when the active list changes under them. useEffect(() => { @@ -219,12 +228,8 @@ export default function MCollections() { ) : noLists ? (
+ {/* The dock's "+" starts the first list (see the ?create= handoff above). */} -
- - {t('collections.newList')} - -
) : ( <> diff --git a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx index d6d55eb99..4d80a9cb0 100644 --- a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx +++ b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx @@ -1,6 +1,6 @@ import { useRef, useState } from 'react' -import { X, Image, Plus, Trash2, UserPlus, Link as LinkIcon, List, Grid3x3, MapPin, Route, Archive, ArchiveRestore, Undo2, Link2, ListChecks, RefreshCw, Share as ShareIcon, Copy, Check } from 'lucide-react' -import { canShareLink, shareLink } from '../../../native/shareLink' +import { X, Image, Plus, Trash2, UserPlus, Link as LinkIcon, List, Grid3x3, MapPin, Route, Archive, ArchiveRestore, Undo2, Link2, ListChecks, RefreshCw } from 'lucide-react' +import MLinkField from '../../components/MLinkField' import MSheet from '../../components/MSheet' import MIconBtn from '../../components/MIconBtn' import MToggle from '../../components/MToggle' @@ -257,28 +257,16 @@ export default function MJourneySettingsSheet({ ) : ( <> -
- - {shareUrl} - - {canShareLink() && shareUrl && ( - - )} -
+ {shareUrl && ( + + )} {([ { key: 'share_timeline' as const, label: t('journey.share.timeline'), icon: List }, { key: 'share_gallery' as const, label: t('journey.share.gallery'), icon: Grid3x3 }, @@ -294,9 +282,9 @@ export default function MJourneySettingsSheet({ )} @@ -425,11 +413,12 @@ function MRecordingPrepRow({ prep, enabled }: { prep: JourneyRecordingPrepState; function MShareMapExtras({ link, onToggle }: { link: JourneyShareLink; onToggle: (key: JourneyShareMapExtra) => unknown }) { const { t } = useTranslation() return ( - <> + // Hangs under the map row: a line from below its pin, smaller labels. +
{SHARE_MAP_EXTRAS.map(({ key, labelKey, hintKey }) => ( -
+
- {t(labelKey)} + {t(labelKey)} {link.share_map ? t(hintKey) : t('journey.share.needsMap')} @@ -442,6 +431,6 @@ function MShareMapExtras({ link, onToggle }: { link: JourneyShareLink; onToggle: />
))} - +
) } diff --git a/client/src/mobile/screens/trip/sheets/MTripSettingsSheet.tsx b/client/src/mobile/screens/trip/sheets/MTripSettingsSheet.tsx index 059bbe977..98c39b17f 100644 --- a/client/src/mobile/screens/trip/sheets/MTripSettingsSheet.tsx +++ b/client/src/mobile/screens/trip/sheets/MTripSettingsSheet.tsx @@ -1,6 +1,5 @@ import { Check, - Copy, Crown, Link2, LogOut, @@ -8,7 +7,6 @@ import { Plus, RefreshCw, Settings2, - Share as ShareIcon, Trash2, UserMinus, UserPlus, @@ -27,8 +25,8 @@ import { type ListedMember, } from '../../../../components/Trips/useTripShare'; import { useTranslation } from '../../../../i18n'; -import { canShareLink, shareLink } from '../../../../native/shareLink'; import MChip from '../../../components/MChip'; +import MLinkField from '../../../components/MLinkField'; import MSheet from '../../../components/MSheet'; import MConfirmSheet from '../../settings/MConfirmSheet'; import { Eyebrow, INNER_CLS, TileHeader } from './MTripSheetUi'; @@ -51,17 +49,37 @@ const FIELD = const PRIMARY = 'flex h-[42px] flex-none items-center gap-1.5 rounded-full bg-m-act px-4 text-[length:calc(13px*var(--fs-scale-body,1))] font-semibold text-m-actfg disabled:opacity-40'; /** The round icon buttons next to a link: copy, share. */ -const LINK_ACTION = 'flex h-[34px] w-[34px] flex-none items-center justify-center rounded-full bg-m-act text-m-actfg'; +/** The round, filled icon button next to a picker or field: invite, add. */ +const ROUND_PRIMARY = + 'flex h-[42px] w-[42px] flex-none items-center justify-center rounded-full bg-m-act text-m-actfg disabled:opacity-40'; const ROUND = - 'flex h-[34px] w-[34px] flex-none items-center justify-center rounded-full bg-[color:var(--m-ic)] text-m-muted disabled:opacity-40'; + 'flex h-[42px] w-[42px] flex-none items-center justify-center rounded-full bg-[color:var(--m-ic)] text-m-muted disabled:opacity-40'; const PILL = 'flex h-[22px] flex-none items-center gap-[3px] rounded-full px-[8px] font-geist text-[length:calc(9.5px*var(--fs-scale-caption,1))] font-bold uppercase tracking-[.06em]'; /** A titled block of the sheet: the eyebrow, an optional line under it and the content on the inner surface. */ -function Section({ title, hint, children }: { title: string; hint?: string; children: ReactNode }) { +function Section({ + title, + count, + hint, + children, +}: { + title: string; + /** How many there are, as a small badge next to the title rather than glued onto it. */ + count?: number; + hint?: string; + children: ReactNode; +}) { return (
- {title} +
+ {title} + {count != null && ( + + {count} + + )} +
{hint && (

{hint} @@ -98,48 +116,6 @@ function PersonRow({ ); } -/** A link with its copy button, read-only, the way the phone shows one to hand on. */ -function LinkField({ - url, - copied, - onCopy, - t, -}: { - url: string; - copied: boolean; - onCopy: () => void; - t: (key: string) => string; -}) { - return ( -

- - - {canShareLink() && ( - - )} -
- ); -} - function ShareLinkSection({ tripId }: { tripId: number }) { const { t } = useTranslation(); const link = useShareLink(tripId); @@ -168,7 +144,14 @@ function ShareLinkSection({ tripId }: { tripId: number }) {
{link.url ? ( <> - void link.copy()} t={t} /> + void link.copy()} + copyLabel={t('common.copy')} + copiedLabel={t('common.copied')} + shareLabel={t('common.share')} + /> @@ -404,7 +394,8 @@ function GuestsSection({ m, ask }: { m: Members; ask: Ask }) { if (!m.isCurrentOwner && m.guests.length === 0) return null; return (
0 ? `${t('members.guests')} ${m.guests.length}` : t('members.guests')} + title={t('members.guests')} + count={m.guests.length > 0 ? m.guests.length : undefined} hint={t('members.guestsHint')} > {m.guests.map((guest) => ( @@ -427,7 +418,7 @@ function GuestsSection({ m, ask }: { m: Members; ask: Ask }) { onClick={() => void m.addGuest()} disabled={m.addingGuest || !m.newGuestName.trim()} aria-label={t('members.addGuest')} - className={PRIMARY} + className={ROUND_PRIMARY} >