coderuday21 commited on
Commit
c9b0675
·
1 Parent(s): 717d61b

Move Result View into a modal overlay to declutter main page

Browse files
Files changed (3) hide show
  1. static/css/style.css +58 -0
  2. static/js/app.js +31 -4
  3. templates/index.html +65 -61
static/css/style.css CHANGED
@@ -924,6 +924,64 @@ input:focus, select:focus, textarea:focus {
924
  gap: 0.75rem;
925
  }
926
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
927
  /* ---- Alerts ---- */
928
  .alert {
929
  padding: 0.7rem 1rem;
 
924
  gap: 0.75rem;
925
  }
926
 
927
+ /* ---- Result Modal (full-screen overlay) ---- */
928
+ .result-modal-backdrop {
929
+ position: fixed;
930
+ inset: 0;
931
+ z-index: 1100;
932
+ background: rgba(0,0,0,0.45);
933
+ backdrop-filter: blur(4px);
934
+ display: flex;
935
+ align-items: flex-start;
936
+ justify-content: center;
937
+ overflow-y: auto;
938
+ animation: fadeIn 0.18s ease;
939
+ }
940
+ .result-modal {
941
+ background: var(--bg-card);
942
+ border-radius: var(--radius);
943
+ width: 94%;
944
+ max-width: 1100px;
945
+ margin: 2rem auto;
946
+ padding: 1.5rem 1.5rem 2rem;
947
+ box-shadow: 0 20px 60px rgba(0,0,0,0.18);
948
+ position: relative;
949
+ }
950
+ .result-modal-header {
951
+ display: flex;
952
+ align-items: center;
953
+ justify-content: space-between;
954
+ margin-bottom: 1rem;
955
+ }
956
+ .result-modal-header h3 {
957
+ font-size: 1.15rem;
958
+ font-weight: 600;
959
+ margin: 0;
960
+ }
961
+ .btn-close-modal {
962
+ background: none;
963
+ border: none;
964
+ cursor: pointer;
965
+ color: var(--text-muted);
966
+ padding: 4px;
967
+ border-radius: 6px;
968
+ transition: background 0.15s, color 0.15s;
969
+ }
970
+ .btn-close-modal:hover {
971
+ background: rgba(0,0,0,0.07);
972
+ color: var(--text-primary);
973
+ }
974
+
975
+ @media (max-width: 600px) {
976
+ .result-modal {
977
+ width: 100%;
978
+ margin: 0;
979
+ border-radius: 0;
980
+ min-height: 100vh;
981
+ padding: 1rem;
982
+ }
983
+ }
984
+
985
  /* ---- Alerts ---- */
