feat(web): make calendar and map readable with several authors

Explore and other creator-less scopes mix authors, but the calendar and
map were built for one person's memos.

Calendar:
- Excerpts lead with their author's avatar when no creator is selected.
- From xl the grid always makes room for the day panel instead of being
  covered; the panel narrows (to its 320px minimum) so columns keep
  preview width, and cells between 64 and 100px use a slim preview.
- Cells with no room for a preview (phones) carry one mark under the
  date: the first photo, else the day's authors in a mixed scope, else a
  glyph of written lines.

Map:
- Pins follow the calendar's mark order: the memo's first photo, else
  its author's avatar in a mixed scope, else the dot. Hover text names
  the author, and updates once authors resolve.
- A place label is its author's words: the panel title uses one only
  when it speaks for every selected memo, and "Write here" never copies
  another author's label into a new memo.
- Guests are not asked to add a location, and the tile error no longer
  says "your memos".

Shared day/place panel: pin marks only in a single creator's scope,
creators resolved in one batch, and an empty day says so.
This commit is contained in:
johnnyjoygh
2026-09-27 10:01:07 +08:00
parent 0c53b775ce
commit 65d2278a2e
61 changed files with 842 additions and 121 deletions
@@ -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 (
<img
src={photo.thumbnailUrl}
alt=""
loading="lazy"
decoding="async"
className="size-4 shrink-0 rounded-[3px] object-cover"
onError={() => onImageError(photo.thumbnailUrl)}
/>
);
}
if (authorNames.length > 0) {
return (
<span className="flex gap-0.5">
{authorNames.map((name) => {
const user = authors.get(name);
return <UserAvatar key={name} className="size-3.5" avatarUrl={user?.avatarUrl} name={user?.displayName || user?.username} />;
})}
</span>
);
}
return (
<span className="flex flex-col gap-[3px] text-muted-foreground/45 transition-colors group-hover/day:text-muted-foreground">
<span className="h-0.5 w-4 rounded-full bg-current" />
<span className="h-0.5 w-2.5 rounded-full bg-current" />
</span>
);
};
/**
* 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<string[]>([]);
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 = (
<span
@@ -126,6 +199,7 @@ export const CalendarDayCell = memo(
aria-current={day.isSelected ? "page" : undefined}
className={cn(
"group/day relative flex min-h-14 min-w-0 flex-col overflow-hidden border-border/70 px-1.5 py-2 text-start no-underline transition-colors sm:px-3 sm:min-h-20 md:min-h-[5.5rem]",
layout.slim && "sm:px-2",
!isLastColumn && "border-e",
!isLastRow && "border-b",
corner && CORNER_CLASSES[corner],
@@ -145,6 +219,16 @@ export const CalendarDayCell = memo(
</span>
)}
{layout.mark && day.isCurrentMonth && !showSkeleton && summary && (
<span aria-hidden="true" className="flex h-4 shrink-0 items-center">
<DayMark
photo={markPhoto}
authorNames={showAuthor && !markPhoto ? summary.creators.slice(0, MARK_AUTHORS) : NO_CREATORS}
onImageError={(url) => setFailedImages((failed) => [...failed, url])}
/>
</span>
)}
{day.isCurrentMonth && !showSkeleton && (excerpt || showImages) && (
<span aria-hidden="true" className="mt-1 flex min-w-0 flex-col gap-1">
{excerpt && (
@@ -157,6 +241,14 @@ export const CalendarDayCell = memo(
)}
style={{ WebkitLineClamp: textLines }}
>
{/* Inline, so the avatar sits on the first line and the clamp still counts lines. */}
{showAuthor && (
<UserAvatar
className="me-1.5 inline-flex size-3.5 align-[-2px]"
avatarUrl={author?.avatarUrl}
name={author?.displayName || author?.username}
/>
)}
{excerpt.text}
</span>
)}
@@ -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<string, number> = { 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}
@@ -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 && (
<MemoPanelList
memos={activeMemos}
selectionKey={activeDate}
timeDisplay="time"
emptyText={canCompose ? undefined : t("calendar.no-memos-on-day")}
compose={
user && (!creatorUsername || creatorUsername === user.username)
canCompose
? {
cacheKey: `calendar-day-editor:${activeDate}`,
label: t("calendar.new-memo-on-day"),
@@ -132,16 +148,19 @@ export const CalendarView = ({ month, date }: CalendarViewProps) => {
style={{ paddingInlineEnd: xl && panelOpen ? `calc(${MEMO_PANEL_WIDTH_CSS} + ${MEMO_PANEL_INSET}px)` : undefined }}
>
<CalendarHeader month={month} monthLabel={monthLabel} today={today} activeDate={activeDate} closable={md} />
<CalendarGrid
month={month}
monthLabel={monthLabel}
today={today}
counts={statistics.activityStats}
model={model}
pending={isLoading}
selectedDate={activeDate}
showRows={md}
/>
<MentionResolutionProvider contents={NO_CONTENTS} userNames={authorNames}>
<CalendarGrid
month={month}
monthLabel={monthLabel}
today={today}
counts={statistics.activityStats}
model={model}
pending={isLoading}
selectedDate={activeDate}
showRows={md}
showAuthors={showAuthors}
/>
</MentionResolutionProvider>
{error && <MemoListError error={error} onRetry={refetch} />}
{isEmptyMonth && md && (
<p className="mt-2 shrink-0 text-center text-ui text-muted-foreground">
+25 -7
View File
@@ -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<string, CalendarDayExcerpt>();
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)));
+78 -12
View File
@@ -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<string, MapPin>;
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<MapPinFace, { kind: "dot" }>, selected: boolean): L.DivIcon => {
const box = selected ? 40 : 28;
const side = selected ? 30 : 24;
const html = ReactDOMServer.renderToString(
<div
aria-hidden="true"
className={cn("grid place-items-center", selected && "bg-primary/20", face.kind === "photo" ? "rounded-[11px]" : "rounded-full")}
style={{ width: box, height: box }}
>
{face.kind === "photo" ? (
<span
className={cn("block rounded-md bg-primary bg-cover bg-center", FACE_EDGE)}
style={{ width: side, height: side, backgroundImage: `url(${JSON.stringify(face.url)})` }}
/>
) : (
<UserAvatar className={cn(FACE_EDGE, selected ? "size-[30px]" : "size-6")} avatarUrl={face.avatarUrl} name={face.name} />
)}
</div>,
);
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<Props, "memos" | "selected" | "onSelect">) {
function Markers({ memos, pins, selected, onSelect }: Pick<Props, "memos" | "pins" | "selected" | "onSelect">) {
const names = useRef(new WeakMap<L.Marker, string>());
const markers = useRef(new Map<string, L.Marker>());
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<string, L.DivIcon>());
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<Props, "memos" | "selected"
);
}}
>
{points.map(({ memo, position, label }) => (
{points.map(({ memo, position, face, label }) => (
<Marker
key={memo.name}
ref={(marker) => {
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) {
<BasemapLayer onTileError={props.onTileError} />
<MinimalAttributionControl />
<MapBehavior {...props} />
<Markers memos={props.memos} selected={props.selected} onSelect={props.onSelect} />
<Markers memos={props.memos} pins={props.pins} selected={props.selected} onSelect={props.onSelect} />
</MapContainer>
);
}
+20 -6
View File
@@ -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<L.Map | null>(null);
const [panelSize, setPanelSize] = useState<MemoPanelSize>({ 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() {
>
<MapCanvas
memos={query.memos}
pins={pins}
selected={selected}
viewport={viewport}
complete={query.complete}
@@ -266,7 +277,10 @@ export function MapView() {
<div className="pointer-events-none absolute inset-0 flex items-center justify-center p-8">
<div className={cn("pointer-events-auto max-w-sm rounded-xl p-5 text-center", surfaceClass)}>
<h2 className="font-medium">{t(filters.length ? "map.no-results" : "map.empty")}</h2>
<p className="mt-2 text-sm text-muted-foreground">{t(filters.length ? "map.no-results-hint" : "map.empty-hint")}</p>
{/* Guests cannot add a location, so only filters get a hint for them. */}
{(filters.length > 0 || user) && (
<p className="mt-2 text-sm text-muted-foreground">{t(filters.length ? "map.no-results-hint" : "map.empty-hint")}</p>
)}
{filters.length > 0 && (
<Button className="mt-4" variant="outline" onClick={() => removeFilter(() => true)}>
{t("map.clear-filters")}
+31
View File
@@ -34,6 +34,37 @@ export function mapMemos(pages: { memos: Memo[] }[] | undefined, timeBasis: Memo
.sort((a, b) => time(b) - time(a) || a.name.localeCompare(b.name));
}
/**
* What a pin shows, in the calendar cell's mark order: the memo's first photo; else its author,
* when several creators share the map; else the plain dot.
*/
export type MapPinFace = { kind: "photo"; url: string } | { kind: "author"; avatarUrl?: string; name?: string } | { kind: "dot" };
export interface MapPin {
face: MapPinFace;
/** The pin's tooltip and accessible name: the place, and its author when several share the map. */
label: string;
}
/** `photo` is undefined for a hidden memo, which never shows its images; `author` only when several creators share the map. */
export function pinFace(photo: string | undefined, author: { avatarUrl?: string; name?: string } | undefined): MapPinFace {
if (photo) return { kind: "photo", url: photo };
if (author) return { kind: "author", avatarUrl: author.avatarUrl || undefined, name: author.name };
return { kind: "dot" };
}
/**
* The label a selection at one point may be titled and written with. A place label is its
* author's own words, so it only speaks for memos by that author, or for several authors who
* all used it; otherwise there is none and the coordinates stand in. `memos` is newest first.
*/
export function pointLabel(memos: Memo[]): string {
const labels = new Set(memos.map((memo) => memo.location?.placeholder.trim() ?? ""));
const creators = new Set(memos.map((memo) => memo.creator));
if (creators.size === 1) return memos[0]?.location?.placeholder.trim() ?? "";
return labels.size === 1 ? [...labels][0] : "";
}
export function readViewport(search: string): MapViewport | undefined {
const params = new URLSearchParams(search);
const values = ["lat", "lng", "zoom"].map((key) => params.get(key));
+40
View File
@@ -0,0 +1,40 @@
import { useMemo } from "react";
import { getMemoThumbnail } from "@/components/CalendarView/dayModel";
import { getLocationDisplayText } from "@/components/MemoMetadata/Location/locationHelpers";
import { useAuth } from "@/contexts/AuthContext";
import { useUsersByUsernames } from "@/hooks/useUserQueries";
import { extractUsernameFromName } from "@/lib/resource-names";
import { isMemoBlurred } from "@/lib/tag";
import type { Memo } from "@/types/proto/api/v1/memo_service_pb";
import { type MapPin, pinFace } from "./model";
/**
* Each memo's pin, keyed by memo name. Photos are found once per memo list; authors are resolved
* in one batch, and only when no single creator is selected.
*/
export function useMapPins(memos: Memo[], showAuthors: boolean): ReadonlyMap<string, MapPin> {
const { userTagsSetting } = useAuth();
const photos = useMemo(
() => new Map(memos.map((memo) => [memo.name, isMemoBlurred(memo, userTagsSetting) ? undefined : getMemoThumbnail(memo)])),
[memos, userTagsSetting],
);
const usernames = useMemo(
() => (showAuthors ? Array.from(new Set(memos.map((memo) => extractUsernameFromName(memo.creator)))) : []),
[memos, showAuthors],
);
const { data: usersByUsername } = useUsersByUsernames(usernames);
return useMemo(() => {
const pins = new Map<string, MapPin>();
for (const memo of memos) {
const place = getLocationDisplayText(memo.location!);
const user = showAuthors ? usersByUsername?.get(extractUsernameFromName(memo.creator)) : undefined;
const name = user?.displayName || user?.username;
pins.set(memo.name, {
face: pinFace(photos.get(memo.name), showAuthors ? { avatarUrl: user?.avatarUrl, name } : undefined),
label: name ? `${place} · ${name}` : place,
});
}
return pins;
}, [memos, photos, showAuthors, usersByUsername]);
}
+10 -4
View File
@@ -62,9 +62,14 @@ export function MemoPanelList({ memos, selectionKey, timeDisplay, emptyText, com
}, [composing, onComposingChange]);
const contents = useMemo(() => memos.map((memo) => memo.content), [memos]);
// A mixed-author selection shows each card's creator; resolve them with the reactors in one batch.
const showCreator = !creatorUsername;
const userNames = useMemo(
() => Array.from(new Set(memos.flatMap((memo) => memo.reactions.map((reaction) => reaction.creator)))),
[memos],
() =>
Array.from(
new Set(memos.flatMap((memo) => [...(showCreator ? [memo.creator] : []), ...memo.reactions.map((reaction) => reaction.creator)])),
),
[memos, showCreator],
);
return (
@@ -75,9 +80,10 @@ export function MemoPanelList({ memos, selectionKey, timeDisplay, emptyText, com
key={memo.name}
memo={memo}
timeDisplay={timeDisplay}
showCreator={!creatorUsername}
showCreator={showCreator}
showVisibility
showPinned
// Pinning is the owner's arrangement, so it only shows in a single creator's scope, as on Home.
showPinned={!showCreator}
showSpace={!selectedSpaceName}
compact={compactMode}
/>
+2 -1
View File
@@ -941,7 +941,7 @@
"zoom-in": "تكبير",
"zoom-out": "تصغير",
"load-error": "تعذر تحميل جميع المذكرات.",
"tile-error": "تعذر تحميل الخريطة. مذكراتك لا تزال متاحة.",
"tile-error": "تعذر تحميل الخريطة. لا تزال المذكرات متاحة.",
"empty": "لا توجد مذكرات بموقع محدد حتى الآن.",
"empty-hint": "أضف موقعًا إلى مذكرة لعرضها هنا.",
"no-results": "لا توجد مذكرات مطابقة.",
@@ -956,6 +956,7 @@
"new-memo-on-day": "مذكرة جديدة في هذا اليوم",
"next-year": "العام القادم",
"no-memos-in-month": "لا توجد مذكرات في {{month}}",
"no-memos-on-day": "لا توجد مذكرات في هذا اليوم",
"previous-year": "العام الماضي",
"select-month": "اختر الشهر"
},
+2 -1
View File
@@ -6,7 +6,7 @@
"zoom-in": "Yaxınlaşdır",
"zoom-out": "Uzaqlaşdır",
"load-error": "Bütün qeydləri yükləmək mümkün olmadı.",
"tile-error": "Xəritə yüklənmədi. Qeydləriniz hələ də əlçatandır.",
"tile-error": "Xəritə yüklənmədi. Qeydlər hələ də əlçatandır.",
"empty": "Hələ məkanı olan qeyd yoxdur",
"empty-hint": "Qeydi burada görmək üçün ona məkan əlavə edin.",
"no-results": "Uyğun qeyd yoxdur",
@@ -66,6 +66,7 @@
"new-memo-on-day": "Bu gün üçün yeni qeyd",
"next-year": "Növbəti il",
"no-memos-in-month": "{{month}} ayında qeyd yoxdur",
"no-memos-on-day": "Bu gün qeyd yoxdur",
"previous-year": "Əvvəlki il",
"select-month": "Ay seç"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Увеличаване",
"zoom-out": "Намаляване",
"load-error": "Не можаха да се заредят всички бележки.",
"tile-error": "Картата не можа да се зареди. Вашите бележки все още са налични.",
"tile-error": "Картата не можа да се зареди. Бележките все още са налични.",
"empty": "Все още няма бележки с местоположение",
"empty-hint": "Добавете местоположение към бележка, за да я видите тук.",
"no-results": "Няма съответстващи бележки",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Нова бележка на този ден",
"next-year": "Следващата година",
"no-memos-in-month": "Няма бележки в {{month}}",
"no-memos-on-day": "Няма бележки в този ден",
"previous-year": "Предишна година",
"select-month": "Изберете месец"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Apropa",
"zoom-out": "Allunya",
"load-error": "No s'han pogut carregar totes les notes.",
"tile-error": "No s'ha pogut carregar el mapa. Les teves notes encara estan disponibles.",
"tile-error": "No s'ha pogut carregar el mapa. Les notes encara estan disponibles.",
"empty": "Encara no hi ha notes amb una ubicació",
"empty-hint": "Afegeix una ubicació a una nota per veure-la aquí.",
"no-results": "No hi ha notes coincidents",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nova nota en aquest dia",
"next-year": "L'any que ve",
"no-memos-in-month": "No hi ha notes a {{month}}",
"no-memos-on-day": "No hi ha notes aquest dia",
"previous-year": "L'any anterior",
"select-month": "Selecciona el mes"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Přiblížit",
"zoom-out": "Oddálit",
"load-error": "Nelze načíst všechny poznámky.",
"tile-error": "Mapa se nepodařilo načíst. Vaše poznámky jsou stále k dispozici.",
"tile-error": "Mapa se nepodařilo načíst. Poznámky jsou stále k dispozici.",
"empty": "Zatím žádné poznámky s polohou",
"empty-hint": "Přidejte k poznámce polohu, abyste ji zde viděli.",
"no-results": "Žádné odpovídající poznámky",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nová poznámka z tohoto dne",
"next-year": "Příští rok",
"no-memos-in-month": "Žádné poznámky v {{month}}",
"no-memos-on-day": "Žádné poznámky v tento den",
"previous-year": "Předchozí rok",
"select-month": "Vyberte měsíc"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Zoom ind",
"zoom-out": "Zoom ud",
"load-error": "Kunne ikke indlæse alle notater.",
"tile-error": "Kortet kunne ikke indlæses. Dine notater er stadig tilgængelige.",
"tile-error": "Kortet kunne ikke indlæses. Notaterne er stadig tilgængelige.",
"empty": "Ingen notater med en placering endnu",
"empty-hint": "Tilføj en placering til et notat for at se det her.",
"no-results": "Ingen matchende notater",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nyt notat på denne dag",
"next-year": "Næste år",
"no-memos-in-month": "Ingen notater i {{month}}",
"no-memos-on-day": "Ingen notater denne dag",
"previous-year": "Forrige år",
"select-month": "Vælg måned"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Vergrößern",
"zoom-out": "Verkleinern",
"load-error": "Es konnten nicht alle Notizen geladen werden.",
"tile-error": "Die Karte konnte nicht geladen werden. Ihre Notizen sind weiterhin verfügbar.",
"tile-error": "Die Karte konnte nicht geladen werden. Die Notizen sind weiterhin verfügbar.",
"empty": "Noch keine Notizen mit Ortsangabe",
"empty-hint": "Fügen Sie einer Notiz einen Ort hinzu, um ihn hier anzuzeigen.",
"no-results": "Keine passenden Notizen",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Neue Notiz an diesem Tag",
"next-year": "Nächstes Jahr",
"no-memos-in-month": "Keine Notizen in {{month}}",
"no-memos-on-day": "Keine Notizen an diesem Tag",
"previous-year": "Vorheriges Jahr",
"select-month": "Monat auswählen"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Μεγέθυνση",
"zoom-out": "Σμίκρυνση",
"load-error": "Δεν ήταν δυνατή η φόρτωση όλων των σημειωμάτων.",
"tile-error": "Δεν ήταν δυνατή η φόρτωση του χάρτη. Τα σημειώματά σας είναι ακόμα διαθέσιμα.",
"tile-error": "Δεν ήταν δυνατή η φόρτωση του χάρτη. Τα σημειώματα είναι ακόμα διαθέσιμα.",
"empty": "Δεν υπάρχουν σημειώματα με τοποθεσία ακόμα",
"empty-hint": "Προσθέστε μια τοποθεσία σε ένα σημειώμα για να το δείτε εδώ.",
"no-results": "Δεν υπάρχουν σημειώματα που να ταιριάζουν",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Νέο σημείωμα αυτήν την ημέρα",
"next-year": "Επόμενο έτος",
"no-memos-in-month": "Δεν υπάρχουν σημειώματα στο {{month}}",
"no-memos-on-day": "Δεν υπάρχουν σημειώματα αυτήν την ημέρα",
"previous-year": "Προηγούμενο έτος",
"select-month": "Επιλογή μήνα"
},
+2 -1
View File
@@ -913,7 +913,7 @@
"zoom-in": "Zoom in",
"zoom-out": "Zoom out",
"load-error": "Could not load all memos.",
"tile-error": "The map could not load. Your memos are still available.",
"tile-error": "The map could not load. The memos are still available.",
"empty": "No memos with a location yet",
"empty-hint": "Add a location to a memo to see it here.",
"no-results": "No matching memos",
@@ -928,6 +928,7 @@
"new-memo-on-day": "New memo on this day",
"next-year": "Next year",
"no-memos-in-month": "No memos in {{month}}",
"no-memos-on-day": "No memos on this day",
"previous-year": "Previous year",
"select-month": "Select month"
},
+2 -1
View File
@@ -6,7 +6,7 @@
"zoom-in": "Zoom in",
"zoom-out": "Zoom out",
"load-error": "Could not load all memos.",
"tile-error": "The map could not load. Your memos are still available.",
"tile-error": "The map could not load. The memos are still available.",
"empty": "No memos with a location yet",
"empty-hint": "Add a location to a memo to see it here.",
"no-results": "No matching memos",
@@ -66,6 +66,7 @@
"new-memo-on-day": "New memo on this day",
"next-year": "Next year",
"no-memos-in-month": "No memos in {{month}}",
"no-memos-on-day": "No memos on this day",
"previous-year": "Previous year",
"select-month": "Select month"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Acercar",
"zoom-out": "Alejar",
"load-error": "No se pudieron cargar todas las notas.",
"tile-error": "No se pudo cargar el mapa. Tus notas siguen disponibles.",
"tile-error": "No se pudo cargar el mapa. Las notas siguen disponibles.",
"empty": "Aún no hay notas con ubicación",
"empty-hint": "Agrega una ubicación a una nota para verla aquí.",
"no-results": "No hay notas coincidentes",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nuevo memorándum en este día",
"next-year": "El próximo año",
"no-memos-in-month": "No hay memorándums en {{month}}",
"no-memos-on-day": "No hay memorándums este día",
"previous-year": "Año anterior",
"select-month": "Seleccionar mes"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Suumi sisse",
"zoom-out": "Suumi välja",
"load-error": "Kõiki memosid ei saanud laadida.",
"tile-error": "Kaarti ei saanud laadida. Teie memod on endiselt saadaval.",
"tile-error": "Kaarti ei saanud laadida. Memod on endiselt saadaval.",
"empty": "Asukohaga memosid pole veel olemas",
"empty-hint": "Lisage memole asukoht, et seda siin näha.",
"no-results": "Vastavaid memosid pole",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Uus memo sel päeval",
"next-year": "Järgmisel aastal",
"no-memos-in-month": "Memosid pole {{month}}",
"no-memos-on-day": "Sel päeval memosid pole",
"previous-year": "Eelmisel aastal",
"select-month": "Valige kuu"
},
+2 -1
View File
@@ -941,7 +941,7 @@
"zoom-in": "بزرگنمایی",
"zoom-out": "کوچک‌نمایی",
"load-error": "همه یادداشت‌ها بارگذاری نشدند.",
"tile-error": "نقشه بارگذاری نشد. یادداشت‌های شما هنوز در دسترس هستند.",
"tile-error": "نقشه بارگذاری نشد. یادداشت‌ها هنوز در دسترس هستند.",
"empty": "هنوز یادداشتی با موقعیت مکانی وجود ندارد.",
"empty-hint": "برای مشاهده یادداشت در اینجا، مکانی را به آن اضافه کنید.",
"no-results": "یادداشت منطبقی وجود ندارد.",
@@ -956,6 +956,7 @@
"new-memo-on-day": "یادداشت جدید در این روز",
"next-year": "سال آینده",
"no-memos-in-month": "هیچ یادداشتی در {{month}} وجود ندارد",
"no-memos-on-day": "هیچ یادداشتی در این روز وجود ندارد",
"previous-year": "سال قبل",
"select-month": "ماه را انتخاب کنید"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Lähennä",
"zoom-out": "Loitonna",
"load-error": "Kaikkien muistioiden lataaminen epäonnistui.",
"tile-error": "Karttaa ei voitu ladata. Muistionne ovat edelleen saatavilla.",
"tile-error": "Karttaa ei voitu ladata. Muistiot ovat edelleen saatavilla.",
"empty": "Ei vielä muistioita, joilla on sijainti.",
"empty-hint": "Lisää sijainti muistioon nähdäksesi sen tässä.",
"no-results": "Ei vastaavia muistioita.",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Uusi muistio tänä päivänä",
"next-year": "Ensi vuonna",
"no-memos-in-month": "Ei muistioita {{month}}",
"no-memos-on-day": "Ei muistioita tänä päivänä",
"previous-year": "Edellisessä vuodessa",
"select-month": "Valitse kuukausi"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Zoom avant",
"zoom-out": "Zoom arrière",
"load-error": "Impossible de charger tous les mémos.",
"tile-error": "La carte n'a pas pu être chargée. Vos mémos sont toujours disponibles.",
"tile-error": "La carte n'a pas pu être chargée. Les mémos sont toujours disponibles.",
"empty": "Aucun mémo géolocalisé pour le moment.",
"empty-hint": "Ajoutez une localisation à un mémo pour l'afficher ici.",
"no-results": "Aucun mémo correspondant.",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nouvelle note pour aujourd'hui",
"next-year": "L'année prochaine",
"no-memos-in-month": "Aucune note dans {{month}}",
"no-memos-on-day": "Aucune note ce jour-là",
"previous-year": "Année précédente",
"select-month": "Sélectionner un mois"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Achegar",
"zoom-out": "Reducir",
"load-error": "Non se puideron cargar todas as notas.",
"tile-error": "Non se puido cargar o mapa. As túas notas aínda están dispoñibles.",
"tile-error": "Non se puido cargar o mapa. As notas aínda están dispoñibles.",
"empty": "Aínda non hai notas cunha localización",
"empty-hint": "Engade unha localización a unha nota para vela aquí.",
"no-results": "Non hai notas coincidentes",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nova nota neste día",
"next-year": "O ano que vén",
"no-memos-in-month": "Non hai notas en {{month}}",
"no-memos-on-day": "Non hai notas neste día",
"previous-year": "Ano anterior",
"select-month": "Seleccionar mes"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "הגדלה",
"zoom-out": "הקטנה",
"load-error": "לא ניתן היה לטעון את כל התזכירים.",
"tile-error": "המפה לא נטענת. התזכירים שלך עדיין זמינים.",
"tile-error": "המפה לא נטענת. התזכירים עדיין זמינים.",
"empty": "אין תזכירים עם מיקום עדיין",
"empty-hint": "הוסף מיקום לתזכיר כדי לראות אותו כאן.",
"no-results": "אין תזכירים תואמים",
@@ -975,6 +975,7 @@
"new-memo-on-day": "תזכיר חדש ביום זה",
"next-year": "בשנה הבאה",
"no-memos-in-month": "אין תזכירים ב-{{month}}",
"no-memos-on-day": "אין תזכירים ביום זה",
"previous-year": "שנה קודמת",
"select-month": "בחר חודש"
},
+2 -1
View File
@@ -941,7 +941,7 @@
"zoom-in": "ज़ूम इन करें",
"zoom-out": "ज़ूम आउट करें",
"load-error": "सभी मेमो लोड नहीं हो सके.",
"tile-error": "मैप लोड नहीं हो सका. आपके मेमो अभी भी उपलब्ध हैं.",
"tile-error": "मैप लोड नहीं हो सका. मेमो अभी भी उपलब्ध हैं.",
"empty": "अभी तक लोकेशन वाला कोई मेमो नहीं",
"empty-hint": "इसे यहाँ देखने के लिए मेमो में लोकेशन जोड़ें.",
"no-results": "कोई मैचिंग मेमो नहीं",
@@ -956,6 +956,7 @@
"new-memo-on-day": "इस दिन नया मेमो",
"next-year": "अगले साल",
"no-memos-in-month": "{{month}} में कोई मेमो नहीं",
"no-memos-on-day": "इस दिन कोई मेमो नहीं",
"previous-year": "पिछला साल",
"select-month": "महीना चुनें"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Povećaj",
"zoom-out": "Smanji",
"load-error": "Nije moguće učitati sve zapise.",
"tile-error": "Karta se nije mogla učitati. Vaši zapisi su još uvijek dostupni.",
"tile-error": "Karta se nije mogla učitati. Zapisi su još uvijek dostupni.",
"empty": "Još nema zapisa s lokacijom",
"empty-hint": "Dodajte lokaciju zapisu da biste ga vidjeli ovdje.",
"no-results": "Nema odgovarajućih zapisa",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nova bilješka na današnji dan",
"next-year": "Sljedeća godina",
"no-memos-in-month": "Nema bilješki u {{month}}",
"no-memos-on-day": "Nema bilješki na ovaj dan",
"previous-year": "Prethodna godina",
"select-month": "Odaberite mjesec"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Nagyítás",
"zoom-out": "Kicsinyítés",
"load-error": "Nem sikerült betölteni az összes feljegyzést.",
"tile-error": "A térkép nem tölthető be. A feljegyzései továbbra is elérhetők.",
"tile-error": "A térkép nem tölthető be. A feljegyzések továbbra is elérhetők.",
"empty": "Még nincsenek helyszínnel ellátott feljegyzések.",
"empty-hint": "Adjon hozzá egy helyszínt egy feljegyzéshez, hogy itt láthassa.",
"no-results": "Nincsenek egyező feljegyzések.",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Új emlékeztető ezen a napon.",
"next-year": "Jövőre.",
"no-memos-in-month": "Nincsenek emlékeztetők {{month}}-ben.",
"no-memos-on-day": "Ezen a napon nincsenek emlékeztetők",
"previous-year": "Előző év.",
"select-month": "Hónap kiválasztása."
},
+2 -1
View File
@@ -941,7 +941,7 @@
"zoom-in": "Perbesar",
"zoom-out": "Perkecil",
"load-error": "Tidak dapat memuat semua memo.",
"tile-error": "Peta tidak dapat dimuat. Memo Anda masih tersedia.",
"tile-error": "Peta tidak dapat dimuat. Memo masih tersedia.",
"empty": "Belum ada memo dengan lokasi",
"empty-hint": "Tambahkan lokasi ke memo untuk melihatnya di sini.",
"no-results": "Tidak ada memo yang cocok",
@@ -956,6 +956,7 @@
"new-memo-on-day": "Memo baru pada hari ini",
"next-year": "Tahun depan",
"no-memos-in-month": "Tidak ada memo dalam {{month}}",
"no-memos-on-day": "Tidak ada memo pada hari ini",
"previous-year": "Tahun sebelumnya",
"select-month": "Pilih bulan"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Ingrandisci",
"zoom-out": "Riduci",
"load-error": "Impossibile caricare tutte le note.",
"tile-error": "Impossibile caricare la mappa. Le tue note sono ancora disponibili.",
"tile-error": "Impossibile caricare la mappa. Le note sono ancora disponibili.",
"empty": "Nessuna nota con una posizione al momento",
"empty-hint": "Aggiungi una posizione a una nota per visualizzarla qui.",
"no-results": "Nessuna nota corrispondente",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nuovo memo in questo giorno",
"next-year": "Anno prossimo",
"no-memos-in-month": "Nessun memo in {{month}}",
"no-memos-on-day": "Nessun memo in questo giorno",
"previous-year": "Anno precedente",
"select-month": "Seleziona il mese"
},
+1
View File
@@ -975,6 +975,7 @@
"new-memo-on-day": "この日に新しいメモが作成",
"next-year": "来年",
"no-memos-in-month": "{{month}} 件にメモはありません",
"no-memos-on-day": "この日のメモはありません",
"previous-year": "前年",
"select-month": "月を選択"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "მასშტაბირება",
"zoom-out": "მასშტაბირება",
"load-error": "ყველა მემო ვერ ჩაიტვირთა.",
"tile-error": "რუკის ჩატვირთვა ვერ მოხერხდა. თქვენი მემოები კვლავ ხელმისაწვდომია.",
"tile-error": "რუკის ჩატვირთვა ვერ მოხერხდა. მემოები კვლავ ხელმისაწვდომია.",
"empty": "მდებარეობის მემოები ჯერ არ არის",
"empty-hint": "დაამატეთ მდებარეობა მემოში, რომ აქ ნახოთ.",
"no-results": "შესაბამისი მემოები არ არის",
@@ -975,6 +975,7 @@
"new-memo-on-day": "ახალი შენიშვნა ამ დღეს",
"next-year": "შემდეგი წელი",
"no-memos-in-month": "შეტყობინებები არ არის {{month}}-ში",
"no-memos-on-day": "ამ დღეს შეტყობინებები არ არის",
"previous-year": "წინა წელი",
"select-month": "თვის არჩევა"
},
+1
View File
@@ -956,6 +956,7 @@
"new-memo-on-day": "오늘 새 메모가 있습니다.",
"next-year": "내년",
"no-memos-in-month": "{{month}}년 동안 메모가 없습니다.",
"no-memos-on-day": "이 날에는 메모가 없습니다.",
"previous-year": "작년",
"select-month": "월을 선택하세요."
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Priartinti",
"zoom-out": "Tolinti",
"load-error": "Nepavyko įkelti visų priminimų.",
"tile-error": "Žemėlapio įkelti nepavyko. Jūsų priminimai vis dar pasiekiami.",
"tile-error": "Žemėlapio įkelti nepavyko. Priminimai vis dar pasiekiami.",
"empty": "Kol kas nėra priminimų su vieta.",
"empty-hint": "Pridėkite vietą prie priminimo, kad jį pamatytumėte čia.",
"no-results": "Nėra atitinkančių priminimų.",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Naujas priminimas šią dieną",
"next-year": "Kitais metais",
"no-memos-in-month": "Nėra priminimų {{month}}",
"no-memos-on-day": "Šią dieną priminimų nėra",
"previous-year": "Ankstesniais metais",
"select-month": "Pasirinkite mėnesį"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Tuvināt",
"zoom-out": "Tālināt",
"load-error": "Nevarēja ielādēt visas piezīmes.",
"tile-error": "Karti nevarēja ielādēt. Jūsu piezīmes joprojām ir pieejamas.",
"tile-error": "Karti nevarēja ielādēt. Piezīmes joprojām ir pieejamas.",
"empty": "Vēl nav piezīmju ar atrašanās vietu",
"empty-hint": "Pievienojiet piezīmei atrašanās vietu, lai to šeit redzētu.",
"no-results": "Nav atbilstošu piezīmju",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Jauna piezīme šajā dienā",
"next-year": "Nākamgad",
"no-memos-in-month": "Nav piezīmju {{month}}",
"no-memos-on-day": "Šajā dienā nav piezīmju",
"previous-year": "Iepriekšējais gads",
"select-month": "Atlasīt mēnesi"
},
+2 -1
View File
@@ -941,7 +941,7 @@
"zoom-in": "झूम इन करा",
"zoom-out": "झूम आउट करा",
"load-error": "सर्व मेमो लोड होऊ शकले नाहीत.",
"tile-error": "नकाशा लोड होऊ शकला नाही. तुमचे मेमो अजूनही उपलब्ध आहेत.",
"tile-error": "नकाशा लोड होऊ शकला नाही. मेमो अजूनही उपलब्ध आहेत.",
"empty": "स्थानासह अद्याप कोणतेही मेमो नाहीत",
"empty-hint": "येथे पाहण्यासाठी मेमोमध्ये स्थान जोडा.",
"no-results": "जुळणारे मेमो नाहीत",
@@ -956,6 +956,7 @@
"new-memo-on-day": "आजच्या दिवशी नवीन मेमो",
"next-year": "पुढील वर्षी",
"no-memos-in-month": "{{month}} मध्ये कोणतेही मेमो नाहीत",
"no-memos-on-day": "या दिवशी कोणतेही मेमो नाहीत",
"previous-year": "मागील वर्षी",
"select-month": "महिना निवडा"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Zoom inn",
"zoom-out": "Zoom ut",
"load-error": "Kunne ikke laste inn alle notatene.",
"tile-error": "Kartet kunne ikke lastes inn. Notatene dine er fortsatt tilgjengelige.",
"tile-error": "Kartet kunne ikke lastes inn. Notatene er fortsatt tilgjengelige.",
"empty": "Ingen notater med en plassering ennå",
"empty-hint": "Legg til en plassering i et notat for å se det her.",
"no-results": "Ingen samsvarende notater",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nytt notat denne dagen",
"next-year": "Neste år",
"no-memos-in-month": "Ingen notater i {{month}}",
"no-memos-on-day": "Ingen notater denne dagen",
"previous-year": "Forrige år",
"select-month": "Velg måned"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Inzoomen",
"zoom-out": "Uitzoomen",
"load-error": "Niet alle memo's konden worden geladen.",
"tile-error": "De kaart kon niet worden geladen. Uw memo's zijn nog beschikbaar.",
"tile-error": "De kaart kon niet worden geladen. De memo's zijn nog beschikbaar.",
"empty": "Nog geen memo's met een locatie",
"empty-hint": "Voeg een locatie toe aan een memo om deze hier te zien.",
"no-results": "Geen overeenkomende memo's",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nieuwe memo op deze dag",
"next-year": "Volgend jaar",
"no-memos-in-month": "Geen memo's in {{month}}",
"no-memos-on-day": "Geen memo's op deze dag",
"previous-year": "Vorig jaar",
"select-month": "Selecteer maand"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Powiększ",
"zoom-out": "Pomniejsz",
"load-error": "Nie można załadować wszystkich notatek.",
"tile-error": "Nie można załadować mapy. Twoje notatki są nadal dostępne.",
"tile-error": "Nie można załadować mapy. Notatki są nadal dostępne.",
"empty": "Brak notatek z lokalizacją",
"empty-hint": "Dodaj lokalizację do notatki, aby ją tutaj zobaczyć.",
"no-results": "Brak pasujących notatek",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nowa notatka z tego dnia",
"next-year": "Następny rok",
"no-memos-in-month": "Brak notatek w {{month}}",
"no-memos-on-day": "Brak notatek w tym dniu",
"previous-year": "Poprzedni rok",
"select-month": "Wybierz miesiąc"
},
+2 -1
View File
@@ -941,7 +941,7 @@
"zoom-in": "Aumentar zoom",
"zoom-out": "Diminuir zoom",
"load-error": "Não foi possível carregar todos os memorandos.",
"tile-error": "O mapa não pôde ser carregado. Seus memorandos ainda estão disponíveis.",
"tile-error": "O mapa não pôde ser carregado. Os memorandos ainda estão disponíveis.",
"empty": "Nenhum memorando com localização ainda",
"empty-hint": "Adicione uma localização a um memorando para vê-lo aqui.",
"no-results": "Nenhum memorando correspondente",
@@ -956,6 +956,7 @@
"new-memo-on-day": "Novo memorando neste dia",
"next-year": "Próximo ano",
"no-memos-in-month": "Nenhum memorando em {{month}}",
"no-memos-on-day": "Nenhum memorando neste dia",
"previous-year": "Ano anterior",
"select-month": "Selecione o mês"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Aumentar zoom",
"zoom-out": "Diminuir zoom",
"load-error": "Não foi possível carregar todos os memorandos.",
"tile-error": "O mapa não pôde ser carregado. Os seus memorandos ainda estão disponíveis.",
"tile-error": "O mapa não pôde ser carregado. Os memorandos ainda estão disponíveis.",
"empty": "Nenhum memorando com localização ainda",
"empty-hint": "Adicione uma localização a um memorando para o ver aqui.",
"no-results": "Nenhum memorando correspondente",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Novo memorando neste dia",
"next-year": "Próximo ano",
"no-memos-in-month": "Nenhum memorando em {{month}}",
"no-memos-on-day": "Nenhum memorando neste dia",
"previous-year": "Ano anterior",
"select-month": "Selecione o mês"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Mărire",
"zoom-out": "Micșorare",
"load-error": "Nu s-au putut încărca toate memo-urile.",
"tile-error": "Harta nu s-a putut încărca. Memo-urile dvs. sunt încă disponibile.",
"tile-error": "Harta nu s-a putut încărca. Memo-urile sunt încă disponibile.",
"empty": "Nu există memo-uri cu o locație încă",
"empty-hint": "Adăugați o locație la un memo pentru a o vedea aici.",
"no-results": "Nu există memo-uri potrivite",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Memo nou în această zi",
"next-year": "Anul viitor",
"no-memos-in-month": "Niciun memento în {{month}}",
"no-memos-on-day": "Niciun memento în această zi",
"previous-year": "Anul precedent",
"select-month": "Selectați luna"
},
+2 -1
View File
@@ -946,7 +946,7 @@
"zoom-in": "Увеличить масштаб",
"zoom-out": "Уменьшить масштаб",
"load-error": "Не удалось загрузить все заметки.",
"tile-error": "Карта не загрузилась. Ваши заметки по-прежнему доступны.",
"tile-error": "Карта не загрузилась. Заметки по-прежнему доступны.",
"empty": "Пока нет заметок с местоположением",
"empty-hint": "Добавьте местоположение к заметке, чтобы увидеть его здесь.",
"no-results": "Нет подходящих заметок",
@@ -961,6 +961,7 @@
"new-memo-on-day": "Новая заметка в этот день",
"next-year": "В следующем году",
"no-memos-in-month": "Нет заметок в {{month}}",
"no-memos-on-day": "Нет заметок в этот день",
"previous-year": "Предыдущий год",
"select-month": "Выбрать месяц"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Priblížiť",
"zoom-out": "Oddialiť",
"load-error": "Nepodarilo sa načítať všetky poznámky.",
"tile-error": "Mapa sa nepodarilo načítať. Vaše poznámky sú stále k dispozícii.",
"tile-error": "Mapa sa nepodarilo načítať. Poznámky sú stále k dispozícii.",
"empty": "Zatiaľ žiadne poznámky s polohou",
"empty-hint": "Pridajte polohu k poznámke, aby sa tu zobrazila.",
"no-results": "Žiadne zodpovedajúce poznámky",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nová poznámka v tento deň",
"next-year": "Budúci rok",
"no-memos-in-month": "Žiadne poznámky v {{month}}",
"no-memos-on-day": "Žiadne poznámky v tento deň",
"previous-year": "Predchádzajúci rok",
"select-month": "Vyberte mesiac"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Povečaj",
"zoom-out": "Pomanjšaj",
"load-error": "Vseh zapiskov ni bilo mogoče naložiti.",
"tile-error": "Zemljevida ni bilo mogoče naložiti. Vaši zapiski so še vedno na voljo.",
"tile-error": "Zemljevida ni bilo mogoče naložiti. Zapiski so še vedno na voljo.",
"empty": "Še ni zapiskov z lokacijo",
"empty-hint": "Dodajte lokacijo zapisku, da ga vidite tukaj.",
"no-results": "Ni ustreznih zapiskov",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nova beležka na ta dan",
"next-year": "Naslednje leto",
"no-memos-in-month": "Ni beležk v {{month}}",
"no-memos-on-day": "Ta dan ni beležk",
"previous-year": "Prejšnje leto",
"select-month": "Izberite mesec"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Увећај",
"zoom-out": "Умањи",
"load-error": "Није могуће учитати све белешке.",
"tile-error": "Мапа није могла да се учита. Ваше белешке су и даље доступне.",
"tile-error": "Мапа није могла да се учита. Белешке су и даље доступне.",
"empty": "Још увек нема белешки са локацијом",
"empty-hint": "Додајте локацију белешки да бисте је видели овде.",
"no-results": "Нема одговарајућих белешки",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Нова белешка на данашњи дан",
"next-year": "Следећа година",
"no-memos-in-month": "Нема белешки у {{month}}",
"no-memos-on-day": "Нема белешки овог дана",
"previous-year": "Претходна година",
"select-month": "Изаберите месец"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Zooma in",
"zoom-out": "Zooma ut",
"load-error": "Kunde inte ladda alla PM.",
"tile-error": "Kartan kunde inte laddas. Dina PM är fortfarande tillgängliga.",
"tile-error": "Kartan kunde inte laddas. PM:en är fortfarande tillgängliga.",
"empty": "Inga PM med en plats ännu",
"empty-hint": "Lägg till en plats i ett PM för att se det här.",
"no-results": "Inga matchande PM",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Nytt PM denna dag",
"next-year": "Nästa år",
"no-memos-in-month": "Inga PM i {{month}}",
"no-memos-on-day": "Inga PM denna dag",
"previous-year": "Föregående år",
"select-month": "Välj månad"
},
+2 -1
View File
@@ -941,7 +941,7 @@
"zoom-in": "ซูมเข้า",
"zoom-out": "ซูมออก",
"load-error": "ไม่สามารถโหลดบันทึกทั้งหมดได้",
"tile-error": "ไม่สามารถโหลดแผนที่ได้ บันทึกของคุณยังคงใช้งานได้",
"tile-error": "ไม่สามารถโหลดแผนที่ได้ บันทึกยังคงใช้งานได้",
"empty": "ยังไม่มีบันทึกที่มีตำแหน่งที่ตั้ง",
"empty-hint": "เพิ่มตำแหน่งที่ตั้งให้กับบันทึกเพื่อดูที่นี่",
"no-results": "ไม่มีบันทึกที่ตรงกัน",
@@ -956,6 +956,7 @@
"new-memo-on-day": "บันทึกช่วยจำใหม่ในวันนี้",
"next-year": "ปีหน้า",
"no-memos-in-month": "ไม่มีบันทึกช่วยจำใน {{month}}",
"no-memos-on-day": "ไม่มีบันทึกช่วยจำในวันนี้",
"previous-year": "ปีที่แล้ว",
"select-month": "เลือกเดือน"
},
+2 -1
View File
@@ -6,7 +6,7 @@
"zoom-in": "Yakınlaştır",
"zoom-out": "Uzaklaştır",
"load-error": "Notların tamamı yüklenemedi.",
"tile-error": "Harita yüklenemedi. Notlarınız hâlâ erişilebilir durumda.",
"tile-error": "Harita yüklenemedi. Notlar hâlâ erişilebilir durumda.",
"empty": "Henüz konum içeren not yok",
"empty-hint": "Burada görmek için bir nota konum ekleyin.",
"no-results": "Eşleşen not yok",
@@ -66,6 +66,7 @@
"new-memo-on-day": "Bu güne yeni not",
"next-year": "Sonraki yıl",
"no-memos-in-month": "{{month}} ayında not yok",
"no-memos-on-day": "Bu günde not yok",
"previous-year": "Önceki yıl",
"select-month": "Ay seç"
},
+2 -1
View File
@@ -960,7 +960,7 @@
"zoom-in": "Збільшити масштаб",
"zoom-out": "Зменшити масштаб",
"load-error": "Не вдалося завантажити всі нотатки.",
"tile-error": "Не вдалося завантажити карту. Ваші нотатки все ще доступні.",
"tile-error": "Не вдалося завантажити карту. Нотатки все ще доступні.",
"empty": "Поки що немає нотаток із місцем розташування",
"empty-hint": "Додайте місце розташування до нотатки, щоб побачити її тут.",
"no-results": "Немає відповідних нотаток",
@@ -975,6 +975,7 @@
"new-memo-on-day": "Нова нотатка цього дня",
"next-year": "Наступного року",
"no-memos-in-month": "Немає нотаток у {{month}}",
"no-memos-on-day": "Немає нотаток у цей день",
"previous-year": "Попередній рік",
"select-month": "Виберіть місяць"
},
+2 -1
View File
@@ -941,7 +941,7 @@
"zoom-in": "Phóng to",
"zoom-out": "Thu nhỏ",
"load-error": "Không thể tải tất cả ghi chú.",
"tile-error": "Không thể tải bản đồ. Ghi chú của bạn vẫn còn.",
"tile-error": "Không thể tải bản đồ. Các ghi chú vẫn còn.",
"empty": "Chưa có ghi chú nào có vị trí",
"empty-hint": "Thêm vị trí vào ghi chú để xem tại đây.",
"no-results": "Không có ghi chú phù hợp",
@@ -956,6 +956,7 @@
"new-memo-on-day": "Ghi chú mới trong ngày này",
"next-year": "Năm tới",
"no-memos-in-month": "Không có ghi chú nào trong {{month}}",
"no-memos-on-day": "Không có ghi chú nào trong ngày này",
"previous-year": "Năm trước",
"select-month": "Chọn tháng"
},
+1
View File
@@ -66,6 +66,7 @@
"new-memo-on-day": "在这一天新建备忘录",
"next-year": "下一年",
"no-memos-in-month": "{{month}} 没有备忘录",
"no-memos-on-day": "这一天没有备忘录",
"previous-year": "上一年",
"select-month": "选择月份"
},
+2 -1
View File
@@ -48,6 +48,7 @@
"new-memo-on-day": "在這一天新增備忘錄",
"next-year": "下一年",
"no-memos-in-month": "{{month}} 沒有備忘錄",
"no-memos-on-day": "這一天沒有備忘錄",
"previous-year": "上一年",
"select-month": "選擇月份"
},
@@ -1000,7 +1001,7 @@
"zoom-in": "放大",
"zoom-out": "縮小",
"load-error": "無法載入所有備忘錄。",
"tile-error": "地圖載入失敗。您的備忘錄仍然可用。",
"tile-error": "地圖載入失敗。備忘錄仍然可用。",
"empty": "暫無帶有位置資訊的備忘錄",
"empty-hint": "為備忘錄新增位置資訊,即可在此處查看。",
"no-results": "沒有符合的備忘錄",
+38 -1
View File
@@ -1,7 +1,7 @@
import { create, type MessageInitShape } from "@bufbuild/protobuf";
import { timestampFromDate } from "@bufbuild/protobuf/wkt";
import { describe, expect, it } from "vitest";
import { buildCalendarMonthModel } from "@/components/CalendarView/dayModel";
import { buildCalendarMonthModel, getMemoThumbnail } from "@/components/CalendarView/dayModel";
import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb";
import { type Memo, MemoSchema } from "@/types/proto/api/v1/memo_service_pb";
@@ -142,6 +142,32 @@ describe("calendar day snapshots", () => {
expect(day([memoAt(9, { attachments: [pdf] }), memoAt(10, { content: "Notes" })]).excerpt?.text).toBe("Notes");
});
it("attributes the excerpt to the memo it came from, filename fallback included", () => {
const text = day([
memoAt(9, { creator: "users/bob", content: "Morning run" }),
memoAt(10, { creator: "users/alice", content: "Lunch" }),
]);
expect(text.excerpt).toMatchObject({ memoName: "memos/9", creator: "users/bob", text: "Morning run" });
expect(day([memoAt(9, { creator: "users/carol", attachments: [pdf] })]).excerpt).toMatchObject({
creator: "users/carol",
text: "doc.pdf",
});
});
it("names each creator once, in the order they first wrote, hidden memos included", () => {
const summary = buildCalendarMonthModel(
[
memoAt(11, { creator: "users/bob" }),
memoAt(9, { creator: "users/carol", tags: ["private"] }),
memoAt(10, { creator: "users/bob" }),
memoAt(12, { creator: "users/alice" }),
],
"create_time",
{ isRedacted: (memo) => memo.tags.includes("private") },
)["2026-08-02"];
expect(summary.creators).toEqual(["users/carol", "users/bob", "users/alice"]);
});
it("counts hidden memos without exposing text, filenames, or photos", () => {
const summary = buildCalendarMonthModel(
[
@@ -159,4 +185,15 @@ describe("calendar day snapshots", () => {
it("uses update time when selected and ignores undated memos", () => {
expect(Object.keys(buildCalendarMonthModel([memoAt(9), create(MemoSchema)], "update_time"))).toEqual(["2026-08-03"]);
});
it("finds a single memo's first photo in the same order, for map pins", () => {
expect(getMemoThumbnail(memoAt(9, { content: "just words" }))).toBeUndefined();
expect(getMemoThumbnail(memoAt(9, { attachments: [pdf] }))).toBeUndefined();
expect(getMemoThumbnail(memoAt(9, { content: "![a](https://example.com/inline.jpg)", attachments: [image("later")] }))).toBe(
"https://example.com/inline.jpg",
);
expect(getMemoThumbnail(memoAt(9, { attachments: [image("only")] }))).toBe(
day([memoAt(9, { attachments: [image("only")] })]).images[0].thumbnailUrl,
);
});
});
+89 -7
View File
@@ -1,32 +1,50 @@
import { create } from "@bufbuild/protobuf";
import { fireEvent, render, screen } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import { describe, expect, it } from "vitest";
import { describe, expect, it, vi } from "vitest";
import { CalendarDayCell, layoutForCellSize } from "@/components/CalendarView/CalendarDayCell";
import type { CalendarDaySummary } from "@/components/CalendarView/dayModel";
import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb";
const users: Record<string, { name: string; username: string; displayName: string; avatarUrl: string }> = {
"users/bob": { name: "users/bob", username: "bob", displayName: "Bob Martin", avatarUrl: "/bob.png" },
"users/carol": { name: "users/carol", username: "carol", displayName: "Carol Diaz", avatarUrl: "/carol.png" },
"users/dan": { name: "users/dan", username: "dan", displayName: "Dan Okafor", avatarUrl: "/dan.png" },
};
vi.mock("@/components/MemoContent/MentionResolutionContext", () => ({
useResolvedUser: (name: string, options?: { enabled?: boolean }) => (options?.enabled ? users[name] : undefined),
useResolvedUsersByNames: (names: string[]) => new Map(names.map((name) => [name, users[name]])),
}));
const summary: CalendarDaySummary = {
memos: [create(MemoSchema), create(MemoSchema)],
excerpt: { memoName: "memos/a", text: "A memorable afternoon", isCode: false },
excerpt: { memoName: "memos/a", creator: "users/bob", text: "A memorable afternoon", isCode: false },
creators: ["users/bob", "users/carol", "users/dan"],
images: [{ memoName: "memos/b", thumbnailUrl: "/photo.jpg" }],
};
const textOnly: CalendarDaySummary = { ...summary, images: [] };
interface CellOptions {
width?: number;
height?: number;
isSelected?: boolean;
isToday?: boolean;
isCurrentMonth?: boolean;
showAuthor?: boolean;
}
const cell = (value?: CalendarDaySummary, { width = 170, height = 170, isSelected = true, isToday = true }: CellOptions = {}) =>
const cell = (
value?: CalendarDaySummary,
{ width = 170, height = 170, isSelected = true, isToday = true, isCurrentMonth = true, showAuthor = false }: CellOptions = {},
) =>
render(
<MemoryRouter initialEntries={["/spaces/work/calendar/2026/08?filter=test"]}>
<CalendarDayCell
day={{ date: "2026-08-07", label: 7, count: 0, isCurrentMonth: true, isToday, isSelected }}
day={{ date: "2026-08-07", label: 7, count: 0, isCurrentMonth, isToday, isSelected }}
summary={value}
maxCount={4}
layout={layoutForCellSize(width, height)}
pending={false}
timeBasis="create_time"
showAuthor={showAuthor}
tabIndex={0}
isLastColumn={false}
isLastRow={false}
@@ -102,10 +120,74 @@ describe("calendar daily snapshot cell", () => {
cell({ ...summary, excerpt: undefined }, { width: 106, height: 88 });
expect(document.querySelector("img")).toHaveAttribute("src", "/photo.jpg");
});
it("shows only the tinted date when narrow", () => {
cell(summary, { width: 72, isSelected: false });
it("keeps a slim preview with tighter padding under preview width", () => {
cell(summary, { width: 92, height: 140, isSelected: false });
expect(screen.getByRole("link")).toHaveClass("sm:px-2");
expect(screen.getByText("A memorable afternoon")).toHaveStyle({ WebkitLineClamp: "1" });
expect(document.querySelectorAll("img")).toHaveLength(1);
});
it("trades the preview for a mark on the tinted date when very narrow", () => {
cell(summary, { width: 56, isSelected: false });
expect(screen.getByRole("link")).toHaveClass("bg-primary/16");
expect(screen.queryByText("A memorable afternoon")).toBeNull();
expect(document.querySelector("img")).toBeNull();
expect(document.querySelectorAll("img")).toHaveLength(1);
expect(document.querySelector("img")).toHaveClass("size-4");
});
it("leads the excerpt with its author's avatar when several creators share the grid", () => {
cell(summary, { showAuthor: true });
const excerpt = screen.getByText("A memorable afternoon");
const avatar = excerpt.firstElementChild;
// Inside the clamped line, so it sits on the first line and never takes a line of its own.
expect(avatar).toHaveClass("inline-flex", "size-3.5");
expect(avatar?.querySelector("img")).toHaveAttribute("src", "/bob.png");
expect(excerpt).toHaveTextContent(/^A memorable afternoon$/);
});
it("leaves the excerpt unattributed in a single creator's scope", () => {
cell(summary);
expect(screen.getByText("A memorable afternoon").firstElementChild).toBeNull();
expect(document.querySelector('img[src="/bob.png"]')).toBeNull();
});
it("shows no avatar when the cell is too narrow for an excerpt", () => {
cell(summary, { width: 56, showAuthor: true });
expect(document.querySelector('img[src="/bob.png"]')).toBeNull();
});
describe("phone mark", () => {
// The compact phone grid: a 49px column with no room for preview rows.
const phone = { width: 49, height: 0 };
const avatars = () => [...document.querySelectorAll("img")].map((image) => image.getAttribute("src"));
it("shows the day's first photo as a small thumbnail under the date", () => {
cell(summary, { ...phone, showAuthor: true });
expect(avatars()).toEqual(["/photo.jpg"]);
expect(document.querySelector("img")).toHaveClass("size-4");
expect(screen.queryByText("A memorable afternoon")).toBeNull();
});
it("names up to two authors when several creators share the grid and there is no photo", () => {
cell(textOnly, { ...phone, showAuthor: true });
expect(avatars()).toEqual(["/bob.png", "/carol.png"]);
});
it("falls back from a photo that fails to load to the next mark", () => {
cell(summary, { ...phone, showAuthor: true });
fireEvent.error(document.querySelector("img")!);
expect(avatars()).toEqual(["/bob.png", "/carol.png"]);
});
it("draws written lines in a single creator's scope, never the text itself", () => {
cell(textOnly, phone);
expect(document.querySelector("img")).toBeNull();
expect(screen.getByRole("link").querySelectorAll(".rounded-full.bg-current")).toHaveLength(2);
expect(screen.getByRole("link")).toHaveTextContent(/^7$/);
});
it("marks nothing on empty days or days outside the month", () => {
cell(undefined, phone);
expect(screen.getByRole("link").querySelector(".h-4")).toBeNull();
cell(summary, { ...phone, isCurrentMonth: false });
expect(document.querySelectorAll("img")).toHaveLength(0);
});
it("leaves cells with room for a preview unmarked", () => {
cell(summary, { showAuthor: true });
expect(avatars()).toEqual(["/bob.png", "/photo.jpg"]);
expect(document.querySelector("img.size-4")).toBeNull();
});
});
});
+43 -2
View File
@@ -1,9 +1,23 @@
import { describe, expect, it } from "vitest";
import { layoutForCellSize } from "@/components/CalendarView/CalendarDayCell";
import { RESERVED_BESIDE_PANEL } from "@/components/CalendarView/CalendarView";
describe("calendar snapshot sizing", () => {
it("keeps narrow cells readable by omitting previews", () => {
expect(layoutForCellSize(72, 140)).toEqual({ textLines: 0, textLinesWithImages: 0, imageCount: 0 });
it("keeps very narrow cells readable by omitting previews", () => {
expect(layoutForCellSize(56, 140)).toEqual({ textLines: 0, textLinesWithImages: 0, imageCount: 0, slim: false, mark: true });
});
it("gives cells under preview width a slim preview instead of none", () => {
expect(layoutForCellSize(92, 140)).toEqual({ textLines: 2, textLinesWithImages: 1, imageCount: 1, slim: true, mark: false });
expect(layoutForCellSize(64, 140)).toMatchObject({ slim: true, imageCount: 1 });
expect(layoutForCellSize(100, 140)).toMatchObject({ slim: false, textLines: 3 });
});
it("marks the day instead when no preview fits, whatever the reason", () => {
// Phones pass no height: the compact grid has no room for rows, even in a wide column.
expect(layoutForCellSize(49, 0)).toMatchObject({ mark: true, textLines: 0, imageCount: 0 });
expect(layoutForCellSize(95, 0)).toMatchObject({ mark: true, textLines: 0, imageCount: 0 });
expect(layoutForCellSize(160, 60)).toMatchObject({ mark: true });
expect(layoutForCellSize(160, 66)).toMatchObject({ mark: false, textLines: 1 });
expect(layoutForCellSize(160, 88)).toMatchObject({ mark: false });
});
it("limits short cells to the 18px lines that fit", () => {
expect(layoutForCellSize(160, 88)).toMatchObject({ textLines: 2, textLinesWithImages: 0, imageCount: 3 });
@@ -15,3 +29,30 @@ describe("calendar snapshot sizing", () => {
expect(layoutForCellSize(300, 160)).toMatchObject({ imageCount: 3 });
});
});
describe("calendar grid beside the open day panel", () => {
// MemoPanel's width rule: the persisted width, capped by what the page reserves, never under 320px.
const SIDEBAR = 256;
const INSET = 12;
const panelWidth = (viewport: number, persisted = 400) =>
Math.min(Math.max(persisted, 320), Math.max(320, Math.min(640, viewport - SIDEBAR - 2 * INSET - RESERVED_BESIDE_PANEL)));
// The pushed grid: page padding, the card and the gap before it come off; seven columns share the rest inside a 2px border.
const columnWidth = (viewport: number, persisted?: number) => (viewport - SIDEBAR - 48 - panelWidth(viewport, persisted) - INSET - 2) / 7;
it("keeps the persisted card where the window has room", () => {
expect(panelWidth(1600)).toBe(400);
expect(panelWidth(1440)).toBe(400);
expect(columnWidth(1440)).toBeGreaterThanOrEqual(100);
});
it("narrows the card so every column keeps its full preview on laptop widths", () => {
expect(panelWidth(1366)).toBe(348);
expect(columnWidth(1366)).toBe(100);
expect(layoutForCellSize(columnWidth(1366), 140).slim).toBe(false);
expect(panelWidth(1440, 640)).toBeLessThan(640);
expect(columnWidth(1440, 640)).toBeGreaterThanOrEqual(100);
});
it("falls back to slim previews only when even the minimum card does not leave preview width", () => {
expect(panelWidth(1280)).toBe(320);
expect(layoutForCellSize(columnWidth(1280), 140)).toMatchObject({ slim: true, textLines: 2, imageCount: 1 });
});
});
+59 -2
View File
@@ -5,6 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { MapCanvas } from "@/components/MapView/MapCanvas";
import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb";
const markers = vi.hoisted(() => [] as { icon: { options: { html?: string } }; title: string; alt: string }[]);
const map = vi.hoisted(() => ({
getContainer: vi.fn(),
invalidateSize: vi.fn(),
@@ -18,19 +19,23 @@ const map = vi.hoisted(() => ({
}));
vi.mock("react-leaflet", () => ({
MapContainer: ({ children }: { children: ReactNode }) => children,
Marker: () => null,
Marker: (props: { icon: { options: { html?: string } }; title: string; alt: string }) => {
markers.push(props);
return null;
},
useMap: () => map,
useMapEvents: () => map,
}));
vi.mock("react-leaflet-cluster", () => ({ default: ({ children }: { children: ReactNode }) => children }));
vi.mock("@/components/map/map-utils", () => ({
createMarkerIcon: () => ({}),
createMarkerIcon: () => ({ options: {} }),
MinimalAttributionControl: () => null,
}));
vi.mock("@/components/map/BasemapLayer", () => ({ BasemapLayer: () => null }));
beforeEach(() => {
markers.length = 0;
map.getContainer.mockReturnValue(document.createElement("div"));
vi.stubGlobal(
"ResizeObserver",
@@ -46,6 +51,7 @@ const memo = create(MemoSchema, { name: "memos/selected", location: { latitude:
function props(): ComponentProps<typeof MapCanvas> {
return {
memos: [],
pins: new Map(),
selected: [],
complete: false,
desktop: true,
@@ -85,3 +91,54 @@ describe("map viewport", () => {
expect(map.fitBounds).toHaveBeenCalledOnce();
});
});
describe("map pins", () => {
const place = (name: string) => create(MemoSchema, { name, location: { placeholder: "Kyoto", latitude: 35, longitude: 135 } });
const lastMarker = (name: string) => markers.filter((marker) => marker.alt.startsWith(name)).at(-1)!;
it("draws the calendar's marks at map scale: photo square, author avatar, or the plain dot", () => {
const pins = new Map([
["memos/photo", { face: { kind: "photo" as const, url: "/thumb.jpg" }, label: "photo" }],
["memos/author", { face: { kind: "author" as const, avatarUrl: "/bob.png", name: "Bob" }, label: "author" }],
["memos/dot", { face: { kind: "dot" as const }, label: "dot" }],
]);
render(<MapCanvas {...props()} memos={[place("memos/photo"), place("memos/author"), place("memos/dot")]} pins={pins} />);
expect(lastMarker("photo").icon.options.html).toContain("url(&quot;/thumb.jpg&quot;)");
expect(lastMarker("author").icon.options.html).toContain('src="/bob.png"');
expect(lastMarker("dot").icon.options.html).toBeUndefined();
});
it("labels a pin with its place and author, and falls back to the place alone", () => {
const pins = new Map([["memos/a", { face: { kind: "dot" as const }, label: "Kyoto · Bob" }]]);
render(<MapCanvas {...props()} memos={[place("memos/a"), place("memos/b")]} pins={pins} />);
expect(markers.find((marker) => marker.title === "Kyoto · Bob")?.alt).toBe("Kyoto · Bob");
expect(markers.some((marker) => marker.title === "Kyoto")).toBe(true);
});
it("grows a selected face pin and reuses one icon per face", () => {
const face = { kind: "author" as const, avatarUrl: "/bob.png", name: "Bob" };
const pins = new Map([
["memos/a", { face, label: "a" }],
["memos/b", { face, label: "b" }],
]);
const { rerender } = render(<MapCanvas {...props()} memos={[place("memos/a"), place("memos/b")]} pins={pins} />);
expect(lastMarker("a").icon).toBe(lastMarker("b").icon);
rerender(<MapCanvas {...props()} memos={[place("memos/a"), place("memos/b")]} pins={pins} selected={["memos/a"]} />);
expect(lastMarker("a").icon).not.toBe(lastMarker("b").icon);
expect(lastMarker("a").icon.options.html).toContain("bg-primary/20");
});
it("writes a label that resolves after the first draw onto the live marker", () => {
const element = document.createElement("div");
const live = { options: { title: "Kyoto" }, getElement: () => element };
const attach = (marker: { ref?: (value: unknown) => void }) => marker.ref?.(live);
const memos = [place("memos/a")];
const { rerender } = render(<MapCanvas {...props()} memos={memos} />);
attach(markers.at(-1) as never);
rerender(
<MapCanvas {...props()} memos={memos} pins={new Map([["memos/a", { face: { kind: "dot" as const }, label: "Kyoto · Bob" }]])} />,
);
expect(live.options.title).toBe("Kyoto · Bob");
expect(element).toHaveAttribute("title", "Kyoto · Bob");
});
});
+28 -1
View File
@@ -1,6 +1,15 @@
import { create } from "@bufbuild/protobuf";
import { describe, expect, it } from "vitest";
import { locationKey, mapMemos, readViewport, revealOffset, splitLabel, validLocation } from "@/components/MapView/model";
import {
locationKey,
mapMemos,
pinFace,
pointLabel,
readViewport,
revealOffset,
splitLabel,
validLocation,
} from "@/components/MapView/model";
import { LocationSchema, MemoSchema } from "@/types/proto/api/v1/memo_service_pb";
const memo = (name: string, latitude = 0, longitude = 0) => create(MemoSchema, { name, location: { latitude, longitude } });
@@ -51,4 +60,22 @@ describe("map model", () => {
expect(splitLabel("Kyoto")).toEqual({ title: "Kyoto" });
expect(splitLabel("Kyoto, ")).toEqual({ title: "Kyoto, " });
});
it("picks a pin face in the calendar mark order", () => {
expect(pinFace("/thumb.jpg", { avatarUrl: "/bob.png", name: "Bob" })).toEqual({ kind: "photo", url: "/thumb.jpg" });
expect(pinFace(undefined, { avatarUrl: "/bob.png", name: "Bob" })).toEqual({ kind: "author", avatarUrl: "/bob.png", name: "Bob" });
expect(pinFace(undefined, { avatarUrl: "", name: "Dan" })).toEqual({ kind: "author", avatarUrl: undefined, name: "Dan" });
expect(pinFace(undefined, undefined)).toEqual({ kind: "dot" });
});
it("lets a place label speak only for its own author or for everyone who used it", () => {
const at = (creator: string, placeholder: string) =>
create(MemoSchema, { creator, location: { placeholder, latitude: 35, longitude: 135 } });
// One author: their newest label, as before.
expect(pointLabel([at("users/alice", "Mom's house"), at("users/alice", "Home")])).toBe("Mom's house");
// Several authors: only a label they all used.
expect(pointLabel([at("users/alice", "Kyoto Station"), at("users/bob", " Kyoto Station ")])).toBe("Kyoto Station");
expect(pointLabel([at("users/alice", "Mom's house"), at("users/bob", "")])).toBe("");
expect(pointLabel([])).toBe("");
});
});
+72 -10
View File
@@ -5,23 +5,35 @@ import { MemoryRouter } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { MapView } from "@/components/MapView/MapView";
import type { MemoEditorProps } from "@/components/MemoEditor/types";
import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb";
import { type Memo, MemoSchema } from "@/types/proto/api/v1/memo_service_pb";
const mocks = vi.hoisted(() => ({ editor: {} as MemoEditorProps, refetch: vi.fn(), toast: vi.fn() }));
const item = create(MemoSchema, { name: "memos/one", location: { placeholder: "Kyoto", latitude: 35, longitude: 135 } });
const mocks = vi.hoisted(() => ({
editor: {} as MemoEditorProps,
refetch: vi.fn(),
toast: vi.fn(),
memos: [] as Memo[],
user: { name: "users/qa" } as { name: string } | undefined,
filters: [] as unknown[],
}));
const item = create(MemoSchema, {
name: "memos/one",
creator: "users/qa",
location: { placeholder: "Kyoto", latitude: 35, longitude: 135 },
});
vi.mock("@/components/MapView/MapCanvas", () => ({ MapCanvas: () => <div data-testid="map" />, fitMemos: vi.fn() }));
vi.mock("@/components/MemoPanel/MemoPanel", () => ({
MEMO_PANEL_INSET: 12,
MemoPanel: ({ open, busy, children }: { open: boolean; busy: boolean; children: ReactNode }) =>
MemoPanel: ({ open, busy, title, children }: { open: boolean; busy: boolean; title: string; children: ReactNode }) =>
open ? (
<div data-testid="panel" data-busy={busy}>
<div data-testid="panel" data-busy={busy} data-title={title}>
{children}
</div>
) : null,
}));
vi.mock("@/components/MapView/useMapMemos", () => ({
useMapMemos: () => ({ memos: [item], complete: true, refetch: mocks.refetch }),
useMapMemos: () => ({ memos: mocks.memos, complete: true, refetch: mocks.refetch }),
}));
vi.mock("@/components/MapView/useMapPins", () => ({ useMapPins: () => new Map() }));
vi.mock("@/components/MemoEditor", () => ({
default: (props: MemoEditorProps) => {
mocks.editor = props;
@@ -35,15 +47,18 @@ vi.mock("@/components/MemoContent/MentionResolutionContext", () => ({
vi.mock("@/contexts/NewMemoContext", () => ({ NewMemoProvider: ({ children }: { children: ReactNode }) => children }));
vi.mock("@/contexts/AuthContext", () => ({ useAuth: () => ({ isUserSettingsInitialized: true }) }));
vi.mock("@/contexts/SpaceContext", () => ({ useSpaceContext: () => ({ selectedSpaceName: "spaces/travel" }) }));
vi.mock("@/contexts/MemoFilterContext", () => ({ useMemoFilterContext: () => ({ filters: [], removeFilter: vi.fn() }) }));
vi.mock("@/contexts/MemoFilterContext", () => ({ useMemoFilterContext: () => ({ filters: mocks.filters, removeFilter: vi.fn() }) }));
vi.mock("@/contexts/ViewContext", () => ({ useView: () => ({ timeBasis: "create_time", compactMode: false }) }));
vi.mock("@/hooks/useCurrentUser", () => ({ default: () => ({ name: "users/qa" }) }));
vi.mock("@/hooks/useCurrentUser", () => ({ default: () => mocks.user }));
vi.mock("@/hooks/useMediaQuery", () => ({ default: () => true }));
vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));
vi.mock("react-hot-toast", () => ({ toast: mocks.toast }));
beforeEach(() => {
sessionStorage.clear();
mocks.memos = [item];
mocks.user = { name: "users/qa" };
mocks.filters = [];
vi.stubGlobal(
"ResizeObserver",
class {
@@ -55,9 +70,9 @@ beforeEach(() => {
afterEach(() => vi.unstubAllGlobals());
function start() {
function start(selection = "memo=memos%2Fone") {
render(
<MemoryRouter initialEntries={["/spaces/travel/map?lat=35&lng=135&zoom=12&memo=memos%2Fone"]}>
<MemoryRouter initialEntries={[`/spaces/travel/map?lat=35&lng=135&zoom=12&${selection}`]}>
<MapView />
</MemoryRouter>,
);
@@ -107,3 +122,50 @@ describe("map composer", () => {
expect(screen.queryByText("map.saved-outside-filter")).not.toBeInTheDocument();
});
});
describe("map place labels", () => {
const other = create(MemoSchema, {
name: "memos/two",
creator: "users/alice",
location: { placeholder: "Mom's house", latitude: 35, longitude: 135 },
});
it("never copies another author's label into a new memo", () => {
mocks.memos = [other];
start("memo=memos%2Ftwo");
expect(mocks.editor.defaultLocation).toMatchObject({ latitude: 35, longitude: 135, placeholder: "35.0000°, 135.0000°" });
// A single author's label still titles their own memos.
expect(screen.getByTestId("panel")).toHaveAttribute("data-title", "Mom's house");
});
it("titles a mixed-author point by coordinates unless everyone used the same label", () => {
mocks.memos = [other, item];
start("memo=memos%2Ftwo&memo=memos%2Fone");
expect(screen.getByTestId("panel")).toHaveAttribute("data-title", "35.0000°, 135.0000°");
// The writer's own label at the point is theirs to reuse.
expect(mocks.editor.defaultLocation).toMatchObject({ placeholder: "Kyoto" });
});
});
describe("map empty state", () => {
const renderEmpty = () =>
render(
<MemoryRouter initialEntries={["/map"]}>
<MapView />
</MemoryRouter>,
);
it("does not ask guests to add a location they cannot add", () => {
mocks.memos = [];
mocks.user = undefined;
renderEmpty();
expect(screen.getByText("map.empty")).toBeInTheDocument();
expect(screen.queryByText("map.empty-hint")).not.toBeInTheDocument();
});
it("keeps the hint for signed-in users", () => {
mocks.memos = [];
renderEmpty();
expect(screen.getByText("map.empty-hint")).toBeInTheDocument();
});
});
+71
View File
@@ -0,0 +1,71 @@
import { create } from "@bufbuild/protobuf";
import { render, screen } from "@testing-library/react";
import type { ReactNode } from "react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { MemoPanelList } from "@/components/MemoPanel/MemoPanelList";
import type { MemoViewProps } from "@/components/MemoView/types";
import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb";
const mocks = vi.hoisted(() => ({
creatorUsername: undefined as string | undefined,
cards: [] as MemoViewProps[],
userNames: [] as string[],
}));
vi.mock("@/components/MemoView", () => ({
default: (props: MemoViewProps) => {
mocks.cards.push(props);
return <p>{props.memo.name}</p>;
},
}));
vi.mock("@/components/MemoContent/MentionResolutionContext", () => ({
MentionResolutionProvider: ({ userNames, children }: { userNames: string[]; children: ReactNode }) => {
mocks.userNames = userNames;
return children;
},
}));
vi.mock("@/components/MemoEditor", () => ({ default: () => <div data-testid="editor" /> }));
vi.mock("@/contexts/NewMemoContext", () => ({ NewMemoProvider: ({ children }: { children: ReactNode }) => children }));
vi.mock("@/contexts/AuthContext", () => ({ useAuth: () => ({ isUserSettingsInitialized: true }) }));
vi.mock("@/contexts/SpaceContext", () => ({ useSpaceContext: () => ({ creatorUsername: mocks.creatorUsername }) }));
vi.mock("@/contexts/ViewContext", () => ({ useView: () => ({ compactMode: false }) }));
vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));
const memos = [
create(MemoSchema, { name: "memos/a", creator: "users/alice", pinned: true, reactions: [{ creator: "users/carol" }] }),
create(MemoSchema, { name: "memos/b", creator: "users/bob" }),
];
beforeEach(() => {
mocks.cards = [];
mocks.userNames = [];
});
describe("memo panel list", () => {
it("attributes a mixed-author selection and resolves every author in one batch", () => {
mocks.creatorUsername = undefined;
render(<MemoPanelList memos={memos} selectionKey="2026-09-24" />);
expect(mocks.cards.map((card) => card.showCreator)).toEqual([true, true]);
expect(mocks.userNames).toEqual(["users/alice", "users/carol", "users/bob"]);
});
it("does not honor other people's pins in a mixed-author selection", () => {
mocks.creatorUsername = undefined;
render(<MemoPanelList memos={memos} selectionKey="2026-09-24" />);
expect(mocks.cards.map((card) => card.showPinned)).toEqual([false, false]);
});
it("shows pins but not creators in a single creator's scope", () => {
mocks.creatorUsername = "alice";
render(<MemoPanelList memos={memos} selectionKey="2026-09-24" />);
expect(mocks.cards.map((card) => [card.showCreator, card.showPinned])).toEqual([
[false, true],
[false, true],
]);
expect(mocks.userNames).toEqual(["users/carol"]);
});
it("says the selection is empty instead of showing a blank panel", () => {
render(<MemoPanelList memos={[]} selectionKey="2026-09-13" emptyText="No memos on this day" />);
expect(screen.getByText("No memos on this day")).toBeInTheDocument();
});
});