Komalpreet Kaur commited on
Commit
44bc537
·
unverified ·
1 Parent(s): 8f56afb

fix: mobile responsiveness improvements for graph and sleep pages

Browse files
frontend/src/App.css CHANGED
@@ -610,8 +610,9 @@
610
 
611
  .cognitive-container[style] {
612
  flex: none !important;
613
- height: 320px !important;
614
  min-height: auto !important;
 
615
  }
616
 
617
  .activity-feed-wrapper[style] {
 
610
 
611
  .cognitive-container[style] {
612
  flex: none !important;
613
+ height: auto !important;
614
  min-height: auto !important;
615
+ padding: 20px 0 !important;
616
  }
617
 
618
  .activity-feed-wrapper[style] {
frontend/src/components/CognitiveBrainScene.css CHANGED
@@ -205,6 +205,14 @@
205
  to { opacity: 0.3; transform: scale(1.05); }
206
  }
207
 
 
 
 
 
 
 
 
 
208
  /* ── Mobile Responsive Overrides for iPhone 14 ── */
209
  @media (max-width: 480px) {
210
  .brain-core {
 
205
  to { opacity: 0.3; transform: scale(1.05); }
206
  }
207
 
208
+ @media (max-width: 768px) {
209
+ .brain-core {
210
+ max-width: 100% !important;
211
+ height: auto !important;
212
+ aspect-ratio: 1 / 1 !important;
213
+ }
214
+ }
215
+
216
  /* ── Mobile Responsive Overrides for iPhone 14 ── */
217
  @media (max-width: 480px) {
218
  .brain-core {
frontend/src/components/DreamSequence.css CHANGED
@@ -25,7 +25,7 @@
25
  font-family: var(--font-display), 'Inter', sans-serif;
26
  font-size: 1.2rem; /* Exact page header font-size as Console */
27
  font-weight: 700;
28
- color: #1a1a1a;
29
  margin: 0;
30
  letter-spacing: -0.01em;
31
  }
@@ -79,7 +79,7 @@
79
  font-family: var(--font-display), 'Inter', sans-serif;
80
  font-size: 1.15rem; /* Exact block header font-size as Console */
81
  font-weight: 700;
82
- color: #1a1a1a;
83
  margin: 0 0 8px 0;
84
  letter-spacing: -0.01em;
85
  }
@@ -517,10 +517,12 @@
517
  /* ── Mobile Responsive Overrides ── */
518
  @media (max-width: 1024px) {
519
  .sleep-page-container {
520
- padding: 20px 16px !important;
521
  min-height: auto !important;
522
  height: auto !important;
523
  border-radius: 20px !important;
 
 
524
  }
525
 
526
  .sleep-page-header,
@@ -529,7 +531,7 @@
529
  top: auto !important;
530
  left: auto !important;
531
  margin-bottom: 24px !important;
532
- text-align: center !important;
533
  width: 100% !important;
534
  }
535
 
@@ -575,6 +577,7 @@
575
  gap: 16px !important;
576
  margin-top: 32px !important;
577
  width: 100% !important;
 
578
  }
579
 
580
  .sleep-telemetry-card {
@@ -591,4 +594,11 @@
591
  max-width: 100% !important;
592
  width: 100% !important;
593
  }
 
 
 
 
 
 
 
594
  }
 
25
  font-family: var(--font-display), 'Inter', sans-serif;
26
  font-size: 1.2rem; /* Exact page header font-size as Console */
27
  font-weight: 700;
28
+ color: var(--text-main, #1a1a1a);
29
  margin: 0;
30
  letter-spacing: -0.01em;
31
  }
 
79
  font-family: var(--font-display), 'Inter', sans-serif;
80
  font-size: 1.15rem; /* Exact block header font-size as Console */
81
  font-weight: 700;
82
+ color: var(--text-main, #1a1a1a);
83
  margin: 0 0 8px 0;
84
  letter-spacing: -0.01em;
85
  }
 
517
  /* ── Mobile Responsive Overrides ── */
