diff --git a/web/src/components/CalendarView/CalendarDayCell.tsx b/web/src/components/CalendarView/CalendarDayCell.tsx index c7ff0e309..6bf849331 100644 --- a/web/src/components/CalendarView/CalendarDayCell.tsx +++ b/web/src/components/CalendarView/CalendarDayCell.tsx @@ -5,12 +5,14 @@ import { getActivityLevel, getTooltipText, } from "@/components/ActivityCalendar"; +import { useResolvedUser, useResolvedUsersByNames } from "@/components/MemoContent/MentionResolutionContext"; +import UserAvatar from "@/components/UserAvatar"; import { FOCUS_VISIBLE_OUTLINE_CLASSES } from "@/components/ui/focus"; import type { MemoTimeBasis } from "@/contexts/ViewContext"; import { cn } from "@/lib/utils"; import { useTranslate } from "@/utils/i18n"; import { CalendarLink } from "./CalendarLink"; -import type { CalendarDaySummary } from "./dayModel"; +import type { CalendarDayImage, CalendarDaySummary } from "./dayModel"; import { buildCalendarPath, getMonthOfDate } from "./paths"; /** Every excerpt line is one sidebar row of type: 13px on an 18px line. */ @@ -21,6 +23,10 @@ const IMAGE_GAP = 4; /** Vertical space the date line and paddings take before any preview can start. */ const HEADER_HEIGHT = 48; const HORIZONTAL_PADDING = 24; +/** The width a full preview needs; from xl the day panel yields so columns keep it while a day is open. */ +export const PREVIEW_MIN_CELL_WIDTH = 100; +/** Narrower cells, which only a wide sidebar beside the open panel produces, get a mark instead of a preview. */ +const SLIM_MIN_CELL_WIDTH = 64; export interface CalendarCellLayout { /** Excerpt lines when the day has no photo strip. */ @@ -29,18 +35,30 @@ export interface CalendarCellLayout { textLinesWithImages: number; /** Photo marks that fit across; 0 when the cell is too narrow or short for a strip. */ imageCount: number; + /** Below preview width: tighter padding, a shorter excerpt and one photo, rather than no preview. */ + slim: boolean; + /** No preview fits (phones, or under slim width): a single mark under the date says what the day holds. */ + mark: boolean; } /** Use the actual cell size, including width lost to the resizable day panel. */ export const layoutForCellSize = (width: number, height: number): CalendarCellLayout => { - // Too narrow for previews: the date carries the day on its own. - const compact = width < 100; + // Too narrow for any preview: a mark under the date carries the day. + const compact = width < SLIM_MIN_CELL_WIDTH; + const slim = !compact && width < PREVIEW_MIN_CELL_WIDTH; const available = Math.max(0, height - HEADER_HEIGHT); const showImages = !compact && available >= IMAGE_SIZE; + const mark = compact || (!showImages && available < LINE_HEIGHT); return { - textLines: compact ? 0 : Math.min(3, Math.floor(available / LINE_HEIGHT)), - textLinesWithImages: showImages ? Math.min(2, Math.floor((available - IMAGE_SIZE - IMAGE_GAP) / LINE_HEIGHT)) : 0, - imageCount: showImages ? Math.min(3, Math.max(1, Math.floor((width - HORIZONTAL_PADDING + IMAGE_GAP) / (IMAGE_SIZE + IMAGE_GAP)))) : 0, + textLines: compact ? 0 : Math.min(slim ? 2 : 3, Math.floor(available / LINE_HEIGHT)), + textLinesWithImages: showImages ? Math.min(slim ? 1 : 2, Math.floor((available - IMAGE_SIZE - IMAGE_GAP) / LINE_HEIGHT)) : 0, + imageCount: !showImages + ? 0 + : slim + ? 1 + : Math.min(3, Math.max(1, Math.floor((width - HORIZONTAL_PADDING + IMAGE_GAP) / (IMAGE_SIZE + IMAGE_GAP)))), + slim, + mark, }; }; @@ -53,6 +71,8 @@ export interface CalendarDayCellProps { /** The month's memos are still loading; `day.count` from statistics is all we know. */ pending: boolean; timeBasis: MemoTimeBasis; + /** Several creators share the grid, so each excerpt leads with its author's avatar. */ + showAuthor: boolean; tabIndex: number; isLastColumn: boolean; isLastRow: boolean; @@ -82,16 +102,66 @@ const getNumeralClass = (day: CalendarDayCellData, count: number): string => { }; const NO_IMAGES: CalendarDaySummary["images"] = []; +const NO_CREATORS: string[] = []; +/** Two 14px avatars side by side fit the narrowest phone column. */ +const MARK_AUTHORS = 2; /** - * One day, one excerpt, and a strip of photos. The entire cell opens the day's memo stream. + * What a cell too small for a preview shows under its date, in order: the day's first photo; + * else who wrote, when several creators share the grid; else a glyph of written lines. The + * heat tint still carries how much. + */ +const DayMark = ({ + photo, + authorNames, + onImageError, +}: { + photo?: CalendarDayImage; + /** Empty in a single creator's scope, or when the photo already marks the day. */ + authorNames: string[]; + onImageError: (url: string) => void; +}) => { + const authors = useResolvedUsersByNames(authorNames); + if (photo) { + return ( + onImageError(photo.thumbnailUrl)} + /> + ); + } + if (authorNames.length > 0) { + return ( + + {authorNames.map((name) => { + const user = authors.get(name); + return ; + })} + + ); + } + return ( + + + + + ); +}; + +/** + * One day, one excerpt, and a strip of photos; a single mark when the cell is too small for + * them. The entire cell opens the day's memo stream. * * The cell borrows the sidebar's row grammar: the date and every excerpt line are 13px type * on the column's text axis, weight is reserved for the open day, and idle text is muted * and lifts to the foreground under the pointer. */ export const CalendarDayCell = memo( - ({ day, summary, maxCount, layout, pending, timeBasis, tabIndex, isLastColumn, isLastRow, corner }: CalendarDayCellProps) => { + ({ day, summary, maxCount, layout, pending, timeBasis, showAuthor, tabIndex, isLastColumn, isLastRow, corner }: CalendarDayCellProps) => { const t = useTranslate(); const [failedImages, setFailedImages] = useState([]); const count = summary ? summary.memos.length : day.count; @@ -104,6 +174,9 @@ export const CalendarDayCell = memo( const showImages = images.length > 0; const textLines = showImages ? layout.textLinesWithImages : layout.textLines; const excerpt = textLines > 0 ? summary?.excerpt : undefined; + // A photo that failed to load gives way to the next mark rather than an empty square. + const markPhoto = layout.mark ? summary?.images.find((image) => !failedImages.includes(image.thumbnailUrl)) : undefined; + const author = useResolvedUser(excerpt?.creator ?? "", { enabled: showAuthor && Boolean(excerpt) }); const showSkeleton = pending && !summary && day.isCurrentMonth && day.count > 0; const numeral = ( )} + {layout.mark && day.isCurrentMonth && !showSkeleton && summary && ( + + )} + {day.isCurrentMonth && !showSkeleton && (excerpt || showImages) && ( )} diff --git a/web/src/components/CalendarView/CalendarGrid.tsx b/web/src/components/CalendarView/CalendarGrid.tsx index fe96a9505..57bf7b37d 100644 --- a/web/src/components/CalendarView/CalendarGrid.tsx +++ b/web/src/components/CalendarView/CalendarGrid.tsx @@ -24,8 +24,10 @@ export interface CalendarGridProps { model: CalendarMonthModel; pending: boolean; selectedDate?: string; - /** Below md the compact calendar shows tinted dates only, with the stream beneath. */ + /** Below md the compact calendar shows tinted dates with a mark each, with the stream beneath. */ showRows: boolean; + /** No single creator is selected, so previews carry their author. */ + showAuthors: boolean; } const KEY_DELTAS: Record = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -DAYS_IN_WEEK, ArrowDown: DAYS_IN_WEEK }; @@ -38,7 +40,17 @@ const cornerOf = (index: number, total: number): "ss" | "se" | "es" | "ee" | und return undefined; }; -export const CalendarGrid = ({ month, monthLabel, today, counts, model, pending, selectedDate, showRows }: CalendarGridProps) => { +export const CalendarGrid = ({ + month, + monthLabel, + today, + counts, + model, + pending, + selectedDate, + showRows, + showAuthors, +}: CalendarGridProps) => { const direction = useDirection(); const { generalSetting } = useInstance(); const { timeBasis } = useView(); @@ -115,6 +127,7 @@ export const CalendarGrid = ({ month, monthLabel, today, counts, model, pending, layout={layout} pending={pending} timeBasis={timeBasis} + showAuthor={showAuthors} tabIndex={day.date === focusDate ? 0 : -1} isLastColumn={index % DAYS_IN_WEEK === DAYS_IN_WEEK - 1} isLastRow={index >= days.length - DAYS_IN_WEEK} diff --git a/web/src/components/CalendarView/CalendarView.tsx b/web/src/components/CalendarView/CalendarView.tsx index 9bd4f678f..f5930583a 100644 --- a/web/src/components/CalendarView/CalendarView.tsx +++ b/web/src/components/CalendarView/CalendarView.tsx @@ -1,6 +1,7 @@ import { useCallback, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { useLocation, useNavigate } from "react-router-dom"; +import { MentionResolutionProvider } from "@/components/MemoContent/MentionResolutionContext"; import { deriveDefaultCreateTimeFromDate } from "@/components/MemoEditor/utils/deriveDefaultCreateTime"; import { MEMO_PANEL_INSET, MEMO_PANEL_TITLE_CLASS, MEMO_PANEL_WIDTH_CSS, MemoPanel, MemoPanelList } from "@/components/MemoPanel"; import MemoListError from "@/components/PagedMemoList/MemoListError"; @@ -17,14 +18,21 @@ import { isMemoBlurred } from "@/lib/tag"; import { collectionPathForLocation } from "@/router/routes"; import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; +import { PREVIEW_MIN_CELL_WIDTH } from "./CalendarDayCell"; import { CalendarGrid } from "./CalendarGrid"; import { CalendarHeader } from "./CalendarHeader"; import { buildCalendarPath, getDefaultDate } from "./paths"; import { useMonthMemos } from "./useMonthMemos"; const NO_MEMOS: Memo[] = []; -/** Page padding plus seven legible 72px columns. */ -const RESERVED_BESIDE_PANEL = 48 + 7 * 72; +const NO_CONTENTS: string[] = []; +/** + * What the pushed grid keeps beside the panel: page padding, the grid's 2px border and seven + * preview-wide columns. The panel already subtracts both of its insets but the push leaves only + * one as a gap, so one comes back off. A persisted card wider than this yields for as long as + * the window is narrow, down to its minimum. + */ +export const RESERVED_BESIDE_PANEL = 48 + 2 + 7 * PREVIEW_MIN_CELL_WIDTH - MEMO_PANEL_INSET; export interface CalendarViewProps { /** `YYYY-MM` */ @@ -38,10 +46,10 @@ export interface CalendarViewProps { * Month and day both live in the URL; this component only reads them and renders. * * The open day has two homes. From md it is the floating memo panel at the end edge; at xl - * the grid gives way to it so every column stays legible, below xl it floats over the - * trailing columns. Below md the grid is compact and the day's list sits under it, the way - * phone calendars work, so a day is always shown there: today in the current month, - * otherwise the first of the month, until the URL names one. + * the grid gives way to it and the card narrows so every column keeps its preview, below xl + * it floats over the trailing columns. Below md the grid is compact and the day's list sits + * under it, the way phone calendars work, so a day is always shown there: today in the + * current month, otherwise the first of the month, until the URL names one. */ export const CalendarView = ({ month, date }: CalendarViewProps) => { const t = useTranslate(); @@ -101,13 +109,21 @@ export const CalendarView = ({ month, date }: CalendarViewProps) => { const [saving, setSaving] = useState(false); const panelOpen = Boolean(date) && md; + const showAuthors = !creatorUsername; + const authorNames = useMemo( + () => (showAuthors ? Array.from(new Set(Object.values(model).flatMap((day) => day.creators))) : []), + [model, showAuthors], + ); + + const canCompose = Boolean(user && (!creatorUsername || creatorUsername === user.username)); const list = activeDate && ( { style={{ paddingInlineEnd: xl && panelOpen ? `calc(${MEMO_PANEL_WIDTH_CSS} + ${MEMO_PANEL_INSET}px)` : undefined }} > - + + + {error && } {isEmptyMonth && md && (

diff --git a/web/src/components/CalendarView/dayModel.ts b/web/src/components/CalendarView/dayModel.ts index 74384ac73..69948f265 100644 --- a/web/src/components/CalendarView/dayModel.ts +++ b/web/src/components/CalendarView/dayModel.ts @@ -19,6 +19,8 @@ import { classifyManagedAttachmentImageURL, extractAttachmentUIDFromName } from export interface CalendarDayExcerpt { memoName: string; + /** The memo's creator, so a mixed-author scope can attribute the preview. */ + creator: string; text: string; isCode: boolean; } @@ -31,6 +33,8 @@ export interface CalendarDayImage { export interface CalendarDaySummary { /** Every memo, including hidden ones, in chronological order for the day panel. */ memos: Memo[]; + /** Each creator once, in the order they first wrote that day; a hidden memo still names its author. */ + creators: string[]; excerpt?: CalendarDayExcerpt; /** At most one image per memo, from the first two eligible image-bearing memos. */ images: CalendarDayImage[]; @@ -61,7 +65,12 @@ const getExcerpt = (memo: Memo, tree: Root): CalendarDayExcerpt | undefined => { .join("\n") .trim() || (!memo.content.trim() ? memo.snippet.trim() : ""); if (!text) return undefined; - return { memoName: memo.name, text: text.length > 280 ? `${text.slice(0, 280).trimEnd()}…` : text, isCode: readable[0]?.isCode ?? false }; + return { + memoName: memo.name, + creator: memo.creator, + text: text.length > 280 ? `${text.slice(0, 280).trimEnd()}…` : text, + isCode: readable[0]?.isCode ?? false, + }; }; // Resolve reference-style images and apply the same src sanitization as the body renderer. @@ -102,6 +111,17 @@ const getImageCandidates = (memo: Memo, tree: Root): string[] => { return candidates; }; +const parseMarkdown = (content: string): Root => fromMarkdown(content, { extensions: [gfm()], mdastExtensions: [gfmFromMarkdown()] }); + +/** + * The thumbnail of a memo's first photo, chosen the way a calendar day chooses its photos: + * Markdown images in reading order, then image attachments. Content with neither is not parsed. + */ +export const getMemoThumbnail = (memo: Memo): string | undefined => { + if (!memo.content.includes("![") && !memo.attachments.some((attachment) => isImage(attachment.type))) return undefined; + return getImageCandidates(memo, parseMarkdown(memo.content))[0]; +}; + /** Fold the month into stable day snapshots, independent of API pagination/order. */ export const buildCalendarMonthModel = ( memos: Memo[], @@ -117,17 +137,15 @@ export const buildCalendarMonthModel = ( const fileFallbacks = new Map(); for (const { memo, time } of dated) { const date = dayjs(time).format(ISO_DATE_FORMAT); - const summary = (model[date] ??= { memos: [], images: [] }); + const summary = (model[date] ??= { memos: [], creators: [], images: [] }); summary.memos.push(memo); + if (!summary.creators.includes(memo.creator)) summary.creators.push(memo.creator); if (isRedacted?.(memo)) continue; - const tree = - !summary.excerpt || summary.images.length < 2 - ? fromMarkdown(memo.content, { extensions: [gfm()], mdastExtensions: [gfmFromMarkdown()] }) - : undefined; + const tree = !summary.excerpt || summary.images.length < 2 ? parseMarkdown(memo.content) : undefined; if (!summary.excerpt && tree) summary.excerpt = getExcerpt(memo, tree); if (!fileFallbacks.has(date)) { const file = memo.attachments.find((attachment) => !isImage(attachment.type) && !attachment.motionMedia?.groupId); - if (file?.filename) fileFallbacks.set(date, { memoName: memo.name, text: file.filename, isCode: false }); + if (file?.filename) fileFallbacks.set(date, { memoName: memo.name, creator: memo.creator, text: file.filename, isCode: false }); } if (summary.images.length >= 2 || !tree) continue; const usedImages = new Set(summary.images.map((image) => imageKey(image.thumbnailUrl))); diff --git a/web/src/components/MapView/MapCanvas.tsx b/web/src/components/MapView/MapCanvas.tsx index 6ecea3d61..1c0a2bf2d 100644 --- a/web/src/components/MapView/MapCanvas.tsx +++ b/web/src/components/MapView/MapCanvas.tsx @@ -2,16 +2,21 @@ import L from "leaflet"; import "leaflet/dist/leaflet.css"; import "leaflet.markercluster/dist/MarkerCluster.css"; import { useEffect, useMemo, useRef } from "react"; +import ReactDOMServer from "react-dom/server"; import { MapContainer, Marker, useMapEvents } from "react-leaflet"; import MarkerClusterGroup from "react-leaflet-cluster"; import { getLocationDisplayText } from "@/components/MemoMetadata/Location/locationHelpers"; import { BasemapLayer } from "@/components/map/BasemapLayer"; import { createMarkerIcon, MinimalAttributionControl } from "@/components/map/map-utils"; +import UserAvatar from "@/components/UserAvatar"; +import { cn } from "@/lib/utils"; import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; -import { type MapViewport, revealOffset } from "./model"; +import { type MapPin, type MapPinFace, type MapViewport, revealOffset } from "./model"; interface Props { memos: Memo[]; + /** Each memo's face and label by name; a memo without one shows the plain dot and its place. */ + pins: ReadonlyMap; selected: string[]; viewport?: MapViewport; complete: boolean; @@ -28,6 +33,37 @@ interface Props { // Positron's own city dots are 4px black; ours are bigger, colored and white-edged so they never blend in. const markerIcon = createMarkerIcon({ size: 22, dot: 16 }); const selectedIcon = createMarkerIcon({ size: 36, dot: 20, halo: true }); +const FACE_EDGE = "border-2 border-white shadow-[0_1px_4px_rgba(15,23,42,0.4)]"; + +/** + * A photo or avatar pin, the calendar cell's marks at map scale: a rounded photo square or a + * round avatar, white-edged like the dot so it never blends into the basemap. Selection grows + * it and adds the dot's translucent halo. A photo that fails to load leaves the primary fill. + */ +const createFaceIcon = (face: Exclude, selected: boolean): L.DivIcon => { + const box = selected ? 40 : 28; + const side = selected ? 30 : 24; + const html = ReactDOMServer.renderToString( +

, + ); + return L.divIcon({ html, className: "", iconSize: [box, box], iconAnchor: [box / 2, box / 2] }); +}; + +const faceKey = (face: MapPinFace): string => + face.kind === "photo" ? `photo:${face.url}` : face.kind === "author" ? `author:${face.avatarUrl ?? ""}:${face.name ?? ""}` : "dot"; export function fitMemos(map: L.Map, memos: Memo[]) { if (memos.length) @@ -89,19 +125,46 @@ function MapBehavior(props: Props) { return null; } -function Markers({ memos, selected, onSelect }: Pick) { +function Markers({ memos, pins, selected, onSelect }: Pick) { const names = useRef(new WeakMap()); + const markers = useRef(new Map()); const selection = useMemo(() => new Set(selected), [selected]); // Identity-stable positions: a fresh tuple per render would make every marker re-enter the cluster tree. const points = useMemo( () => - memos.map((memo) => ({ - memo, - position: [memo.location!.latitude, memo.location!.longitude] as [number, number], - label: getLocationDisplayText(memo.location!), - })), - [memos], + memos.map((memo) => { + const pin = pins.get(memo.name); + return { + memo, + position: [memo.location!.latitude, memo.location!.longitude] as [number, number], + face: pin?.face ?? { kind: "dot" as const }, + label: pin?.label ?? getLocationDisplayText(memo.location!), + }; + }), + [memos, pins], ); + // One icon per face and state, so a selection change swaps two icons rather than rebuilding every pin. + const icons = useRef(new Map()); + const iconFor = (face: MapPinFace, isSelected: boolean): L.DivIcon => { + if (face.kind === "dot") return isSelected ? selectedIcon : markerIcon; + const key = `${faceKey(face)}:${isSelected}`; + let icon = icons.current.get(key); + if (!icon) { + icon = createFaceIcon(face, isSelected); + icons.current.set(key, icon); + } + return icon; + }; + // Leaflet reads a marker's title only when it is created, and authors resolve after the pins + // first draw, so a changed label is written to the live marker and to what a re-added one reads. + useEffect(() => { + for (const { memo, label } of points) { + const marker = markers.current.get(memo.name); + if (!marker || marker.options.title === label) continue; + marker.options.title = label; + marker.getElement()?.setAttribute("title", label); + } + }, [points]); const clusterGroup = useRef<{ refreshClusters(): void } | null>(null); useEffect(() => { clusterGroup.current?.refreshClusters(); @@ -135,14 +198,17 @@ function Markers({ memos, selected, onSelect }: Pick - {points.map(({ memo, position, label }) => ( + {points.map(({ memo, position, face, label }) => ( { - if (marker) names.current.set(marker, memo.name); + if (marker) { + names.current.set(marker, memo.name); + markers.current.set(memo.name, marker); + } else markers.current.delete(memo.name); }} position={position} - icon={selection.has(memo.name) ? selectedIcon : markerIcon} + icon={iconFor(face, selection.has(memo.name))} zIndexOffset={selection.has(memo.name) ? 1000 : 0} title={label} alt={label} @@ -168,7 +234,7 @@ export function MapCanvas(props: Props) { - + ); } diff --git a/web/src/components/MapView/MapView.tsx b/web/src/components/MapView/MapView.tsx index 2c7f7ebc2..ce6074890 100644 --- a/web/src/components/MapView/MapView.tsx +++ b/web/src/components/MapView/MapView.tsx @@ -4,7 +4,7 @@ import { CrosshairIcon, MinusIcon, PlusIcon } from "lucide-react"; import { type CSSProperties, useCallback, useEffect, useMemo, useRef, useState } from "react"; import { toast } from "react-hot-toast"; import { useLocation, useNavigate } from "react-router-dom"; -import { getLocationDisplayText } from "@/components/MemoMetadata/Location/locationHelpers"; +import { getLocationCoordinatesText } from "@/components/MemoMetadata/Location/locationHelpers"; import { MEMO_PANEL_INSET, MEMO_PANEL_WIDTH_CSS, MemoPanel, MemoPanelList, type MemoPanelSize } from "@/components/MemoPanel"; import { createMemoNavigationState } from "@/components/MemoView/navigation"; import { Button, buttonVariants } from "@/components/ui/button"; @@ -16,8 +16,9 @@ import { cn } from "@/lib/utils"; import { LocationSchema } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { fitMemos, MapCanvas } from "./MapCanvas"; -import { locationKey, type MapViewport, readViewport, splitLabel } from "./model"; +import { locationKey, type MapViewport, pointLabel, readViewport, splitLabel } from "./model"; import { useMapMemos } from "./useMapMemos"; +import { useMapPins } from "./useMapPins"; /** Enough map beside the card to keep a selection visible. */ const RESERVED_BESIDE_PANEL = 160; @@ -33,6 +34,7 @@ export function MapView() { const user = useCurrentUser(); const { filters, removeFilter } = useMemoFilterContext(); const query = useMapMemos(); + const pins = useMapPins(query.memos, !creatorUsername); const mapRef = useRef(null); const [panelSize, setPanelSize] = useState({ width: 0, height: 0 }); // Only a real change may re-render the map tree. @@ -111,16 +113,20 @@ export function MapView() { }, true); } }, [query.complete, query.memos, selected, updateQuery]); + // A place label is its author's words: the title uses one only when it speaks for every memo + // there, and a new memo only inherits the writer's own label, never someone else's. + const sharedLabel = singlePoint ? pointLabel(selectedMemos) : ""; + const ownLabel = singlePoint && user ? pointLabel(selectedMemos.filter((memo) => memo.creator === user.name)) : ""; const composeLocation = useMemo( () => singlePoint ? create(LocationSchema, { latitude: singlePoint.latitude, longitude: singlePoint.longitude, - placeholder: getLocationDisplayText(singlePoint), + placeholder: ownLabel || getLocationCoordinatesText(singlePoint), }) : undefined, - [singlePoint], + [singlePoint, ownLabel], ); const afterSave = async (name: string) => { setSaving(false); @@ -147,7 +153,11 @@ export function MapView() { { duration: 8000 }, ); }; - const heading = singlePoint ? splitLabel(getLocationDisplayText(singlePoint)) : { title: t("map.selection") }; + const heading = !singlePoint + ? { title: t("map.selection") } + : sharedLabel + ? splitLabel(sharedLabel) + : { title: getLocationCoordinatesText(singlePoint) }; // Floating surfaces let the basemap show through, the way Notion's and Linear's overlays do. const surfaceClass = "rounded-lg border border-border/60 bg-background/85 shadow-xs backdrop-blur-md"; // The calendar's 28px quiet square, a touch more on phones. @@ -167,6 +177,7 @@ export function MapView() { >

{t(filters.length ? "map.no-results" : "map.empty")}

-

{t(filters.length ? "map.no-results-hint" : "map.empty-hint")}

+ {/* Guests cannot add a location, so only filters get a hint for them. */} + {(filters.length > 0 || user) && ( +

{t(filters.length ? "map.no-results-hint" : "map.empty-hint")}

+ )} {filters.length > 0 && (