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

address review (codex): collapse the graph legend on landscape phones too

[._.]/ Adam Eivy6ab0b596b2a1
diff --git a/client/src/components/brain/tabs/BrainGraph.jsx b/client/src/components/brain/tabs/BrainGraph.jsx
index b3bc278a3d..d96b16ebf6 100644
--- a/client/src/components/brain/tabs/BrainGraph.jsx
+++ b/client/src/components/brain/tabs/BrainGraph.jsx
@@ -556,11 +556,15 @@ export default function BrainGraph() {
</button>
)}
- {/* Legend. Ten rows blanket a phone-sized canvas, so below `sm` it
- collapses behind a toggle and expands upward from the corner (the
- type filters above already carry the same colour→label mapping; the
- edge colours are only here, so it stays reachable rather than
- hidden). Unchanged at `sm` and up. */}
+ {/* Legend. Its ~200px blankets a short canvas, so it auto-shows only on
+ a `roomy-viewport` (wide AND tall — see index.css); otherwise it
+ collapses behind a toggle and expands upward from the corner. The
+ height half of that variant is what makes a landscape phone work: it
+ is wider than `sm` but only ~390px tall, so a width-only rule
+ force-showed the legend over a floored 240px canvas AND hid the
+ toggle — blanketing the graph with no way out.
+ (The type filters above already duplicate the colour→label mapping,
+ but the edge colours are only here — hence a toggle, not a drop.) */}
{/* pointer-events-none on the WRAPPER, not just the panel: it covers a
corner of the canvas, and as a hit-testable box it would swallow the
orbit drags the panel alone used to let through (pointer-events is
@@ -569,7 +573,7 @@ export default function BrainGraph() {
<div className="absolute bottom-3 left-3 z-10 flex flex-col items-start gap-1.5 pointer-events-none">
<div
data-testid="graph-legend"
- className={`${legendOpen ? 'block' : 'hidden'} sm:block bg-port-bg/90 border border-port-border rounded-lg p-3 text-xs space-y-1.5`}
+ className={`${legendOpen ? 'block' : 'hidden'} roomy-viewport:block bg-port-bg/90 border border-port-border rounded-lg p-3 text-xs space-y-1.5`}
>
{BRAIN_TYPES.map(t => (
<div key={t} className="flex items-center gap-2">
@@ -595,7 +599,7 @@ export default function BrainGraph() {
<button
onClick={() => setLegendOpen(o => !o)}
aria-expanded={legendOpen}
- className="sm:hidden pointer-events-auto flex items-center gap-1.5 px-2.5 py-1.5 min-h-[32px] text-[11px] bg-port-bg/90 border border-port-border text-gray-400 hover:text-white rounded-lg transition-colors"
+ className="roomy-viewport:hidden pointer-events-auto flex items-center gap-1.5 px-2.5 py-1.5 min-h-[32px] text-[11px] bg-port-bg/90 border border-port-border text-gray-400 hover:text-white rounded-lg transition-colors"
>
<Info size={12} />
Legend
diff --git a/client/src/components/brain/tabs/BrainGraph.test.jsx b/client/src/components/brain/tabs/BrainGraph.test.jsx
index b117c743e2..d5500e3eb6 100644
--- a/client/src/components/brain/tabs/BrainGraph.test.jsx
+++ b/client/src/components/brain/tabs/BrainGraph.test.jsx
@@ -71,6 +71,17 @@ describe('legend disclosure', () => {
expect(screen.getByTestId('graph-legend')).not.toHaveClass('hidden');
});
+ it('gates the auto-show on viewport height as well as width', async () => {
+ await renderGraph();
+ // A landscape phone is WIDER than `sm` but only ~390px tall, so a width-only
+ // (`sm:`) gate force-showed the ~200px legend over a floored 240px canvas
+ // while hiding the toggle — un-dismissable, in the exact case this targets.
+ // `roomy-viewport` (index.css) is width AND height; a bare `sm:` regresses it.
+ expect(screen.getByTestId('graph-legend')).toHaveClass('roomy-viewport:block');
+ expect(screen.getByTestId('graph-legend')).not.toHaveClass('sm:block');
+ expect(screen.getByRole('button', { name: /legend/i })).toHaveClass('roomy-viewport:hidden');
+ });
+
it('does not swallow the canvas drags underneath it', async () => {
await renderGraph();
// The legend's wrapper covers a corner of the canvas. It must not be
diff --git a/client/src/index.css b/client/src/index.css
index b3a360c368..9952822145 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -1,5 +1,14 @@
@import "tailwindcss";
+/* Viewport is both wide AND tall enough to host a canvas overlay (a legend/key)
+ without blanketing the graph under it. Width alone is the wrong signal: a
+ landscape phone is wider than `sm` but only ~390px tall, so a `sm:`-only rule
+ force-shows the overlay over a floored canvas. Named here rather than written
+ inline as `sm:[@media(min-height:800px)]:` because Tailwind's source scanner
+ does not extract that arbitrary-variant form from JSX — it compiles when fed
+ the candidate directly but is silently absent from the build. */
+@custom-variant roomy-viewport (@media (width >= 40rem) and (min-height: 800px));
+
@theme {
--color-port-bg: rgb(var(--port-bg));
--color-port-card: rgb(var(--port-card));