fix(mobile): compact place details, softer sheet edges, icon buttons for copy and share

Add place on the phone: the place details showed the mascot half a screen
high while nothing was picked or nothing was found, and pushed the name field
below the fold. Both states are now one quiet line, as in the desktop dialog,
and the details sit in a card in the mobile tokens.

Sheets with a header over a scroll box (trip settings, day, export,
transport, files and more) cut their content off in a hard line right under
the header icon. The scroll box now keeps a little room under the header and
fades its content out at the edges.

Copy and share next to a share or invite link are round icon buttons of the
same size; the share button showed no icon because the copy button's padding
left it no room.
This commit is contained in:
Maurice
2026-11-06 15:44:07 +01:00
parent 79420cd945
commit 821f23aed4
14 changed files with 55 additions and 52 deletions
+1 -1
View File
@@ -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": 32,
"mobile/screens/journey/MJourneySettingsSheet.tsx": 31,
"mobile/screens/journey/mobileJourneyMeta.ts": 4,
"mobile/screens/notifications/MNotificationRow.tsx": 4,
"mobile/screens/notifications/MNotifications.tsx": 3,
@@ -475,9 +475,8 @@ describe('PlaceDetailsColumn — hours and rating', () => {
* FE-PDC-027 — nothing came back for this place.
*
* It used to be a line of grey text plus, when no Google key was set, a panel
* telling the reader to go and ask an administrator for one. The mascot says the
* same thing in the shape every other empty state in TREK uses, and whose key is
* missing is not this panel's business.
* telling the reader to go and ask an administrator for one. One quiet line says
* that nothing came back, and whose key is missing is not this panel's business.
*/
describe('PlaceDetailsColumn — nothing found', () => {
it('FE-PDC-027: shows the empty state once, and no advice about API keys', async () => {
@@ -26,7 +26,6 @@ import { mapsApi } from '../../api/client'
import { resolveOpenNow, resolvePlaceTimeZone, placeWeekdayIndex } from './placeOpenState'
import { convertHoursLine, isUnknownHoursLine, splitHoursLine } from './placeHoursFormat'
import { safeHttpUrl } from '../../utils/safeUrl'
import EmptyState from '../shared/EmptyState'
import { Tooltip } from '../shared/Tooltip'
import { fs } from '../shared/DialogShell'
import { LABEL } from '../shared/dialogParts'
@@ -66,8 +65,8 @@ interface PlaceDetailsColumnProps {
fluid?: boolean
/**
* 'dialog' is the desktop add place dialog: a grey panel of white cards under
* small eyebrows, and a quiet hint card where the sheet shows the mascot. The
* default is the phone sheet's look, which this prop leaves exactly as it was.
* small eyebrows. The default is the phone sheet's look: a card in the mobile
* tokens with the same one-line hints.
*/
variant?: 'sheet' | 'dialog'
/** False on an instance with no Google key, which is most of them. */
@@ -76,6 +75,16 @@ interface PlaceDetailsColumnProps {
type LoadState = 'idle' | 'loading' | 'ready' | 'error'
/** The phone sheet's quiet one-line state: an icon and a sentence, no mascot taking half the screen. */
function SheetHint({ icon, children }: { icon: React.ReactNode; children: React.ReactNode }) {
return (
<p className="flex items-center gap-2 rounded-[12px] bg-[color:var(--m-ic)] px-3 py-2.5 text-caption text-m-muted">
<span className="flex-none">{icon}</span>
{children}
</p>
)
}
/**
* Overline label, the section heading Vacay and the dashboard widgets share.
* Uppercase with wide tracking, muted, no rule underneath.
@@ -225,17 +234,17 @@ export default function PlaceDetailsColumn({
// tiles, which is too small to tell a facade from a foyer. The column is
// stretched to the form's height by the row it sits in, so the extra room
// costs nothing that was being used.
<aside className={dialog ? `${SIDE_COLUMN} ${fluid ? '' : 'sm:w-80'}` : `w-full ${fluid ? '' : 'sm:w-80'} shrink-0 flex flex-col rounded-xl border border-edge bg-surface-secondary overflow-hidden self-stretch`}>
<aside className={dialog ? `${SIDE_COLUMN} ${fluid ? '' : 'sm:w-80'}` : `w-full ${fluid ? '' : 'sm:w-80'} shrink-0 flex flex-col rounded-[18px] border border-[color:var(--m-cbr)] bg-[color:var(--m-card)] overflow-hidden self-stretch`}>
{dialog ? (
<ColumnHead icon={<Landmark size={13} strokeWidth={2.2} />}>{t('places.details.title')}</ColumnHead>
) : (
<div className="flex items-center gap-2 px-3 py-2.5 border-b border-edge shrink-0">
<Landmark size={15} className="text-accent" />
<span className="text-body font-semibold text-content">{t('places.details.title')}</span>
<div className="flex shrink-0 items-center gap-2 px-3 pt-3">
<Landmark size={14} className="text-m-muted" />
<span className="text-caption font-semibold text-m-ink">{t('places.details.title')}</span>
</div>
)}
<div className={dialog ? 'flex min-h-0 flex-1 flex-col gap-3.5 overflow-y-auto px-3 pb-3' : 'flex-1 min-h-0 overflow-y-auto p-3 space-y-3.5'}>
<div className={dialog ? 'flex min-h-0 flex-1 flex-col gap-3.5 overflow-y-auto px-3 pb-3' : 'flex-1 min-h-0 overflow-y-auto p-3 space-y-3'}>
{/* The place's picture first: its own ones are there whatever the sources answer. */}
<PictureBlock
photos={state === 'ready' && !data?.disabled ? (data?.photos ?? []) : []}
@@ -246,19 +255,13 @@ export default function PlaceDetailsColumn({
t={t}
/>
{/* Nothing picked yet, which is a state rather than a fault: the mascot
waits with an idle look instead of a sad one. The dialog says the
same in a quiet card, and the column keeps its width either way. */}
{/* Nothing picked yet, which is a state rather than a fault: one quiet
line, in the dialog and on the phone alike, so the form's own fields
stay in view instead of sitting under a mascot half a screen high. */}
{!selection && (dialog ? (
<HintCard icon={<ImageIcon size={15} strokeWidth={2} />}>{t('places.details.empty')}</HintCard>
) : (
<EmptyState
scene="idle"
title={t('places.details.empty')}
size={92}
fill
surface="var(--bg-secondary)"
/>
<SheetHint icon={<ImageIcon size={14} strokeWidth={2} />}>{t('places.details.empty')}</SheetHint>
))}
{selection && state === 'loading' && (dialog ? (
@@ -278,22 +281,13 @@ export default function PlaceDetailsColumn({
? <HintCard icon={<Landmark size={15} strokeWidth={2} />}>{t('places.details.disabled')}</HintCard>
: <p className="text-caption text-content-muted">{t('places.details.disabled')}</p>)}
{/* The mascot rather than a line of grey text and, under it, a paragraph
telling the reader to go and ask an administrator for a Google key.
Nothing came back for this place, which is worth saying once and
{/* Nothing came back for this place, which is worth saying once and
plainly; whose key is missing is not this panel's business, and on a
place the free sources describe fine it read as an advert. */}
{isEmpty && (dialog ? (
<HintCard icon={<SearchX size={15} strokeWidth={2} />}>{t('places.details.nothing')}</HintCard>
) : (
<EmptyState
scene="search"
mood="sad"
title={t('places.details.nothing')}
size={92}
fill
surface="var(--bg-secondary)"
/>
<SheetHint icon={<SearchX size={14} strokeWidth={2} />}>{t('places.details.nothing')}</SheetHint>
))}
{selection && state === 'ready' && !data?.disabled && !isEmpty && (
+7
View File
@@ -478,3 +478,10 @@
animation: none !important;
}
}
/* A scroll box under a fixed header: content fades out over the padding at its
edges instead of being cut off in a hard line right under the header. */
.m-scroll-fade {
-webkit-mask-image: linear-gradient(to bottom, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
mask-image: linear-gradient(to bottom, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
}
@@ -1,5 +1,5 @@
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 } from 'lucide-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 MSheet from '../../components/MSheet'
import MIconBtn from '../../components/MIconBtn'
@@ -262,19 +262,20 @@ export default function MJourneySettingsSheet({
<span className="min-w-0 flex-1 truncate font-geist text-[0.6875rem] text-m-muted">{shareUrl}</span>
<button
type="button"
aria-label={copied ? t('journey.share.copied') : t('journey.share.copy')}
onClick={copyShareUrl}
className="flex-none rounded-full bg-m-act px-3 py-[5px] font-geist text-[0.65625rem] font-bold text-m-actfg"
className="flex h-7 w-7 flex-none items-center justify-center rounded-full bg-m-act text-m-actfg"
>
{copied ? t('journey.share.copied') : t('journey.share.copy')}
{copied ? <Check size={13} strokeWidth={2.4} /> : <Copy size={13} strokeWidth={2.2} />}
</button>
{canShareLink() && shareUrl && (
<button
type="button"
aria-label={t('common.share')}
onClick={() => void shareLink(shareUrl)}
className="flex h-[26px] w-[26px] flex-none items-center justify-center rounded-full bg-m-act text-m-actfg"
className="flex h-7 w-7 flex-none items-center justify-center rounded-full bg-m-act text-m-actfg"
>
<ShareIcon size={12} strokeWidth={2.4} />
<ShareIcon size={13} strokeWidth={2.2} />
</button>
)}
</div>
@@ -182,7 +182,7 @@ export default function MRtInfoSheet({ planner, shell }: MTripSheetsProps) {
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px]">
<div className="m-scroll-fade mt-2 min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">
{/* ── Vehicle: how far it goes, drawn as the tank it leaves the factory with ── */}
<div className="mt-[14px]">
<InfoCard label={t('roadtrip.limit.sectionVehicle')}>
@@ -270,7 +270,7 @@ export default function MDaySheet({ planner, shell }: MTripSheetsProps) {
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px]">
<div className="m-scroll-fade mt-2 min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">
{/* ── Weather (16-day forecast, climate fallback) ── */}
{day.date && lat != null && lng != null && (
weatherLoading ? (
@@ -60,7 +60,7 @@ export default function MDaysSheet({ planner, shell }: MTripSheetsProps) {
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-[18px] pb-[14px] pt-[14px]">
<div className="m-scroll-fade mt-2 min-h-0 flex-1 overflow-y-auto px-[18px] pb-[14px] pt-[14px]">
<div className="flex flex-col gap-[6px]">
{ordered.map((day, i) => (
<div key={day.id} className={`flex items-center gap-[10px] rounded-[13px] px-[11px] py-[7px] ${INNER_CLS}`}>
@@ -68,7 +68,7 @@ export default function MExportSheet({ planner, shell }: MTripSheetsProps) {
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px] pt-3">
<div className="m-scroll-fade mt-2 min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">
<div className="flex flex-col gap-2">
<ExportRow
icon={FileDown}
@@ -197,7 +197,7 @@ export default function MTransportSheet({ planner, shell }: MTripSheetsProps) {
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px]">
<div className="m-scroll-fade mt-2 min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">
{/* ── Times / seat stats ── */}
{(depTime || arrTime || seat || platform) && (
<div className="mt-[14px] flex gap-[6px]">
@@ -50,6 +50,8 @@ const FIELD =
'h-[42px] min-w-0 flex-1 rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-[14px] text-[length:calc(13px*var(--fs-scale-body,1))] font-medium text-m-ink outline-none placeholder:text-m-faint';
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';
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';
const PILL =
@@ -118,20 +120,20 @@ function LinkField({
/>
<button
type="button"
aria-label={copied ? t('common.copied') : t('common.copy')}
onClick={onCopy}
className={`${PRIMARY} h-[32px] px-3 text-[length:calc(11.5px*var(--fs-scale-caption,1))]`}
className={LINK_ACTION}
>
{copied ? <Check size={13} strokeWidth={2.4} /> : <Copy size={13} strokeWidth={2.2} />}
{copied ? t('common.copied') : t('common.copy')}
{copied ? <Check size={15} strokeWidth={2.4} /> : <Copy size={15} strokeWidth={2.2} />}
</button>
{canShareLink() && (
<button
type="button"
aria-label={t('common.share')}
onClick={() => void shareLink(url)}
className={`${PRIMARY} h-[32px] w-[32px] justify-center px-0`}
className={LINK_ACTION}
>
<ShareIcon size={13} strokeWidth={2.2} />
<ShareIcon size={15} strokeWidth={2.2} />
</button>
)}
</div>
@@ -474,7 +476,7 @@ export default function MTripSettingsSheet({
/>
</div>
<div className="flex min-h-0 flex-1 flex-col gap-2.5 overflow-y-auto px-[18px] pb-[18px] pt-3">
<div className="m-scroll-fade mt-2 flex min-h-0 flex-1 flex-col gap-2.5 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">
<AccessSection m={m} ask={setQuestion} />
<GuestsSection m={m} ask={setQuestion} />
{m.canManageShare && <ShareLinkSection tripId={tripId} />}
@@ -136,7 +136,7 @@ export default function MDocSyncSheet({
</div>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px]">
<div className="m-scroll-fade mt-2 min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">
{sync.loading ? (
<div className="flex justify-center py-12">
<Loader2 size={20} className="animate-spin text-m-faint" />
@@ -73,7 +73,7 @@ export default function MFileLinkSheet({ planner, file, onClose }: MFileLinkShee
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px]">
<div className="m-scroll-fade mt-2 min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">
{isEmpty && (
<div className="py-8 text-center font-geist text-[0.78125rem] text-m-faint">{t('files.linkEmpty')}</div>
)}
@@ -85,7 +85,7 @@ export default function MFileMenuSheet({ planner, file, onClose, onOpenLinks }:
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px]">
<div className="m-scroll-fade mt-2 min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">
{canEdit && (
<div className="mt-3">
<Eyebrow className="mb-[6px]">{t('files.noteLabel')}</Eyebrow>