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(mood-boards): update desktop layout with items on the left and add forms on the right

Adam Eivy9b394a024ca0
diff --git a/client/src/pages/MoodBoardDetail.jsx b/client/src/pages/MoodBoardDetail.jsx
index 29a5683987..77a32d0383 100644
--- a/client/src/pages/MoodBoardDetail.jsx
+++ b/client/src/pages/MoodBoardDetail.jsx
@@ -302,7 +302,7 @@ function MoodBoardEditor({ id }) {
if (loading) {
return (
- <div className="max-w-5xl mx-auto">
+ <div className="max-w-7xl mx-auto">
<PageSkeleton
label="Loading mood board"
titleWidthClass="w-56"
@@ -338,7 +338,7 @@ function MoodBoardEditor({ id }) {
const renderPinUrlForm = (label, buttonText) => (
<div>
<label htmlFor="pinterest-url" className="block text-xs text-gray-400 mb-1">{label}</label>
- <div className="flex gap-2">
+ <div className="flex flex-wrap gap-2">
<input
id="pinterest-url"
type="text"
@@ -346,7 +346,7 @@ function MoodBoardEditor({ id }) {
maxLength={2048}
placeholder="https://www.pinterest.com/user/board/"
onChange={(e) => setPinUrl(e.target.value)}
- className="flex-1 min-w-0 bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
+ className="flex-1 min-w-[180px] bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
/>
<button
type="button"
@@ -370,17 +370,17 @@ function MoodBoardEditor({ id }) {
);
return (
- <div className="max-w-5xl mx-auto">
+ <div className="max-w-7xl mx-auto space-y-6">
<button
type="button"
onClick={() => navigate('/mood-boards')}
- className="flex items-center gap-1 text-sm text-gray-400 hover:text-white mb-4 transition-colors"
+ className="flex items-center gap-1 text-sm text-gray-400 hover:text-white transition-colors"
>
<ArrowLeft className="w-4 h-4" aria-hidden="true" /> Boards
</button>
{/* Board metadata */}
- <div className="bg-port-card border border-port-border rounded-md p-4 mb-6">
+ <div className="bg-port-card border border-port-border rounded-md p-4">
<div className="space-y-3">
<div>
<label htmlFor="board-name" className="block text-xs text-gray-400 mb-1">Name</label>
@@ -419,333 +419,349 @@ function MoodBoardEditor({ id }) {
<MoodBoardStylePanel board={board} onBoardChange={setBoard} />
- {/* Pinterest link + sync */}
- <div className="bg-port-card border border-port-border rounded-md p-4 mb-6">
- <div className="flex items-center gap-2 mb-3">
- <Link2 className="w-4 h-4 text-port-accent" aria-hidden="true" />
- <h2 className="text-sm font-medium text-white">Pinterest board</h2>
- </div>
- {linkedFeedUrl ? (
- <div className="space-y-3">
- <div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs">
- <a
- href={linkedBoardUrl}
- target="_blank"
- rel="noopener noreferrer"
- className="text-port-accent hover:underline truncate max-w-full"
- >
- {linkedBoardUrl}
- </a>
- <span className="text-gray-500">
- {lastSyncedAt ? `Last synced ${timeAgo(lastSyncedAt)}` : 'Not synced yet'}
- </span>
- </div>
- <p className="text-[11px] text-gray-500">
- Pinterest’s feed exposes only the most-recent ~25 pins, so a sync pulls those — not the entire board.
- </p>
- <p className="text-[11px] text-gray-500">
- Use “Import pins” below to read the full board from your signed-in PortOS browser.
- </p>
- <div className="flex flex-wrap items-center gap-2">
- <button
- type="button"
- onClick={handleSyncPinterest}
- disabled={syncing || linking || importingPinterest || pinDirty}
- title={pinDirty ? 'Link the new URL before syncing' : undefined}
- className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50 transition-colors"
- >
- <RefreshCw className={`w-4 h-4 ${syncing ? 'animate-spin' : ''}`} aria-hidden="true" />
- {syncing ? 'Syncing…' : 'Sync now'}
- </button>
- {confirmingUnlink ? (
- <InlineConfirmRow
- question="Unlink this board?"
- confirmText="Unlink"
- onConfirm={handleUnlinkPinterest}
- onCancel={() => setConfirmingUnlink(false)}
- />
- ) : (
- <button
- type="button"
- onClick={() => setConfirmingUnlink(true)}
- className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-bg text-gray-400 hover:text-white transition-colors"
- >
- <Unlink className="w-4 h-4" aria-hidden="true" /> Unlink
- </button>
- )}
- </div>
- {renderPinUrlForm('Change board URL', 'Update')}
- </div>
- ) : (
- <div>
- {renderPinUrlForm('Board URL', 'Link')}
- <p className="text-[11px] text-gray-500 mt-2">
- Link a public board to sync its newest ~25 pins. “Import pins” reads the full board from your signed-in PortOS browser and saves the images here.
- </p>
- </div>
- )}
- </div>
-
- {/* X.com (Twitter) post import */}
- <div className="bg-port-card border border-port-border rounded-md p-4 mb-6">
- <div className="flex items-center gap-2 mb-3">
- <AtSign className="w-4 h-4 text-port-accent" aria-hidden="true" />
- <h2 className="text-sm font-medium text-white">Import from an X post</h2>
- </div>
- <div>
- <label htmlFor="x-post-url" className="block text-xs text-gray-400 mb-1">Post URL</label>
- <div className="flex gap-2">
- <input
- id="x-post-url"
- type="text"
- value={xPostUrl}
- maxLength={2048}
- placeholder="https://x.com/user/status/1234567890"
- onChange={(e) => setXPostUrl(e.target.value)}
- className="flex-1 min-w-0 bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
- />
- <button
- type="button"
- onClick={handleImportXPost}
- disabled={importingXPost || !xPostUrl.trim()}
- className="px-3 py-1.5 text-sm rounded bg-port-success text-white hover:bg-port-success/80 disabled:opacity-50 transition-colors"
- >
- {importingXPost ? 'Importing…' : 'Import'}
- </button>
- </div>
- </div>
- <p className="text-[11px] text-gray-500 mt-2">
- Paste a public x.com/twitter.com post URL. Pulls every attached photo (or its video) into this board.
- </p>
- </div>
-
- {/* Add item */}
- <div className="bg-port-card border border-port-border rounded-md p-4 mb-6">
- <div className="flex flex-wrap items-center gap-2 mb-3">
- {/* The shared TabPills owns the roving tabindex + arrow-key
- contract — never roll a tab bar (client/src/AGENTS.md). */}
- <TabPills
- variant="pills"
- size="sm"
- tabs={[
- { id: 'image', label: 'Image', icon: ImageIcon },
- { id: 'text', label: 'Note', icon: FileText },
- ]}
- activeTab={itemType}
- onChange={setItemType}
- ariaLabel="Item type"
- />
- {/* Gallery pins (#4188) — pick or upload, added to the board immediately. */}
- <div className="flex items-center gap-2 sm:ml-auto">
- <button
- type="button"
- onClick={() => setImagePickerOpen(true)}
- className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-bg text-gray-400 hover:text-white transition-colors"
- >
- <Images className="w-4 h-4" aria-hidden="true" /> Pick from gallery
- </button>
- <button
- type="button"
- onClick={() => setVideoPickerOpen(true)}
- className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-bg text-gray-400 hover:text-white transition-colors"
- >
- <Film className="w-4 h-4" aria-hidden="true" /> Pick video
- </button>
+ {/* Desktop 2-column layout: items on left, add forms on right column */}
+ <div className="grid grid-cols-1 lg:grid-cols-[minmax(0,1fr)_380px] xl:grid-cols-[minmax(0,1fr)_400px] gap-6 items-start">
+ {/* Left column: Mood board items */}
+ <section aria-label="Mood board items" className="min-w-0 space-y-3">
+ <div className="flex items-center justify-between">
+ <h2 className="text-sm font-medium text-white">Items ({items.length})</h2>
</div>
- </div>
- <div className="space-y-3">
- {itemType === 'image' ? (
- <div>
- <label htmlFor="item-image-url" className="block text-xs text-gray-400 mb-1">Image URL</label>
- <input
- id="item-image-url"
- type="text"
- value={imageUrl}
- maxLength={2048}
- placeholder="https://… or /data/images/…"
- onChange={(e) => setImageUrl(e.target.value)}
- className="w-full bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
- />
+ {items.length === 0 ? (
+ <div className="text-gray-400 text-sm py-12 text-center border border-dashed border-port-border rounded">
+ No items yet. Pin an image or note to get started.
</div>
) : (
- <div>
- <label htmlFor="item-text" className="block text-xs text-gray-400 mb-1">Note</label>
- <textarea
- id="item-text"
- value={text}
- maxLength={10000}
- rows={2}
- onChange={(e) => setText(e.target.value)}
- className="w-full bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none resize-y"
- />
+ <div className="grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-3">
+ {items.map((item) => {
+ const src = moodBoardItemSrc(item);
+ const videoSrc = moodBoardItemVideoSrc(item);
+ const analysisSource = moodBoardItemAnalysisSource(item);
+ return (
+ <div key={item.id} className="bg-port-card border border-port-border rounded-md overflow-hidden flex flex-col">
+ {item.type === 'video' && videoSrc ? (
+ playingItemId === item.id ? (
+ // eslint-disable-next-line jsx-a11y/media-has-caption -- reference clips have no caption track
+ <video
+ src={videoSrc}
+ poster={src || undefined}
+ controls
+ autoPlay
+ playsInline
+ className="w-full aspect-square object-cover bg-black"
+ />
+ ) : (
+ <button
+ type="button"
+ onClick={() => setPlayingItemId(item.id)}
+ aria-label="Play video"
+ className="relative w-full aspect-square bg-port-bg text-gray-600 group"
+ >
+ {src ? (
+ <img
+ src={src}
+ alt={item.caption || ''}
+ loading="lazy"
+ className="w-full h-full object-cover"
+ onError={(e) => {
+ // A synced board can carry a poster URL whose file
+ // only exists on the sending machine (a downloaded
+ // video's thumbnail is named `<id>.jpg`, not
+ // `<filename-stem>.jpg`). The receiver regenerates
+ // the stem-named poster when it pulls the video, so
+ // fall back to that derived name on a 404.
+ const fallback = moodBoardItemSrc({ ...item, imageUrl: null });
+ if (fallback && e.currentTarget.getAttribute('src') !== fallback) {
+ e.currentTarget.src = fallback;
+ }
+ }}
+ />
+ ) : (
+ <span className="w-full h-full flex items-center justify-center">
+ <Film className="w-8 h-8" aria-hidden="true" />
+ </span>
+ )}
+ <span className="absolute inset-0 flex items-center justify-center bg-black/30 opacity-80 group-hover:opacity-100 transition-opacity">
+ <Play className="w-8 h-8 text-white drop-shadow" aria-hidden="true" />
+ </span>
+ </button>
+ )
+ ) : item.type === 'image' || item.type === 'video' ? (
+ src ? (
+ <img src={src} alt={item.caption || ''} loading="lazy" className="w-full aspect-square object-cover bg-port-bg" />
+ ) : (
+ <div className="w-full aspect-square flex items-center justify-center bg-port-bg text-gray-600">
+ <ImageIcon className="w-8 h-8" aria-hidden="true" />
+ </div>
+ )
+ ) : (
+ <div className="w-full aspect-square p-3 overflow-y-auto bg-port-bg text-sm text-gray-200 whitespace-pre-wrap">
+ {item.text}
+ </div>
+ )}
+ <div className="p-2 flex flex-col gap-1">
+ <input
+ type="text"
+ aria-label="Item caption"
+ defaultValue={item.caption || ''}
+ placeholder="Add a caption…"
+ maxLength={2000}
+ onBlur={(e) => {
+ const next = e.target.value.trim();
+ if (next !== (item.caption || '')) handleUpdateCaption(item.id, next);
+ }}
+ className="w-full bg-transparent border-0 border-b border-transparent focus:border-port-border text-xs text-gray-300 px-0 py-0.5 outline-none"
+ />
+ <div className="flex items-center justify-between">
+ {item.source ? (
+ <span className="text-[10px] text-gray-500 truncate" title={item.source}>{item.source}</span>
+ ) : <span />}
+ <div className="flex items-center gap-1">
+ {analysisSource ? (
+ <button
+ type="button"
+ onClick={() => setAnalyzeItemId(item.id)}
+ title={item.analysis ? 'View prompt from media' : 'Prompt from media'}
+ aria-label={item.analysis ? 'View prompt from media' : 'Prompt from media'}
+ className={`min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 transition-colors ${item.analysis ? 'text-port-accent hover:text-port-accent/80' : 'text-gray-500 hover:text-white'}`}
+ >
+ <ScanEye className="w-3.5 h-3.5" aria-hidden="true" />
+ </button>
+ ) : null}
+ <button
+ type="button"
+ onClick={() => setConfirmingItemId(item.id)}
+ title="Remove item"
+ aria-label="Remove item"
+ className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 text-gray-500 hover:text-port-error transition-colors"
+ >
+ <Trash2 className="w-3.5 h-3.5" aria-hidden="true" />
+ </button>
+ </div>
+ </div>
+ {confirmingItemId === item.id ? (
+ <InlineConfirmRow
+ question="Remove this item?"
+ confirmText="Remove"
+ onConfirm={() => handleRemoveItem(item.id)}
+ onCancel={() => setConfirmingItemId(null)}
+ />
+ ) : null}
+ </div>
+ </div>
+ );
+ })}
</div>
)}
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
- <div>
- <label htmlFor="item-caption" className="block text-xs text-gray-400 mb-1">Caption (optional)</label>
- <input
- id="item-caption"
- type="text"
- value={caption}
- maxLength={2000}
- onChange={(e) => setCaption(e.target.value)}
- className="w-full bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
- />
+ </section>
+
+ {/* Right column: Add forms */}
+ <aside aria-label="Add to mood board" className="w-full space-y-6">
+ {/* Add item */}
+ <div className="bg-port-card border border-port-border rounded-md p-4">
+ <div className="flex items-center gap-2 mb-3">
+ <Plus className="w-4 h-4 text-port-accent" aria-hidden="true" />
+ <h2 className="text-sm font-medium text-white">Add item</h2>
</div>
- <div>
- <label htmlFor="item-source" className="block text-xs text-gray-400 mb-1">Source (optional)</label>
- <input
- id="item-source"
- type="text"
- value={source}
- maxLength={2048}
- placeholder="where it came from"
- onChange={(e) => setSource(e.target.value)}
- className="w-full bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
+ <div className="flex flex-wrap items-center gap-2 mb-3">
+ {/* The shared TabPills owns the roving tabindex + arrow-key
+ contract — never roll a tab bar (client/src/AGENTS.md). */}
+ <TabPills
+ variant="pills"
+ size="sm"
+ tabs={[
+ { id: 'image', label: 'Image', icon: ImageIcon },
+ { id: 'text', label: 'Note', icon: FileText },
+ ]}
+ activeTab={itemType}
+ onChange={setItemType}
+ ariaLabel="Item type"
/>
+ {/* Gallery pins (#4188) — pick or upload, added to the board immediately. */}
+ <div className="flex items-center gap-2 sm:ml-auto">
+ <button
+ type="button"
+ onClick={() => setImagePickerOpen(true)}
+ className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-bg text-gray-400 hover:text-white transition-colors"
+ >
+ <Images className="w-4 h-4" aria-hidden="true" /> Pick from gallery
+ </button>
+ <button
+ type="button"
+ onClick={() => setVideoPickerOpen(true)}
+ className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-bg text-gray-400 hover:text-white transition-colors"
+ >
+ <Film className="w-4 h-4" aria-hidden="true" /> Pick video
+ </button>
+ </div>
+ </div>
+
+ <div className="space-y-3">
+ {itemType === 'image' ? (
+ <div>
+ <label htmlFor="item-image-url" className="block text-xs text-gray-400 mb-1">Image URL</label>
+ <input
+ id="item-image-url"
+ type="text"
+ value={imageUrl}
+ maxLength={2048}
+ placeholder="https://… or /data/images/…"
+ onChange={(e) => setImageUrl(e.target.value)}
+ className="w-full bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
+ />
+ </div>
+ ) : (
+ <div>
+ <label htmlFor="item-text" className="block text-xs text-gray-400 mb-1">Note</label>
+ <textarea
+ id="item-text"
+ value={text}
+ maxLength={10000}
+ rows={2}
+ onChange={(e) => setText(e.target.value)}
+ className="w-full bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none resize-y"
+ />
+ </div>
+ )}
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
+ <div>
+ <label htmlFor="item-caption" className="block text-xs text-gray-400 mb-1">Caption (optional)</label>
+ <input
+ id="item-caption"
+ type="text"
+ value={caption}
+ maxLength={2000}
+ onChange={(e) => setCaption(e.target.value)}
+ className="w-full bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
+ />
+ </div>
+ <div>
+ <label htmlFor="item-source" className="block text-xs text-gray-400 mb-1">Source (optional)</label>
+ <input
+ id="item-source"
+ type="text"
+ value={source}
+ maxLength={2048}
+ placeholder="where it came from"
+ onChange={(e) => setSource(e.target.value)}
+ className="w-full bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
+ />
+ </div>
+ </div>
+ <div className="flex justify-end">
+ <button
+ type="button"
+ onClick={handleAddItem}
+ disabled={adding}
+ className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-success text-white hover:bg-port-success/80 disabled:opacity-50 transition-colors"
+ >
+ <Plus className="w-4 h-4" aria-hidden="true" /> Pin to board
+ </button>
+ </div>
</div>
</div>
- <div className="flex justify-end">
- <button
- type="button"
- onClick={handleAddItem}
- disabled={adding}
- className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-success text-white hover:bg-port-success/80 disabled:opacity-50 transition-colors"
- >
- <Plus className="w-4 h-4" aria-hidden="true" /> Pin to board
- </button>
- </div>
- </div>
- </div>
- {/* Items grid */}
- {items.length === 0 ? (
- <div className="text-gray-400 text-sm py-12 text-center border border-dashed border-port-border rounded">
- No items yet. Pin an image or note above.
- </div>
- ) : (
- <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3">
- {items.map((item) => {
- const src = moodBoardItemSrc(item);
- const videoSrc = moodBoardItemVideoSrc(item);
- const analysisSource = moodBoardItemAnalysisSource(item);
- return (
- <div key={item.id} className="bg-port-card border border-port-border rounded-md overflow-hidden flex flex-col">
- {item.type === 'video' && videoSrc ? (
- playingItemId === item.id ? (
- // eslint-disable-next-line jsx-a11y/media-has-caption -- reference clips have no caption track
- <video
- src={videoSrc}
- poster={src || undefined}
- controls
- autoPlay
- playsInline
- className="w-full aspect-square object-cover bg-black"
+ {/* Pinterest link + sync */}
+ <div className="bg-port-card border border-port-border rounded-md p-4">
+ <div className="flex items-center gap-2 mb-3">
+ <Link2 className="w-4 h-4 text-port-accent" aria-hidden="true" />
+ <h2 className="text-sm font-medium text-white">Pinterest board</h2>
+ </div>
+ {linkedFeedUrl ? (
+ <div className="space-y-3">
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs">
+ <a
+ href={linkedBoardUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-port-accent hover:underline truncate max-w-full"
+ >
+ {linkedBoardUrl}
+ </a>
+ <span className="text-gray-500">
+ {lastSyncedAt ? `Last synced ${timeAgo(lastSyncedAt)}` : 'Not synced yet'}
+ </span>
+ </div>
+ <p className="text-[11px] text-gray-500">
+ Pinterest’s feed exposes only the most-recent ~25 pins, so a sync pulls those — not the entire board.
+ </p>
+ <p className="text-[11px] text-gray-500">
+ Use “Import pins” below to read the full board from your signed-in PortOS browser.
+ </p>
+ <div className="flex flex-wrap items-center gap-2">
+ <button
+ type="button"
+ onClick={handleSyncPinterest}
+ disabled={syncing || linking || importingPinterest || pinDirty}
+ title={pinDirty ? 'Link the new URL before syncing' : undefined}
+ className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50 transition-colors"
+ >
+ <RefreshCw className={`w-4 h-4 ${syncing ? 'animate-spin' : ''}`} aria-hidden="true" />
+ {syncing ? 'Syncing…' : 'Sync now'}
+ </button>
+ {confirmingUnlink ? (
+ <InlineConfirmRow
+ question="Unlink this board?"
+ confirmText="Unlink"
+ onConfirm={handleUnlinkPinterest}
+ onCancel={() => setConfirmingUnlink(false)}
/>
) : (
<button
type="button"
- onClick={() => setPlayingItemId(item.id)}
- aria-label="Play video"
- className="relative w-full aspect-square bg-port-bg text-gray-600 group"
+ onClick={() => setConfirmingUnlink(true)}
+ className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-bg text-gray-400 hover:text-white transition-colors"
>
- {src ? (
- <img
- src={src}
- alt={item.caption || ''}
- loading="lazy"
- className="w-full h-full object-cover"
- onError={(e) => {
- // A synced board can carry a poster URL whose file
- // only exists on the sending machine (a downloaded
- // video's thumbnail is named `<id>.jpg`, not
- // `<filename-stem>.jpg`). The receiver regenerates
- // the stem-named poster when it pulls the video, so
- // fall back to that derived name on a 404.
- const fallback = moodBoardItemSrc({ ...item, imageUrl: null });
- if (fallback && e.currentTarget.getAttribute('src') !== fallback) {
- e.currentTarget.src = fallback;
- }
- }}
- />
- ) : (
- <span className="w-full h-full flex items-center justify-center">
- <Film className="w-8 h-8" aria-hidden="true" />
- </span>
- )}
- <span className="absolute inset-0 flex items-center justify-center bg-black/30 opacity-80 group-hover:opacity-100 transition-opacity">
- <Play className="w-8 h-8 text-white drop-shadow" aria-hidden="true" />
- </span>
+ <Unlink className="w-4 h-4" aria-hidden="true" /> Unlink
</button>
- )
- ) : item.type === 'image' || item.type === 'video' ? (
- src ? (
- <img src={src} alt={item.caption || ''} loading="lazy" className="w-full aspect-square object-cover bg-port-bg" />
- ) : (
- <div className="w-full aspect-square flex items-center justify-center bg-port-bg text-gray-600">
- <ImageIcon className="w-8 h-8" aria-hidden="true" />
- </div>
- )
- ) : (
- <div className="w-full aspect-square p-3 overflow-y-auto bg-port-bg text-sm text-gray-200 whitespace-pre-wrap">
- {item.text}
- </div>
- )}
- <div className="p-2 flex flex-col gap-1">
- <input
- type="text"
- aria-label="Item caption"
- defaultValue={item.caption || ''}
- placeholder="Add a caption…"
- maxLength={2000}
- onBlur={(e) => {
- const next = e.target.value.trim();
- if (next !== (item.caption || '')) handleUpdateCaption(item.id, next);
- }}
- className="w-full bg-transparent border-0 border-b border-transparent focus:border-port-border text-xs text-gray-300 px-0 py-0.5 outline-none"
- />
- <div className="flex items-center justify-between">
- {item.source ? (
- <span className="text-[10px] text-gray-500 truncate" title={item.source}>{item.source}</span>
- ) : <span />}
- <div className="flex items-center gap-1">
- {analysisSource ? (
- <button
- type="button"
- onClick={() => setAnalyzeItemId(item.id)}
- title={item.analysis ? 'View prompt from media' : 'Prompt from media'}
- aria-label={item.analysis ? 'View prompt from media' : 'Prompt from media'}
- className={`min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 transition-colors ${item.analysis ? 'text-port-accent hover:text-port-accent/80' : 'text-gray-500 hover:text-white'}`}
- >
- <ScanEye className="w-3.5 h-3.5" aria-hidden="true" />
- </button>
- ) : null}
- <button
- type="button"
- onClick={() => setConfirmingItemId(item.id)}
- title="Remove item"
- aria-label="Remove item"
- className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 text-gray-500 hover:text-port-error transition-colors"
- >
- <Trash2 className="w-3.5 h-3.5" aria-hidden="true" />
- </button>
- </div>
- </div>
- {confirmingItemId === item.id ? (
- <InlineConfirmRow
- question="Remove this item?"
- confirmText="Remove"
- onConfirm={() => handleRemoveItem(item.id)}
- onCancel={() => setConfirmingItemId(null)}
- />
- ) : null}
+ )}
</div>
+ {renderPinUrlForm('Change board URL', 'Update')}
</div>
- );
- })}
- </div>
- )}
+ ) : (
+ <div>
+ {renderPinUrlForm('Board URL', 'Link')}
+ <p className="text-[11px] text-gray-500 mt-2">
+ Link a public board to sync its newest ~25 pins. “Import pins” reads the full board from your signed-in PortOS browser and saves the images here.
+ </p>
+ </div>
+ )}
+ </div>
+
+ {/* X.com (Twitter) post import */}
+ <div className="bg-port-card border border-port-border rounded-md p-4">
+ <div className="flex items-center gap-2 mb-3">
+ <AtSign className="w-4 h-4 text-port-accent" aria-hidden="true" />
+ <h2 className="text-sm font-medium text-white">Import from an X post</h2>
+ </div>
+ <div>
+ <label htmlFor="x-post-url" className="block text-xs text-gray-400 mb-1">Post URL</label>
+ <div className="flex gap-2">
+ <input
+ id="x-post-url"
+ type="text"
+ value={xPostUrl}
+ maxLength={2048}
+ placeholder="https://x.com/user/status/1234567890"
+ onChange={(e) => setXPostUrl(e.target.value)}
+ className="flex-1 min-w-0 bg-port-bg border border-port-border rounded px-2 py-1.5 text-white text-sm focus:border-port-accent outline-none"
+ />
+ <button
+ type="button"
+ onClick={handleImportXPost}
+ disabled={importingXPost || !xPostUrl.trim()}
+ className="px-3 py-1.5 text-sm rounded bg-port-success text-white hover:bg-port-success/80 disabled:opacity-50 transition-colors"
+ >
+ {importingXPost ? 'Importing…' : 'Import'}
+ </button>
+ </div>
+ </div>
+ <p className="text-[11px] text-gray-500 mt-2">
+ Paste a public x.com/twitter.com post URL. Pulls every attached photo (or its video) into this board.
+ </p>
+ </div>
+ </aside>
+ </div>
<GalleryImagePicker
open={imagePickerOpen}
diff --git a/client/src/pages/MoodBoardDetail.test.jsx b/client/src/pages/MoodBoardDetail.test.jsx
index 8900b771e8..4941900c63 100644
--- a/client/src/pages/MoodBoardDetail.test.jsx
+++ b/client/src/pages/MoodBoardDetail.test.jsx
@@ -475,3 +475,32 @@ describe('MoodBoardDetail item analysis (#4188 Phase 3)', () => {
await screen.findByRole('button', { name: 'Prompt from media' });
});
});
+
+describe('MoodBoardDetail desktop layout', () => {
+ it('renders mood board items on the left and add forms on the right column', async () => {
+ mockGetMoodBoard.mockResolvedValueOnce({
+ id: 'a',
+ name: 'Board A',
+ items: [{ id: 'mbi-1', type: 'image', imageUrl: '/data/images/pic.jpg', caption: 'Pic 1' }],
+ });
+ renderPage();
+ await waitFor(() => expect(boardNameValue()).toBe('Board A'));
+
+ const itemsSection = screen.getByRole('region', { name: 'Mood board items' });
+ const addAside = screen.getByRole('complementary', { name: 'Add to mood board' });
+
+ expect(itemsSection).toBeInTheDocument();
+ expect(addAside).toBeInTheDocument();
+
+ const parentGrid = itemsSection.parentElement;
+ expect(parentGrid).toBe(addAside.parentElement);
+ expect(parentGrid.className).toContain('lg:grid-cols-');
+ expect(parentGrid.firstElementChild).toBe(itemsSection);
+ expect(parentGrid.lastElementChild).toBe(addAside);
+
+ // Verify add forms are contained within the right aside
+ expect(addAside).toContainElement(screen.getByRole('button', { name: 'Pin to board' }));
+ expect(addAside).toContainElement(screen.getByRole('button', { name: 'Import pins' }));
+ expect(addAside).toContainElement(screen.getByRole('button', { name: 'Import' }));
+ });
+});