diff --git a/app/static/builder/command-builder.css b/app/static/builder/command-builder.css index 4872d72c0..26b4c18ee 100644 --- a/app/static/builder/command-builder.css +++ b/app/static/builder/command-builder.css @@ -20,16 +20,6 @@ #nullius-builder .nb-dialoghead h2 { margin: 0; } #nullius-builder .nb-dialogclose { flex: none; display: grid; place-items: center; padding: 0; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--nb-muted); font-size: 20px; line-height: 1; cursor: pointer; } #nullius-builder .nb-dialogclose:hover { background: var(--nb-soft); color: var(--nb-text); } -/* a message: a toast at the bottom right, its bar counting down the seconds it stays; paused while pointed at */ -#nullius-builder .nb-toast { position: fixed; inset: auto 16px 16px auto; margin: 0; z-index: 50; display: flex; align-items: center; gap: 12px; box-sizing: border-box; width: max-content; max-width: min(420px, calc(100vw - 32px)); padding: 12px 10px 14px 16px; border: 1px solid var(--nb-line); border-radius: 10px; background: var(--nb-surface); color: var(--nb-text); font-size: 13px; box-shadow: 0 12px 32px #0005; overflow: hidden; } -#nullius-builder .nb-toast:not(:popover-open) { display: none; } -#nullius-builder .nb-toast[hidden] { display: none; } -#nullius-builder .nb-toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; } -#nullius-builder .nb-toast-close { flex: none; display: grid; place-items: center; padding: 0; width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--nb-muted); font-size: 18px; line-height: 1; cursor: pointer; } -#nullius-builder .nb-toast-close:hover { background: var(--nb-soft); color: var(--nb-text); } -#nullius-builder .nb-toast-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--nb-blue); transform-origin: left; animation: nb-toast-time 5s linear forwards; } -#nullius-builder .nb-toast:hover .nb-toast-bar, #nullius-builder .nb-toast:focus-within .nb-toast-bar { animation-play-state: paused; } -@keyframes nb-toast-time { from { transform: scaleX(1); } to { transform: scaleX(0); } } #nullius-builder .nb-savedrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; } #nullius-builder .nb-savedrow > span { min-width: 0; overflow-wrap: anywhere; } #nullius-builder .nb-savedrow small { display: block; } @@ -40,7 +30,6 @@ @media(max-width:520px) { #nullius-builder .nb-errorlist { padding: 10px; } #nullius-builder .nb-field input { font-size: 16px; } } #nullius-builder h3 { text-transform: none; letter-spacing: -.1px; } -#nullius-builder #nb-status:empty { min-height: 0; margin: 0; } #nullius-builder h2 { scroll-margin-top: 90px; } diff --git a/app/static/builder/command-builder.js b/app/static/builder/command-builder.js index ded987536..3f35d9ebe 100644 --- a/app/static/builder/command-builder.js +++ b/app/static/builder/command-builder.js @@ -210,25 +210,10 @@ const r = () => recipe; const store = recipeStore({request: (...a) => nulliusFetch(...a), csrf: schema.csrf, storage: (() => { try { return localStorage; } catch { return {length: 0}; } })()}); let saved = []; - // A message is a toast at the bottom right: a new one replaces it, its bar runs down and it goes, or its × closes it. - // Shown again on each message, so it lands above a dialog opened since. + // A message is the shared toast (nulliusNotify), stacked with the page's others; a new one replaces the builder's last. const status = text => { text = [text, ...loadNotes.splice(0)].filter(Boolean).join(' '); - const t = $('#nb-status'), bar = t && t.querySelector('.nb-toast-bar'); - if (!t) return; - const show = on => { - if (t.showPopover) { if (t.matches(':popover-open')) t.hidePopover(); if (on) t.showPopover(); } - else t.hidden = !on; - }; - if (!t.dataset.wired) { - t.dataset.wired = '1'; - t.querySelector('.nb-toast-close').addEventListener('click', () => show(false)); - bar.addEventListener('animationend', () => show(false)); - } - if (!text) { show(false); return; } - show(true); - t.querySelector('.nb-toast-text').textContent = text; - bar.style.animation = 'none'; void bar.offsetWidth; bar.style.animation = ''; + if (text) window.nulliusNotify?.(text, {key: 'builder'}); }; const button = (label,attrs='',cls='nb-button') => ``; // Which Harbor runs this recipe: the one it pins (Runner step), or a @@ -1368,7 +1353,7 @@ }catch(e){say('✕ '+e,'nb-error');b.disabled=false;} } // The button says it is reading until the answer's toast replaces it: a toast alone would be gone before a slow answer. - async function refreshRegistry(){const b=$('#nb-refresh'),label=b.textContent;b.disabled=true;b.classList.add('nb-loading');b.setAttribute('aria-busy','true');b.textContent='Reading Harbor’s catalogue…';status('');try{const response=await nulliusFetch('/new-run/registry');if(!response.ok)throw Error();const data=await response.json(),names=[...new Set([...schema.datasets.map(d=>d.registry),...schema.seenRegistry,...(data.names||[]),...(data.hub||[])])].filter(Boolean);$('#nb-registry').innerHTML=names.map(n=>``).join('');status(names.length+' catalogue references available. You can also enter one directly.');}catch{status('Catalogue refresh unavailable. Existing references and custom entry still work.');}finally{if(b.isConnected){b.disabled=false;b.classList.remove('nb-loading');b.removeAttribute('aria-busy');b.textContent=label;}}} + async function refreshRegistry(){const b=$('#nb-refresh'),label=b.textContent;b.disabled=true;b.classList.add('nb-loading');b.setAttribute('aria-busy','true');b.textContent='Reading Harbor’s catalogue…';try{const response=await nulliusFetch('/new-run/registry');if(!response.ok)throw Error();const data=await response.json(),names=[...new Set([...schema.datasets.map(d=>d.registry),...schema.seenRegistry,...(data.names||[]),...(data.hub||[])])].filter(Boolean);$('#nb-registry').innerHTML=names.map(n=>``).join('');status(names.length+' catalogue references available. You can also enter one directly.');}catch{status('Catalogue refresh unavailable. Existing references and custom entry still work.');}finally{if(b.isConnected){b.disabled=false;b.classList.remove('nb-loading');b.removeAttribute('aria-busy');b.textContent=label;}}} function completeDirectory(value){clearTimeout(pendingDirs);const seq=++dirsSequence;pendingDirs=setTimeout(async()=>{try{const response=await nulliusFetch('/new-run/dirs?path='+encodeURIComponent(value));if(!response.ok)return;const data=await response.json();if(seq===dirsSequence)$('#nb-paths').innerHTML=(data.dirs||[]).map(p=>``).join('');}catch{}},180);} // Start over (startOver): Escape outside a dialog is Keep it; another recipe taking the page's place (a load, an import, // the other runner's) drops the question diff --git a/app/static/style.css b/app/static/style.css index 2525e8013..a9248f36c 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -1759,7 +1759,7 @@ pre.instruction { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32 .origin-tag.benchmark { color: var(--text-dim); background: color-mix(in srgb, var(--text-faint) 16%, transparent); } -/* A notice (flash) as a toast at the bottom right, as the builder's. */ +/* A notice (flash) as a toast at the bottom right. */ .toasts { position: fixed; inset: auto 16px 16px auto; margin: 0; padding: 0; border: 0; background: transparent; width: max-content; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(440px, calc(100vw - 32px)); } .toast { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 10px 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13px; box-shadow: 0 12px 32px #0005; overflow: hidden; } .toast.bad { border-color: color-mix(in srgb, var(--bad) 55%, var(--border)); } diff --git a/app/templates/base.html b/app/templates/base.html index 2c5fdd573..848b8fb25 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -403,7 +403,7 @@ {% if not embedded %} {% endif %} -{#- Every notice a page is sent (Flask's flash) is a toast at the bottom left, as the builder's: it goes after a +{#- Every notice a page is sent (Flask's flash) is a toast at the bottom right: it goes after a few seconds - an error after twice as many - its bar counting them, paused while pointed at, or on its close. #} {% set notices = get_flashed_messages(with_categories=true) %} {% if notices %} diff --git a/app/templates/builder/new_run.html b/app/templates/builder/new_run.html index 4109f0e64..f92accd2c 100644 --- a/app/templates/builder/new_run.html +++ b/app/templates/builder/new_run.html @@ -23,9 +23,7 @@ {% endset %} {{ page_head('Set up the next experiment.', actions=actions) }} - {#- a message is a toast at the bottom left. - A popover, so it shows above the Saved recipes dialog too -#} -
+

Saved recipes

@@ -53,7 +51,6 @@

Give this recipe a name.

{{ tasks_state('tasks', true) }}
{{ tasks_list('tasks') }}
-