518
  @media (max-width: 1024px) {
519
  .sleep-page-container {
520
+ padding: 20px 16px 16px 16px !important;
521
  min-height: auto !important;
522
  height: auto !important;
523
  border-radius: 20px !important;
524
+ justify-content: flex-start !important;
525
+ overflow-y: auto !important;
526
  }
527
 
528
  .sleep-page-header,
 
531
  top: auto !important;
532
  left: auto !important;
533
  margin-bottom: 24px !important;
534
+ text-align: left !important;
535
  width: 100% !important;
536
  }
537
 
 
577
  gap: 16px !important;
578
  margin-top: 32px !important;
579
  width: 100% !important;
580
+ margin-bottom: 16px !important;
581
  }
582
 
583
  .sleep-telemetry-card {
 
594
  max-width: 100% !important;
595
  width: 100% !important;
596
  }
597
+
598
+ .sleep-trigger-btn {
599
+ margin: 0 auto !important;
600
+ display: flex !important;
601
+ justify-content: center !important;
602
+ align-items: center !important;
603
+ }
604
  }
frontend/src/components/DreamSequence.jsx CHANGED
@@ -12,7 +12,7 @@ export function SleepProgress({ phaseIndex, isConsolidating, onStart, summary, v
12
  return (
13
  <div className="sleep-page-container fade-in">
14
  <div className="sleep-page-header">
15
- <h2>7. Sleep (Consolidation)</h2>
16
  </div>
17
 
18
  <div className="sleep-split-layout">
 
12
  return (
13
  <div className="sleep-page-container fade-in">
14
  <div className="sleep-page-header">
15
+ <h2>Sleep (Consolidation)</h2>
16
  </div>
17
 
18
  <div className="sleep-split-layout">
frontend/src/components/KnowledgeGraph.css CHANGED
@@ -393,6 +393,8 @@
393
  @media (max-width: 1024px) {
394
  .graph-stage {
395
  padding: 0 0 16px 0 !important;
 
 
396
  }
397
 
398
  .graph-toolbar {
@@ -402,16 +404,27 @@
402
  }
403
 
404
  .graph-actions {
405
- width: 100% !important;
406
- justify-content: flex-start !important;
407
- flex-wrap: wrap !important;
 
 
 
 
 
 
 
 
 
 
 
408
  }
409
 
410
  .graph-network-container {
411
  padding-left: 0 !important; /* Remove shifted padding */
412
  border-radius: 16px !important;
413
- height: 460px !important;
414
- min-height: 460px !important;
415
  width: 100% !important;
416
  flex: none !important;
417
  }
@@ -420,15 +433,17 @@
420
  position: relative !important;
421
  top: auto !important;
422
  left: auto !important;
423
- padding: 16px !important;
 
424
  display: grid !important;
425
  grid-template-columns: 1fr 1fr !important;
426
- gap: 16px !important;
427
  }
428
 
429
  .hud-panel {
430
  width: 100% !important;
431
  box-sizing: border-box !important;
 
432
  }
433
 
434
  /* On very small screens stack the HUD panels */
 
393
  @media (max-width: 1024px) {
394
  .graph-stage {
395
  padding: 0 0 16px 0 !important;
396
+ height: auto !important;
397
+ overflow: visible !important;
398
  }
399
 
400
  .graph-toolbar {
 
404
  }
405
 
406
  .graph-actions {
407
+ position: absolute !important;
408
+ bottom: 20px !important;
409
+ left: 50% !important;
410
+ transform: translateX(-50%) !important;
411
+ z-index: 100 !important;
412
+ display: flex !important;
413
+ justify-content: center !important;
414
+ background: rgba(18, 18, 18, 0.75) !important;
415
+ backdrop-filter: blur(20px) !important;
416
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
417
+ border-radius: 100px !important;
418
+ padding: 6px 12px !important;
419
+ box-shadow: 0 10px 30px rgba(0,0,0,0.05) !important;
420
+ width: auto !important;
421
  }
422
 
423
  .graph-network-container {
424
  padding-left: 0 !important; /* Remove shifted padding */
425
  border-radius: 16px !important;
426
+ height: 600px !important;
427
+ min-height: 600px !important;
428
  width: 100% !important;
429
  flex: none !important;
430
  }
 
433
  position: relative !important;
434
  top: auto !important;
435
  left: auto !important;
436
+ right: auto !important;
437
+ padding: 8px !important;
438
  display: grid !important;
439
  grid-template-columns: 1fr 1fr !important;
440
+ gap: 8px !important;
441
  }
442
 
443
  .hud-panel {
444
  width: 100% !important;
445
  box-sizing: border-box !important;
446
+ padding: 12px !important;
447
  }
448
 
449
  /* On very small screens stack the HUD panels */
frontend/src/components/KnowledgeGraph.jsx CHANGED
@@ -43,6 +43,7 @@ function KnowledgeGraph({ refreshTick }) {
43
  const [dimensions, setDimensions] = useState({ width: 800, height: 500 });
44
  const [stats, setStats] = useState({ node_count: 0, edge_count: 0, top_entities: [] });
45
  const [physicsActive, setPhysicsActive] = useState(true);
 
46
 
47
  const containerRef = useRef(null);
48
  const fgRef = useRef();
@@ -53,7 +54,9 @@ function KnowledgeGraph({ refreshTick }) {
53
  const resizeObserver = new ResizeObserver((entries) => {
54
  for (let entry of entries) {
55
  const { width, height } = entry.contentRect;
56
- setDimensions({ width: width || 800, height: height || 500 });
 
 
57
  }
58
  });
59
  resizeObserver.observe(containerRef.current);
@@ -129,13 +132,35 @@ function KnowledgeGraph({ refreshTick }) {
129
  if (fgRef.current) {
130
  const d3Force = fgRef.current.d3Force;
131
  if (d3Force) {
132
- d3Force('charge').strength(-50); // Gentle repulsion for an ultra-compact molecular look
133
- d3Force('link').distance(30); // Extremely tight connection paths to pull nodes together
 
 
 
 
 
 
 
 
 
134
  }
135
 
136
- // Auto-fit camera with very tight padding to zoom in close and eliminate empty workspace
137
  setTimeout(() => {
138
- fgRef.current.zoomToFit(800, 20);
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }, 600);
140
  }
141
  }, [graphData]);
@@ -265,25 +290,34 @@ function KnowledgeGraph({ refreshTick }) {
265
  {/* Live Telemetry HUD Overlay */}
266
  <div className="graph-hud-overlay">
267
  <div className="hud-panel">
268
- <div className="hud-header">
269
- <span className="material-icons">analytics</span>
270
- <span>Semantic Telemetry</span>
271
- </div>
272
- <div className="hud-row">
273
- <span className="hud-label">Nodes:</span>
274
- <span className="hud-value">{dbStatus === 'online' ? stats.node_count : graphData.nodes.length}</span>
275
- </div>
276
- <div className="hud-row">
277
- <span className="hud-label">Synapses:</span>
278
- <span className="hud-value">{dbStatus === 'online' ? stats.edge_count : graphData.links.length}</span>
279
- </div>
280
- <div className="hud-row">
281
- <span className="hud-label">Storage:</span>
282
- <span className="hud-value status-glow">{dbStatus === 'online' ? 'LTM (Neo4j)' : 'STM (Cache)'}</span>
283
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  </div>
285
 
286
- {dbStatus === 'online' && stats.top_entities && stats.top_entities.length > 0 && (
287
  <div className="hud-panel top-entities">
288
  <div className="hud-header">
289
  <span className="material-icons">star</span>
 
43
  const [dimensions, setDimensions] = useState({ width: 800, height: 500 });
44
  const [stats, setStats] = useState({ node_count: 0, edge_count: 0, top_entities: [] });
45
  const [physicsActive, setPhysicsActive] = useState(true);
46
+ const [hudCollapsed, setHudCollapsed] = useState(false);
47
 
48
  const containerRef = useRef(null);
49
  const fgRef = useRef();
 
54
  const resizeObserver = new ResizeObserver((entries) => {
55
  for (let entry of entries) {
56
  const { width, height } = entry.contentRect;
57
+ const isMobile = window.innerWidth < 768;
58
+ const adjustedHeight = isMobile ? Math.max(height - 100, 300) : height;
59
+ setDimensions({ width: width || 800, height: adjustedHeight || 500 });
60
  }
61
  });
62
  resizeObserver.observe(containerRef.current);
 
132
  if (fgRef.current) {
133
  const d3Force = fgRef.current.d3Force;
134
  if (d3Force) {
135
+ d3Force('charge').strength(-20).distanceMax(100);
136
+ d3Force('link').distance(30);
137
+
138
+ // Custom gravity force to pull unconnected clusters to the upper center
139
+ d3Force('gravity', (alpha) => {
140
+ graphData.nodes.forEach(node => {
141
+ node.vx = (node.vx || 0) + (0 - node.x) * 0.05 * alpha;
142
+ node.vy = (node.vy || 0) + (150 - node.y) * 0.05 * alpha; // Pull up to Y=150
143
+ node.vz = (node.vz || 0) + (0 - node.z) * 0.05 * alpha;
144
+ });
145
+ });
146
  }
147
 
148
+ // Auto-fit camera with appropriate padding to ensure complete visibility
149
  setTimeout(() => {
150
+ const padding = window.innerWidth < 768 ? 120 : 20;
151
+ fgRef.current.zoomToFit(800, padding);
152
+
153
+ // Shift camera down on mobile to pull the graph content up
154
+ if (window.innerWidth < 768) {
155
+ setTimeout(() => {
156
+ const currentPos = fgRef.current.cameraPosition();
157
+ fgRef.current.cameraPosition(
158
+ { x: currentPos.x, y: currentPos.y - 100, z: currentPos.z },
159
+ null,
160
+ 300
161
+ );
162
+ }, 900); // Wait for zoomToFit to complete
163
+ }
164
  }, 600);
165
  }
166
  }, [graphData]);
 
290
  {/* Live Telemetry HUD Overlay */}
291
  <div className="graph-hud-overlay">
292
  <div className="hud-panel">
293
+ <div className="hud-header" style={{display: 'flex', justifyContent: 'space-between', width: '100%', alignItems: 'center'}}>
294
+ <div style={{display: 'flex', alignItems: 'center', gap: '8px'}}>
295
+ <span className="material-icons">analytics</span>
296
+ <span>Semantic Telemetry</span>
297
+ </div>
298
+ <span className="material-icons" style={{cursor: 'pointer', fontSize: '20px', color: '#ff6b35'}} onClick={() => setHudCollapsed(!hudCollapsed)}>
299
+ {hudCollapsed ? 'expand_more' : 'expand_less'}
300
+ </span>
 
 
 
 
 
 
 
301
  </div>
302
+ {!hudCollapsed && (
303
+ <>
304
+ <div className="hud-row">
305
+ <span className="hud-label">Nodes:</span>
306
+ <span className="hud-value">{dbStatus === 'online' ? stats.node_count : graphData.nodes.length}</span>
307
+ </div>
308
+ <div className="hud-row">
309
+ <span className="hud-label">Synapses:</span>
310
+ <span className="hud-value">{dbStatus === 'online' ? stats.edge_count : graphData.links.length}</span>
311
+ </div>
312
+ <div className="hud-row">
313
+ <span className="hud-label">Storage:</span>
314
+ <span className="hud-value status-glow">{dbStatus === 'online' ? 'LTM (Neo4j)' : 'STM (Cache)'}</span>
315
+ </div>
316
+ </>
317
+ )}
318
  </div>
319
 
320
+ {!hudCollapsed && dbStatus === 'online' && stats.top_entities && stats.top_entities.length > 0 && (
321
  <div className="hud-panel top-entities">
322
  <div className="hud-header">
323
  <span className="material-icons">star</span>
frontend/src/components/KnowledgeInput.css CHANGED
@@ -392,6 +392,8 @@
392
 
393
  .inscription-main {
394
  padding-right: 0 !important;
 
 
395
  }
396
 
397
  .inscription-sidebar {
 
392
 
393
  .inscription-main {
394
  padding-right: 0 !important;
395
+ overflow-y: visible !important;
396
+ height: auto !important;
397
  }
398
 
399
  .inscription-sidebar {