The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Library: Select all and the count go by what's shown; the bar's names match
Claude56f057505905
diff --git a/src/components/library-view.tsx b/src/components/library-view.tsxindex 4a0b899d..a67300e0 100644--- a/src/components/library-view.tsx+++ b/src/components/library-view.tsx@@ -30,7 +30,7 @@ import { Kbd } from "@/components/ui/kbd";import { Skeleton } from "@/components/ui/skeleton";import { BULK_MAX, useCreateGeneration, useFolders, useGenerationActions, useLibrary, useLibraryFacets, useUploads, type Asset, type FeedFilter } from "@/lib/api";import type { Generation, MediaKind } from "@/lib/catalog/types";-import { modKey } from "@/lib/keys";+import { keyCombo, useModKey } from "@/lib/keys";import { buildEntries, folderAndDescendants, reviewInfo, splitByDate, toggleAll, TRASH_DAYS, type LibraryEntry } from "@/lib/library";import { isLayered, shownOutputs } from "@/lib/output-actions";import { cn } from "@/lib/utils";@@ -271,6 +271,7 @@ function Inner() {// --- Selection ---------------------------------------------------------------------------const [selecting, setSelecting] = useState(false);const [selected, setSelected] = useState<Set<string>>(new Set());+ const mod = useModKey();const order = useMemo(() => sections.flatMap((s) => s.items.flatMap((e) => [e, ...(e.type === "stack" && expanded.has(e.key) ? e.items.map((g) => ({ type: "single" as const, key: g.id, g })) : [])])), [sections, expanded]);const latest = useRef({ order, selected, items });useEffect(() => {@@ -517,8 +518,8 @@ function Inner() {{!uploadsTab && (<buttononClick={() => (selecting ? clear() : setSelecting(true))}- aria-pressed={selecting}- aria-label="Select"+ // Named for what a press does, and with the word it shows ("Done" while selecting).+ aria-label={selecting ? "Done selecting" : "Select"}title={selecting ? "Done selecting" : "Select several"}className={cn("inline-flex h-8 shrink-0 items-center gap-1.5 rounded-full px-3 text-[13px] font-medium transition-colors",@@ -708,9 +709,9 @@ function Inner() {<div role="toolbar" aria-label="Selection" className="pointer-events-auto flex max-w-full items-center gap-1 overflow-x-auto rounded-full border bg-background p-1.5 shadow-strong">{/* Phones show just the count, so every action fits at 390 px. */}<span className="shrink-0 px-2.5 text-[13px] font-medium whitespace-nowrap">- {selected.size ? (+ {selectedGens.length ? (<>- {selected.size}+ {selectedGens.length}<span className="hidden sm:inline"> selected</span></>) : (@@ -719,20 +720,21 @@ function Inner() {</>)}</span>- {items.length > 0 && selected.size < items.length && (+ {/* Shown while any result in view is unselected (a search or filter can hide some of the selection). */}+ {items.some((g) => !selected.has(g.id)) && (<buttononClick={() => setSelected(new Set(items.map((g) => g.id)))}className={cn(BAR, "text-brand-text")}aria-label={`Select all ${items.length}`}- title={`Select all ${items.length} shown here (${modKey()}+A)`}+ title={`Select all ${items.length} shown here (${keyCombo("A", { mod })})`}><CheckCheck className="size-4" /> <span className="hidden sm:inline">Select all</span> <span className="font-mono text-[11px] tabular-nums">{items.length}</span></button>)}{trash ? (<>- <BarButton icon={ArchiveRestore} label="Restore" disabled={!selected.size} onClick={() => void actions.restore(selectedGens).then((n) => (n && toast(`Restored ${n}`), clear()))} />- <BarButton icon={Trash2} label="Delete forever" destructive disabled={!selected.size} onClick={() => confirmForever?.(selectedGens, clear)} />+ <BarButton icon={ArchiveRestore} label="Restore" disabled={!selectedGens.length} onClick={() => void actions.restore(selectedGens).then((n) => (n && toast(`Restored ${n}`), clear()))} />+ <BarButton icon={Trash2} label="Delete forever" destructive disabled={!selectedGens.length} onClick={() => confirmForever?.(selectedGens, clear)} /></>) : (<>@@ -746,16 +748,16 @@ function Inner() {if (done.length > BULK_MAX) toast(`The zip has the first ${BULK_MAX} of ${done.length}`, { description: "Select the rest and download them as a second zip." });}}/>- <BarButton icon={Heart} label={allFav ? "Unlike" : "Like"} disabled={!selected.size} onClick={() => void actions.favoriteMany(selectedGens, !allFav)} />+ <BarButton icon={Heart} label={allFav ? "Unlike" : "Like"} disabled={!selectedGens.length} onClick={() => void actions.favoriteMany(selectedGens, !allFav)} /><BarButtonicon={allPinned ? PinOff : Pin}label={allPinned ? "Unpin" : "Pin"}- disabled={!selected.size}+ disabled={!selectedGens.length}onClick={() => void actions.pin(selectedGens, !allPinned).then((n) => n && toast(allPinned ? `Unpinned ${n}` : `Pinned ${n} to the top`))}/><DropdownMenu modal={false}>- <DropdownMenuTrigger asChild disabled={!selected.size}>- <button className={BAR} disabled={!selected.size} aria-label="Review status" title="Review status">+ <DropdownMenuTrigger asChild disabled={!selectedGens.length}>+ <button className={BAR} disabled={!selectedGens.length} aria-label="Review status" title="Review status"><CircleDot className="size-4" /> <span className="hidden sm:inline">Review</span></button></DropdownMenuTrigger>@@ -764,8 +766,8 @@ function Inner() {</DropdownMenuContent></DropdownMenu><DropdownMenu modal={false}>- <DropdownMenuTrigger asChild disabled={!selected.size}>- <button className={BAR} disabled={!selected.size}>+ <DropdownMenuTrigger asChild disabled={!selectedGens.length}>+ <button className={BAR} disabled={!selectedGens.length} aria-label="Move to"><FolderInput className="size-4" /> <span className="hidden sm:inline">Move to</span></button></DropdownMenuTrigger>@@ -777,7 +779,7 @@ function Inner() {icon={Trash2}label="Delete"destructive- disabled={!selected.size}+ disabled={!selectedGens.length}onClick={() => {void actions.trash(selectedGens);clear();@@ -786,7 +788,7 @@ function Inner() {</>)}<span className="mx-1 h-5 w-px shrink-0 bg-border" />- <button onClick={clear} className="inline-flex h-8 shrink-0 items-center gap-1.5 rounded-full px-2.5 text-[13px] whitespace-nowrap text-muted-foreground hover:bg-accent hover:text-foreground" aria-label="Unselect all">+ <button onClick={clear} className="inline-flex h-8 shrink-0 items-center gap-1.5 rounded-full px-2.5 text-[13px] whitespace-nowrap text-muted-foreground hover:bg-accent hover:text-foreground" aria-label="Unselect all, Esc" aria-keyshortcuts="Escape"><X className="size-3.5" /> <span className="hidden sm:inline">Unselect all</span> <Kbd className="hidden sm:inline-flex">Esc</Kbd></button></div>diff --git a/tests/e2e/library-flows.mjs b/tests/e2e/library-flows.mjsindex c170f857..fe43fe04 100644--- a/tests/e2e/library-flows.mjs+++ b/tests/e2e/library-flows.mjs@@ -141,6 +141,38 @@ try {check("the bulk bar pins and reviews several", !!g3.pinnedAt && !!g4.pinnedAt && g3.review === "rejected" && g4.review === "rejected");await page.getByRole("button", { name: "Unselect all" }).click();+ // --- Select all (N), a date's Select, Ctrl/⌘+A, Esc ---------------------------------------------+ {+ await library();+ const shown = await openCards();+ const picked = () => page.getByRole("button", { name: new RegExp(`^Select “${tag}`), pressed: true }).count();+ const selectAll = bar.getByRole("button", { name: /^Select all \d+$/ });+ await page.getByRole("button", { name: "Select", exact: true }).click();+ check("Select all names how many are shown", (await selectAll.getAttribute("aria-label")) === `Select all ${shown}`, await selectAll.getAttribute("aria-label"));+ await selectAll.click();+ check("Select all (N) selects every result shown", (await picked()) === shown && (await selectAll.count()) === 0, `${await picked()} of ${shown}`);+ await page.keyboard.press("Escape");+ check("Esc unselects and leaves selection mode", (await bar.count()) === 0);+ await page.getByRole("button", { name: "Select", exact: true }).click();+ const pinnedSection = page.locator("section", { has: page.getByRole("heading", { name: /^Pinned/ }) });+ await pinnedSection.getByRole("button", { name: /^Select Pinned, 2$/ }).click();+ check("a section's Select takes that section", (await picked()) === 2 && (await pinnedSection.getByRole("button", { name: /^Unselect Pinned/ }).count()) === 1, `${await picked()} picked`);+ await pinnedSection.getByRole("button", { name: /^Unselect Pinned/ }).click();+ check("…and Unselect gives it back", (await picked()) === 0);+ await page.keyboard.press("ControlOrMeta+a");+ check("Ctrl/⌘+A in selection mode selects everything shown", (await picked()) === shown, `${await picked()} of ${shown}`);+ // A search that hides the selection: Select all is back for the results left, and the count is what's shown.+ await page.keyboard.press("Escape");+ await page.getByRole("button", { name: "Select", exact: true }).click();+ for (const w of ["paper boats", "sleeping cat"]) await page.getByRole("button", { name: new RegExp(`Select “${tag} ${w}`) }).first().click({ force: true });+ await page.getByRole("textbox", { name: "Search prompts" }).fill(`${tag} fox`);+ await page.waitForTimeout(1500);+ check("a selection hidden by a search: Select all is offered for what's shown", (await selectAll.count()) === 1 && /^Select\b/.test((await bar.innerText()).trim()), (await bar.innerText()).replace(/\s+/g, " "));+ await page.getByRole("button", { name: "Unselect all" }).click();+ await page.getByRole("textbox", { name: "Search prompts" }).fill(tag);+ await page.waitForTimeout(1500);+ }+await page.getByRole("button", { name: /Any status/ }).click();await page.getByRole("radio", { name: /^Rejected/ }).click();await page.keyboard.press("Escape");