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: open the standard image preview lightbox from mood board images

Adam Eivyc6e63c76d389
diff --git a/client/src/pages/MoodBoardDetail.jsx b/client/src/pages/MoodBoardDetail.jsx
index 37123246d8..fb476e7be1 100644
--- a/client/src/pages/MoodBoardDetail.jsx
+++ b/client/src/pages/MoodBoardDetail.jsx
@@ -19,6 +19,7 @@ import InlineConfirmRow from '../components/ui/InlineConfirmRow';
import GalleryImagePicker from '../components/imageGen/GalleryImagePicker';
import GalleryVideoPicker from '../components/videoGen/GalleryVideoPicker';
import { PromptFromMediaModal } from '../components/media/PromptFromMedia';
+import MediaLightbox from '../components/media/MediaLightbox';
import MoodBoardStylePanel from '../components/moodBoard/MoodBoardStylePanel';
import MoodBoardCollagePanel from '../components/moodBoard/MoodBoardCollagePanel';
import { copyToClipboard } from '../lib/clipboard';
@@ -74,6 +75,7 @@ function MoodBoardEditor({ id }) {
const [imagePickerOpen, setImagePickerOpen] = useState(false);
const [videoPickerOpen, setVideoPickerOpen] = useState(false);
const [playingItemId, setPlayingItemId] = useState(null);
+ const [previewItemId, setPreviewItemId] = useState(null);
// Per-item prompt-from-media analysis (#4188 Phase 3). Track the item by id
// (not a snapshot) so the modal's stored-analysis view stays fresh after the
@@ -386,6 +388,23 @@ function MoodBoardEditor({ id }) {
}
const items = Array.isArray(board.items) ? board.items : [];
+ // Still images only (videos play inline); prev/next walks this subset.
+ const previewables = items
+ .filter((it) => it.type === 'image' && moodBoardItemSrc(it))
+ .map((it) => {
+ const url = moodBoardItemSrc(it);
+ return {
+ kind: 'image',
+ key: `moodboard:${it.id}`,
+ id: it.id,
+ filename: decodeURIComponent(url.split(/[?#]/)[0].split('/').pop() || ''),
+ previewUrl: url,
+ downloadUrl: url,
+ prompt: moodBoardItemPrompt(it) || it.caption || '',
+ };
+ });
+ const previewIndex = previewables.findIndex((it) => it.id === previewItemId);
+
const linkedFeedUrl = board.pinterest?.feedUrl || '';
const linkedBoardUrl = board.pinterest?.boardUrl || '';
const lastSyncedAt = board.pinterest?.lastSyncedAt || null;
@@ -556,7 +575,14 @@ function MoodBoardEditor({ id }) {
)
) : item.type === 'image' || item.type === 'video' ? (
src ? (
- <img src={src} alt={displayText} loading="lazy" className="w-full h-full object-cover bg-port-bg" />
+ <button
+ type="button"
+ onClick={() => setPreviewItemId(item.id)}
+ aria-label="Preview image"
+ className="block w-full h-full cursor-zoom-in"
+ >
+ <img src={src} alt={displayText} loading="lazy" className="w-full h-full object-cover bg-port-bg" />
+ </button>
) : (
<div className="w-full h-full flex items-center justify-center bg-port-bg text-gray-600">
<ImageIcon className="w-8 h-8" aria-hidden="true" />
@@ -919,6 +945,17 @@ function MoodBoardEditor({ id }) {
uploadToGallery
/>
+ {previewIndex >= 0 ? (
+ <MediaLightbox
+ item={previewables[previewIndex]}
+ onClose={() => setPreviewItemId(null)}
+ hasPrevious={previewIndex > 0}
+ hasNext={previewIndex < previewables.length - 1}
+ onPrevious={() => setPreviewItemId(previewables[previewIndex - 1].id)}
+ onNext={() => setPreviewItemId(previewables[previewIndex + 1].id)}
+ />
+ ) : null}
+
{/* Per-item prompt-from-media analysis (#4188 Phase 3). A successful run
auto-persists onto the item; the stored analysis renders above the
analyzer with copy/remove. */}
diff --git a/client/src/pages/MoodBoardDetail.test.jsx b/client/src/pages/MoodBoardDetail.test.jsx
index 1d5ed5af59..db10d32c3c 100644
--- a/client/src/pages/MoodBoardDetail.test.jsx
+++ b/client/src/pages/MoodBoardDetail.test.jsx
@@ -46,6 +46,14 @@ vi.mock('../components/moodBoard/MoodBoardStylePanel', () => ({
default: () => <div data-testid="board-style-panel" />,
}));
+vi.mock('../components/media/MediaLightbox', () => ({
+ default: ({ item, onClose }) => (
+ <div data-testid="lightbox" data-src={item.previewUrl}>
+ <button type="button" onClick={onClose}>close-lightbox</button>
+ </div>
+ ),
+}));
+
vi.mock('../components/media/PromptFromMedia', () => ({
PromptFromMediaModal: ({ open, item, onResult, children }) => (open && item ? (
<div data-testid="pfm-modal">
@@ -113,6 +121,20 @@ beforeEach(() => {
analysisDelay = null;
});
+describe('MoodBoardDetail image preview', () => {
+ it('opens the standard lightbox when an image item is clicked and closes it', async () => {
+ mockGetMoodBoard.mockResolvedValueOnce({
+ id: 'a', name: 'Board A',
+ items: [{ id: 'i1', type: 'image', imageUrl: '/data/images/one.png', caption: 'one' }],
+ });
+ renderPage();
+ fireEvent.click(await screen.findByRole('button', { name: 'Preview image' }));
+ expect(screen.getByTestId('lightbox').dataset.src).toBe('/data/images/one.png');
+ fireEvent.click(screen.getByText('close-lightbox'));
+ expect(screen.queryByTestId('lightbox')).toBeNull();
+ });
+});
+
describe('MoodBoardDetail stale-response guards', () => {
it('renders the loaded board', async () => {
mockGetMoodBoard.mockResolvedValueOnce({ id: 'a', name: 'Board A', items: [] });