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: collapse the Daily Log toolbar to two mobile rows so the editor stays above the fold (#3526)

[._.]/ Adam Eivy86ae8e958041
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index e9e85ae6b6..facc7634e0 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -105,6 +105,7 @@
- **[issue-3517] A failed "Schedule Time Blocks" left the goal's scheduling buttons stuck on "Scheduling..." until you reloaded the page.** Scheduling, rescheduling, and removing a goal's time blocks each raised a shared busy flag before their request and lowered it afterwards, but nothing caught a rejection — so a server error or a dropped connection aborted the handler before the flag came back down, and all three buttons stayed disabled with no way to retry short of reloading. The three now share one runner that always clears the flag, and the panel refreshes afterwards whether or not the request succeeded, because a scheduling run can write some blocks before it fails and leaving that half-written state off screen is the more confusing outcome. The failure itself still surfaces exactly once, from the shared request helper, rather than picking up a second toast of its own.
- **[issue-3525] Tapping "edit bucket" on a phone in Bookmarks often deleted the bucket instead.** The edit and delete icons in a bucket's header were 13px glyphs with 4px of padding — roughly 17px of tappable area each, sitting right next to each other — so on a narrow screen a thumb aimed at edit landed on delete and opened its confirmation instead. Both now use the standard 44px minimum tap target with the icon centered inside it, which is what the rest of PortOS uses for icon-only buttons, and the header's own vertical padding drops to compensate so the taller buttons don't inflate the card. The bucket's "add a URL" submit button had the same problem and gets the same treatment.
+- **[issue-3526] Opening the Daily Log on a phone showed you a wall of buttons and no writing area.** The editor toolbar packed eleven controls into one wrapping row, which on a 375px screen stacked into four-plus lines of header and pushed the text area itself off the bottom of the screen — so the one thing the page exists for was below the fold before you had typed anything. The toolbar is now two compact rows on a phone: day navigation on the first, the date and save status alongside the controls you actually use while writing — dictate and save — on the second. Draft, Read back and Delete move into an overflow menu rather than being hidden, so every action is still one tap away; the menu opens with the keyboard, closes on Escape or an outside click, and its items and trigger meet the 44px tap-target minimum, as do the toolbar buttons beside them. From a tablet up the toolbar is unchanged: one row with every button labeled.
- **[issue-3529] Syncing two machines wiped your Digital Twin's evaluation history down to a single run.** Every persona test, values-alignment run, adversarial-boundary run and multi-turn run is recorded with a `runId`, but the peer merge was unioning those four histories on an `id` field none of them has. Every entry therefore resolved to the same empty key: the local runs overwrote each other until one was left, and every run arriving from the other machine was then discarded as a duplicate of it. Both machines lost their history on the first sync, permanently. The merge now keys on `runId`, so runs recorded on either machine survive and a run both machines already have is not duplicated. The union helper underneath no longer collapses records at all when the field it was pointed at is missing — records with no usable key are matched on their content instead, so the next time a key field is named wrong the result is a harmless duplicate rather than silent destruction, and re-syncing the same records adds nothing. Merged histories are also re-sorted newest-first, because the recorders keep only the fifty most recent runs and take them off the front: a peer's runs appended to the end would have read as the oldest, and the next local run would have trimmed away the newest entries instead of the oldest.
- **[issue-3518] A failed goal check-in silently expanded the check-ins list onto nothing.** "Run Check-In" raised its busy flag, fired the request, and then unconditionally opened the check-ins accordion and refreshed the panel — whether or not the server had actually produced a check-in. So a failed run ended with the list flipping open on the same entries it already had, which reads as "the check-in ran and produced nothing" rather than "the request failed." The panel now only opens when the server returns the new check-in, and the pointless refresh is gone with it; the failure surfaces exactly once, from the shared request helper, rather than picking up a second toast of its own. Clearing the busy flag also moved into a `finally`, so a call that throws before returning a promise can no longer latch the button on "Checking in..." until a page reload.
diff --git a/client/src/components/brain/tabs/DailyLogTab.jsx b/client/src/components/brain/tabs/DailyLogTab.jsx
index d83348f71a..99e62d04aa 100644
--- a/client/src/components/brain/tabs/DailyLogTab.jsx
+++ b/client/src/components/brain/tabs/DailyLogTab.jsx
@@ -6,6 +6,7 @@ import { getNotesVaults } from '../../../services/apiNotes';
import toast from '../../ui/Toast';
import InlineConfirmRow from '../../ui/InlineConfirmRow';
import { FormField } from '../../ui/FormField';
+import OverflowMenu from '../../ui/OverflowMenu';
import { onVoiceEvent, sendText, setDictation as setVoiceDictation } from '../../../services/voiceClient';
import BrailleSpinner from '../../BrailleSpinner';
import useMounted from '../../../hooks/useMounted';
@@ -519,6 +520,20 @@ export default function DailyLogTab() {
} catch { return date; }
}, [date]);
+ // AI policy: the surface that can trigger LLM work names the provider, so the
+ // overflow menu item and the sm+ button share one title string.
+ const draftTitle = digestProvider
+ ? `Draft an activity-digest section for this day using ${digestProvider.name || digestProvider.id}`
+ : 'Draft an activity-digest section for this day (structured summary — no AI provider)';
+
+ // Under `sm` these three drop out of the toolbar row and live here instead —
+ // still reachable, just not costing a wrapped row each (#3526).
+ const mobileToolbarActions = [
+ { id: 'draft', label: drafting ? 'Drafting…' : 'Draft activity digest', icon: Sparkles, disabled: drafting, onSelect: handleDraft },
+ { id: 'read-back', label: 'Read back', icon: Volume2, onSelect: readBack },
+ { id: 'delete', label: 'Delete entry', icon: Trash2, tone: 'danger', disabled: !entry, onSelect: () => setConfirmDelete(true) },
+ ];
+
return (
<div className="flex h-full min-h-0 relative">
{/* Left: history + settings. Drawer on mobile, persistent column on md+. */}
@@ -654,7 +669,7 @@ export default function DailyLogTab() {
</FormField>
<p className="text-[10px] text-gray-600">
{digestProvider
- ? `Scheduled drafts will call ${digestProvider.name || digestProvider.id}. Use the Draft button in the toolbar to run it now.`
+ ? `Scheduled drafts will call ${digestProvider.name || digestProvider.id}. Use the Draft action in the toolbar to run it now.`
: 'No AI provider selected — drafts are a deterministic structured summary with zero AI calls.'}
</p>
</div>
@@ -691,103 +706,119 @@ export default function DailyLogTab() {
{/* Right: editor */}
<div className="flex-1 flex flex-col min-w-0 min-h-0">
- <div className="flex flex-wrap items-center gap-2 px-3 sm:px-4 py-2 sm:py-3 border-b border-port-border">
- <button
- onClick={() => setHistoryOpen(true)}
- className="md:hidden min-h-[40px] min-w-[40px] flex items-center justify-center rounded hover:bg-port-card text-gray-400 hover:text-white"
- title="Show history"
- aria-label="Show history"
- >
- <Menu size={16} />
- </button>
- <button
- onClick={() => setDate(shiftDate(date, -1))}
- className="min-h-[40px] min-w-[40px] flex items-center justify-center rounded hover:bg-port-card text-gray-400 hover:text-white"
- title="Previous day" aria-label="Previous day"
- >
- <ChevronLeft size={16} />
- </button>
- <input
- type="date"
- value={date}
- onChange={(e) => setDate(e.target.value || serverToday)}
- className="bg-port-bg border border-port-border rounded px-2 min-h-[40px] text-sm text-white"
- />
- <button
- onClick={() => setDate(shiftDate(date, 1))}
- disabled={date >= serverToday}
- className="min-h-[40px] min-w-[40px] flex items-center justify-center rounded hover:bg-port-card text-gray-400 hover:text-white disabled:opacity-30"
- title="Next day" aria-label="Next day"
- >
- <ChevronRight size={16} />
- </button>
- {!isToday && (
+ {/* Two stacked clusters under `sm` (date nav, then label + actions), one
+ wrapping row from `sm` up. The old flat `flex-wrap` toolbar spilled
+ its 11 controls into 4+ rows on a 375px viewport and pushed the
+ textarea below the fold (#3526), so on phones the rarely-used
+ actions move into the overflow menu instead of taking a row each. */}
+ <div className="flex flex-col sm:flex-row sm:flex-wrap sm:items-center gap-2 px-3 sm:px-4 py-2 sm:py-3 border-b border-port-border">
+ <div className="flex items-center gap-1.5 sm:gap-2 shrink-0">
<button
- onClick={() => setDate(serverToday)}
- className="px-3 min-h-[40px] rounded bg-port-card text-xs text-gray-300 hover:text-white"
+ onClick={() => setHistoryOpen(true)}
+ className="md:hidden min-h-[44px] min-w-[44px] sm:min-h-[40px] sm:min-w-[40px] flex items-center justify-center rounded hover:bg-port-card text-gray-400 hover:text-white"
+ title="Show history"
+ aria-label="Show history"
>
- Today
+ <Menu size={16} />
</button>
- )}
- <div className="basis-full md:basis-auto md:flex-1 md:min-w-0">
- <div className="text-white font-medium truncate text-sm md:text-base">{dateLabel}</div>
- <div className="text-xs text-gray-500 truncate">
- {segmentCount} segment{segmentCount === 1 ? '' : 's'}
- {entry?.obsidianPath ? ` · ${entry.obsidianPath}` : ''}
- {saveStatus ? <span className={parked ? 'text-port-warning' : ''}> · {saveStatus}</span> : null}
+ <button
+ onClick={() => setDate(shiftDate(date, -1))}
+ className="min-h-[44px] min-w-[44px] sm:min-h-[40px] sm:min-w-[40px] flex items-center justify-center rounded hover:bg-port-card text-gray-400 hover:text-white"
+ title="Previous day" aria-label="Previous day"
+ >
+ <ChevronLeft size={16} />
+ </button>
+ <input
+ type="date"
+ value={date}
+ onChange={(e) => setDate(e.target.value || serverToday)}
+ aria-label="Log date"
+ className="min-w-0 bg-port-bg border border-port-border rounded px-2 min-h-[44px] sm:min-h-[40px] text-sm text-white"
+ />
+ <button
+ onClick={() => setDate(shiftDate(date, 1))}
+ disabled={date >= serverToday}
+ className="min-h-[44px] min-w-[44px] sm:min-h-[40px] sm:min-w-[40px] flex items-center justify-center rounded hover:bg-port-card text-gray-400 hover:text-white disabled:opacity-30"
+ title="Next day" aria-label="Next day"
+ >
+ <ChevronRight size={16} />
+ </button>
+ {!isToday && (
+ <button
+ onClick={() => setDate(serverToday)}
+ className="px-3 min-h-[44px] sm:min-h-[40px] rounded bg-port-card text-xs text-gray-300 hover:text-white"
+ >
+ Today
+ </button>
+ )}
+ </div>
+ {/* `sm:flex-1` so on sm+ the date label absorbs the slack and the
+ action buttons stay right-aligned, as the flat toolbar rendered
+ them; under sm this cluster is simply the second stacked row. */}
+ <div className="flex items-center gap-1.5 sm:gap-2 sm:flex-1 min-w-0">
+ <div className="flex-1 min-w-0">
+ <div className="text-white font-medium truncate text-sm md:text-base">{dateLabel}</div>
+ <div className="text-xs text-gray-500 truncate">
+ {segmentCount} segment{segmentCount === 1 ? '' : 's'}
+ {entry?.obsidianPath ? ` · ${entry.obsidianPath}` : ''}
+ {saveStatus ? <span className={parked ? 'text-port-warning' : ''}> · {saveStatus}</span> : null}
+ </div>
</div>
+ <button
+ onClick={handleDraft}
+ disabled={drafting}
+ className="hidden sm:flex items-center gap-1 px-3 min-h-[40px] rounded bg-port-card text-gray-300 text-sm hover:text-white disabled:opacity-50"
+ title={draftTitle}
+ aria-label="Draft activity digest"
+ >
+ <Sparkles size={14} className={drafting ? 'animate-pulse' : ''} />
+ <span>{drafting ? 'Drafting…' : 'Draft'}</span>
+ </button>
+ <button
+ onClick={readBack}
+ className="hidden sm:flex items-center gap-1 px-3 min-h-[40px] rounded bg-port-card text-gray-300 text-sm hover:text-white"
+ title="Have the voice agent read this log back to you"
+ aria-label="Read back"
+ >
+ <Volume2 size={14} /> <span>Read back</span>
+ </button>
+ <button
+ onClick={toggleDictation}
+ className={`flex items-center gap-1 px-3 min-h-[44px] min-w-[44px] sm:min-h-[40px] sm:min-w-0 justify-center rounded text-sm ${
+ dictation
+ ? 'bg-port-accent text-white animate-pulse'
+ : 'bg-port-card text-gray-300 hover:text-white'
+ }`}
+ title={dictation ? 'Stop voice dictation' : 'Start voice dictation (voice goes straight into this log)'}
+ aria-label={dictation ? 'Stop dictation' : 'Start dictation'}
+ >
+ {dictation ? <MicOff size={14} /> : <Mic size={14} />}
+ <span className="hidden sm:inline">{dictation ? 'Dictating' : 'Dictate'}</span>
+ </button>
+ <button
+ onClick={handleSave}
+ disabled={saving || !dirty}
+ className="flex items-center gap-1 px-3 min-h-[44px] min-w-[44px] sm:min-h-[40px] sm:min-w-0 justify-center rounded bg-port-accent text-white text-sm hover:bg-port-accent/80 disabled:opacity-50"
+ aria-label="Save"
+ >
+ <Save size={14} />
+ <span className="hidden sm:inline">{saving ? 'Saving…' : 'Save'}</span>
+ </button>
+ <button
+ onClick={() => setConfirmDelete(true)}
+ disabled={!entry}
+ className="hidden sm:flex min-h-[40px] min-w-[40px] items-center justify-center rounded hover:bg-port-card text-gray-400 hover:text-port-error disabled:opacity-30"
+ title="Delete this entry"
+ aria-label="Delete entry"
+ >
+ <Trash2 size={14} />
+ </button>
+ <OverflowMenu
+ className="sm:hidden shrink-0"
+ label="More log actions"
+ items={mobileToolbarActions}
+ />
</div>
- <button
- onClick={handleDraft}
- disabled={drafting}
- className="flex items-center gap-1 px-3 min-h-[40px] rounded bg-port-card text-gray-300 text-sm hover:text-white disabled:opacity-50"
- title={digestProvider
- ? `Draft an activity-digest section for this day using ${digestProvider.name || digestProvider.id}`
- : 'Draft an activity-digest section for this day (structured summary — no AI provider)'}
- aria-label="Draft activity digest"
- >
- <Sparkles size={14} className={drafting ? 'animate-pulse' : ''} />
- <span className="hidden sm:inline">{drafting ? 'Drafting…' : 'Draft'}</span>
- </button>
- <button
- onClick={readBack}
- className="flex items-center gap-1 px-3 min-h-[40px] rounded bg-port-card text-gray-300 text-sm hover:text-white"
- title="Have the voice agent read this log back to you"
- aria-label="Read back"
- >
- <Volume2 size={14} /> <span className="hidden sm:inline">Read back</span>
- </button>
- <button
- onClick={toggleDictation}
- className={`flex items-center gap-1 px-3 min-h-[40px] rounded text-sm ${
- dictation
- ? 'bg-port-accent text-white animate-pulse'
- : 'bg-port-card text-gray-300 hover:text-white'
- }`}
- title={dictation ? 'Stop voice dictation' : 'Start voice dictation (voice goes straight into this log)'}
- aria-label={dictation ? 'Stop dictation' : 'Start dictation'}
- >
- {dictation ? <MicOff size={14} /> : <Mic size={14} />}
- <span className="hidden sm:inline">{dictation ? 'Dictating' : 'Dictate'}</span>
- </button>
- <button
- onClick={handleSave}
- disabled={saving || !dirty}
- className="flex items-center gap-1 px-3 min-h-[40px] rounded bg-port-accent text-white text-sm hover:bg-port-accent/80 disabled:opacity-50"
- aria-label="Save"
- >
- <Save size={14} />
- <span className="hidden sm:inline">{saving ? 'Saving…' : 'Save'}</span>
- </button>
- <button
- onClick={() => setConfirmDelete(true)}
- disabled={!entry}
- className="min-h-[40px] min-w-[40px] flex items-center justify-center rounded hover:bg-port-card text-gray-400 hover:text-port-error disabled:opacity-30"
- title="Delete this entry"
- aria-label="Delete entry"
- >
- <Trash2 size={14} />
- </button>
</div>
{dictation && (
diff --git a/client/src/components/brain/tabs/DailyLogTab.test.jsx b/client/src/components/brain/tabs/DailyLogTab.test.jsx
index b33baac5cd..2cd35d9f8c 100644
--- a/client/src/components/brain/tabs/DailyLogTab.test.jsx
+++ b/client/src/components/brain/tabs/DailyLogTab.test.jsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
-import { render, screen, fireEvent, act } from '@testing-library/react';
+import { render, screen, fireEvent, act, within } from '@testing-library/react';
import { __resetVisibilityEventForTests } from '../../../hooks/useVisibilityEvent';
// ── Mock toast ────────────────────────────────────────────────────────────────
@@ -397,3 +397,85 @@ describe('DailyLogTab autosave', () => {
expect(screen.getByText(/· Saved/)).toBeInTheDocument();
});
});
+
+// The toolbar used to be one flat `flex-wrap` row of 11 controls, which spilled
+// into 4+ stacked rows on a 375px viewport and pushed the textarea below the
+// fold (#3526). jsdom has no layout engine, so these assert the structure that
+// produces the two-row mobile toolbar rather than measured pixel heights.
+describe('DailyLogTab mobile toolbar', () => {
+ const toolbar = () => screen.getByLabelText('Save').closest('div.border-b');
+ const openOverflow = () => {
+ fireEvent.click(screen.getByRole('button', { name: 'More log actions' }));
+ return screen.getByRole('menu', { name: 'More log actions' });
+ };
+
+ it('stacks into exactly two clusters under sm — date nav, then label + actions', async () => {
+ await renderTab();
+ const header = toolbar();
+
+ // `flex-col` under sm keeps the clusters as two rows no matter how many
+ // controls each holds; from sm up it collapses back to one wrapping row.
+ expect(header.className).toContain('flex-col');
+ expect(header.className).toContain('sm:flex-row');
+ expect(header.children).toHaveLength(2);
+ });
+
+ it('demotes Draft / Read back / Delete out of the mobile row but keeps them on sm+', async () => {
+ await renderTab();
+
+ for (const label of ['Draft activity digest', 'Read back', 'Delete entry']) {
+ expect(screen.getByLabelText(label).className).toContain('hidden sm:flex');
+ }
+ // Primary controls stay on the mobile row.
+ for (const label of ['Save', 'Start dictation', 'Previous day', 'Next day']) {
+ expect(screen.getByLabelText(label).className).not.toContain('hidden');
+ }
+ // ...and the overflow trigger is the mobile-only counterpart.
+ expect(screen.getByRole('button', { name: 'More log actions' }).parentElement.className)
+ .toContain('sm:hidden');
+ });
+
+ it('keeps every demoted action reachable from the overflow menu', async () => {
+ await renderTab();
+ const menu = openOverflow();
+
+ for (const name of ['Draft activity digest', 'Read back', 'Delete entry']) {
+ expect(within(menu).getByRole('menuitem', { name })).toBeTruthy();
+ }
+ });
+
+ it('runs Read back from the overflow menu and closes it', async () => {
+ await renderTab();
+ const menu = openOverflow();
+
+ fireEvent.click(within(menu).getByRole('menuitem', { name: 'Read back' }));
+ expect(voice.sendText).toHaveBeenCalledWith(expect.stringContaining('existing'));
+ expect(screen.queryByRole('menu')).toBeNull();
+ });
+
+ it('runs Draft from the overflow menu', async () => {
+ api.draftActivityDigest.mockResolvedValue({ entry: entryFor(TODAY, 'drafted'), drafted: true });
+ await renderTab();
+ const menu = openOverflow();
+
+ fireEvent.click(within(menu).getByRole('menuitem', { name: 'Draft activity digest' }));
+ await act(async () => { await vi.advanceTimersByTimeAsync(0); });
+ expect(api.draftActivityDigest).toHaveBeenCalledWith(TODAY, { silent: true });
+ });
+
+ it('opens the inline delete confirm from the overflow menu', async () => {
+ await renderTab();
+ const menu = openOverflow();
+
+ fireEvent.click(within(menu).getByRole('menuitem', { name: 'Delete entry' }));
+ expect(screen.getByText(new RegExp(`Delete the entry for ${TODAY}`))).toBeInTheDocument();
+ });
+
+ it('closes the overflow menu on Escape', async () => {
+ await renderTab();
+ openOverflow();
+
+ fireEvent.keyDown(window, { key: 'Escape' });
+ expect(screen.queryByRole('menu')).toBeNull();
+ });
+});
diff --git a/client/src/components/ui/OverflowMenu.jsx b/client/src/components/ui/OverflowMenu.jsx
index 76f877e1ef..db6030a385 100644
--- a/client/src/components/ui/OverflowMenu.jsx
+++ b/client/src/components/ui/OverflowMenu.jsx
@@ -7,7 +7,8 @@ import useEscapeKey from '../../hooks/useEscapeKey';
// always-visible control set, so the row keeps a single primary affordance.
// Keyboard: ArrowDown from the trigger opens and focuses the first item,
// ArrowUp/ArrowDown cycle, Escape closes and returns focus to the trigger.
-// Items are >=40px tall so they stay tappable on a phone.
+// Trigger and items are >=44px on phones (the repo's touch-target floor) and
+// relax to the denser desktop sizing from `sm` up.
//
// Tones pre-compose full Tailwind class names — the JIT scans for complete
// tokens, so `text-port-${tone}` would NOT generate the utility.
@@ -93,7 +94,7 @@ export default function OverflowMenu({ label, items = [], className = '', trigge
aria-expanded={open}
aria-label={label}
title={label}
- className="px-2 py-1.5 min-h-[40px] sm:min-h-0 inline-flex items-center rounded-lg border border-port-border text-gray-400 hover:text-white hover:bg-port-border transition-colors focus:outline-hidden focus:ring-2 focus:ring-port-accent"
+ className="px-2 py-1.5 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 inline-flex items-center justify-center rounded-lg border border-port-border text-gray-400 hover:text-white hover:bg-port-border transition-colors focus:outline-hidden focus:ring-2 focus:ring-port-accent"
>
<MoreHorizontal size={16} aria-hidden="true" />
</button>
@@ -115,7 +116,7 @@ export default function OverflowMenu({ label, items = [], className = '', trigge
// follow-up UI (an inline confirm) owns moving focus onward from
// there — its mount effect runs after this commit and wins.
onClick={() => { close(true); item.onSelect?.(); }}
- className={`w-full px-3 py-2 min-h-[40px] text-left text-xs flex items-center gap-2 transition-colors disabled:opacity-50 focus:outline-hidden focus:bg-port-border/70 ${TONES[item.tone] || TONES.default}`}
+ className={`w-full px-3 py-2 min-h-[44px] sm:min-h-[40px] text-left text-xs flex items-center gap-2 transition-colors disabled:opacity-50 focus:outline-hidden focus:bg-port-border/70 ${TONES[item.tone] || TONES.default}`}
>
{item.icon ? <item.icon size={14} aria-hidden="true" /> : null}
<span>{item.label}</span>