Skip to content

Commit 0ec2bb7

Browse files
committed
feat: refactor sidebar functionality and improve mobile experience
1 parent 73af11c commit 0ec2bb7

2 files changed

Lines changed: 226 additions & 225 deletions

File tree

frontend/src/App.tsx

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ export default function App() {
8383
setAnalysis(null);
8484
};
8585

86-
const handleToggleSidebar = useCallback(() => {
87-
setSidebarOpen((p) => !p);
86+
const handleOpenSidebar = useCallback(() => {
87+
setSidebarOpen(true);
88+
}, []);
89+
90+
const handleCloseSidebar = useCallback(() => {
91+
setSidebarOpen(false);
8892
}, []);
8993

9094
const renderActiveView = () => {
@@ -319,12 +323,13 @@ export default function App() {
319323
})}
320324
</div>
321325

322-
{/* ── Mobile examples sidebar (left edge rail + overlay) ── */}
326+
{/* ── Mobile examples sidebar (left edge touch zone + overlay) */}
323327
<ExampleSidebar
324328
activeExampleId={activeExampleId}
325329
onSelect={handleSelectExample}
326330
open={sidebarOpen}
327-
onToggle={handleToggleSidebar}
331+
onOpen={handleOpenSidebar}
332+
onClose={handleCloseSidebar}
328333
isMobile
329334
/>
330335
</div>
@@ -345,15 +350,16 @@ export default function App() {
345350
overflow: "hidden",
346351
}}
347352
>
348-
{/* ── Left sidebar — always visible ───────────────────────── */}
353+
{/* ── Examples sidebar — collapsible icon rail on the left ── */}
349354
<ExampleSidebar
350355
activeExampleId={activeExampleId}
351356
onSelect={handleSelectExample}
352357
open={sidebarOpen}
353-
onToggle={handleToggleSidebar}
358+
onOpen={handleOpenSidebar}
359+
onClose={handleCloseSidebar}
354360
/>
355361

356-
{/* ── Main area (header + content grid) ───────────────────── */}
362+
{/* ── Main content area ────────────────────────────────────── */}
357363
<div
358364
style={{
359365
flex: 1,
@@ -363,7 +369,7 @@ export default function App() {
363369
overflow: "hidden",
364370
}}
365371
>
366-
{/* ── Header ──────────────────────────────────────────────── */}
372+
{/* ── Header ────────────────────────────────────────────── */}
367373
<div
368374
style={{
369375
gridColumn: "1/-1",
@@ -379,9 +385,7 @@ export default function App() {
379385
<span style={{ fontSize: 15, fontWeight: 800, color: COLORS.accent, display: "flex", alignItems: "center", gap: 4 }}>
380386
<IconZap size={14} /> Anatomizer
381387
</span>
382-
<span
383-
style={{ fontSize: 10, color: COLORS.textMuted, letterSpacing: 1 }}
384-
>
388+
<span style={{ fontSize: 10, color: COLORS.textMuted, letterSpacing: 1 }}>
385389
CODE EXECUTION VISUALIZER
386390
</span>
387391
</div>
@@ -439,7 +443,7 @@ export default function App() {
439443
</div>
440444
</div>
441445

442-
{/* ── Demo mode banner ────────────────────────────────────── */}
446+
{/* ── Demo mode banner ──────────────────────────────────── */}
443447
{demoMode && (
444448
<div
445449
style={{
@@ -488,7 +492,7 @@ export default function App() {
488492
</div>
489493
)}
490494

491-
{/* ── Editor + Analyze bar ────────────────────────────────── */}
495+
{/* ── Editor + Analyze bar ──────────────────────────────── */}
492496
<div
493497
style={{
494498
display: "flex",
@@ -497,7 +501,6 @@ export default function App() {
497501
overflow: "hidden",
498502
}}
499503
>
500-
{/* Code editor */}
501504
<div style={{ flex: 1, overflow: "hidden" }}>
502505
<CodeEditor
503506
code={code}
@@ -508,8 +511,6 @@ export default function App() {
508511
lang={lang}
509512
/>
510513
</div>
511-
512-
{/* Analyze action bar */}
513514
<div
514515
style={{
515516
display: "flex",
@@ -547,18 +548,11 @@ export default function App() {
547548
<><IconZap size={12} /> Analyze</>
548549
)}
549550
</button>
550-
<span
551-
style={{
552-
fontSize: 10,
553-
color: COLORS.textMuted,
554-
}}
555-
>
556-
{lang}
557-
</span>
551+
<span style={{ fontSize: 10, color: COLORS.textMuted }}>{lang}</span>
558552
</div>
559553
</div>
560554

561-
{/* ── Visualization ───────────────────────────────────────── */}
555+
{/* ── Visualization ─────────────────────────────────────── */}
562556
<div
563557
style={{
564558
display: "flex",
@@ -575,7 +569,7 @@ export default function App() {
575569
<div style={{ flex: 1, overflow: "hidden" }}>{renderActiveView()}</div>
576570
</div>
577571

578-
{/* ── AI Chat ─────────────────────────────────────────────── */}
572+
{/* ── AI Chat ───────────────────────────────────────────── */}
579573
<div style={{ background: COLORS.panel, overflow: "hidden" }}>
580574
<AIChatPanel />
581575
</div>

0 commit comments

Comments
 (0)