rafmacalaba commited on
Commit
377124a
·
verified ·
1 Parent(s): 197ba14

disagreement warning toast

Browse files
Files changed (1) hide show
  1. review.html +16 -4
review.html CHANGED
@@ -50,7 +50,7 @@ select { appearance: none; -webkit-appearance: none; background-color: var(--car
50
  select:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--hl); outline-offset: 1px; }
51
  button { transition: background .12s ease, transform .05s ease; }
52
  button:active:not(:disabled) { transform: scale(.97); }
53
- button:disabled { cursor: not-allowed; }
54
  input[type="text"], input:not([type]) { font: inherit; color: var(--fg); background: var(--bg);
55
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
56
  #who { max-width: 170px; }
@@ -310,8 +310,10 @@ function paintRuled() {
310
  }
311
  }
312
  let toastTimer = null;
 
313
  function toast(msg, withExport) {
314
  const t = $('toast');
 
315
  t.innerHTML = `<span>${esc(msg)}</span>` +
316
  (withExport ? `<button onclick="exp();hideToast()">export now</button>` : '') +
317
  `<button onclick="hideToast()">dismiss</button>`;
@@ -319,7 +321,14 @@ function toast(msg, withExport) {
319
  clearTimeout(toastTimer);
320
  toastTimer = setTimeout(hideToast, 15000);
321
  }
322
- function hideToast() { $('toast').style.display = 'none'; }
 
 
 
 
 
 
 
323
  function bindMarks(o) {
324
  document.querySelectorAll('#passage mark').forEach(m => m.onclick = () => {
325
  show(i, o.spans.findIndex(x => x.key === m.dataset.k));
@@ -376,9 +385,12 @@ async function rule(v) {
376
  saved = await sinkCommit(entry);
377
  }
378
  lastSaved = saved;
379
- // show the agree/disagree flag on this span first, advance after a beat
380
- cancelAdv();
381
  light();
 
 
 
382
  advTimer = setTimeout(() => {
383
  const o = cur();
384
  const nx = o.spans.findIndex((x, n) => n > s && !R[x.key]);
 
50
  select:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--hl); outline-offset: 1px; }
51
  button { transition: background .12s ease, transform .05s ease; }
52
  button:active:not(:disabled) { transform: scale(.97); }
53
+ #toast.warn { border-color: var(--drop); }
54
  input[type="text"], input:not([type]) { font: inherit; color: var(--fg); background: var(--bg);
55
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
56
  #who { max-width: 170px; }
 
310
  }
311
  }
312
  let toastTimer = null;
313
+ function hideToast() { $('toast').style.display = 'none'; $('toast').classList.remove('warn'); }
314
  function toast(msg, withExport) {
315
  const t = $('toast');
316
+ t.classList.remove('warn');
317
  t.innerHTML = `<span>${esc(msg)}</span>` +
318
  (withExport ? `<button onclick="exp();hideToast()">export now</button>` : '') +
319
  `<button onclick="hideToast()">dismiss</button>`;
 
321
  clearTimeout(toastTimer);
322
  toastTimer = setTimeout(hideToast, 15000);
323
  }
324
+ function warnToast(msg) {
325
+ const t = $('toast');
326
+ t.innerHTML = `<span>${esc(msg)}</span><button onclick="hideToast()">dismiss</button>`;
327
+ t.classList.add('warn');
328
+ t.style.display = 'flex';
329
+ clearTimeout(toastTimer);
330
+ toastTimer = setTimeout(hideToast, 20000);
331
+ }
332
  function bindMarks(o) {
333
  document.querySelectorAll('#passage mark').forEach(m => m.onclick = () => {
334
  show(i, o.spans.findIndex(x => x.key === m.dataset.k));
 
385
  saved = await sinkCommit(entry);
386
  }
387
  lastSaved = saved;
388
+ // warning toast on disagreement (stays up across the advance)
389
+ const sp0 = span(), dk = (v === 'DATA_MENTION') !== (sp0.luna_label === 1);
390
  light();
391
+ if (dk) {
392
+ warnToast(`DISAGREE — “${sp0.surface}”: Luna ${sp0.luna_label === 1 ? 'kept this, you’re dropping' : 'dropped this, you’re keeping'}`);
393
+ }
394
  advTimer = setTimeout(() => {
395
  const o = cur();
396
  const nx = o.spans.findIndex((x, n) => n > s && !R[x.key]);