986
  .alert {
987
  padding: 0.7rem 1rem;
static/js/app.js CHANGED
@@ -375,12 +375,15 @@ function formatCompact(n) {
375
  let currentResultData = null;
376
 
377
  function showResult(data) {
378
- const card = document.getElementById('result-card');
379
  const statsEl = document.getElementById('result-stats');
380
  const tbody = document.getElementById('regions-tbody');
 
381
 
382
  currentResultData = data;
383
 
 
 
384
  const locParts = [data.village, data.zone].filter(Boolean);
385
  const locLabel = locParts.length ? locParts.join(', ') : '—';
386
 
@@ -433,10 +436,34 @@ function showResult(data) {
433
  });
434
 
435
  setupRegionHover(tbody, regions);
436
- card.classList.remove('hidden');
437
- card.scrollIntoView({ behavior: 'smooth' });
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  }
439
 
 
 
 
 
 
 
 
 
 
 
 
440
  function setupRegionHover(tbody, regions) {
441
  const overlay = document.getElementById('region-highlight-overlay');
442
  if (!overlay) return;
@@ -581,7 +608,7 @@ async function loadHistory() {
581
  <td class="stats-cell">${r.regionsCount} regions</td>
582
  <td class="stats-cell">${r.changePercentage.toFixed(2)}%</td>
583
  <td class="actions-cell">
584
- ${r.overlayUrl ? `<a href="${r.overlayUrl}" target="_blank" class="btn btn-secondary btn-sm" onclick="event.stopPropagation()">View</a>` : ''}
585
  <button type="button" class="btn-icon" title="Delete" onclick="event.stopPropagation(); confirmDelete(${r.id})">
586
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>
587
  </button>
 
375
  let currentResultData = null;
376
 
377
  function showResult(data) {
378
+ const modal = document.getElementById('result-modal');
379
  const statsEl = document.getElementById('result-stats');
380
  const tbody = document.getElementById('regions-tbody');
381
+ const titleEl = document.getElementById('result-modal-title');
382
 
383
  currentResultData = data;
384
 
385
+ if (titleEl) titleEl.textContent = data.title || 'Result View';
386
+
387
  const locParts = [data.village, data.zone].filter(Boolean);
388
  const locLabel = locParts.length ? locParts.join(', ') : '—';
389
 
 
436
  });
437
 
438
  setupRegionHover(tbody, regions);
439
+ openResultModal();
440
+ }
441
+
442
+ function openResultModal() {
443
+ const modal = document.getElementById('result-modal');
444
+ if (!modal) return;
445
+ modal.classList.remove('hidden');
446
+ document.body.style.overflow = 'hidden';
447
+ }
448
+
449
+ function closeResultModal() {
450
+ const modal = document.getElementById('result-modal');
451
+ if (!modal) return;
452
+ modal.classList.add('hidden');
453
+ document.body.style.overflow = '';
454
  }
455
 
456
+ document.getElementById('result-modal-close')?.addEventListener('click', closeResultModal);
457
+ document.getElementById('result-modal')?.addEventListener('click', (e) => {
458
+ if (e.target === e.currentTarget) closeResultModal();
459
+ });
460
+ document.addEventListener('keydown', (e) => {
461
+ if (e.key === 'Escape') {
462
+ const modal = document.getElementById('result-modal');
463
+ if (modal && !modal.classList.contains('hidden')) closeResultModal();
464
+ }
465
+ });
466
+
467
  function setupRegionHover(tbody, regions) {
468
  const overlay = document.getElementById('region-highlight-overlay');
469
  if (!overlay) return;
 
608
  <td class="stats-cell">${r.regionsCount} regions</td>
609
  <td class="stats-cell">${r.changePercentage.toFixed(2)}%</td>
610
  <td class="actions-cell">
611
+ <button type="button" class="btn btn-secondary btn-sm" onclick="event.stopPropagation(); openRunFromHistory(${r.id})">View</button>
612
  <button type="button" class="btn-icon" title="Delete" onclick="event.stopPropagation(); confirmDelete(${r.id})">
613
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>
614
  </button>
templates/index.html CHANGED
@@ -4,7 +4,7 @@
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>AI Change Detection</title>
7
- <link rel="stylesheet" href="/static/css/style.css" />
8
  </head>
9
  <body>
10
  <div class="app">
@@ -241,65 +241,7 @@
241
  </form>
242
  </div>
243
 
244
- <!-- Section 2: Result View -->
245
- <div class="card hidden" id="result-card">
246
- <div class="card-header">
247
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--grad-start)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 11-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
248
- <h3>Result View</h3>
249
- </div>
250
- <div class="result-stats" id="result-stats"></div>
251
-
252
- <!-- Zoom controls + Before/After slider -->
253
- <div class="zoom-slider-section">
254
- <div class="zoom-controls">
255
- <button type="button" class="btn btn-zoom" id="zoom-out" title="Zoom out" aria-label="Zoom out">−</button>
256
- <span class="zoom-level" id="zoom-level">100%</span>
257
- <button type="button" class="btn btn-zoom" id="zoom-in" title="Zoom in" aria-label="Zoom in">+</button>
258
- </div>
259
- <div class="zoom-wrapper" id="zoom-wrapper">
260
- <div class="compare-slider compare-slider-zoomed" id="compare-slider">
261
- <div class="compare-before">
262
- <img id="compare-before-img" alt="Before" draggable="false" />
263
- <span class="compare-label compare-label-left">Before</span>
264
- </div>
265
- <div class="compare-after" id="compare-after-clip">
266
- <img id="compare-after-img" alt="Changes detected" draggable="false" />
267
- <span class="compare-label compare-label-right">Changes</span>
268
- </div>
269
- <div class="compare-handle" id="compare-handle">
270
- <div class="compare-handle-line"></div>
271
- <div class="compare-handle-knob">
272
- <svg width="20" height="20" viewBox="0 0 20 20"><path d="M6 10l4-5v10z" fill="currentColor"/><path d="M14 10l-4-5v10z" fill="currentColor"/></svg>
273
- </div>
274
- <div class="compare-handle-line"></div>
275
- </div>
276
- <!-- Overlay for highlighting region on table row hover -->
277
- <div class="region-highlight-overlay" id="region-highlight-overlay"></div>
278
- </div>
279
- </div>
280
- </div>
281
-
282
- <!-- Tabular change summary: hover row highlights box on image -->
283
- <div class="regions-table-wrap">
284
- <table class="regions-table" id="regions-table">
285
- <thead>
286
- <tr>
287
- <th>#</th>
288
- <th>Change Type</th>
289
- <th>Sub-Type</th>
290
- <th>Severity</th>
291
- <th>Confidence</th>
292
- <th>Area (px)</th>
293
- <th>Coordinates</th>
294
- <th>Stories</th>
295
- <th>Height</th>
296
- <th>Stage</th>
297
- </tr>
298
- </thead>
299
- <tbody id="regions-tbody"></tbody>
300
- </table>
301
- </div>
302
- </div>
303
 
304
  <!-- Section 3: History View (tabular, click row to open result) -->
305
  <div class="card mt-2 section-history">
@@ -329,6 +271,68 @@
329
  </section>
330
  </div>
331
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  <!-- Delete confirm modal -->
333
  <div class="modal-backdrop hidden" id="modal-delete">
334
  <div class="modal">
@@ -341,6 +345,6 @@
341
  </div>
342
  </div>
343
 
344
- <script src="/static/js/app.js?v=16"></script>
345
  </body>
346
  </html>
 
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>AI Change Detection</title>
7
+ <link rel="stylesheet" href="/static/css/style.css?v=17" />
8
  </head>
9
  <body>
10
  <div class="app">
 
241
  </form>
242
  </div>
243
 
244
+ <!-- Result View lives in a modal (opened from detection or history "View") -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
 
246
  <!-- Section 3: History View (tabular, click row to open result) -->
247
  <div class="card mt-2 section-history">
 
271
  </section>
272
  </div>
273
 
274
+ <!-- Result modal (full-screen overlay opened from detection or history) -->
275
+ <div class="result-modal-backdrop hidden" id="result-modal">
276
+ <div class="result-modal">
277
+ <div class="result-modal-header">
278
+ <h3 id="result-modal-title">Result View</h3>
279
+ <button type="button" class="btn-close-modal" id="result-modal-close" aria-label="Close">
280
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
281
+ </button>
282
+ </div>
283
+
284
+ <div class="result-stats" id="result-stats"></div>
285
+
286
+ <div class="zoom-slider-section">
287
+ <div class="zoom-controls">
288
+ <button type="button" class="btn btn-zoom" id="zoom-out" title="Zoom out" aria-label="Zoom out">−</button>
289
+ <span class="zoom-level" id="zoom-level">100%</span>
290
+ <button type="button" class="btn btn-zoom" id="zoom-in" title="Zoom in" aria-label="Zoom in">+</button>
291
+ </div>
292
+ <div class="zoom-wrapper" id="zoom-wrapper">
293
+ <div class="compare-slider compare-slider-zoomed" id="compare-slider">
294
+ <div class="compare-before">
295
+ <img id="compare-before-img" alt="Before" draggable="false" />
296
+ <span class="compare-label compare-label-left">Before</span>
297
+ </div>
298
+ <div class="compare-after" id="compare-after-clip">
299
+ <img id="compare-after-img" alt="Changes detected" draggable="false" />
300
+ <span class="compare-label compare-label-right">Changes</span>
301
+ </div>
302
+ <div class="compare-handle" id="compare-handle">
303
+ <div class="compare-handle-line"></div>
304
+ <div class="compare-handle-knob">
305
+ <svg width="20" height="20" viewBox="0 0 20 20"><path d="M6 10l4-5v10z" fill="currentColor"/><path d="M14 10l-4-5v10z" fill="currentColor"/></svg>
306
+ </div>
307
+ <div class="compare-handle-line"></div>
308
+ </div>
309
+ <div class="region-highlight-overlay" id="region-highlight-overlay"></div>
310
+ </div>
311
+ </div>
312
+ </div>
313
+
314
+ <div class="regions-table-wrap">
315
+ <table class="regions-table" id="regions-table">
316
+ <thead>
317
+ <tr>
318
+ <th>#</th>
319
+ <th>Change Type</th>
320
+ <th>Sub-Type</th>
321
+ <th>Severity</th>
322
+ <th>Confidence</th>
323
+ <th>Area (px)</th>
324
+ <th>Coordinates</th>
325
+ <th>Stories</th>
326
+ <th>Height</th>
327
+ <th>Stage</th>
328
+ </tr>
329
+ </thead>
330
+ <tbody id="regions-tbody"></tbody>
331
+ </table>
332
+ </div>
333
+ </div>
334
+ </div>
335
+
336
  <!-- Delete confirm modal -->
337
  <div class="modal-backdrop hidden" id="modal-delete">
338
  <div class="modal">
 
345
  </div>
346
  </div>
347
 
348
+ <script src="/static/js/app.js?v=17"></script>
349
  </body>
350
  </html>