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

fix: put Rapid Reader text and reading actions first (#11005)

Adam Eivy4c618c4fabca
diff --git a/client/src/pages/RapidReader.jsx b/client/src/pages/RapidReader.jsx
index 24a864a7a1..cf05770a28 100644
--- a/client/src/pages/RapidReader.jsx
+++ b/client/src/pages/RapidReader.jsx
@@ -227,66 +227,7 @@ export default function RapidReaderPage() {
) : (
<div className="space-y-4">
<div className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
- <div className="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3">
- <div className="flex items-start gap-3">
- <BookOpen size={20} className="mt-0.5 text-port-accent shrink-0" aria-hidden="true" />
- <div>
- <h2 className="text-sm font-medium text-gray-200">Accelerando</h2>
- <p className="text-xs text-gray-400">Charles Stross · official HTML edition</p>
- </div>
- </div>
- <button
- type="button"
- onClick={() => loadBook()}
- disabled={loadingBook}
- className="inline-flex items-center justify-center min-h-10 px-3 py-2 rounded-md bg-port-accent text-white text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed hover:bg-port-accent/90"
- >
- {loadingBook ? 'Loading…' : 'Load Accelerando'}
- </button>
- </div>
- <p className="text-xs leading-5 text-gray-400">
- Downloads the author-hosted book when requested, then keeps the source in this instance's local cache for repeat and offline reads.
- </p>
- <div className="flex flex-wrap gap-x-3 gap-y-1 text-xs text-gray-500">
- <a
- href={ACCELERANDO_SOURCE_PAGE_URL}
- target="_blank"
- rel="noreferrer"
- className="inline-flex items-center gap-1 text-port-accent hover:underline"
- >
- Author's page <ExternalLink size={11} aria-hidden="true" />
- </a>
- <a
- href={ACCELERANDO_LICENSE_URL}
- target="_blank"
- rel="noreferrer"
- className="text-port-accent hover:underline"
- >
- CC BY-NC-ND 2.5
- </a>
- </div>
- {bookStatus === 'downloaded' && (
- <p role="status" className="text-xs text-green-400">Downloaded from the author's site and cached on this instance.</p>
- )}
- {bookStatus === 'downloaded-uncached' && (
- <p role="status" className="text-xs text-yellow-400">Downloaded from the author's site, but this instance could not save its local cache.</p>
- )}
- {bookStatus === 'cached' && (
- <p role="status" className="text-xs text-green-400">Loaded from this instance's local cache.</p>
- )}
- {bookStatus === 'error' && (
- <p role="alert" className="text-xs text-red-400">{bookError}</p>
- )}
- </div>
-
- <section className="bg-port-card border border-port-border rounded-lg p-4 space-y-3" aria-label="Shelf">
- <div className="flex items-center justify-between gap-3"><div><h2 className="text-sm font-medium text-gray-200">Shelf</h2><p className="text-xs text-gray-400">Saved books stay on this machine and in its backups.</p></div><button type="button" onClick={loadShelf} className="text-xs text-port-accent hover:underline">Retry</button></div>
- {shelfError && <p role="alert" className="text-xs text-red-400">{shelfError}</p>}
- {shelfLoading ? <p className="text-xs text-gray-500">Loading shelf…</p> : shelf.length === 0 ? <p className="text-xs text-gray-500">No saved books yet.</p> : <ul className="divide-y divide-port-border">{shelf.map((entry) => <li key={entry.id} className="py-2 flex flex-wrap items-center justify-between gap-2"><button type="button" onClick={() => openShelf(entry.id)} aria-label={`Open ${entry.title}`} className="text-left min-h-10"><span className="block text-sm text-gray-200">{entry.title}</span><span className="block text-xs text-gray-500">{entry.author || entry.sourceUrl || entry.sourceType} · {entry.wordCount} words</span></button>{pendingDelete === entry.id ? <span className="flex gap-2 text-xs"><button type="button" onClick={() => deleteShelf(entry.id)} className="text-red-400">Delete</button><button type="button" onClick={() => setPendingDelete(null)} className="text-gray-400">Cancel</button></span> : <button type="button" onClick={() => setPendingDelete(entry.id)} aria-label={`Delete ${entry.title}`} className="min-h-10 px-2 text-gray-500 hover:text-red-400"><Trash2 size={15} /></button>}</li>)}</ul>}
- </section>
-
- <div className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
- <div className="flex items-center justify-between gap-2">
+ <div className="flex flex-wrap items-center justify-between gap-2">
<label htmlFor="rr-text" className="text-sm font-medium text-gray-300">
Text to read
</label>
@@ -323,15 +264,54 @@ export default function RapidReaderPage() {
ref={textareaRef}
value={text}
onChange={(e) => setText(e.target.value)}
- rows={10}
+ rows={5}
placeholder="Paste an article, email, briefing, or any prose…"
- className="w-full bg-port-bg border border-port-border rounded-md px-3 py-2 text-sm text-gray-200 placeholder-gray-600 font-mono focus:outline-none focus:border-port-accent/60"
+ className="w-full sm:h-36 bg-port-bg border border-port-border rounded-md px-3 py-2 text-sm text-gray-200 placeholder-gray-600 font-mono focus:outline-none focus:border-port-accent/60"
/>
<div className="flex flex-wrap items-center justify-between gap-3 text-xs text-gray-500">
<span>
{wordCount} word{wordCount === 1 ? '' : 's'} · approx {estSec}s at {wpm} WPM
</span>
</div>
+ <div className="flex flex-wrap items-center gap-3">
+ <button
+ type="button"
+ onClick={() => startAt(0)}
+ disabled={!text.trim()}
+ className="inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-lg bg-port-accent text-white font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:bg-port-accent/90"
+ >
+ <Zap size={16} /> Start reading
+ </button>
+ <button
+ type="button"
+ onClick={() => startAt(rapidReaderWordIndexAtCursor(text, textareaRef.current?.selectionStart || 0))}
+ disabled={!documentText}
+ className="inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-lg border border-port-accent/50 text-port-accent font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:bg-port-accent/10"
+ >
+ <Play size={16} /> Start at cursor
+ </button>
+ {bookmark && (
+ <>
+ <button
+ type="button"
+ onClick={() => startAt(bookmark.wordIndex, bookmark)}
+ className="inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-lg border border-port-border text-gray-200 font-medium hover:border-port-accent/60 hover:bg-port-bg/40"
+ >
+ <Bookmark size={16} className="text-port-accent" /> Resume at word {bookmark.wordIndex + 1}
+ </button>
+ <button
+ type="button"
+ onClick={() => { clearRapidReaderProgress(documentText, documentIdentity); setBookmark(null); }}
+ className="min-h-10 px-3 py-2 text-xs text-gray-500 hover:text-white"
+ >
+ Clear bookmark
+ </button>
+ </>
+ )}
+ <span className="text-xs text-gray-500">
+ Tip: many surfaces in PortOS expose a Rapid Read button — Briefing, Wiki notes, and more.
+ </span>
+ </div>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2 pt-1">
<label className="text-xs text-gray-400"><span className="sr-only">Shelf title</span><input value={saveTitle} onChange={(event) => setSaveTitle(event.target.value)} placeholder="Title to save" className="w-full min-h-10 bg-port-bg border border-port-border rounded-md px-3" /></label>
<button type="button" disabled={savingShelf || !documentText || !saveTitle.trim()} onClick={saveToShelf} className="inline-flex justify-center items-center gap-1 min-h-10 border border-port-accent/50 text-port-accent rounded-md disabled:opacity-40"><Save size={14} /> Save to shelf</button>
@@ -346,8 +326,8 @@ export default function RapidReaderPage() {
</div>
</div>
- <div className="bg-port-card border border-port-border rounded-lg p-4 space-y-4">
- <div className="text-sm font-medium text-gray-300">Settings</div>
+ <details className="bg-port-card border border-port-border rounded-lg p-4 space-y-4">
+ <summary className="cursor-pointer text-sm font-medium text-gray-300">Reading settings · {wpm} WPM</summary>
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
<label className="flex flex-col gap-1.5 text-xs text-gray-400">
<span>Words per minute</span>
@@ -402,47 +382,68 @@ export default function RapidReaderPage() {
</div>
</div>
</div>
- </div>
+ </details>
- <div className="flex flex-wrap items-center gap-3">
- <button
- type="button"
- onClick={() => startAt(0)}
- disabled={!text.trim()}
- className="inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-lg bg-port-accent text-white font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:bg-port-accent/90"
- >
- <Zap size={16} /> Start reading
- </button>
- <button
- type="button"
- onClick={() => startAt(rapidReaderWordIndexAtCursor(text, textareaRef.current?.selectionStart || 0))}
- disabled={!documentText}
- className="inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-lg border border-port-accent/50 text-port-accent font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:bg-port-accent/10"
- >
- <Play size={16} /> Start at cursor
- </button>
- {bookmark && (
- <>
- <button
- type="button"
- onClick={() => startAt(bookmark.wordIndex, bookmark)}
- className="inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-lg border border-port-border text-gray-200 font-medium hover:border-port-accent/60 hover:bg-port-bg/40"
- >
- <Bookmark size={16} className="text-port-accent" /> Resume at word {bookmark.wordIndex + 1}
- </button>
- <button
- type="button"
- onClick={() => { clearRapidReaderProgress(documentText, documentIdentity); setBookmark(null); }}
- className="min-h-10 px-3 py-2 text-xs text-gray-500 hover:text-white"
- >
- Clear bookmark
- </button>
- </>
+ <div className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
+ <div className="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3">
+ <div className="flex items-start gap-3">
+ <BookOpen size={20} className="mt-0.5 text-port-accent shrink-0" aria-hidden="true" />
+ <div>
+ <h2 className="text-sm font-medium text-gray-200">Accelerando</h2>
+ <p className="text-xs text-gray-400">Charles Stross · official HTML edition</p>
+ </div>
+ </div>
+ <button
+ type="button"
+ onClick={() => loadBook()}
+ disabled={loadingBook}
+ className="inline-flex items-center justify-center min-h-10 px-3 py-2 rounded-md bg-port-accent text-white text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed hover:bg-port-accent/90"
+ >
+ {loadingBook ? 'Loading…' : 'Load Accelerando'}
+ </button>
+ </div>
+ <p className="text-xs leading-5 text-gray-400">
+ Downloads the author-hosted book when requested, then keeps the source in this instance's local cache for repeat and offline reads.
+ </p>
+ <div className="flex flex-wrap gap-x-3 gap-y-1 text-xs text-gray-500">
+ <a
+ href={ACCELERANDO_SOURCE_PAGE_URL}
+ target="_blank"
+ rel="noreferrer"
+ className="inline-flex items-center gap-1 text-port-accent hover:underline"
+ >
+ Author's page <ExternalLink size={11} aria-hidden="true" />
+ </a>
+ <a
+ href={ACCELERANDO_LICENSE_URL}
+ target="_blank"
+ rel="noreferrer"
+ className="text-port-accent hover:underline"
+ >
+ CC BY-NC-ND 2.5
+ </a>
+ </div>
+ {bookStatus === 'downloaded' && (
+ <p role="status" className="text-xs text-green-400">Downloaded from the author's site and cached on this instance.</p>
+ )}
+ {bookStatus === 'downloaded-uncached' && (
+ <p role="status" className="text-xs text-yellow-400">Downloaded from the author's site, but this instance could not save its local cache.</p>
+ )}
+ {bookStatus === 'cached' && (
+ <p role="status" className="text-xs text-green-400">Loaded from this instance's local cache.</p>
+ )}
+ {bookStatus === 'error' && (
+ <p role="alert" className="text-xs text-red-400">{bookError}</p>
)}
- <span className="text-xs text-gray-500">
- Tip: many surfaces in PortOS expose a Rapid Read button — Briefing, Wiki notes, and more.
- </span>
</div>
+
+ <section className="bg-port-card border border-port-border rounded-lg p-4 space-y-3" aria-label="Shelf">
+ <div className="flex items-center justify-between gap-3"><div><h2 className="text-sm font-medium text-gray-200">Shelf</h2><p className="text-xs text-gray-400">Saved books stay on this machine and in its backups.</p></div><button type="button" onClick={loadShelf} className="text-xs text-port-accent hover:underline">Retry</button></div>
+ {shelfError && <p role="alert" className="text-xs text-red-400">{shelfError}</p>}
+ {shelfLoading ? <p className="text-xs text-gray-500">Loading shelf…</p> : shelf.length === 0 ? <p className="text-xs text-gray-500">No saved books yet.</p> : <ul className="divide-y divide-port-border">{shelf.map((entry) => <li key={entry.id} className="py-2 flex flex-wrap items-center justify-between gap-2"><button type="button" onClick={() => openShelf(entry.id)} aria-label={`Open ${entry.title}`} className="text-left min-h-10"><span className="block text-sm text-gray-200">{entry.title}</span><span className="block text-xs text-gray-500">{entry.author || entry.sourceUrl || entry.sourceType} · {entry.wordCount} words</span></button>{pendingDelete === entry.id ? <span className="flex gap-2 text-xs"><button type="button" onClick={() => deleteShelf(entry.id)} className="text-red-400">Delete</button><button type="button" onClick={() => setPendingDelete(null)} className="text-gray-400">Cancel</button></span> : <button type="button" onClick={() => setPendingDelete(entry.id)} aria-label={`Delete ${entry.title}`} className="min-h-10 px-2 text-gray-500 hover:text-red-400"><Trash2 size={15} /></button>}</li>)}</ul>}
+ </section>
+
+
</div>
)}
</div>