diff --git a/web/src/components/MemoActionMenu/MemoActionMenu.tsx b/web/src/components/MemoActionMenu/MemoActionMenu.tsx index f48aa5d04..5edfda510 100644 --- a/web/src/components/MemoActionMenu/MemoActionMenu.tsx +++ b/web/src/components/MemoActionMenu/MemoActionMenu.tsx @@ -35,8 +35,9 @@ import { useMemoActionHandlers } from "./hooks"; import type { MemoActionMenuProps } from "./types"; /** - * The memo's action menu, in order of how often each action is reached for: - * open, edit and pin first; then archive, tasks and the Copy submenu; Delete last. + * The memo's action menu, grouped by what each action does to the card: + * write on it (Edit, the task action), place it (Pin, Archive), reach it beyond + * the feed (Open its page, Copy its link or content), then Delete last. * A memo's Space is changed in the editor, not here. An archived memo offers * only Restore and Delete, and a viewer only Open and Copy. */ @@ -136,25 +137,10 @@ const MemoActionMenu = (props: MemoActionMenuProps) => { return ( <> - {openItem} {t("common.edit")} - {!isComment && ( - - {memo.pinned ? : } - {memo.pinned ? t("common.unpin") : t("common.pin")} - - )} - - - {!isComment && ( - - - {t("common.archive")} - - )} {/* One task action at a time: finish the open tasks, or reset a finished list. */} {hasTaskList && (hasOpenTasks ? ( @@ -168,6 +154,24 @@ const MemoActionMenu = (props: MemoActionMenuProps) => { {t("memo.task-actions.uncheck-all")} ))} + + {/* A comment has no place of its own to pin or archive; it lives under its parent. */} + {!isComment && ( + <> + + + {memo.pinned ? : } + {memo.pinned ? t("common.unpin") : t("common.pin")} + + + + {t("common.archive")} + + + )} + + + {openItem} {copySubmenu} diff --git a/web/src/components/MemoMetadata/MetadataSection.tsx b/web/src/components/MemoMetadata/MetadataSection.tsx index a7f94bf4a..b8809e072 100644 --- a/web/src/components/MemoMetadata/MetadataSection.tsx +++ b/web/src/components/MemoMetadata/MetadataSection.tsx @@ -18,6 +18,11 @@ export const METADATA_ROW_CLASSES = cn( "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 compact row: 24px instead of 28px, for a list that previews rather than edits (the + * comment strip under a feed card). It packs rows into one block of lines. + */ +export const METADATA_COMPACT_ROW_CLASSES = cn(METADATA_ROW_CLASSES, "h-6"); /** The focusable body of a split row; its gap must equal the box's `gap-1`. */ export const METADATA_ROW_LABEL_CLASSES = `flex h-full min-w-0 flex-1 items-center gap-1 text-start ${FOCUS_VISIBLE_OUTLINE_CLASSES}`; export const METADATA_ROW_SLOT_CLASSES = "flex size-5 shrink-0 items-center justify-center"; @@ -107,23 +112,25 @@ interface MetadataSectionProps extends PropsWithChildren { count?: number; /** A control on the header's trailing end; it pulls out by its own padding to end on the text edge. */ action?: ReactNode; + /** `compact` sets a 20px header over gapless rows, to pair with `METADATA_COMPACT_ROW_CLASSES`. */ + density?: "default" | "compact"; } /** - * A quiet titled list: a 24px header with an uppercase title on the text edge, then + * A quiet titled list: a 24px header (20px when compact) with an uppercase title on the text edge, then * rows whose leading glyph lands on that same edge. No box or band, so the list recedes * behind the memo's own content. */ -const MetadataSection = ({ title, count, action, children }: MetadataSectionProps) => ( +const MetadataSection = ({ title, count, action, density = "default", children }: MetadataSectionProps) => (
-
+

{title} {count != null && {count}}

{action &&
{action}
}
-
{children}
+
{children}
); diff --git a/web/src/components/MemoPreview/MemoPreview.tsx b/web/src/components/MemoPreview/MemoPreview.tsx index 3d80e6b0c..3f5a5cdae 100644 --- a/web/src/components/MemoPreview/MemoPreview.tsx +++ b/web/src/components/MemoPreview/MemoPreview.tsx @@ -142,14 +142,9 @@ const MemoPreview = ({ return (
{showMeta && meta} - {showMeta && truncate && (hasContent || hasAttachments) &&
ยท
} {contentNode} {hasAttachments && (truncate ? ( diff --git a/web/src/components/MemoView/components/MemoCommentListView.tsx b/web/src/components/MemoView/components/MemoCommentListView.tsx index 8ea58a084..53b621dc8 100644 --- a/web/src/components/MemoView/components/MemoCommentListView.tsx +++ b/web/src/components/MemoView/components/MemoCommentListView.tsx @@ -1,23 +1,31 @@ -import { ArrowUpRightIcon } from "lucide-react"; +import { ChevronRightIcon } from "lucide-react"; import { Link } from "react-router-dom"; -import MetadataSection, { METADATA_ROW_CLASSES, METADATA_ROW_SLOT_CLASSES } from "@/components/MemoMetadata/MetadataSection"; +import MetadataSection, { METADATA_COMPACT_ROW_CLASSES, METADATA_ROW_SLOT_CLASSES } from "@/components/MemoMetadata/MetadataSection"; import { MemoPreview } from "@/components/MemoPreview"; -import { buttonVariants } from "@/components/ui/button"; +import { FOCUS_VISIBLE_OUTLINE_CLASSES } from "@/components/ui/focus"; import { useMemoComments } from "@/hooks/useMemoQueries"; import { useNearViewport } from "@/hooks/useNearViewport"; import { useUsersByNames } from "@/hooks/useUserQueries"; import { MEMO_COMMENTS_ANCHOR_ID } from "@/lib/memo-comments"; import { extractMemoIdFromName } from "@/lib/resource-names"; +import { cn } from "@/lib/utils"; import { useTranslate } from "@/utils/i18n"; import UserAvatar from "../../UserAvatar"; import { useMemoViewContext, useMemoViewDerived } from "../MemoViewContext"; import { createMemoNavigationState } from "../navigation"; -const VIEW_ALL_CLASSES = buttonVariants({ variant: "quiet", size: "sm" }); +/** + * "View all" speaks at the header's scale: 11px muted ink in a box as tall as the compact + * header, so it sits on the title's line instead of stretching it. + */ +const VIEW_ALL_CLASSES = cn( + "inline-flex h-5 items-center gap-0.5 rounded-md px-2 text-2xs text-muted-foreground/60 transition-colors hover:bg-muted/60 hover:text-foreground", + FOCUS_VISIBLE_OUTLINE_CLASSES, +); /** - * The comment strip hangs off the card's bottom edge: a titled list of up to three - * comments, each a row whose avatar sits in the leading slot on the card's text edge. + * The comment strip hangs off the card's bottom edge: a compact titled list of up to three + * comments, each a 24px row whose avatar sits in the leading slot on the card's text edge. */ const MemoCommentListView: React.FC = () => { const t = useTranslate(); @@ -38,14 +46,15 @@ const MemoCommentListView: React.FC = () => { } return ( -
+
{t("common.view-all")} - + } > @@ -58,7 +67,7 @@ const MemoCommentListView: React.FC = () => { to={`/${memo.name}#${uid}`} state={createMemoNavigationState(parentPage)} viewTransition - className={METADATA_ROW_CLASSES} + className={METADATA_COMPACT_ROW_CLASSES} >