Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: tweak heatmap calendar cells
bluedbird73306272f91f
diff --git a/web/src/components/ActivityCalendar/CalendarCell.tsx b/web/src/components/ActivityCalendar/CalendarCell.tsxindex 3bde82078..f86093fc0 100644--- a/web/src/components/ActivityCalendar/CalendarCell.tsx+++ b/web/src/components/ActivityCalendar/CalendarCell.tsx@@ -40,7 +40,7 @@ export const CalendarCell = memo(({ day, maxCount, tooltipText, onClick }: Calen{day.isToday && (<spanaria-hidden="true"- className="absolute bottom-[3px] left-1/2 size-[3px] -translate-x-1/2 rounded-full bg-blue-600/80 dark:bg-blue-300/80"+ className="absolute bottom-[3px] left-1/2 size-[3px] -translate-x-1/2 rounded-full bg-current opacity-70"/>)}</span>diff --git a/web/src/components/ActivityCalendar/MonthCalendar.tsx b/web/src/components/ActivityCalendar/MonthCalendar.tsxindex b2df525a1..fceda818a 100644--- a/web/src/components/ActivityCalendar/MonthCalendar.tsx+++ b/web/src/components/ActivityCalendar/MonthCalendar.tsx@@ -1,12 +1,16 @@import { memo, useMemo } from "react";import { useInstance } from "@/contexts/InstanceContext";import { getToday } from "@/lib/calendar-utils";+import { cn } from "@/lib/utils";import { useTranslate } from "@/utils/i18n";import { CalendarCell } from "./CalendarCell";import { rotateWeekdays, useMonthDays } from "./monthDays";import type { MonthCalendarProps } from "./types";import { calculateMaxCount, getTooltipText } from "./utils";+/** The type of a weekday column label, shared by every month grid. */+export const WEEKDAY_LABEL_CLASSES = "text-2xs font-medium uppercase tracking-[0.04em] text-muted-foreground/50";+/** Localized weekday labels starting on the instance's first day of the week. */export const useWeekdayLabels = (weekStartDayOffset: number) => {const t = useTranslate();@@ -44,12 +48,9 @@ export const MonthCalendar = memo(({ month, data, selectedDate, onClick, timeBasreturn (<div className="flex flex-col" role="group" aria-label={`Calendar for ${month}`}>{/* Every day button already announces its full date, so the initials are decoration. */}- <div className="mb-1.5 grid grid-cols-7 gap-1 text-2xs" aria-hidden="true">+ <div className="mb-1.5 grid grid-cols-7 gap-1" aria-hidden="true">{weekDays.map((label, index) => (- <div- key={index}- className="flex h-5 items-center justify-center font-medium uppercase tracking-[0.04em] text-muted-foreground/50"- >+ <div key={index} className={cn("flex h-5 items-center justify-center", WEEKDAY_LABEL_CLASSES)}>{Array.from(label)[0]}</div>))}diff --git a/web/src/components/ActivityCalendar/cellStyles.ts b/web/src/components/ActivityCalendar/cellStyles.tsindex e0a7375b8..ab1d8669d 100644--- a/web/src/components/ActivityCalendar/cellStyles.ts+++ b/web/src/components/ActivityCalendar/cellStyles.ts@@ -1,5 +1,6 @@import { cn } from "@/lib/utils";import type { CalendarDayCell } from "./types";+import { type ActivityLevel, getActivityLevel } from "./utils";/*** The square chip inside a cell carries every visual. `max-w-[30px]` caps it so a wider@@ -18,24 +19,33 @@ const EMPTY_CHIP = "bg-transparent text-foreground/75 group-hover/day:bg-muted/4/** A picked day is a checked filter like a view or tag row: it takes the accent, not a ring. */const SELECTED_CHIP = "z-10 bg-primary font-medium text-primary-foreground";-/** Activity tints, ordered from the fraction of `maxCount` a day must exceed to earn them. */-const INTENSITY_TINTS: ReadonlyArray<readonly [threshold: number, className: string]> = [- [0.75, "bg-blue-400/60 text-foreground/85"],- [0.5, "bg-blue-400/45 text-foreground/80"],- [0.25, "bg-blue-400/30 text-foreground/80"],- [0, "bg-blue-400/18 text-foreground/75"],-];+/** Primary-tinted activity levels; the small chip can carry a stronger wash than a full day cell. */+const INTENSITY_TINTS: Record<Exclude<ActivityLevel, 0>, string> = {+ 1: "bg-primary/12 text-foreground/75",+ 2: "bg-primary/22 text-foreground/80",+ 3: "bg-primary/34 text-foreground/80",+ 4: "bg-primary/48 text-foreground/85",+};++/**+ * The same ladder for a full calendar day cell, with its hover step: lighter than the chip+ * because excerpts and photos sit on top. Kept beside the chip's so the two cannot drift.+ */+export const DAY_CELL_FILLS: Record<ActivityLevel, string> = {+ 0: "bg-card hover:bg-muted/40",+ 1: "bg-primary/8 hover:bg-primary/12",+ 2: "bg-primary/16 hover:bg-primary/20",+ 3: "bg-primary/26 hover:bg-primary/30",+ 4: "bg-primary/38 hover:bg-primary/42",+};const getFillClass = (day: CalendarDayCell, maxCount: number): string => {if (!day.isCurrentMonth) return OUTSIDE_MONTH_CHIP;// Selected owns the fill outright: layering the empty-cell hover tint on top would swap// the accent out on hover and leave primary-foreground text on a muted chip.if (day.isSelected) return SELECTED_CHIP;- if (day.count === 0) return EMPTY_CHIP;-- const ratio = day.count / maxCount;- const tint = INTENSITY_TINTS.find(([threshold]) => ratio > threshold);- return tint?.[1] ?? EMPTY_CHIP;+ const level = getActivityLevel(day.count, maxCount);+ return level === 0 ? EMPTY_CHIP : INTENSITY_TINTS[level];};export const getChipClassName = (day: CalendarDayCell, maxCount: number, isInteractive: boolean): string =>diff --git a/web/src/components/ActivityCalendar/index.ts b/web/src/components/ActivityCalendar/index.tsindex a7f154d96..14975170f 100644--- a/web/src/components/ActivityCalendar/index.ts+++ b/web/src/components/ActivityCalendar/index.ts@@ -1,4 +1,5 @@-export { MonthCalendar, useWeekdayLabels } from "./MonthCalendar";+export { DAY_CELL_FILLS } from "./cellStyles";+export { MonthCalendar, useWeekdayLabels, WEEKDAY_LABEL_CLASSES } from "./MonthCalendar";export { useMonthDays } from "./monthDays";export type { CalendarData, CalendarDayCell, MonthCalendarProps } from "./types";-export { getTooltipText } from "./utils";+export { type ActivityLevel, calculateMaxCount, getActivityLevel, getTooltipText } from "./utils";diff --git a/web/src/components/ActivityCalendar/utils.ts b/web/src/components/ActivityCalendar/utils.tsindex 3b362ebe6..145268375 100644--- a/web/src/components/ActivityCalendar/utils.ts+++ b/web/src/components/ActivityCalendar/utils.ts@@ -7,6 +7,19 @@ export type TranslateFunction = ReturnType<typeof useTranslate>;/** Largest daily count in the data, floored at 1 so intensity ratios never divide by zero. */export const calculateMaxCount = (data: CalendarData): number => Math.max(1, ...Object.values(data));+/** 0 = no activity; 1–4 = the quarter of `maxCount` a day's count falls into, GitHub-heatmap style. */+export type ActivityLevel = 0 | 1 | 2 | 3 | 4;++/** `maxCount` is at least 1, as `calculateMaxCount` guarantees. */+export const getActivityLevel = (count: number, maxCount: number): ActivityLevel => {+ if (count <= 0) return 0;+ const ratio = count / maxCount;+ if (ratio > 0.75) return 4;+ if (ratio > 0.5) return 3;+ if (ratio > 0.25) return 2;+ return 1;+};+export const getTooltipText = (count: number, date: string, t: TranslateFunction, timeBasis: MemoTimeBasis = "create_time"): string => {if (count === 0) {return date;diff --git a/web/src/components/AppSidebar/SidebarResizeHandle.tsx b/web/src/components/AppSidebar/SidebarResizeHandle.tsxindex eb2c90f58..dad06a7f3 100644--- a/web/src/components/AppSidebar/SidebarResizeHandle.tsx+++ b/web/src/components/AppSidebar/SidebarResizeHandle.tsx@@ -30,8 +30,28 @@ interface Props {edge?: "start" | "end";/** Accessible name; defaults to the sidebar's. */label?: string;+ /** `line` for a divider between two panes; `grip` for a floating card's edge. */+ appearance?: keyof typeof INDICATORS;}+/**+ * What the 8px strip shows. `line` is a 2px band centring to whole pixels inside the strip, so+ * it covers the rail's border and stays crisp at 1x. `grip` is a short pill astride the edge,+ * like the sheet's grab handle sits on its top, fading in only for a pointer over the strip.+ */+const INDICATORS = {+ line: {+ base: "h-full w-0.5 transition-colors",+ dragging: "bg-primary/70",+ rest: "bg-transparent group-hover:bg-border group-focus-visible:bg-primary/70",+ },+ grip: {+ base: "h-8 w-1 rounded-full transition-[background-color,opacity] duration-150",+ dragging: "bg-primary/70 opacity-100",+ rest: "bg-muted-foreground/50 opacity-0 group-hover:opacity-100 group-focus-visible:bg-primary/70 group-focus-visible:opacity-100",+ },+} as const;+const SidebarResizeHandle = ({width,minWidth,@@ -42,9 +62,11 @@ const SidebarResizeHandle = ({defaultWidth = SIDEBAR_DEFAULT_WIDTH,edge = "end",label,+ appearance = "line",}: Props) => {const t = useTranslate();const direction = useDirection();+ const indicator = INDICATORS[appearance];// Pointer and arrow deltas grow the rail when they move toward its far side: rightward for an// end-edge handle in LTR, leftward for a start-edge one; RTL mirrors both.const growSign = (edge === "end" ? 1 : -1) * (direction === "rtl" ? -1 : 1);@@ -170,18 +192,11 @@ const SidebarResizeHandle = ({onDoubleClick={() => onWidthChange(defaultWidth)}onKeyDown={handleKeyDown}className={cn(- "group absolute inset-y-0 z-10 flex w-2 cursor-col-resize touch-none justify-center focus-visible:outline-none",+ "group absolute inset-y-0 z-10 flex w-2 cursor-col-resize touch-none items-center justify-center focus-visible:outline-none",edge === "end" ? "-end-1" : "-start-1",)}>- {/* A 2px band centering to whole pixels inside the 8px strip, so it covers the rail's- border and stays crisp at 1x instead of antialiasing across a half-pixel seam. */}- <div- className={cn(- "h-full w-0.5 transition-colors",- dragging ? "bg-primary/70" : "bg-transparent group-hover:bg-border group-focus-visible:bg-primary/70",- )}- />+ <div className={cn(indicator.base, dragging ? indicator.dragging : indicator.rest)} /></div>);};diff --git a/web/src/components/CalendarView/CalendarDayCell.tsx b/web/src/components/CalendarView/CalendarDayCell.tsxindex 199d918fc..c7ff0e309 100644--- a/web/src/components/CalendarView/CalendarDayCell.tsx+++ b/web/src/components/CalendarView/CalendarDayCell.tsx@@ -1,5 +1,10 @@import { memo, useState } from "react";-import { type CalendarDayCell as CalendarDayCellData, getTooltipText } from "@/components/ActivityCalendar";+import {+ type CalendarDayCell as CalendarDayCellData,+ DAY_CELL_FILLS,+ getActivityLevel,+ getTooltipText,+} from "@/components/ActivityCalendar";import { FOCUS_VISIBLE_OUTLINE_CLASSES } from "@/components/ui/focus";import type { MemoTimeBasis } from "@/contexts/ViewContext";import { cn } from "@/lib/utils";@@ -8,27 +13,42 @@ import { CalendarLink } from "./CalendarLink";import type { CalendarDaySummary } from "./dayModel";import { buildCalendarPath, getMonthOfDate } from "./paths";+/** Every excerpt line is one sidebar row of type: 13px on an 18px line. */+const LINE_HEIGHT = 18;+/** The photo strip is a row of square marks, sized like a small sidebar avatar. */+const IMAGE_SIZE = 36;+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;+export interface CalendarCellLayout {- compact: boolean;+ /** Excerpt lines when the day has no photo strip. */textLines: number;- imageHeight: number;+ /** Excerpt lines above the photo strip; can be 0 while the strip still fits. */+ textLinesWithImages: number;+ /** Photo marks that fit across; 0 when the cell is too narrow or short for a strip. */imageCount: number;}/** Use the actual cell size, including width lost to the resizable day panel. */export const layoutForCellSize = (width: number, height: number): CalendarCellLayout => {- const available = Math.max(0, height - 48);+ // Too narrow for previews: the date carries the day on its own.+ const compact = width < 100;+ const available = Math.max(0, height - HEADER_HEIGHT);+ const showImages = !compact && available >= IMAGE_SIZE;return {- compact: width < 100,- textLines: width < 100 ? 0 : Math.min(3, Math.floor(available / 18)),- imageHeight: width < 100 || available < 32 ? 0 : available,- imageCount: width < 150 ? 1 : 2,+ 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,};};export interface CalendarDayCellProps {day: CalendarDayCellData;summary?: CalendarDaySummary;+ /** Busiest day in the statistics; the cell's fill is the quarter of it this day reaches. */+ maxCount: number;layout: CalendarCellLayout;/** The month's memos are still loading; `day.count` from statistics is all we know. */pending: boolean;@@ -42,19 +62,60 @@ export interface CalendarDayCellProps {const CORNER_CLASSES = { ss: "rounded-ss-lg", se: "rounded-se-lg", es: "rounded-es-lg", ee: "rounded-ee-lg" } as const;-/** One day, one excerpt, and supporting photos. The entire cell opens the day's memo stream. */+/**+ * Today and the open day share one object, the way Notion Calendar marks dates: a 22px+ * rounded-square badge on the numeral, starting on the text axis. Today is the solid+ * primary fill, the open day a quiet foreground wash, and when today is open the primary+ * badge sits inside a grey halo rather than stacking a second shape.+ */+const BADGE = "inline-flex h-[22px] min-w-[22px] items-center justify-center rounded-md px-[5px]";+const TODAY_BADGE = `${BADGE} bg-primary text-primary-foreground`;+const OPEN_BADGE = `${BADGE} bg-foreground/10 text-foreground`;+/** Negative margin keeps the badge where it was; only the halo grows outward. */+const OPEN_TODAY_HALO = "-m-[3px] inline-flex rounded-[9px] bg-foreground/10 p-[3px]";++const getNumeralClass = (day: CalendarDayCellData, count: number): string => {+ if (day.isToday) return TODAY_BADGE;+ if (day.isSelected) return OPEN_BADGE;+ if (!day.isCurrentMonth) return "text-muted-foreground/40";+ return count > 0 ? "text-foreground" : "text-muted-foreground/70";+};++const NO_IMAGES: CalendarDaySummary["images"] = [];++/**+ * One day, one excerpt, and a strip of photos. 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, layout, pending, timeBasis, tabIndex, isLastColumn, isLastRow, corner }: CalendarDayCellProps) => {+ ({ day, summary, maxCount, layout, pending, timeBasis, tabIndex, isLastColumn, isLastRow, corner }: CalendarDayCellProps) => {const t = useTranslate();const [failedImages, setFailedImages] = useState<string[]>([]);const count = summary ? summary.memos.length : day.count;- const excerpt = summary?.excerpt;- const images = (summary?.images ?? []).filter((image) => !failedImages.includes(image.thumbnailUrl)).slice(0, layout.imageCount);- // Keep a usable image even when a short cell cannot also fit the excerpt.- // Text uses the space above the 32px image and 8px gap; flex gives photos any unused space.- const showImages = images.length > 0 && layout.imageHeight >= 32;- const textLines = showImages && excerpt ? Math.max(0, Math.min(2, Math.floor((layout.imageHeight - 40) / 18))) : layout.textLines;+ const level = getActivityLevel(count, maxCount);+ const images =+ layout.imageCount > 0+ ? (summary?.images ?? NO_IMAGES).filter((image) => !failedImages.includes(image.thumbnailUrl)).slice(0, layout.imageCount)+ : NO_IMAGES;+ // Keep a usable photo even when a short cell cannot also fit the excerpt.+ const showImages = images.length > 0;+ const textLines = showImages ? layout.textLinesWithImages : layout.textLines;+ const excerpt = textLines > 0 ? summary?.excerpt : undefined;const showSkeleton = pending && !summary && day.isCurrentMonth && day.count > 0;+ const numeral = (+ <span+ className={cn(+ "text-ui leading-none tabular-nums tracking-[-0.01em]",+ day.isSelected ? "font-medium" : "font-normal",+ getNumeralClass(day, count),+ )}+ >+ {day.label}+ </span>+ );return (<CalendarLink@@ -64,57 +125,35 @@ export const CalendarDayCell = memo(aria-label={getTooltipText(count, day.date, t, timeBasis)}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 sm:px-3 text-start no-underline transition-colors sm:min-h-20 md:min-h-[5.5rem]",+ "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]",!isLastColumn && "border-e",!isLastRow && "border-b",corner && CORNER_CLASSES[corner],FOCUS_VISIBLE_OUTLINE_CLASSES,- // The open day is the place you are, so it takes the fill the sidebar gives a current row.- day.isSelected ? "bg-accent" : day.isCurrentMonth ? "bg-card hover:bg-muted/40" : "bg-muted/25 hover:bg-muted/45",+ // The open day keeps its heat tint; its numeral badge is the selection mark.+ day.isCurrentMonth ? DAY_CELL_FILLS[level] : "bg-muted/25 hover:bg-muted/45",)}>- {/* A fixed date slot keeps today's circle inside the cell, including on narrow screens. */}- <span className={cn("flex min-h-6 gap-1", layout.compact ? "flex-col items-start" : "items-center justify-between")}>- <span- className={cn(- "relative z-0 inline-flex size-6 shrink-0 items-center justify-center text-ui font-medium leading-none tabular-nums",- day.isToday- ? "font-medium text-primary-foreground before:absolute before:left-1/2 before:top-1/2 before:-z-10 before:size-[22px] before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:bg-primary before:content-['']"- : !day.isCurrentMonth- ? "text-muted-foreground/40"- : count > 0- ? "font-medium text-foreground"- : "text-muted-foreground",- )}- >- {day.label}- </span>- {count > 0 && (- <span- className={cn(- "min-w-0 max-w-full whitespace-nowrap text-[10px] font-normal leading-4 tabular-nums sm:text-2xs",- layout.compact && "w-6 text-center",- day.isCurrentMonth ? "text-muted-foreground" : "text-muted-foreground/40",- )}- >- {count}- </span>- )}+ {/* The date starts on the text axis like every line below it. */}+ <span className="flex h-6 shrink-0 items-center">+ {day.isSelected && day.isToday ? <span className={OPEN_TODAY_HALO}>{numeral}</span> : numeral}</span>- {showSkeleton && layout.textLines > 0 && <span aria-hidden="true" className="mt-2 h-2 w-2/3 animate-pulse rounded bg-muted" />}+ {showSkeleton && layout.textLines > 0 && (+ <span aria-hidden="true" className="mt-1 flex h-[18px] items-center">+ <span className="h-2 w-2/3 animate-pulse rounded-sm bg-muted" />+ </span>+ )}- {day.isCurrentMonth && !showSkeleton && ((excerpt && textLines > 0) || showImages) && (- <span- aria-hidden="true"- className="mt-1 flex min-h-0 min-w-0 flex-col gap-2"- style={{ height: showImages ? layout.imageHeight : undefined }}- >- {excerpt && textLines > 0 && (+ {day.isCurrentMonth && !showSkeleton && (excerpt || showImages) && (+ <span aria-hidden="true" className="mt-1 flex min-w-0 flex-col gap-1">+ {excerpt && (<spanclassName={cn(- "shrink-0 overflow-hidden whitespace-pre-line break-words text-xs leading-[18px] text-foreground/80 [display:-webkit-box] [-webkit-box-orient:vertical]",- excerpt.isCode && "font-mono",+ "overflow-hidden whitespace-pre-line break-words text-ui leading-[18px] [display:-webkit-box] [-webkit-box-orient:vertical]",+ "text-muted-foreground transition-colors group-hover/day:text-foreground",+ day.isSelected && "text-foreground",+ excerpt.isCode && "font-mono text-xs",)}style={{ WebkitLineClamp: textLines }}>@@ -122,7 +161,7 @@ export const CalendarDayCell = memo(</span>)}{showImages && (- <span className="flex max-h-16 min-h-8 min-w-0 flex-1 gap-1">+ <span className="flex gap-1">{images.map((image) => (<imgkey={image.thumbnailUrl}@@ -130,8 +169,7 @@ export const CalendarDayCell = memo(alt=""loading="lazy"decoding="async"- className="h-full min-w-0 flex-1 rounded object-cover"- style={{ maxWidth: images.length === 1 ? 112 : undefined }}+ className="size-9 shrink-0 rounded-md object-cover"onError={() => setFailedImages((failed) => [...failed, image.thumbnailUrl])}/>))}diff --git a/web/src/components/CalendarView/CalendarGrid.tsx b/web/src/components/CalendarView/CalendarGrid.tsxindex a10bf657c..fe96a9505 100644--- a/web/src/components/CalendarView/CalendarGrid.tsx+++ b/web/src/components/CalendarView/CalendarGrid.tsx@@ -1,10 +1,11 @@import { useDirection } from "@base-ui/react/direction-provider";import dayjs from "dayjs";-import { type KeyboardEvent, useLayoutEffect, useRef, useState } from "react";-import { type CalendarData, useMonthDays, useWeekdayLabels } from "@/components/ActivityCalendar";+import { type KeyboardEvent, useLayoutEffect, useMemo, useRef, useState } from "react";+import { type CalendarData, calculateMaxCount, useMonthDays, useWeekdayLabels, WEEKDAY_LABEL_CLASSES } from "@/components/ActivityCalendar";import { useInstance } from "@/contexts/InstanceContext";import { useView } from "@/contexts/ViewContext";import { ISO_DATE_FORMAT } from "@/lib/calendar-utils";+import { cn } from "@/lib/utils";import { CalendarDayCell, layoutForCellSize } from "./CalendarDayCell";import type { CalendarMonthModel } from "./dayModel";import { getDefaultDate } from "./paths";@@ -23,7 +24,7 @@ export interface CalendarGridProps {model: CalendarMonthModel;pending: boolean;selectedDate?: string;- /** Below md the compact calendar shows dates and counts, with the stream beneath. */+ /** Below md the compact calendar shows tinted dates only, with the stream beneath. */showRows: boolean;}@@ -46,6 +47,8 @@ export const CalendarGrid = ({ month, monthLabel, today, counts, model, pending,const weekdayLabels = useWeekdayLabels(generalSetting.weekStartDayOffset);const days = useMonthDays({ month, data: counts, weekStartDayOffset: generalSetting.weekStartDayOffset, today, selectedDate });+ // The same all-time ceiling the sidebar heatmap uses, so a day reads the same tint in both.+ const maxCount = useMemo(() => calculateMaxCount(counts), [counts]);const firstDate = `${month}-01`;const lastDate = dayjs(firstDate).endOf("month").format(ISO_DATE_FORMAT);// One tab stop for the grid: the open day, else today, else the first of the month.@@ -64,6 +67,8 @@ export const CalendarGrid = ({ month, monthLabel, today, counts, model, pending,observer.observe(el);return () => observer.disconnect();}, [rowCount, showRows]);+ // One layout for every cell, and a stable reference so unchanged cells skip re-rendering.+ const layout = useMemo(() => layoutForCellSize(cellSize.width, showRows ? cellSize.height : 0), [cellSize, showRows]);const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {const current = (event.target as HTMLElement).dataset.calendarDate;@@ -91,12 +96,12 @@ export const CalendarGrid = ({ month, monthLabel, today, counts, model, pending,<div className="grid grid-cols-7 px-px" aria-hidden="true">{weekdayLabels.map((label) => (<div key={label} className="flex h-8 items-end px-3 pb-1.5">- <span className="text-2xs leading-none text-muted-foreground/60">{label}</span>+ <span className={cn("leading-none", WEEKDAY_LABEL_CLASSES)}>{label}</span></div>))}</div>{/* From xl the grid fills the sticky section, so the rows share its height evenly with a- floor that keeps the date, count, and a short excerpt visible on short windows. */}+ floor that keeps the date and a short excerpt visible on short windows. */}<divref={cellsRef}className="grid auto-rows-fr grid-cols-7 overflow-hidden rounded-lg border border-border/70 bg-card md:[grid-auto-rows:9rem] xl:min-h-0 xl:flex-1 xl:[grid-auto-rows:minmax(5.5rem,1fr)]"@@ -106,7 +111,8 @@ export const CalendarGrid = ({ month, monthLabel, today, counts, model, pending,key={day.date}day={day}summary={model[day.date]}- layout={layoutForCellSize(cellSize.width, showRows ? cellSize.height : 0)}+ maxCount={maxCount}+ layout={layout}pending={pending}timeBasis={timeBasis}tabIndex={day.date === focusDate ? 0 : -1}diff --git a/web/src/components/MemoPanel/MemoPanel.tsx b/web/src/components/MemoPanel/MemoPanel.tsxindex 77a709581..49569713b 100644--- a/web/src/components/MemoPanel/MemoPanel.tsx+++ b/web/src/components/MemoPanel/MemoPanel.tsx@@ -128,16 +128,18 @@ export function MemoPanel({ open, title, subtitle, reservedWidth, busy = false,aria-describedby={undefined}style={!desktop ? { height: `${sheetShare * 100}dvh` } : undefined}className={cn(- "fixed z-30 flex min-h-0 flex-col border border-border/70 bg-background shadow-md outline-none transition-transform duration-200",+ // A popover surface: lighter than the page in both themes, with the float shadow+ // rather than the tight card shadow, so a 400px card reads as lifted, not pasted on.+ "fixed z-30 flex min-h-0 flex-col border border-border/70 bg-popover text-popover-foreground shadow-float outline-none transition-transform duration-200",desktop? "inset-y-3 end-3 w-[var(--memo-panel-width)] rounded-xl data-starting-style:translate-x-full data-ending-style:translate-x-full": "inset-x-0 bottom-0 rounded-t-2xl pb-[env(safe-area-inset-bottom)] data-starting-style:translate-y-full data-ending-style:translate-y-full",)}>{desktop && (- // The rail stops short of the corners so it reads as the straight run of the card's edge.- <div className="absolute inset-y-3 start-0 w-0">+ <div className="absolute inset-y-0 start-0 w-0"><SidebarResizeHandle+ appearance="grip"width={width}minWidth={minWidth}maxWidth={maxWidth}diff --git a/web/src/components/MemoPreview/MemoPreview.tsx b/web/src/components/MemoPreview/MemoPreview.tsxindex 4b1697bc3..3d80e6b0c 100644--- a/web/src/components/MemoPreview/MemoPreview.tsx+++ b/web/src/components/MemoPreview/MemoPreview.tsx@@ -95,9 +95,9 @@ const PreviewMeta = ({}return (- <div className="flex shrink-0 items-center gap-1.5 text-ui leading-none text-muted-foreground">+ <div className="flex min-w-0 shrink-0 items-center gap-1.5 text-ui leading-none text-muted-foreground">{showMemoId && memoId && <span className="shrink-0 font-mono text-2xs text-muted-foreground/60">{memoId}</span>}- {showCreator && creatorName && <span className="truncate font-medium text-foreground">{creatorName}</span>}+ {showCreator && creatorName && <span className="max-w-32 truncate font-medium text-foreground">{creatorName}</span>}</div>);};diff --git a/web/src/components/MemoReactionListView/ReactionView.tsx b/web/src/components/MemoReactionListView/ReactionView.tsxindex 7a9904d61..fb905d548 100644--- a/web/src/components/MemoReactionListView/ReactionView.tsx+++ b/web/src/components/MemoReactionListView/ReactionView.tsx@@ -9,18 +9,21 @@ import { formatReactionTooltip, useReactionActions } from "./hooks";/*** A reaction is a token attached to the memo, not a control, so it takes the pill shape- * the space and New badges use rather than the rounded box of a button. Everything else- * is the quiet grammar: 28px, 13px, muted ink under a light wash, and the accent fill for- * the one that is on — your own reaction, or the add control while its picker is open.+ * the space and New badges use rather than the rounded box of a button, and like them it+ * has a faint resting surface: a token must read as one even where it cannot be pressed.+ * Everything else is the quiet grammar: 28px, 13px, muted ink that darkens under a light+ * wash, and the accent fill for the one that is on — your own reaction, or the add+ * control while its picker is open.*/-export const REACTION_PILL_CLASSES = "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full px-2.5 text-ui text-muted-foreground/70";+export const REACTION_PILL_CLASSES =+ "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full bg-muted/40 px-2.5 text-ui text-muted-foreground/70";const REACTION_PILL_INTERACTIVE_CLASSES = cn(REACTION_PILL_CLASSES,- "cursor-pointer transition-colors hover:bg-muted/60 hover:text-foreground aria-pressed:bg-accent aria-pressed:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground",+ "cursor-pointer transition-colors hover:bg-muted/70 hover:text-foreground aria-pressed:bg-accent aria-pressed:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground",FOCUS_VISIBLE_OUTLINE_CLASSES,);-/** The strip's add control: a round quiet face of the pills' height, so the strip reads as one row. */-export const REACTION_ADD_CLASSES = cn(REACTION_PILL_INTERACTIVE_CLASSES, "size-7 justify-center px-0");+/** The strip's add control is a control, not a token: a round quiet face of the pills' height with no resting surface. */+export const REACTION_ADD_CLASSES = cn(REACTION_PILL_INTERACTIVE_CLASSES, "size-7 justify-center bg-transparent px-0 hover:bg-muted/60");interface Props {memo: Memo;diff --git a/web/src/components/MemoView/components/MemoHeader.tsx b/web/src/components/MemoView/components/MemoHeader.tsxindex 946c3fcfb..61623763c 100644--- a/web/src/components/MemoView/components/MemoHeader.tsx+++ b/web/src/components/MemoView/components/MemoHeader.tsx@@ -70,7 +70,9 @@ const MemoHeader: React.FC<MemoHeaderProps> = ({ timeDisplay = "relative", showC// moves with what the header happens to show.<div className="flex h-6 w-full items-center justify-between gap-2"><div className="flex min-w-0 flex-1 items-center gap-2">- <div data-slot="memo-header-meta" className="flex min-w-0 items-center gap-1.5">+ {/* Width priority when the row is short: the time never truncates, the name keeps at least+ 64px and truncates, and the Space badge gives way first. */}+ <div data-slot="memo-header-meta" className="flex min-w-0 items-center gap-1.5 overflow-hidden">{showCreator && creator && <CreatorDisplay creator={creator} />}<TimeDisplay displayTime={displayTime} timeTooltip={timeTooltip} onGotoDetail={handleGotoMemoDetailPage} />{spaceMetadata}@@ -132,7 +134,7 @@ const CreatorDisplay: React.FC<{ creator: User }> = ({ creator }) => (<><LinkclassName={cn(- "flex min-w-0 items-center gap-1.5 rounded-sm text-ui font-medium text-foreground transition-colors hover:text-foreground/80",+ "flex min-w-16 shrink items-center gap-1.5 rounded-sm text-ui font-medium text-foreground transition-colors hover:text-foreground/80",FOCUS_VISIBLE_OUTLINE_CLASSES,)}to={`/u/${encodeURIComponent(creator.username)}`}@@ -141,9 +143,9 @@ const CreatorDisplay: React.FC<{ creator: User }> = ({ creator }) => (<span className="flex size-5 shrink-0 items-center justify-center"><UserAvatar className="size-5 rounded-[5px]" avatarUrl={creator.avatarUrl} /></span>- <span className="truncate">{creator.displayName || creator.username}</span>+ <span className="min-w-0 truncate">{creator.displayName || creator.username}</span></Link>- <span aria-hidden="true" className="text-muted-foreground/40">+ <span aria-hidden="true" className="shrink-0 text-muted-foreground/40">·</span></>diff --git a/web/src/components/MemoView/constants.ts b/web/src/components/MemoView/constants.tsindex 797fe506e..f3ff8d8bb 100644--- a/web/src/components/MemoView/constants.ts+++ b/web/src/components/MemoView/constants.ts@@ -9,7 +9,7 @@ export const MEMO_CARD_BASE_CLASSES =* 13px text with no box, darkening on hover like every quiet label.*/export const MEMO_TIME_CONTROL_CLASSES = cn(- "min-w-0 truncate rounded-sm text-start text-ui text-muted-foreground transition-colors select-none hover:text-foreground",+ "shrink-0 whitespace-nowrap rounded-sm text-start text-ui text-muted-foreground transition-colors select-none hover:text-foreground",FOCUS_VISIBLE_OUTLINE_CLASSES,);diff --git a/web/src/themes/default-dark.css b/web/src/themes/default-dark.cssindex 82f263363..5a60d8fd1 100644--- a/web/src/themes/default-dark.css+++ b/web/src/themes/default-dark.css@@ -36,6 +36,9 @@--warning: oklch(0.78 0.14 75);--warning-foreground: oklch(0.25 0.03 75);+ /* Floating surfaces separate mostly by their lighter popover tone; the shadow adds depth below. */+ --shadow-float: 0 1px 2px hsl(0 0% 0% / 0.3), 0 8px 24px -6px hsl(0 0% 0% / 0.4), 0 24px 56px -16px hsl(0 0% 0% / 0.5);+/* Borders - --border for layout dividers, --input for form field borders */--border: oklch(0.38 0.01 255);--input: oklch(0.42 0.011 255);diff --git a/web/src/themes/default.css b/web/src/themes/default.cssindex e5b560366..658dd7b48 100644--- a/web/src/themes/default.css+++ b/web/src/themes/default.css@@ -43,6 +43,8 @@--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);+ /* A surface floating over page content: a soft contact edge plus a wide, faint ambient fall. */+ --shadow-float: 0 1px 2px hsl(0 0% 0% / 0.05), 0 8px 24px -6px hsl(0 0% 0% / 0.1), 0 24px 56px -16px hsl(0 0% 0% / 0.14);}/* Tailwind v4 token mappings — compiled once at build time, shared by all themes.@@ -99,6 +101,7 @@--shadow-lg: var(--shadow-lg);--shadow-xl: var(--shadow-xl);--shadow-2xl: var(--shadow-2xl);+ --shadow-float: var(--shadow-float);/* Layering tiers — keep overlays/dropdowns/tooltips stacked consistently.Used by the ui/ primitives via z-overlay / z-dropdown / z-tooltip. */diff --git a/web/src/themes/paper.css b/web/src/themes/paper.cssindex 10d0c5ce0..aa4de86d1 100644--- a/web/src/themes/paper.css+++ b/web/src/themes/paper.css@@ -35,4 +35,5 @@--shadow-lg: 0 1px 3px 0px hsl(34 12% 15% / 0.08), 0 4px 6px -1px hsl(34 12% 15% / 0.08);--shadow-xl: 0 1px 3px 0px hsl(34 12% 15% / 0.08), 0 8px 10px -1px hsl(34 12% 15% / 0.08);--shadow-2xl: 0 1px 3px 0px hsl(34 12% 15% / 0.18);+ --shadow-float: 0 1px 2px hsl(34 12% 15% / 0.05), 0 8px 24px -6px hsl(34 12% 15% / 0.09), 0 24px 56px -16px hsl(34 12% 15% / 0.12);}diff --git a/web/tests/calendar-day-snapshot.test.tsx b/web/tests/calendar-day-snapshot.test.tsxindex 4ebf431fd..2d65dd848 100644--- a/web/tests/calendar-day-snapshot.test.tsx+++ b/web/tests/calendar-day-snapshot.test.tsx@@ -11,12 +11,19 @@ const summary: CalendarDaySummary = {excerpt: { memoName: "memos/a", text: "A memorable afternoon", isCode: false },images: [{ memoName: "memos/b", thumbnailUrl: "/photo.jpg" }],};-const cell = (value?: CalendarDaySummary, width = 170, height = 170) =>+interface CellOptions {+ width?: number;+ height?: number;+ isSelected?: boolean;+ isToday?: boolean;+}+const cell = (value?: CalendarDaySummary, { width = 170, height = 170, isSelected = true, isToday = true }: CellOptions = {}) =>render(<MemoryRouter initialEntries={["/spaces/work/calendar/2026/08?filter=test"]}><CalendarDayCell- day={{ date: "2026-08-07", label: 7, count: 0, isCurrentMonth: true, isToday: true, isSelected: true }}+ day={{ date: "2026-08-07", label: 7, count: 0, isCurrentMonth: true, isToday, isSelected }}summary={value}+ maxCount={4}layout={layoutForCellSize(width, height)}pending={false}timeBasis="create_time"@@ -28,12 +35,13 @@ const cell = (value?: CalendarDaySummary, width = 170, height = 170) =>);describe("calendar daily snapshot cell", () => {- it("separates the count from the date and keeps one day link with Space and filters", () => {+ it("keeps the count out of the cell text and in one day link with Space and filters", () => {cell(summary);const link = screen.getByRole("link");- expect(screen.getByText("2")).not.toHaveClass("rounded-full", "bg-primary");- expect(screen.getByText("7")).toHaveClass("text-primary-foreground", "size-6");- expect(screen.getByText("2")).toHaveClass("font-normal", "text-muted-foreground");+ expect(screen.queryByText("2")).toBeNull();+ // Today's badge is a 22px rounded square that starts on the text axis, not a centred disc.+ expect(screen.getByText("7")).toHaveClass("text-primary-foreground", "bg-primary", "rounded-md", "h-[22px]", "text-ui");+ expect(screen.getByText("7")).not.toHaveClass("size-6", "before:rounded-full");expect(link).toHaveAccessibleName("2 memos in 2026-08-07");expect(link).toHaveAttribute("href", "/spaces/work/calendar/2026/08/07?filter=test");expect(link).toHaveAttribute("aria-current", "page");@@ -47,32 +55,56 @@ describe("calendar daily snapshot cell", () => {expect(screen.queryByText(/memos/)).toBeNull();expect(document.querySelector("img")).toBeNull();});- it("removes failed photos while retaining the excerpt and total count", () => {+ it("tints the background by the day's share of the busiest day, like a heatmap", () => {+ cell(summary, { isSelected: false });+ // Two of a max of four memos is the second of four levels.+ expect(screen.getByRole("link")).toHaveClass("bg-primary/16");+ expect(screen.getByRole("link")).not.toHaveClass("bg-card", "bg-accent");+ });+ it("keeps the heat tint under the open day and marks it with a quiet badge on the numeral", () => {+ cell(summary, { isToday: false });+ expect(screen.getByRole("link")).toHaveClass("bg-primary/16");+ expect(screen.getByRole("link")).not.toHaveClass("bg-accent");+ expect(screen.getByText("7")).toHaveClass("font-medium", "bg-foreground/10", "text-foreground", "rounded-md");+ expect(screen.getByText("7").parentElement).not.toHaveClass("bg-foreground/10");+ });+ it("marks today with the solid primary badge and no weight change", () => {+ cell(summary, { isSelected: false });+ expect(screen.getByText("7")).toHaveClass("bg-primary", "text-primary-foreground", "font-normal");+ expect(screen.getByText("7").parentElement).not.toHaveClass("bg-foreground/10");+ });+ it("nests today's badge in a grey halo when today is also the open day", () => {+ cell(summary);+ expect(screen.getByText("7")).toHaveClass("bg-primary", "text-primary-foreground", "font-medium");+ expect(screen.getByText("7").parentElement).toHaveClass("bg-foreground/10", "p-[3px]", "-m-[3px]");+ });+ it("removes failed photos while retaining the excerpt", () => {cell(summary);fireEvent.error(document.querySelector("img")!);expect(document.querySelector("img")).toBeNull();expect(screen.getByText("A memorable afternoon")).toBeInTheDocument();- expect(screen.getByText("2")).toBeInTheDocument();});- it("keeps a thumbnail beside a clamped excerpt in the 117px cell that previously hid it", () => {- cell(summary, 106, 117);+ it("keeps a thumbnail under a clamped excerpt in the 117px cell that previously hid it", () => {+ cell(summary, { width: 106, height: 117 });expect(document.querySelector("img")).toHaveAttribute("src", "/photo.jpg");+ expect(document.querySelector("img")).toHaveClass("size-9", "rounded-md");expect(screen.getByText("A memorable afternoon")).toHaveStyle({ WebkitLineClamp: "1" });+ expect(screen.getByText("A memorable afternoon")).toHaveClass("text-ui", "leading-[18px]");});it("keeps the image instead of text when both cannot fit in a short cell", () => {- cell(summary, 106, 97);+ cell(summary, { width: 106, height: 97 });expect(document.querySelector("img")).toHaveAttribute("src", "/photo.jpg");expect(screen.queryByText("A memorable afternoon")).toBeNull();fireEvent.error(document.querySelector("img")!);expect(screen.getByText("A memorable afternoon")).toBeInTheDocument();});it("keeps image-only days visible in short cells", () => {- cell({ ...summary, excerpt: undefined }, 106, 88);+ cell({ ...summary, excerpt: undefined }, { width: 106, height: 88 });expect(document.querySelector("img")).toHaveAttribute("src", "/photo.jpg");});- it("shows only the date and count when narrow", () => {- cell(summary, 72);- expect(screen.getByText("2")).toBeInTheDocument();+ it("shows only the tinted date when narrow", () => {+ cell(summary, { width: 72, isSelected: false });+ expect(screen.getByRole("link")).toHaveClass("bg-primary/16");expect(screen.queryByText("A memorable afternoon")).toBeNull();expect(document.querySelector("img")).toBeNull();});diff --git a/web/tests/calendar-grid-rows.test.ts b/web/tests/calendar-grid-rows.test.tsindex 7a9c4c1ad..e88e349f4 100644--- a/web/tests/calendar-grid-rows.test.ts+++ b/web/tests/calendar-grid-rows.test.ts@@ -3,14 +3,15 @@ import { layoutForCellSize } from "@/components/CalendarView/CalendarDayCell";describe("calendar snapshot sizing", () => {it("keeps narrow cells readable by omitting previews", () => {- expect(layoutForCellSize(72, 140)).toMatchObject({ compact: true, textLines: 0, imageHeight: 0 });+ expect(layoutForCellSize(72, 140)).toEqual({ textLines: 0, textLinesWithImages: 0, imageCount: 0 });});- it("limits short cells to the text that fits", () => {- expect(layoutForCellSize(160, 88)).toMatchObject({ textLines: 2 });- expect(layoutForCellSize(160, 40)).toMatchObject({ textLines: 0, imageHeight: 0 });+ it("limits short cells to the 18px lines that fit", () => {+ expect(layoutForCellSize(160, 88)).toMatchObject({ textLines: 2, textLinesWithImages: 0, imageCount: 3 });+ expect(layoutForCellSize(160, 40)).toMatchObject({ textLines: 0, imageCount: 0 });});- it("reduces photos when the day panel takes space without shrinking the type", () => {- expect(layoutForCellSize(110, 160)).toMatchObject({ textLines: 3, imageCount: 1 });- expect(layoutForCellSize(160, 160)).toMatchObject({ textLines: 3, imageCount: 2 });+ it("fits as many 36px photo marks as the width allows, capped at three", () => {+ expect(layoutForCellSize(110, 160)).toMatchObject({ textLines: 3, textLinesWithImages: 2, imageCount: 2 });+ expect(layoutForCellSize(160, 160)).toMatchObject({ textLines: 3, imageCount: 3 });+ expect(layoutForCellSize(300, 160)).toMatchObject({ imageCount: 3 });});});diff --git a/web/tests/sidebar-resize-handle.test.tsx b/web/tests/sidebar-resize-handle.test.tsxindex 099158e12..3bd1026c1 100644--- a/web/tests/sidebar-resize-handle.test.tsx+++ b/web/tests/sidebar-resize-handle.test.tsx@@ -302,4 +302,27 @@ describe("<SidebarResizeHandle />", () => {expect(shellWidthVar()).toBe(`${SIDEBAR_DEFAULT_WIDTH}px`);expect(onWidthChange).not.toHaveBeenCalled();});+ it("renders the grip appearance as a short pill astride a start edge, hidden until hovered", () => {+ const targetRef = { current: document.createElement("div") };+ render(+ <DirectionProvider direction="ltr">+ <SidebarResizeHandle+ appearance="grip"+ edge="start"+ width={400}+ minWidth={320}+ maxWidth={640}+ onWidthChange={vi.fn()}+ targetRef={targetRef}+ cssVariable="--memo-panel-width"+ label="Resize panel"+ />+ </DirectionProvider>,+ );+ const handle = screen.getByRole("separator", { name: "Resize panel" });+ expect(handle).toHaveClass("-start-1", "w-2");+ const pill = handle.firstElementChild as HTMLElement;+ expect(pill).toHaveClass("h-8", "w-1", "rounded-full", "opacity-0", "group-hover:opacity-100");+ expect(pill).not.toHaveClass("h-full", "bg-transparent");+ });});