refactor(ui): one rule for resettable, role key and display name; an honest reset label

The card menu's reset read 'Clear watch progress' but also un-hides and un-watches; it now says so.
The resettable rule, the demo-first role key and the display-name fallback each lived in several
components tied by comments; they are shared helpers now, and the menu reuses the card's own
strings instead of duplicate keys.
This commit is contained in:
2026-09-19 05:47:17 +02:00
parent 2d5bd275fa
commit 92979fa920
11 changed files with 45 additions and 45 deletions
+3 -3
View File
@@ -21,6 +21,7 @@ import VideoInfoCard from "./VideoInfoCard";
import { navItemAttrs } from "../lib/listNav";
import clsx from "clsx";
import type { Video, VideoStatus } from "../lib/api";
import { isResettable } from "../lib/api/feed";
import { FEED_VIEW_SPEC, type FeedView } from "../lib/feedView";
import { formatDate, formatDuration, formatNumber, formatViews, relativeTime } from "../lib/format";
import { isPlainLeftClick } from "../lib/nav";
@@ -46,9 +47,8 @@ function Actions({
e.stopPropagation();
onState(video.id, video.status === status ? "new" : status);
};
// Pristine = never opened: default status and no resume position. The reset clears the
// whole state (incl. an in-progress position the un-watch toggle can't touch).
const resettable = video.status !== "new" || video.position_seconds > 0;
// The reset clears the whole state (incl. an in-progress position the un-watch toggle can't touch).
const resettable = isResettable(video);
const toggleSave = (e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();