Files
siftlode/frontend/src/components/ui/MoreButton.tsx
T
peter 7455fff401 feat(design): a playlist's one action list (C1) — the row's "…", Delete + undo, the header's "…" (E28 S3e2)
- Playlist rows: the X column became the row's "…" (play, pin, copy title/link, move, order,
  remove). Remove runs at once, with no confirm; its toast's Undo puts the row back at its index.
  The Delete key removes a keyboard-walked row, and focus moves on to the next.
- POST /api/playlists/{id}/items takes an optional `position`, so an undo is one request that
  renumbers the list around the row.
- A new `listDelete` key scope. Only a list with `onDelete` registers it, so the help sheet does not
  offer Delete where nothing handles it.
- A playlist has one list, `usePlaylistActions.items`: rename, pin, YouTube open/push/revert,
  delete. The rail row's "…" and the page header's "…" both open it. Push and revert moved into
  the hook; the header keeps Play all.
- Phone-width playlist table: "#" and Channel are hidden below sm (`Column.phoneHidden`). Their
  fixed widths had left the title no width.
2026-09-26 04:05:39 +02:00

43 lines
1.3 KiB
TypeScript

import { type Ref } from "react";
import { MoreHorizontal } from "lucide-react";
import { IconButton } from "./IconButton";
import { type IconButtonSize, type IconButtonVariant } from "./buttonStyles";
// The visible door to an object's ONE action list (docs/DESIGN.md "Action placement", C1): the "…"
// that opens the same menu as a right-click, a long-press and Shift+F10, so no action is reachable
// only by a gesture. It carries no menu of its own — `menuProps` is the list's
// `useContextMenu().buttonProps(row)`, and `expanded` says whether THIS row's menu is the open one.
export function MoreButton({
label,
expanded,
menuProps,
variant = "ghost",
size = "sm",
className,
ref,
}: {
/** The menu's name ("Video actions"): the button's accessible name and tooltip. */
label: string;
expanded: boolean;
menuProps: Record<string, unknown>;
variant?: IconButtonVariant;
size?: IconButtonSize;
className?: string;
/** For a caller that hands the focus back here — an in-place rename the menu opened. */
ref?: Ref<HTMLButtonElement>;
}) {
return (
<IconButton
ref={ref}
variant={variant}
size={size}
label={label}
aria-expanded={expanded}
className={className}
{...menuProps}
>
<MoreHorizontal />
</IconButton>
);
}