fix(mobile): refine places sheets and restore the round dock

Put the category icon beside place names, shorten translated tab labels, and give tab counts their own badges. Bring the save-to-list dialog and trip badges in line with mobile sheets, and restore the icon-only dock.
This commit is contained in:
Maurice
2026-12-04 11:56:22 +01:00
parent d6527fa2e5
commit ef9a6fd7e1
36 changed files with 140 additions and 160 deletions
@@ -1,6 +1,6 @@
import { Bookmark, BookmarkCheck, Check, CheckCircle2, Loader2, Plus, X } from 'lucide-react'
import { Bookmark, BookmarkCheck, Check, CheckCircle2, Loader2, Plus } from 'lucide-react'
import MSheet from '../../mobile/components/MSheet'
import MIconBtn from '../../mobile/components/MIconBtn'
import { FormSheetBody, FormSheetHeader, FormSheetSection } from '../../mobile/screens/trip/sheets/PlSheetChrome'
import { useTranslation } from '../../i18n'
import { STATUS_META, nextStatus } from '../../pages/collections/collectionsModel'
import { VISITED_EVERYWHERE_BUSY, useSaveToCollection } from './useSaveToCollection'
@@ -14,46 +14,35 @@ import { VISITED_EVERYWHERE_BUSY, useSaveToCollection } from './useSaveToCollect
export default function MSaveToCollectionSheet() {
const { target, close, lists, loading, busyId, savedByCollection, unvisited, handleStatus, handleVisitedEverywhere, handleToggle, openCollections } = useSaveToCollection()
const { t } = useTranslation()
const title = t('collections.pickList')
return (
<MSheet open={!!target} onClose={close} variant="card" material="glass" ariaLabel={t('collections.pickList')}>
{/* Header — mirrors the place detail sheet: icon + title + target name + close */}
<div className="flex-none px-[18px] pt-4">
<div className="flex items-start gap-3">
<span className="flex h-10 w-10 flex-none items-center justify-center rounded-[13px] bg-[color:var(--m-ic)] text-m-ink">
<Bookmark size={18} strokeWidth={2} />
</span>
<div className="min-w-0 flex-1">
<div className="text-[1rem] font-bold leading-snug">{t('collections.pickList')}</div>
{target?.name && (
<div className="mt-[2px] truncate font-geist text-[0.6875rem] text-m-muted">{target.name}</div>
)}
</div>
<MIconBtn variant="neutral" size={34} onClick={close} ariaLabel={t('common.close')}>
<X size={15} strokeWidth={2.2} />
</MIconBtn>
</div>
</div>
<MSheet open={!!target} onClose={close} variant="card" material="glass" ariaLabel={title} form>
<FormSheetHeader
icon={Bookmark}
title={title}
subtitle={<bdi>{target?.name}</bdi>}
onClose={close}
closeLabel={t('common.close')}
/>
<div className="min-h-0 flex-1 overflow-y-auto px-[14px] pb-[16px] pt-2">
<FormSheetBody className="space-y-2">
{loading ? (
<div className="flex items-center justify-center py-10 text-m-faint">
<Loader2 size={20} className="animate-spin" />
</div>
) : lists.length === 0 ? (
<div className="flex flex-col items-center px-4 py-10 text-center">
<span className="mb-3 flex h-11 w-11 items-center justify-center rounded-2xl bg-[color:var(--m-ic)] text-m-faint">
<Bookmark size={20} strokeWidth={2} />
</span>
<p className="mb-3 font-geist text-[0.75rem] text-m-faint">{t('collections.noListsYet')}</p>
<FormSheetSection>
<p className="m-0 mb-3 text-control text-m-muted">{t('collections.noListsYet')}</p>
<button
type="button"
onClick={openCollections}
className="inline-flex items-center gap-1.5 rounded-full bg-m-act px-4 py-[9px] text-[0.75rem] font-semibold text-m-actfg"
className="flex min-h-11 w-full items-center justify-center gap-2 rounded-xl bg-m-act px-3 text-control font-semibold text-m-actfg"
>
<Plus size={14} strokeWidth={2.2} /> {t('collections.newList')}
<Plus size={16} aria-hidden />
{t('collections.newList')}
</button>
</div>
</FormSheetSection>
) : (
lists.map(list => {
const entry = savedByCollection.get(list.id)
@@ -67,20 +56,21 @@ export default function MSaveToCollectionSheet() {
type="button"
onClick={() => handleToggle(list)}
disabled={busyId != null}
className={`mt-2 flex w-full items-center gap-[11px] rounded-[14px] border px-3 py-[10px] text-start disabled:opacity-60 ${
aria-pressed={saved}
className={`flex min-h-12 w-full items-center gap-2.5 rounded-[14px] border px-3 py-2 text-start disabled:opacity-60 ${
saved
? 'border-[color:var(--m-act)] bg-[color:var(--m-inner)]'
: 'border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)]'
? 'border-m-rowbr bg-m-sheetop'
: 'border-transparent bg-m-ic'
}`}
>
<span
className="flex h-9 w-9 flex-none items-center justify-center rounded-xl text-white"
style={{ background: list.color || '#6366f1' }}
className="grid size-9 flex-none place-items-center rounded-lg bg-m-sheetop text-m-muted"
style={{ color: list.color || undefined }}
>
<Bookmark size={15} strokeWidth={2} />
<Bookmark size={15} strokeWidth={2} aria-hidden />
</span>
<span className="min-w-0 flex-1">
<span className="block truncate text-[0.8125rem] font-semibold text-m-ink">{list.name}</span>
<span dir="auto" className="block truncate text-control font-semibold text-m-ink">{list.name}</span>
{/* Saved lists show their own status here instead of the place
count — that number matters when picking a list, the status
matters once the place is in it (#1469). */}
@@ -91,26 +81,26 @@ export default function MSaveToCollectionSheet() {
aria-label={t(statusMeta.labelKey)}
onClick={entry.can_edit ? e => { e.preventDefault(); e.stopPropagation(); void handleStatus(entry, nextStatus(entry.status)) } : undefined}
onKeyDown={entry.can_edit ? e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); e.stopPropagation(); void handleStatus(entry, nextStatus(entry.status)) } } : undefined}
className="mt-[3px] inline-flex items-center gap-1 rounded-full bg-[color:var(--m-inner)] px-2 py-[3px] font-geist text-[0.65625rem] font-semibold"
className="mt-0.5 inline-flex items-center gap-1 rounded-lg bg-m-ic px-2 py-0.5 text-caption font-medium"
style={{ color: statusMeta.color }}
>
<StatusIcon size={11} strokeWidth={2.4} />
{t(statusMeta.labelKey)}
</span>
) : (
<span className="mt-px block font-geist text-[0.65625rem] text-m-muted">
<span className="mt-px block text-caption text-m-muted">
{t('collections.placeCount', { count: list.place_count ?? 0 })}
</span>
)}
</span>
{list.is_owner === false && (
<span className="flex-none font-geist text-[0.5625rem] font-bold uppercase tracking-[.05em] text-m-faint">
<span className="flex-none text-caption text-m-muted">
{t('collections.shared')}
</span>
)}
<span
className={`flex h-[26px] w-[26px] flex-none items-center justify-center rounded-full ${
saved ? 'bg-m-act text-m-actfg' : 'border border-[color:var(--m-rowbr)] text-m-faint'
saved ? 'bg-m-act text-m-actfg' : 'border border-m-rowbr text-m-muted'
}`}
>
{busy ? <Loader2 size={14} className="animate-spin" /> : saved ? <BookmarkCheck size={14} strokeWidth={2} /> : <Check size={14} strokeWidth={2} />}
@@ -119,15 +109,15 @@ export default function MSaveToCollectionSheet() {
)
})
)}
</div>
</FormSheetBody>
{unvisited.length > 0 && (
<div className="flex-none px-[14px] pb-1">
<div className="flex-none px-[18px] pb-2">
<button
type="button"
onClick={handleVisitedEverywhere}
disabled={busyId != null}
className="flex w-full items-center justify-center gap-1.5 rounded-[14px] border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] py-[10px] text-[0.78125rem] font-semibold text-m-ink disabled:opacity-60"
className="flex min-h-11 w-full items-center justify-center gap-2 rounded-xl bg-m-ic px-3 text-control font-semibold text-m-ink disabled:opacity-60"
>
{busyId === VISITED_EVERYWHERE_BUSY
? <Loader2 size={14} className="animate-spin" />
@@ -138,18 +128,18 @@ export default function MSaveToCollectionSheet() {
)}
{lists.length > 0 && (
<div className="flex flex-none items-center justify-between gap-2 border-t border-[color:var(--m-rowbr)] px-[18px] py-3">
<div className="flex flex-none items-center justify-between gap-2 border-t border-m-rowbr px-[18px] py-3">
<button
type="button"
onClick={openCollections}
className="text-[0.78125rem] font-semibold text-[color:var(--m-act)]"
className="min-h-11 text-control font-semibold text-m-ink"
>
{t('collections.viewInCollection')}
</button>
<button
type="button"
onClick={close}
className="rounded-full bg-[color:var(--m-ic)] px-4 py-[8px] text-[0.78125rem] font-semibold text-m-ink"
className="min-h-11 rounded-xl bg-m-ic px-4 text-control font-semibold text-m-ink"
>
{t('common.close')}
</button>
+7 -7
View File
@@ -13,7 +13,7 @@ import MMenuRow from './MMenuRow'
import MSheet from './MSheet'
/**
* Labelled destination dock with a persistent slot for the screen's primary action.
* Floating icon dock with a persistent slot for the screen's primary action.
*/
export default function MBottomNav() {
const { t } = useTranslation()
@@ -81,10 +81,10 @@ export default function MBottomNav() {
onClick={() => open(item)}
aria-label={label}
aria-current={active ? 'page' : undefined}
title={shortLabel}
className="m-dock-item"
>
<span className="m-dock-symbol"><Icon size={dash ? 18 : 21} strokeWidth={dash ? 2.1 : 1.9} /></span>
<span className={`m-dock-label${dash ? ' capitalize' : ''}`}>{shortLabel}</span>
<Icon size={dash ? 18 : 21} strokeWidth={dash ? 2.1 : 1.9} aria-hidden />
</button>
)
}
@@ -109,7 +109,7 @@ export default function MBottomNav() {
)}
{!overMap && <MDockScrim />}
<nav aria-label={t('mobileNav.navigation')} className="m-dock-vt m-labelled-dock fixed inset-x-4 z-40 flex h-[62px] items-center rounded-[24px] border border-[color:var(--m-gbr)] bg-[color:var(--m-dock)] px-2 backdrop-blur-[24px] bottom-[calc(env(safe-area-inset-bottom,0px)+12px)]">
<nav aria-label={t('mobileNav.navigation')} className="m-dock-vt m-labelled-dock fixed inset-x-4 z-40 flex h-[62px] items-center rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-dock)] px-3 backdrop-blur-[30px] backdrop-saturate-[1.4] bottom-[calc(env(safe-area-inset-bottom,0px)+12px)]">
<div className="flex min-w-0 flex-1 items-center justify-around">{left.map(renderItem)}</div>
{logoSlot ? (
@@ -141,10 +141,10 @@ export default function MBottomNav() {
aria-expanded={moreOpen}
aria-haspopup="dialog"
aria-current={moreActive ? 'page' : undefined}
className="m-dock-item"
title={t('mobileNav.more')}
className="m-dock-item m-dock-more"
>
<span className="m-dock-symbol"><MoreHorizontal size={21} strokeWidth={1.9} /></span>
<span className="m-dock-label">{t('mobileNav.more')}</span>
<MoreHorizontal size={21} strokeWidth={1.9} aria-hidden />
</button>
)}
</div>
+13 -23
View File
@@ -457,14 +457,12 @@ html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-
.m-dock-item {
display: grid;
justify-items: center;
align-content: center;
gap: 2px;
flex: 1;
min-width: 44px;
min-height: 54px;
place-items: center;
flex: none;
width: 42px;
height: 42px;
color: var(--m-muted);
border-radius: 14px;
border-radius: 50%;
}
.m-root .m-dock-item:focus-visible {
@@ -477,13 +475,6 @@ html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-
background: var(--m-ic);
}
.m-dock-symbol {
display: grid;
place-items: center;
width: 36px;
height: 26px;
}
.m-dock-item[aria-current='page'] {
background: var(--m-act);
color: var(--m-actfg);
@@ -493,15 +484,14 @@ html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-
outline-color: var(--m-actfg);
}
.m-dock-label {
min-width: 0;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: calc(10px * var(--fs-scale-caption, 1));
font-weight: 600;
line-height: 1.2;
.m-dock-more[aria-current='page'] {
background: var(--m-ic);
color: var(--m-ink);
box-shadow: inset 0 0 0 1.5px var(--m-act);
}
.m-root .m-dock-more[aria-current='page']:focus-visible {
outline-color: var(--m-act);
}
.m-dock-vt {
@@ -19,8 +19,8 @@ export const SHEET_ACTION =
/**
* The frame of the one place view on the phone, the same from All places and from
* a list: photo, name and location in the header, then the scrolling body
* with its category and the footer actions.
* a list: category icon, name and location in the header, followed by the
* scrolling body and the footer actions.
*/
export default function MPlaceSheetShell({
open,
@@ -97,13 +97,21 @@ export default function MPlaceSheetShell({
name && (address?.trim() || (lat != null && lng != null ? coordsText(lat, lng) : t('places.noCoordinates')));
const coverLabel = t('collections.coverImage');
const placeName = name && (
<bdi
ref={(node) => {
titleRef.current = node;
}}
>
{name}
</bdi>
<>
{category &&
createElement(meta.icon, {
className: 'me-1.5 inline-block size-4 align-[-0.1em]',
role: 'img',
'aria-label': category.name,
})}
<bdi
ref={(node) => {
titleRef.current = node;
}}
>
{name}
</bdi>
</>
);
const closeLabel = t('common.close');
const renderPlaceHeader = () => (
@@ -141,7 +149,7 @@ export default function MPlaceSheetShell({
</header>
) : (
<FormSheetHeader
icon={meta.icon}
icon={category ? undefined : meta.icon}
title={head ?? placeName}
subtitle={
location && (
@@ -163,18 +171,7 @@ export default function MPlaceSheetShell({
<>
<MSheet open={open} onClose={onClose} ariaLabel={name ?? undefined} covered={viewingCover}>
{renderPlaceHeader()}
<FormSheetBody>
{category && (
<span
className="inline-flex max-w-full items-center gap-1.5 rounded-lg bg-m-ic px-2 py-1 text-caption font-medium"
style={{ color: meta.color }}
>
{createElement(meta.icon, { size: 13, className: 'flex-none', 'aria-hidden': true })}
<bdi className="truncate">{category.name}</bdi>
</span>
)}
{children}
</FormSheetBody>
<FormSheetBody>{children}</FormSheetBody>
{footer && (
<div className="flex flex-none items-center gap-2 border-t border-m-rowbr px-[18px] py-3">{footer}</div>
)}
@@ -55,7 +55,11 @@ export default function MPlaceSheetTabs({
}
>
{t(PLACE_TAB_LABEL[key])}
{sheet.counts[key] > 0 && <span className="opacity-70">{sheet.counts[key]}</span>}
{sheet.counts[key] > 0 && (
<span className="grid h-4 min-w-4 flex-none place-items-center rounded-full bg-m-sheetop px-1 text-caption tabular-nums leading-none text-m-ink">
{sheet.counts[key]}
</span>
)}
</button>
);
})}
@@ -144,11 +144,11 @@ function Row({ entry, onOpen, t }: { entry: PlacesLibraryEntry; onOpen: () => vo
)}
</span>
{first && (
<span className="flex max-w-[42%] flex-none items-center gap-1 rounded-full border border-m-rowbr bg-m-ic px-2 py-[3px] text-caption font-semibold text-m-muted">
<span className="inline-flex max-w-[38%] flex-none items-center gap-1.5 rounded-lg bg-m-ic px-2 py-1 text-caption font-medium text-m-muted">
{first.kind === 'trip' ? (
<Luggage size={11} className="flex-none" />
<Luggage size={12} className="flex-none text-m-faint" aria-hidden />
) : (
<Bookmark size={11} className="flex-none" />
<Bookmark size={12} className="flex-none text-m-faint" aria-hidden />
)}
<span dir="auto" className="truncate">
{originName(first)}
@@ -882,7 +882,7 @@ export default function MTripShell({
{/* ── Bottom dock (replaces the global bottom nav on this screen) ── */}
{/* A tab's list fades out under the dock rather than showing in the gap below it; a map runs to the edge. */}
{!wide && !MAP_TABS.has(trTab) && <MDockScrim />}
{!wide && <nav aria-label={t('mobileNav.navigation')} className="m-labelled-dock absolute inset-x-4 z-40 flex h-[62px] items-center justify-around rounded-[24px] border border-[color:var(--m-gbr)] bg-[color:var(--m-dock)] px-2 backdrop-blur-[24px] bottom-[calc(env(safe-area-inset-bottom,0px)+12px)]">
{!wide && <nav aria-label={t('mobileNav.navigation')} className="m-labelled-dock absolute inset-x-4 z-40 flex h-[62px] items-center justify-around rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-dock)] px-3 backdrop-blur-[30px] backdrop-saturate-[1.4] bottom-[calc(env(safe-area-inset-bottom,0px)+12px)]">
{dockTabs.map(({ id, icon: Icon }) => {
// While More is open the dock points at More, not at the tab under it.
const active = trTab === id && sheet?.id !== 'mehr'