utkarshpathak48 commited on
Commit
6531f4e
·
2 Parent(s): 71969be2d19ca9

merge: agent4 interaction/a11y fixes

Browse files
Files changed (1) hide show
  1. static/index.html +52 -17
static/index.html CHANGED
@@ -44,7 +44,7 @@
44
  --t1: var(--tx);
45
  --t2: var(--tx2);
46
  --t3: var(--tx3);
47
- --t4: #5b667e;
48
  --muted: var(--tx3);
49
 
50
  /* ── Palette ── */
@@ -1531,7 +1531,7 @@ nav {
1531
  .state-filter-toggle {
1532
  display:inline-flex; align-items:center; gap:5px;
1533
  background:var(--glass2); border:1px solid var(--gb);
1534
- border-radius:8px; padding:4px 10px;
1535
  font-size:11px; font-weight:700; color:var(--t2); cursor:pointer;
1536
  transition:all 0.2s;
1537
  }
@@ -1586,7 +1586,7 @@ nav {
1586
 
1587
  .row-summary { display:none; }
1588
  .card.row-mode .row-summary {
1589
- display:grid; cursor:pointer;
1590
  grid-template-columns:40px 1.5fr 1.1fr .9fr .9fr .8fr .8fr .8fr 70px;
1591
  align-items:center; gap:10px;
1592
  }
@@ -1673,7 +1673,7 @@ nav {
1673
 
1674
  /* ── Touch targets — minimum 44px per WCAG 2.5.5 ── */
1675
  .chip { min-height:40px; }
1676
- .chip input, .chip select { min-height:20px; }
1677
  .bt-run-btn { min-height:36px; padding:6px 12px; }
1678
  .live-acc-resolve-btn { min-height:36px; padding:6px 10px; }
1679
  .signals-refresh-btn { width:36px !important; height:36px !important; }
@@ -1753,11 +1753,6 @@ nav {
1753
  backdrop-filter:blur(14px) saturate(160%);
1754
  -webkit-backdrop-filter:blur(14px) saturate(160%);
1755
  }
1756
- .card:hover {
1757
- transform:translateY(-2px);
1758
- border-color:var(--gb);
1759
- box-shadow:var(--shadow), inset 0 1px 0 var(--rim), 0 0 0 1px rgba(76,201,240,0.22);
1760
- }
1761
  #cycle-section { position:relative; }
1762
  #grid { position:relative; }
1763
 
@@ -2480,10 +2475,22 @@ function stopSymbolStream() { clearInterval(symStreamTimer); }
2480
  /* ═══ Loader step animator ═══ */
2481
  let stepTimer=null, elapsedTimer=null, countTimer=null, currentStep=0;
2482
  let scanStartTime=0;
 
 
 
 
 
 
 
 
 
 
 
2483
 
2484
  function startLoaderSteps() {
2485
  currentStep=0; scanStartTime=Date.now();
2486
- clearInterval(stepTimer); clearInterval(elapsedTimer); clearInterval(countTimer);
 
2487
 
2488
  // Reset all steps
2489
  for(let i=1;i<=4;i++){
@@ -2492,6 +2499,8 @@ function startLoaderSteps() {
2492
  const num=el.querySelector('.step-num'); if(num) num.textContent=i;
2493
  const t=$('st'+i); if(t) t.textContent='';
2494
  }
 
 
2495
  const sc=$('scan-count'); if(sc) sc.textContent='0';
2496
  const se=$('scan-elapsed'); if(se) se.textContent='0s';
2497
 
@@ -2499,12 +2508,18 @@ function startLoaderSteps() {
2499
  activateStep(1);
2500
  startSymbolStream();
2501
 
2502
- // Progress through steps: 1→2 at 3s, 2→3 at 7s, 3→4 at 11s
 
 
2503
  const timings=[3000,4000,4000];
2504
  let cumulative=0;
2505
  timings.forEach((delay,i)=>{
2506
  cumulative+=delay;
2507
- setTimeout(()=>{ markDone(i+1); activateStep(i+2); }, cumulative);
 
 
 
 
2508
  });
2509
 
2510
  // Elapsed counter
@@ -2513,7 +2528,8 @@ function startLoaderSteps() {
2513
  const se=$('scan-elapsed'); if(se) se.textContent=s+'s';
2514
  },500);
2515
 
2516
- // Fake count-up: 0→280 over ~12s (pace slows toward end)
 
2517
  let count=0;
2518
  countTimer=setInterval(()=>{
2519
  const target=280, elapsed=(Date.now()-scanStartTime)/1000;
@@ -2524,6 +2540,17 @@ function startLoaderSteps() {
2524
  },120);
2525
  }
2526
 
 
 
 
 
 
 
 
 
 
 
 
2527
  function activateStep(n) {
2528
  if(n>4) return;
2529
  const el=$('sd'+n); if(!el) return;
@@ -2539,7 +2566,9 @@ function markDone(n) {
2539
  }
2540
 
2541
  function stopLoaderSteps() {
2542
- clearInterval(stepTimer); clearInterval(elapsedTimer); clearInterval(countTimer);
 
 
2543
  for(let i=1;i<=4;i++) markDone(i);
2544
  const sc=$('scan-count'); if(sc) sc.textContent='280+';
2545
  stopSymbolStream();
@@ -2946,13 +2975,19 @@ function setLoading(on) {
2946
 
2947
  /* ═══ FLIP re-rank + never-blank auto-refresh ═══ */
2948
  function flipReorder(container, mutation) {
2949
- const before = new Map([...container.children].map(el => [el, el.getBoundingClientRect()]));
 
 
 
 
 
2950
  mutation();
2951
  const reduced = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
2952
  if (reduced) return;
2953
  [...container.children].forEach(el => {
2954
- const f = before.get(el);
2955
- if (!f) return; // brand-new element — handled by its own reveal animation
 
2956
  const l = el.getBoundingClientRect();
2957
  const dx = f.left - l.left, dy = f.top - l.top;
2958
  if (dx || dy) {
 
44
  --t1: var(--tx);
45
  --t2: var(--tx2);
46
  --t3: var(--tx3);
47
+ --t4: #707c98;
48
  --muted: var(--tx3);
49
 
50
  /* ── Palette ── */
 
1531
  .state-filter-toggle {
1532
  display:inline-flex; align-items:center; gap:5px;
1533
  background:var(--glass2); border:1px solid var(--gb);
1534
+ border-radius:8px; padding:4px 10px; min-height:36px; box-sizing:border-box;
1535
  font-size:11px; font-weight:700; color:var(--t2); cursor:pointer;
1536
  transition:all 0.2s;
1537
  }
 
1586
 
1587
  .row-summary { display:none; }
1588
  .card.row-mode .row-summary {
1589
+ display:grid; cursor:pointer; min-height:40px;
1590
  grid-template-columns:40px 1.5fr 1.1fr .9fr .9fr .8fr .8fr .8fr 70px;
1591
  align-items:center; gap:10px;
1592
  }
 
1673
 
1674
  /* ── Touch targets — minimum 44px per WCAG 2.5.5 ── */
1675
  .chip { min-height:40px; }
1676
+ .chip input, .chip select { min-height:36px; }
1677
  .bt-run-btn { min-height:36px; padding:6px 12px; }
1678
  .live-acc-resolve-btn { min-height:36px; padding:6px 10px; }
1679
  .signals-refresh-btn { width:36px !important; height:36px !important; }
 
1753
  backdrop-filter:blur(14px) saturate(160%);
1754
  -webkit-backdrop-filter:blur(14px) saturate(160%);
1755
  }
 
 
 
 
 
1756
  #cycle-section { position:relative; }
1757
  #grid { position:relative; }
1758
 
 
2475
  /* ═══ Loader step animator ═══ */
2476
  let stepTimer=null, elapsedTimer=null, countTimer=null, currentStep=0;
2477
  let scanStartTime=0;
2478
+ let step4WaitTimer=null, step4MsgIdx=0;
2479
+ // Step 4 ("Ranking setups") is the last step and has no further server signal to advance on —
2480
+ // on a slow cold-start scan (40-90s) it would otherwise sit frozen on "running…" for a long
2481
+ // time. Rotate its sub-label through reassurance copy every ~5s instead of appearing stuck,
2482
+ // until stopLoaderSteps() is called when the real fetch resolves.
2483
+ const STEP4_WAIT_MESSAGES = [
2484
+ '35/20/15/15/15 scoring · sorting by confidence',
2485
+ 'Still ranking — large markets can take up to 90s',
2486
+ 'Cross-checking confidence bands…',
2487
+ 'Almost there — finalizing setup order…'
2488
+ ];
2489
 
2490
  function startLoaderSteps() {
2491
  currentStep=0; scanStartTime=Date.now();
2492
+ clearInterval(stepTimer); clearInterval(elapsedTimer); clearInterval(countTimer); clearInterval(step4WaitTimer);
2493
+ step4MsgIdx=0;
2494
 
2495
  // Reset all steps
2496
  for(let i=1;i<=4;i++){
 
2499
  const num=el.querySelector('.step-num'); if(num) num.textContent=i;
2500
  const t=$('st'+i); if(t) t.textContent='';
2501
  }
2502
+ const sd4sub=document.querySelector('#sd4 .step-sub');
2503
+ if(sd4sub) sd4sub.textContent=STEP4_WAIT_MESSAGES[0];
2504
  const sc=$('scan-count'); if(sc) sc.textContent='0';
2505
  const se=$('scan-elapsed'); if(se) se.textContent='0s';
2506
 
 
2508
  activateStep(1);
2509
  startSymbolStream();
2510
 
2511
+ // Progress through steps: 1→2 at 3s, 2→3 at 7s, 3→4 at 11s. These are illustrative pacing
2512
+ // for the first 3 steps only — step 4 has its own indefinite-wait handling below since the
2513
+ // real scan duration varies 40-90s and isn't streamed to the client.
2514
  const timings=[3000,4000,4000];
2515
  let cumulative=0;
2516
  timings.forEach((delay,i)=>{
2517
  cumulative+=delay;
2518
+ setTimeout(()=>{
2519
+ markDone(i+1);
2520
+ activateStep(i+2);
2521
+ if(i+2===4) startStep4Wait();
2522
+ }, cumulative);
2523
  });
2524
 
2525
  // Elapsed counter
 
2528
  const se=$('scan-elapsed'); if(se) se.textContent=s+'s';
2529
  },500);
2530
 
2531
+ // Fake count-up: 0→280 over ~12s (pace slows toward end), then holds at 280 gracefully
2532
+ // (rather than looking frozen mid-count) for the remainder of a slow scan.
2533
  let count=0;
2534
  countTimer=setInterval(()=>{
2535
  const target=280, elapsed=(Date.now()-scanStartTime)/1000;
 
2540
  },120);
2541
  }
2542
 
2543
+ function startStep4Wait() {
2544
+ clearInterval(step4WaitTimer);
2545
+ step4MsgIdx=0;
2546
+ step4WaitTimer=setInterval(()=>{
2547
+ step4MsgIdx=(step4MsgIdx+1)%STEP4_WAIT_MESSAGES.length;
2548
+ const sd4sub=document.querySelector('#sd4 .step-sub');
2549
+ if(sd4sub) sd4sub.textContent=STEP4_WAIT_MESSAGES[step4MsgIdx];
2550
+ const t=$('st4'); if(t) t.textContent=Math.floor((Date.now()-scanStartTime)/1000)+'s';
2551
+ },5000);
2552
+ }
2553
+
2554
  function activateStep(n) {
2555
  if(n>4) return;
2556
  const el=$('sd'+n); if(!el) return;
 
2566
  }
2567
 
2568
  function stopLoaderSteps() {
2569
+ clearInterval(stepTimer); clearInterval(elapsedTimer); clearInterval(countTimer); clearInterval(step4WaitTimer);
2570
+ const sd4sub=document.querySelector('#sd4 .step-sub');
2571
+ if(sd4sub) sd4sub.textContent=STEP4_WAIT_MESSAGES[0];
2572
  for(let i=1;i<=4;i++) markDone(i);
2573
  const sc=$('scan-count'); if(sc) sc.textContent='280+';
2574
  stopSymbolStream();
 
2975
 
2976
  /* ═══ FLIP re-rank + never-blank auto-refresh ═══ */
2977
  function flipReorder(container, mutation) {
2978
+ // Keyed by data-sym (stable identity) rather than DOM element reference: refreshScanQuietly
2979
+ // replaces unchanged cards with brand-new nodes via replaceWith(), so an element-reference
2980
+ // keyed map would never match post-mutation and the FLIP transform would always be skipped.
2981
+ const before = new Map([...container.children]
2982
+ .filter(el => el.dataset && el.dataset.sym)
2983
+ .map(el => [el.dataset.sym, el.getBoundingClientRect()]));
2984
  mutation();
2985
  const reduced = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
2986
  if (reduced) return;
2987
  [...container.children].forEach(el => {
2988
+ const key = el.dataset && el.dataset.sym;
2989
+ const f = key ? before.get(key) : null;
2990
+ if (!f) return; // brand-new/unkeyed element — handled by its own reveal animation
2991
  const l = el.getBoundingClientRect();
2992
  const dx = f.left - l.left, dy = f.top - l.top;
2993
  if (dx || dy) {