Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat(media): organize-to-collection from MediaLightbox footer

Adam Eivyab043bf2c087
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index fb00a5c7fa..9856fc07d5 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -22,6 +22,8 @@
## Changed
+- **Organize from the lightbox.** `MediaLightbox` footer now hosts an Add-to-collection (folder+) button alongside Download — pick a collection (or create one) without closing the larger preview. `AddToCollectionMenu` gained a `size` prop (`sm` default for the card action row, `md` for the lightbox footer) so both surfaces share one component without duplicate styling. `browser/data/` is now gitignored (CDP profile cache shouldn't be tracked).
+
- **World Builder batch render reuses one collection per world.** Auto-generated collection names drop the ` — YYYY-MM-DD HH:MM` suffix: a batch render of "Echoes of the Choir" now files into `World: Echoes of the Choir` every time instead of minting a fresh date-stamped bucket. A user-supplied `collectionName` also flows through find-or-create (case-insensitive trimmed match), so repeat renders into a custom name append into the same collection. Backed by a new `findOrCreateCollectionByName()` helper in `server/services/mediaCollections.js`. One-shot migration at `data/migrations/001-merge-worldbuilder-collections.js` collapses legacy date-suffixed `World: <name> — <date>` collections into their base name (dedupes items by `kind:ref`, preserves the earliest `createdAt`, rewrites `world-builder.json` `runs[].collectionId` references). Run via `npm run migrations`; idempotent.
- **Clean → Light / Aggressive available beyond Image Gen.** The Eraser pill that strips render artifacts now appears in any image lightbox: Media History and Media Collection Detail both wire `onClean` into `MediaLightbox`. Cleaning from inside a collection automatically adds the cleaned file to that collection alongside the original, so the user can compare side-by-side before deciding which to keep. (Image Gen behaviour unchanged; Video Gen's lightbox only renders videos so it intentionally doesn't expose Clean.)
- **MediaCard thumbnails.** Removed the "IMAGE"/"VIDEO" badge overlay from the bottom-right of media cards — the icon and aspect already convey the kind, and the badge added visual noise on grid views.
diff --git a/.gitignore b/.gitignore
index c4f2839834..0fe1916ea0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,9 @@ BTW.md
# Browser service node_modules (code is committed)
browser/node_modules/
+# Browser service runtime data (CDP profiles, cache, downloads)
+browser/data/
+
# Sub-package lock files. Root package.json does NOT declare these as
# workspaces; `npm run setup` runs `npm install --prefix <pkg>` for each,
# generating their own lockfiles locally. The root package-lock.json only
diff --git a/client/src/components/media/AddToCollectionMenu.jsx b/client/src/components/media/AddToCollectionMenu.jsx
index 991c0fce79..9023584d20 100644
--- a/client/src/components/media/AddToCollectionMenu.jsx
+++ b/client/src/components/media/AddToCollectionMenu.jsx
@@ -20,7 +20,13 @@ const VIEWPORT_PADDING = 8;
// Show search affordance only when the list could meaningfully scroll.
const SEARCH_THRESHOLD = 6;
-export default function AddToCollectionMenu({ item }) {
+// Only the trigger button varies by size — popover styling is fixed.
+const SIZES = {
+ sm: { button: 'px-1.5 py-1 text-[10px]', icon: 'w-3 h-3' },
+ md: { button: 'px-2 py-1.5 text-xs', icon: 'w-3.5 h-3.5' },
+};
+
+export default function AddToCollectionMenu({ item, size = 'sm' }) {
const [open, setOpen] = useState(false);
const [collections, setCollections] = useState(null); // null = not loaded
const [creating, setCreating] = useState(false);
@@ -175,6 +181,7 @@ export default function AddToCollectionMenu({ item }) {
const showSearch = (collections?.length || 0) >= SEARCH_THRESHOLD;
const list = filtered ?? collections;
+ const sizeCls = SIZES[size] || SIZES.sm;
return (
<>
@@ -182,12 +189,12 @@ export default function AddToCollectionMenu({ item }) {
ref={triggerRef}
type="button"
onClick={handleToggleOpen}
- className="shrink-0 px-1.5 py-1 bg-port-border hover:bg-port-border/70 text-white text-[10px] rounded flex items-center justify-center"
+ className={`shrink-0 ${sizeCls.button} bg-port-border hover:bg-port-border/70 text-white rounded flex items-center justify-center`}
title="Add to collection"
aria-haspopup="menu"
aria-expanded={open}
>
- <FolderPlus className="w-3 h-3" />
+ <FolderPlus className={sizeCls.icon} />
</button>
{open && createPortal(
<div
diff --git a/client/src/components/media/MediaLightbox.jsx b/client/src/components/media/MediaLightbox.jsx
index 7797fe2030..fe85d265a4 100644
--- a/client/src/components/media/MediaLightbox.jsx
+++ b/client/src/components/media/MediaLightbox.jsx
@@ -5,6 +5,7 @@ import {
} from 'lucide-react';
import toast from '../ui/Toast';
import PromptRefineModal from './PromptRefineModal';
+import AddToCollectionMenu from './AddToCollectionMenu';
const NOTE_MAX = 2000;
const NOTE_DEBOUNCE_MS = 500;
@@ -447,6 +448,7 @@ function SettingsPane({
<ImageIcon className="w-3.5 h-3.5" /> Continue
</button>
)}
+ <AddToCollectionMenu item={item} size="md" />
<a
href={item.downloadUrl}
download