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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: redesign mood boards page as cards with cover and item thumbnails
[._.]/ Adam Eivy9abb8ce4e9f2
diff --git a/client/src/pages/MoodBoards.jsx b/client/src/pages/MoodBoards.jsxindex c5ee514c49..0e68e4f8f5 100644--- a/client/src/pages/MoodBoards.jsx+++ b/client/src/pages/MoodBoards.jsx@@ -4,31 +4,177 @@* Lists every mood board (an inspiration/reference canvas that feeds the Create* suite) and lets the user create, open, or delete one. The heavy canvas lives* at `/mood-boards/:id`; "New Board" creates a blank board and drops into it.- * Mirrors the Universes index (list/table → detail editor) but simpler — boards- * are local-only with no sync/duplicate machinery.+ * Redesigned as cards with a cover image and smaller thumbnails of items within+ * the board.*/-import { useEffect, useState, useCallback } from 'react';+import { useEffect, useState, useCallback, useMemo } from 'react';import { Link, useNavigate } from 'react-router';-import { Plus, Palette, Trash2, ImageIcon, FileText } from 'lucide-react';+import { Plus, Palette, Trash2, ImageIcon, FileText, Film } from 'lucide-react';import PageSkeleton from '../components/ui/PageSkeleton';import toast from '../components/ui/Toast';import InlineConfirmRow from '../components/ui/InlineConfirmRow';import EmptyState from '../components/EmptyState';import { timeAgo } from '../utils/formatters';import { listMoodBoards, createMoodBoard, deleteMoodBoard } from '../services/api';+import { moodBoardItemSrc } from '../lib/moodBoardItemSrc';const itemCounts = (board) => {const items = Array.isArray(board?.items) ? board.items : [];let images = 0;+ let videos = 0;let texts = 0;for (const it of items) {if (it?.type === 'image') images += 1;+ else if (it?.type === 'video') videos += 1;else if (it?.type === 'text') texts += 1;}- return { images, texts, total: items.length };+ return { images, videos, texts, total: items.length };};+const MAX_THUMBNAILS = 4;++function MoodBoardCard({ board, onDelete, isConfirming, onConfirmDelete, onCancelDelete }) {+ const { images, videos, texts, total } = useMemo(() => itemCounts(board), [board]);++ // Extract visual items (images or videos with a resolvable thumbnail/poster)+ const visualItems = useMemo(() => {+ const items = Array.isArray(board?.items) ? board.items : [];+ return items+ .map((it) => ({+ id: it.id,+ src: moodBoardItemSrc(it),+ type: it.type,+ caption: it.caption || '',+ }))+ .filter((it) => Boolean(it.src));+ }, [board]);++ const coverItem = visualItems[0] || null;+ const subThumbnails = visualItems.slice(1, 1 + MAX_THUMBNAILS);+ const remainingVisualsCount = visualItems.length - (1 + subThumbnails.length);++ return (+ <li className="bg-port-card border border-port-border rounded-xl overflow-hidden flex flex-col hover:border-port-accent/40 transition-colors">+ {isConfirming ? (+ <InlineConfirmRow+ variant="separator"+ question={`Delete "${board.name}"? This can't be undone.`}+ onConfirm={() => onConfirmDelete(board.id)}+ onCancel={onCancelDelete}+ />+ ) : null}++ {/* Cover and Thumbnail Preview Area */}+ <Link+ to={`/mood-boards/${board.id}`}+ className="block bg-port-bg border-b border-port-border/60 group relative"+ >+ <div className="aspect-[16/10] w-full overflow-hidden relative bg-port-bg flex items-center justify-center">+ {coverItem ? (+ <img+ src={coverItem.src}+ alt={board.name}+ loading="lazy"+ className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-200"+ />+ ) : (+ <div className="flex flex-col items-center justify-center text-gray-600 gap-1 p-4">+ <Palette className="w-10 h-10 stroke-[1.5]" aria-hidden="true" />+ <span className="text-xs text-gray-500 font-medium">Empty Board</span>+ </div>+ )}+ </div>++ {/* Smaller thumbnails row beneath the main cover */}+ {subThumbnails.length > 0 ? (+ <div className="grid grid-cols-4 sm:grid-cols-4 gap-1 p-1.5 bg-port-card/80 border-t border-port-border/40">+ {subThumbnails.map((thumb, idx) => {+ const isLast = idx === subThumbnails.length - 1;+ const showOverflow = isLast && remainingVisualsCount > 0;+ return (+ <div+ key={thumb.id}+ className="relative aspect-square rounded-md overflow-hidden bg-port-bg border border-port-border/50"+ >+ <img+ src={thumb.src}+ alt={thumb.caption || `Item ${idx + 2}`}+ loading="lazy"+ className="w-full h-full object-cover"+ />+ {showOverflow ? (+ <div className="absolute inset-0 bg-black/60 flex items-center justify-center text-white text-[11px] font-semibold">+ +{remainingVisualsCount}+ </div>+ ) : null}+ </div>+ );+ })}+ </div>+ ) : null}+ </Link>++ {/* Card Body & Details */}+ <div className="p-3.5 flex-1 flex flex-col justify-between gap-2.5">+ <div>+ <Link+ to={`/mood-boards/${board.id}`}+ className="text-white font-medium text-base hover:text-port-accent line-clamp-1 block transition-colors"+ title={board.name}+ >+ {board.name}+ </Link>+ {board.description ? (+ <p className="text-xs text-gray-400 line-clamp-2 mt-1" title={board.description}>+ {board.description}+ </p>+ ) : null}+ </div>++ <div className="flex items-center justify-between pt-2 border-t border-port-border/40 text-xs text-gray-500">+ <div className="flex items-center gap-2.5">+ {images > 0 ? (+ <span className="flex items-center gap-1" title={`${images} image${images === 1 ? '' : 's'}`}>+ <ImageIcon className="w-3.5 h-3.5" aria-hidden="true" />+ <span>{images}</span>+ </span>+ ) : null}+ {videos > 0 ? (+ <span className="flex items-center gap-1" title={`${videos} video${videos === 1 ? '' : 's'}`}>+ <Film className="w-3.5 h-3.5" aria-hidden="true" />+ <span>{videos}</span>+ </span>+ ) : null}+ {texts > 0 ? (+ <span className="flex items-center gap-1" title={`${texts} note${texts === 1 ? '' : 's'}`}>+ <FileText className="w-3.5 h-3.5" aria-hidden="true" />+ <span>{texts}</span>+ </span>+ ) : null}+ {total === 0 ? (+ <span>0 items</span>+ ) : (+ <span>{total} item{total === 1 ? '' : 's'}</span>+ )}+ <span>· {timeAgo(board.updatedAt)}</span>+ </div>++ <button+ type="button"+ onClick={() => onDelete(board.id)}+ title="Delete board"+ aria-label={`Delete ${board.name}`}+ className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 text-gray-500 hover:text-port-error transition-colors rounded"+ >+ <Trash2 className="w-4 h-4" aria-hidden="true" />+ </button>+ </div>+ </div>+ </li>+ );+}+export default function MoodBoards() {const navigate = useNavigate();const [boards, setBoards] = useState([]);@@ -67,7 +213,7 @@ export default function MoodBoards() {};return (- <div className="max-w-5xl mx-auto">+ <div className="max-w-6xl mx-auto space-y-4"><div className="flex items-center justify-between mb-4"><div className="flex items-center gap-2"><Palette className="w-6 h-6 text-port-accent" aria-hidden="true" />@@ -89,7 +235,7 @@ export default function MoodBoards() {</p>{loading ? (- <PageSkeleton header="none" label="Loading mood boards" cards={3} sidebar={false} />+ <PageSkeleton header="none" label="Loading mood boards" cards={4} sidebar={false} />) : boards.length === 0 ? (<EmptyStateicon={Palette}@@ -99,55 +245,17 @@ export default function MoodBoards() {onAction={handleCreate}/>) : (- <ul className="space-y-2">- {boards.map((board) => {- const { images, texts, total } = itemCounts(board);- return (- <li- key={board.id}- className="bg-port-card border border-port-border rounded-md overflow-hidden"- >- {confirmingId === board.id ? (- <InlineConfirmRow- variant="separator"- question={`Delete "${board.name}"? This can't be undone.`}- onConfirm={() => handleDelete(board.id)}- onCancel={() => setConfirmingId(null)}- />- ) : null}- <div className="flex items-center gap-3 p-3">- <Link- to={`/mood-boards/${board.id}`}- className="flex-1 min-w-0"- >- <div className="text-white font-medium truncate">{board.name}</div>- {board.description ? (- <div className="text-xs text-gray-400 truncate">{board.description}</div>- ) : null}- <div className="flex items-center gap-3 mt-1 text-xs text-gray-500">- <span className="flex items-center gap-1">- <ImageIcon className="w-3 h-3" aria-hidden="true" /> {images}- </span>- <span className="flex items-center gap-1">- <FileText className="w-3 h-3" aria-hidden="true" /> {texts}- </span>- <span>{total} item{total === 1 ? '' : 's'}</span>- <span>· {timeAgo(board.updatedAt)}</span>- </div>- </Link>- <button- type="button"- onClick={() => setConfirmingId(board.id)}- title="Delete board"- aria-label={`Delete ${board.name}`}- className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1.5 text-gray-500 hover:text-port-error transition-colors"- >- <Trash2 className="w-4 h-4" aria-hidden="true" />- </button>- </div>- </li>- );- })}+ <ul className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">+ {boards.map((board) => (+ <MoodBoardCard+ key={board.id}+ board={board}+ onDelete={(id) => setConfirmingId(id)}+ isConfirming={confirmingId === board.id}+ onConfirmDelete={handleDelete}+ onCancelDelete={() => setConfirmingId(null)}+ />+ ))}</ul>)}</div>diff --git a/client/src/pages/MoodBoards.test.jsx b/client/src/pages/MoodBoards.test.jsxindex d837698810..0464b51442 100644--- a/client/src/pages/MoodBoards.test.jsx+++ b/client/src/pages/MoodBoards.test.jsx@@ -10,14 +10,15 @@ vi.mock('../services/api', () => ({}));import MoodBoards from './MoodBoards';-import { listMoodBoards, createMoodBoard } from '../services/api';+import { listMoodBoards, createMoodBoard, deleteMoodBoard } from '../services/api';const renderPage = () => render(<MemoryRouter><MoodBoards /></MemoryRouter>);-describe('MoodBoards index empty state', () => {+describe('MoodBoards index', () => {beforeEach(() => {vi.clearAllMocks();createMoodBoard.mockResolvedValue({ id: 'board-1' });+ deleteMoodBoard.mockResolvedValue({ success: true });});it('offers a call to action with an accessible name when no boards exist', async () => {@@ -32,12 +33,63 @@ describe('MoodBoards index empty state', () => {await waitFor(() => expect(createMoodBoard).toHaveBeenCalled());});- it('renders the board list instead of the empty state once boards exist', async () => {+ it('renders the board cards with cover and item thumbnails once boards exist', async () => {listMoodBoards.mockResolvedValue([- { id: 'board-1', name: 'Example Board', items: [], updatedAt: '2026-01-01T00:00:00.000Z' },+ {+ id: 'board-1',+ name: 'Retro Sci-Fi',+ description: 'Neon aesthetics and space vibes',+ items: [+ { id: 'it-1', type: 'image', imageUrl: '/data/images/cover.png', caption: 'Cyber city' },+ { id: 'it-2', type: 'image', imageUrl: '/data/images/thumb1.png', caption: 'Neon sign' },+ { id: 'it-3', type: 'video', mediaKey: 'video:clip.mp4', imageUrl: '/data/video-thumbnails/clip.jpg', caption: 'Hovercar' },+ { id: 'it-4', type: 'text', text: 'Some notes on lighting' },+ { id: 'it-5', type: 'image', imageUrl: '/data/images/thumb3.png', caption: 'Spaceship' },+ { id: 'it-6', type: 'image', imageUrl: '/data/images/thumb4.png', caption: 'Terminal' },+ { id: 'it-7', type: 'image', imageUrl: '/data/images/thumb5.png', caption: 'Astronaut' },+ ],+ updatedAt: '2026-01-01T00:00:00.000Z',+ },]);renderPage();- expect(await screen.findByText('Example Board')).toBeInTheDocument();+ expect(await screen.findByText('Retro Sci-Fi')).toBeInTheDocument();+ expect(screen.getByText('Neon aesthetics and space vibes')).toBeInTheDocument();expect(screen.queryByRole('button', { name: 'Create your first board' })).toBeNull();++ // Cover image check+ const cover = screen.getByAltText('Retro Sci-Fi');+ expect(cover).toBeInTheDocument();+ expect(cover.getAttribute('src')).toBe('/data/images/cover.png');++ // Sub-thumbnails check (it-2, it-3, it-5, it-6)+ expect(screen.getByAltText('Neon sign')).toBeInTheDocument();+ expect(screen.getByAltText('Hovercar')).toBeInTheDocument();+ expect(screen.getByAltText('Spaceship')).toBeInTheDocument();+ expect(screen.getByAltText('Terminal')).toBeInTheDocument();++ // Overflow badge check: 6 visual items total, 1 cover + 4 sub-thumbnails = 1 remaining (+1 badge)+ expect(screen.getByText('+1')).toBeInTheDocument();++ // Stats check: 5 images, 1 video, 1 text+ expect(screen.getByText('7 items')).toBeInTheDocument();+ });++ it('allows deleting a board with confirmation', async () => {+ listMoodBoards.mockResolvedValue([+ { id: 'board-1', name: 'Board To Delete', items: [], updatedAt: '2026-01-01T00:00:00.000Z' },+ ]);+ renderPage();+ expect(await screen.findByText('Board To Delete')).toBeInTheDocument();++ const deleteBtn = screen.getByRole('button', { name: 'Delete Board To Delete' });+ await userEvent.click(deleteBtn);++ // Confirmation row appears+ expect(screen.getByText('Delete "Board To Delete"? This can\'t be undone.')).toBeInTheDocument();+ const confirmBtn = screen.getByRole('button', { name: 'Delete' });+ await userEvent.click(confirmBtn);++ await waitFor(() => expect(deleteMoodBoard).toHaveBeenCalledWith('board-1', { silent: true }));+ expect(screen.queryByText('Board To Delete')).toBeNull();});});