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

keep folded publish cards' bodies mounted so stage deep links unfold them; say what Not done removes

[._.]/ Adam Eivye6ac7c991b6d
diff --git a/client/src/components/musicVideo/PublishCard.jsx b/client/src/components/musicVideo/PublishCard.jsx
index 9924e7736d..392db06af8 100644
--- a/client/src/components/musicVideo/PublishCard.jsx
+++ b/client/src/components/musicVideo/PublishCard.jsx
@@ -21,7 +21,8 @@ function rememberOpen(projectId, cardId, open) {
* get past the finished ones to the step they need. `defaultOpen` is the
* card's own sense of whether it still needs attention; a toggle is
* remembered on this device per project. `summary` shows beside a folded
- * title (e.g. "7 of 9 done"). `actions` (a button, say) sit beside the title,
+ * title (e.g. "7 of 9 done"). The body stays mounted while folded so a deep
+ * link into it can find its anchor and unfold the card (lib/unfoldToAnchor.js). `actions` (a button, say) sit beside the title,
* outside the fold toggle.
*/
export default function PublishCard({ projectId, cardId, label, icon: Icon, summary = '', defaultOpen = true, actions = null, className = '', children }) {
@@ -34,10 +35,10 @@ export default function PublishCard({ projectId, cardId, label, icon: Icon, summ
};
const Chevron = open ? ChevronDown : ChevronRight;
return (
- <section aria-label={label} className={`rounded-lg border border-port-border bg-port-card p-3 space-y-2 text-xs ${className}`.trim()}>
+ <section data-fold aria-label={label} className={`rounded-lg border border-port-border bg-port-card p-3 space-y-2 text-xs ${className}`.trim()}>
<div className="flex flex-wrap items-center justify-between gap-2">
<h3 className="text-sm font-medium min-w-0 flex-1">
- <button type="button" aria-expanded={open} aria-controls={open ? bodyId : undefined} onClick={toggle}
+ <button type="button" data-fold-toggle aria-expanded={open} aria-controls={bodyId} onClick={toggle}
className="flex w-full items-center gap-1.5 min-h-[44px] sm:min-h-0">
<Chevron size={14} className="shrink-0" />
{Icon && <Icon size={14} className="shrink-0" />}
@@ -47,7 +48,8 @@ export default function PublishCard({ projectId, cardId, label, icon: Icon, summ
</h3>
{actions}
</div>
- {open && <div id={bodyId} className="space-y-2">{children}</div>}
+ {/* Kept mounted while folded: deep links (#mv-post-<target>) must find their anchor to unfold it. */}
+ <div id={bodyId} hidden={!open} className="space-y-2">{children}</div>
</section>
);
}
diff --git a/client/src/components/musicVideo/PublishCard.test.jsx b/client/src/components/musicVideo/PublishCard.test.jsx
index 588d3141f6..0df6af8061 100644
--- a/client/src/components/musicVideo/PublishCard.test.jsx
+++ b/client/src/components/musicVideo/PublishCard.test.jsx
@@ -18,20 +18,21 @@ describe('PublishCard', () => {
expect(screen.getByText('Card body')).toBeInTheDocument();
fireEvent.click(toggle);
expect(toggle).toHaveAttribute('aria-expanded', 'false');
- expect(screen.queryByText('Card body')).not.toBeInTheDocument();
+ expect(screen.getByText('Card body')).not.toBeVisible(); // folded, still mounted for deep links
expect(screen.getByText('Built')).toBeInTheDocument();
});
it('starts folded when it needs nothing, and remembers a toggle per project', () => {
const { unmount } = render(card({ defaultOpen: false }));
- expect(screen.queryByText('Card body')).not.toBeInTheDocument();
+ expect(screen.getByText('Card body')).not.toBeVisible();
fireEvent.click(screen.getByRole('button', { name: /Release assets/ }));
unmount();
- render(card({ defaultOpen: false }));
- expect(screen.getByText('Card body')).toBeInTheDocument();
+ const { unmount: unmountAgain } = render(card({ defaultOpen: false }));
+ expect(screen.getByText('Card body')).toBeVisible();
+ unmountAgain();
// another project keeps its own default
render(card({ projectId: 'mv-2', defaultOpen: false }));
- expect(screen.getAllByText('Card body')).toHaveLength(1);
+ expect(screen.getByText('Card body')).not.toBeVisible();
});
it('keeps header actions outside the fold toggle', () => {
diff --git a/client/src/components/musicVideo/PublishPostingPanel.jsx b/client/src/components/musicVideo/PublishPostingPanel.jsx
index 5077f56b3f..1d094c21c2 100644
--- a/client/src/components/musicVideo/PublishPostingPanel.jsx
+++ b/client/src/components/musicVideo/PublishPostingPanel.jsx
@@ -247,12 +247,12 @@ function ManualLink({ idFor, label, placeholder, onSave, hideMarkDone = false })
);
}
-/** Undo a platform's done mark (PortOS's record only), behind a confirm. */
+/** Undo a platform's done mark: drops PortOS's record (link, rating, notes), never the post. Behind a confirm. */
function UndoDone({ label, onUndo }) {
const [confirm, setConfirm] = useState(false);
return confirm ? (
<ConfirmButtonPair
- prompt={`Mark ${label} as not done? The post itself stays up.`}
+ prompt={`Remove PortOS's record of the ${label} post (its link, rating and notes)? The post itself stays up.`}
confirmText="Not done"
ariaLabel={`Confirm marking ${label} not done`}
confirmAriaLabel={`Confirm marking ${label} not done`}
@@ -309,11 +309,11 @@ function TargetRow({ project, kit, entry, publishing }) {
};
return (
- <li id={publishRowAnchor(target)} className="rounded border border-port-border p-2 space-y-2 scroll-mt-4">
+ <li id={publishRowAnchor(target)} data-fold className="rounded border border-port-border p-2 space-y-2 scroll-mt-4">
<div className="flex flex-wrap items-start justify-between gap-2">
<div className="min-w-0 flex-1">
<h4 className="text-xs font-medium">
- <button type="button" aria-expanded={open} aria-controls={open ? idFor('body') : undefined} onClick={() => setOpen(!open)}
+ <button type="button" data-fold-toggle aria-expanded={open} aria-controls={open ? idFor('body') : undefined} onClick={() => setOpen(!open)}
className="flex items-center gap-1 min-h-[44px] sm:min-h-0">
<Chevron size={13} className="shrink-0" />
<span>{label}{account && <span className="font-normal text-port-text-muted"> as {entry.accountPlaceholder ? '' : '@'}{account}</span>}</span>
diff --git a/client/src/components/musicVideo/PublishPostingPanel.test.jsx b/client/src/components/musicVideo/PublishPostingPanel.test.jsx
index 541aff2178..052db1cd42 100644
--- a/client/src/components/musicVideo/PublishPostingPanel.test.jsx
+++ b/client/src/components/musicVideo/PublishPostingPanel.test.jsx
@@ -226,4 +226,13 @@ describe('PublishPostingPanel (#9282)', () => {
fireEvent.click(within(done).getByRole('button', { name: 'Confirm marking DistroKid not done' }));
expect(publishing.removePost).toHaveBeenCalledWith('distrokid');
});
+
+ it('keeps a platform row reachable by its anchor while the card and row are folded', () => {
+ localStorage.setItem('portos.musicVideo.publishCards', JSON.stringify({ 'mv-1': { posting: false } }));
+ render(<PublishPostingPanel project={project({ posts: { youtube: { url: 'https://youtu.be/abc' } } })} publishing={hook({ enabledTargets: ['youtube', 'distrokid'] })} />);
+ expect(screen.getByRole('button', { name: /Publish manually/ })).toHaveAttribute('aria-expanded', 'false');
+ expect(document.getElementById('mv-post-distrokid')).not.toBeNull();
+ expect(document.getElementById('mv-post-youtube')).not.toBeNull();
+ localStorage.clear();
+ });
});
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index 4ba85929c7..f30256f103 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -202,6 +202,7 @@ grep -i "what you want to do" client/src/lib/README.md
| `rapidReaderPosition.js` | Cursor-to-word mapping plus privacy-preserving Rapid Reader progress persistence keyed by a text fingerprint; stores position/settings without storing pasted source text. |
| `registerServiceWorker.js` | `registerServiceWorker()` / `unregisterServiceWorkers()` — wires up the offline app-shell + low-bandwidth asset-caching service worker (`public/sw.js`). Registers only in a production secure context (HTTPS or localhost); no-ops over plain-HTTP Tailnet and tears down any stale SW in dev. Called once from `main.jsx`. |
| `safeStorage.js` | `safeReadStorage` / `safeReadJsonStorage` / `safeWriteStorage` / `safeWriteJsonStorage` / `safeRemoveStorage` — guarded `localStorage` access that swallows throws (Safari private mode, blocked storage), with fallback-safe JSON parsing for structured entries. Use instead of touching `localStorage` inline so a storage failure never crashes init or a write path (#2387). Consumed by `useTheme`, `useNavWorkingSet`, and the command palette. Also `safeReadJsonSession` / `safeWriteJsonSession` / `safeRemoveSession` — the same guarantees over `sessionStorage`, for tab-scoped crash-recovery buffers of edits the server has not accepted yet (QuotaBurn's unsaved-patch stash). |
+| `unfoldToAnchor.js` | `unfoldToAnchor(el)` reveals a deep-link target inside folded sections before the page scrolls to it: opens every `<details>` around it and presses each `[data-fold-toggle]` that reads `aria-expanded="false"` in the `[data-fold]` elements around it (the element itself included), returning true when a React-state fold was pressed so the caller waits a frame. Used by the Music Video page's stage anchors (`#mv-post-<target>` into a folded Publish card or platform row). |
| `sameJsonShape.js` | `sameJsonShape(prev, next)` — JSON.stringify-based equality for `useAutoRefetch`'s `compare` option on small, deterministically-shaped poll payloads. |
| `sketchCanvas.js` | Pure stroke model + 2D-context renderer for the media annotation canvas (`createStroke`, `appendPoint`, `undoStrokes`, `drawStrokes`, `clampSize`). Points stored in natural-pixel space; erase strokes use `destination-out`. Used by `AnnotationCanvas.jsx` / `MediaAnnotate.jsx` (#2036). |
| `unsorted.js` | Synthetic "Unsorted" collection from media not filed in any real collection. |
diff --git a/client/src/lib/index.js b/client/src/lib/index.js
index e6f8978d13..9a5ecd0de2 100644
--- a/client/src/lib/index.js
+++ b/client/src/lib/index.js
@@ -164,6 +164,7 @@ export * from './providerManagement.js';
export * from './rapidReaderPosition.js';
export * from './registerServiceWorker.js';
export * from './safeStorage.js';
+export * from './unfoldToAnchor.js';
export * from './sameJsonShape.js';
export * from './sketchCanvas.js';
export * from './unsorted.js';
diff --git a/client/src/lib/unfoldToAnchor.js b/client/src/lib/unfoldToAnchor.js
new file mode 100644
index 0000000000..57ceafceea
--- /dev/null
+++ b/client/src/lib/unfoldToAnchor.js
@@ -0,0 +1,19 @@
+/**
+ * Reveal an anchor that sits inside folded sections, so a deep link (a stage's
+ * "Next: post to X", a checklist's "Post here") lands on it. Opens every
+ * `<details>` around it, and presses the toggle of every `[data-fold]` element
+ * around it (the element itself included) whose `[data-fold-toggle]` reads
+ * aria-expanded="false". Returns true when a React-state fold was pressed, so
+ * the caller can wait a frame for it to render before scrolling.
+ */
+export function unfoldToAnchor(el) {
+ if (!el) return false;
+ for (let fold = el.closest('details'); fold; fold = fold.parentElement?.closest('details')) fold.open = true;
+ let pressed = false;
+ for (let fold = el.closest('[data-fold]'); fold; fold = fold.parentElement?.closest('[data-fold]')) {
+ // a fold's own header toggle comes before anything nested in its body
+ const toggle = fold.querySelector('[data-fold-toggle]');
+ if (toggle?.getAttribute('aria-expanded') === 'false') { toggle.click(); pressed = true; }
+ }
+ return pressed;
+}
diff --git a/client/src/lib/unfoldToAnchor.test.js b/client/src/lib/unfoldToAnchor.test.js
new file mode 100644
index 0000000000..1a9273f6a3
--- /dev/null
+++ b/client/src/lib/unfoldToAnchor.test.js
@@ -0,0 +1,29 @@
+import { describe, it, expect, vi } from 'vitest';
+import { unfoldToAnchor } from './unfoldToAnchor.js';
+
+describe('unfoldToAnchor', () => {
+ it('opens details around the anchor and presses each folded toggle, outermost too', () => {
+ document.body.innerHTML = `
+ <details id="outer"><summary>s</summary>
+ <section data-fold><h3><button data-fold-toggle aria-expanded="false">Card</button></h3>
+ <div hidden>
+ <li id="row" data-fold><h4><button data-fold-toggle aria-expanded="false">Row</button></h4></li>
+ </div>
+ </section>
+ </details>`;
+ const clicks = [];
+ for (const b of document.querySelectorAll('[data-fold-toggle]')) b.addEventListener('click', () => clicks.push(b.textContent));
+ expect(unfoldToAnchor(document.getElementById('row'))).toBe(true);
+ expect(document.getElementById('outer').open).toBe(true);
+ expect(clicks.sort()).toEqual(['Card', 'Row']);
+ });
+
+ it('leaves open folds alone and says nothing was pressed', () => {
+ document.body.innerHTML = '<section data-fold><button data-fold-toggle aria-expanded="true">Card</button><p id="a">x</p></section>';
+ const click = vi.fn();
+ document.querySelector('button').addEventListener('click', click);
+ expect(unfoldToAnchor(document.getElementById('a'))).toBe(false);
+ expect(click).not.toHaveBeenCalled();
+ expect(unfoldToAnchor(null)).toBe(false);
+ });
+});
diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsx
index dac13497a7..e6f83ab185 100644
--- a/client/src/pages/MusicVideo.jsx
+++ b/client/src/pages/MusicVideo.jsx
@@ -1,4 +1,5 @@
import ProductionReviewPanel from '../components/musicVideo/ProductionReviewPanel.jsx';
+import { unfoldToAnchor } from '../lib/unfoldToAnchor.js';
import useMusicVideoProductionReview from '../hooks/useMusicVideoProductionReview.js';
import { useEffect, useState, useCallback, useMemo, useRef } from 'react';
import { useParams, useNavigate, useSearchParams, useLocation } from 'react-router';
@@ -956,11 +957,15 @@ export default function MusicVideo() {
if (!anchor || !selected) return;
const el = document.getElementById(anchor);
if (!el) return;
- // An anchor inside a folded section (Production review) unfolds it first.
- for (let fold = el.closest('details'); fold; fold = fold.parentElement?.closest('details')) fold.open = true;
- el.scrollIntoView?.({ block: 'start', behavior: 'instant' });
- const focusable = el.matches('[tabindex], button, input, select, textarea, a') ? el : el.querySelector('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), a');
- focusable?.focus?.({ preventScroll: true });
+ // An anchor inside a folded section (Production review, a Publish card or
+ // platform row) unfolds it first; a React-state fold renders a frame later.
+ const land = () => {
+ el.scrollIntoView?.({ block: 'start', behavior: 'instant' });
+ const focusable = el.matches('[tabindex], button, input, select, textarea, a') ? el : el.querySelector('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), a');
+ focusable?.focus?.({ preventScroll: true });
+ };
+ if (unfoldToAnchor(el)) requestAnimationFrame(land);
+ else land();
}, [activeStage, location.key, selectedId, !!selected]);
const goToStage = (stage, anchor = null, params = null) => {
// Preserve search params (e.g. ?play=, ?new=, ?sheet=) across tabs; `params` sets more (e.g. ?scenes=missing).