From b1c46950805393f0a86256ddbaec04adb03d500c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 1 Nov 2026 18:25:14 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style:=20every=20settings,=20adm?= =?UTF-8?q?in,=20organization=20and=20repo=20management=20page=20now=20fol?= =?UTF-8?q?lows=20the=20Security=20page:=20one=20pane=20of=20hairline=20ro?= =?UTF-8?q?ws=20with=20an=20icon,=20a=20label,=20a=20status=20and=20the=20?= =?UTF-8?q?action=20at=20the=20right,=20where=20adding=20a=20key,=20token,?= =?UTF-8?q?=20member,=20label=20or=20webhook=20opens=20in=20place=20from?= =?UTF-8?q?=20the=20first=20row,=20and=20no=20page=20keeps=20a=20side=20fo?= =?UTF-8?q?rm=20or=20a=20half-empty=20stretched=20pane;=20=E2=9C=A8=20feat?= =?UTF-8?q?:=20search=20reads=20the=20pages=20themselves,=20so=20every=20l?= =?UTF-8?q?abel,=20button,=20hint=20and=20link=20on=20settings,=20admin,?= =?UTF-8?q?=20organization=20and=20repo=20settings=20pages=20can=20be=20fo?= =?UTF-8?q?und,=20as=20the=20viewer=20and=20in=20their=20language,=20and?= =?UTF-8?q?=20picking=20a=20result=20opens=20what=20hides=20it,=20marks=20?= =?UTF-8?q?the=20row=20and=20puts=20you=20in=20its=20control;=20a=20typo?= =?UTF-8?q?=20is=20only=20guessed=20at=20when=20nothing=20has=20the=20lett?= =?UTF-8?q?ers=20as=20typed,=20so=20play=20finds=20the=20sound=20setting?= =?UTF-8?q?=20and=20not=20display=20name;=20=F0=9F=90=9B=20fix:=20opening?= =?UTF-8?q?=20a=20run=20keeps=20the=20runs=20list=20beside=20it;=20mark=20?= =?UTF-8?q?all=20read=20answers=20at=20once=20without=20leaving=20the=20pa?= =?UTF-8?q?ge;=20inline=20disclosures=20open=20and=20shut=20with=20no=20an?= =?UTF-8?q?imation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/forge-e2e/tests/e2e/ui_prefs_e2e.rs | 3 +- crates/forge-web/assets/nav.js | 289 +++++++++---- crates/forge-web/src/pages/admin_backups.rs | 102 ++++- crates/forge-web/src/pages/admin_health.rs | 143 +++++-- crates/forge-web/src/pages/admin_mail.rs | 71 +++- .../forge-web/src/pages/admin_replication.rs | 120 ++++-- crates/forge-web/src/pages/admin_runners.rs | 176 ++++---- crates/forge-web/src/pages/admin_server.rs | 88 ++-- .../forge-web/src/pages/admin_user_detail.rs | 237 ++++++----- crates/forge-web/src/pages/admin_users.rs | 142 ++++--- crates/forge-web/src/pages/ci_runs.rs | 82 ++-- crates/forge-web/src/pages/ci_tests.rs | 11 +- .../src/pages/discussion_settings.rs | 23 +- crates/forge-web/src/pages/invites.rs | 36 +- crates/forge-web/src/pages/labels_page.rs | 161 +++---- crates/forge-web/src/pages/milestones_page.rs | 139 +++--- crates/forge-web/src/pages/org_members.rs | 147 +++---- crates/forge-web/src/pages/org_settings.rs | 162 +++---- crates/forge-web/src/pages/org_teams.rs | 369 +++++++++------- crates/forge-web/src/pages/palette.rs | 8 +- crates/forge-web/src/pages/passkeys.rs | 30 +- .../forge-web/src/pages/repo_collaborators.rs | 210 +++++---- crates/forge-web/src/pages/repo_mirrors.rs | 162 +++---- crates/forge-web/src/pages/repo_rename.rs | 87 ++-- crates/forge-web/src/pages/repo_secrets.rs | 131 +++--- crates/forge-web/src/pages/repo_security.rs | 111 ++--- crates/forge-web/src/pages/repo_settings.rs | 224 +++++----- crates/forge-web/src/pages/repo_webhooks.rs | 222 +++++----- .../src/pages/settings_appearance.rs | 110 +++-- crates/forge-web/src/pages/settings_export.rs | 84 ++-- crates/forge-web/src/pages/settings_gpg.rs | 76 ++-- crates/forge-web/src/pages/settings_keys.rs | 87 ++-- .../src/pages/settings_notifications.rs | 140 +++--- .../forge-web/src/pages/settings_profile.rs | 134 +++--- .../forge-web/src/pages/settings_security.rs | 106 ++--- .../forge-web/src/pages/settings_sessions.rs | 39 +- crates/forge-web/src/pages/settings_tokens.rs | 95 +++-- crates/forge-web/src/pages/wiki.rs | 23 +- style/_account_admin.scss | 125 ------ style/_alive_settings.scss | 6 - style/_appearance.scss | 32 -- style/_canvas_account.scss | 2 +- style/_canvas_detail.scss | 90 ---- style/_fit_admin.scss | 59 --- style/_lang_admin.scss | 22 +- style/_lang_ci.scss | 37 +- style/_look.scss | 3 +- style/_palette.scss | 21 +- style/_system.scss | 26 -- style/main.scss | 399 +++++++++--------- 50 files changed, 2850 insertions(+), 2552 deletions(-) diff --git a/crates/forge-e2e/tests/e2e/ui_prefs_e2e.rs b/crates/forge-e2e/tests/e2e/ui_prefs_e2e.rs index 559f523..23291c3 100644 --- a/crates/forge-e2e/tests/e2e/ui_prefs_e2e.rs +++ b/crates/forge-e2e/tests/e2e/ui_prefs_e2e.rs @@ -196,7 +196,8 @@ async fn the_form_has_no_save_button_and_every_field_autosubmits() { let form = scraper::Selector::parse("form[data-appearance]").expect("selector"); assert_eq!(doc.select(&form).count(), 1, "one appearance form"); - let buttons = scraper::Selector::parse("form[data-appearance] button").expect("selector"); + let buttons = scraper::Selector::parse("form[data-appearance] button:not([type=\"button\"])") + .expect("selector"); assert_eq!(doc.select(&buttons).count(), 0, "no Save button"); let submits = scraper::Selector::parse("form[data-appearance] input[type=\"submit\"]").expect("selector"); diff --git a/crates/forge-web/assets/nav.js b/crates/forge-web/assets/nav.js index 128bae0..93401d4 100644 --- a/crates/forge-web/assets/nav.js +++ b/crates/forge-web/assets/nav.js @@ -505,6 +505,7 @@ var keep = !!o.keep && res.url.pathname === o.target.pathname; var finish = function () { swap(res.html, dest, how, keep); + if (pal.find) { paletteLand(); } // Other parts of this file follow page changes through this event (list memory, say). document.dispatchEvent(new CustomEvent('forge:swapped', { detail: { how: how, url: dest } })); }; @@ -1191,6 +1192,25 @@ if (seq === peekSeq && isPeekOpen(pop)) { pop.classList.add('bell-ready'); } }); } + // Mark all read from the bell: the post goes in the background, so the page under the popover is + // not fetched again. The list and the count change once the server has answered; the inbox page + // follows through its own stream. + document.addEventListener('submit', function (e) { + var form = e.target; + if (!form.matches || !form.matches('.bell-clear')) { return; } + e.preventDefault(); + if (form.classList.contains('is-busy')) { return; } + form.classList.add('is-busy'); + var pop = form.closest('.bell-pop'); + fetch(form.action, { method: 'POST', credentials: 'same-origin', redirect: 'manual', body: new URLSearchParams(new FormData(form)) }).then(function (r) { + form.classList.remove('is-busy'); + if (r.type !== 'opaqueredirect') { throw new Error('status ' + r.status); } + if (pop && isPeekOpen(pop)) { loadPeek(pop); } + }).catch(function () { + form.classList.remove('is-busy'); + form.submit(); + }); + }, true); var PEEK_SLOW = 300; // ms before a slow list shows its loading note var peekSeq = 0; // a fetch's number: only the newest answer is drawn @@ -1404,70 +1424,11 @@ } }, false); - // Inline disclosures (a branch rule, a review thread, a delivery, a
in markdown) slide - // open and shut instead of jumping. The details' height is animated from where it is to where it - // goes, clipped only while it moves, so an open one never clips what it holds. Closing keeps it open - // until the slide ends. A click during a slide turns it around. Floating panels (menus, popovers, - // inline confirms) are left to the browser, as is a reader who asks for reduced motion. + // Inline disclosures open and shut at once, with the browser's own details. Floating panels are the + // ones a click drops in below. var FLOATING = DROPDOWN + ', details.row-menu, details.confirm-inline, details.commit-status, details.reaction-picker'; var reducedMotion = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null; - function slideDetails(d) { - var opening = d.__closing || !d.open; - // An exclusive group (details[name]): the browser would shut the open sibling at once while this - // one slides, so the page jumps. This one leaves the group for the slide, the sibling slides shut - // alongside, and the name comes back once both have finished. - var group = opening ? d.getAttribute('name') : null; - var others = []; - if (group) { - document.querySelectorAll('details[name]').forEach(function (o) { - if (o !== d && o.getAttribute('name') === group && o.open && !o.__closing) { others.push(o); } - }); - if (others.length) { d.removeAttribute('name'); } else { group = null; } - } - var from = d.getBoundingClientRect().height; - if (d.__slide) { d.__slide.cancel(); } - d.open = false; - var shut = d.getBoundingClientRect().height; - d.open = true; - var to = opening ? d.getBoundingClientRect().height : shut; - d.__closing = !opening; - d.style.overflow = 'hidden'; - var slide = d.animate({ height: [from + 'px', to + 'px'] }, { duration: 200, easing: 'cubic-bezier(0.2, 0, 0, 1)' }); - d.__slide = slide; - slide.onfinish = function () { - d.__slide = null; - d.style.overflow = ''; - if (d.__closing) { d.__closing = false; d.open = false; } - }; - if (group) { - others.forEach(slideDetails); - var slides = others.map(function (o) { return o.__slide.finished; }).concat(slide.finished); - // `finished` settles before onfinish shuts a closing sibling, and the name must come back only - // once they are shut, or the browser would shut this one instead. A sibling the reader opened - // again meanwhile keeps this one out of the group. - Promise.allSettled(slides).then(function () { - others.forEach(function (o) { - if (o.__closing) { o.__closing = false; o.open = false; } - }); - if (others.every(function (o) { return !o.open; })) { d.setAttribute('name', group); } - }); - } - } - - document.addEventListener('click', function (e) { - if (e.defaultPrevented || !e.target || !e.target.closest) { return; } - var summary = e.target.closest('summary'); - var d = summary && summary.parentElement; - if (!d || d.tagName !== 'DETAILS' || d.querySelector('summary') !== summary) { return; } - if (d.matches(FLOATING) || (reducedMotion && reducedMotion.matches)) { return; } - // A link or control inside the summary does its own thing. - var control = e.target.closest('a, button, input, select, textarea'); - if (control && summary.contains(control)) { return; } - e.preventDefault(); - slideDetails(d); - }, false); - // Plays a one-shot motion class (see _motion.scss) on the reader's own action. function play(el, cls) { el.classList.remove(cls); @@ -4035,7 +3996,8 @@ // is on the wire. reload: the page a sent change answered with, shown once the palette closes. var pal = { dlg: null, input: null, list: null, note: null, hits: [], sel: 0, str: null, data: null, request: null, failed: false, files: null, filesSrc: '', filesBusy: null, - acts: [], busy: false, reload: null, prefill: '' }; + acts: [], busy: false, reload: null, prefill: '', find: '', + scan: { key: '', at: 0, texts: {} }, scanBusy: false, scanGen: 0 }; // The words the palette shows, read from the topbar button: the server writes them in the viewer's // language, so this script carries no text of its own. @@ -4097,12 +4059,142 @@ // An item's label and other words, folded once. function paletteMeta(item) { - if (!item.meta) { - item.meta = { label: paletteParts(item.label), terms: (item.terms || []).map(paletteParts) }; + if (!item.meta || item.metaGen !== pal.scanGen) { + var read = (item.scan && pal.scan.texts[item.scan]) || []; + item.meta = { label: paletteParts(item.label), terms: (item.terms || []).concat(read).map(paletteParts) }; + item.metaGen = pal.scanGen; } return item.meta; } + // What a page says that a reader may search for. The same list reads a fetched page and, after a + // jump, finds the control on the page itself. A long list of options, such as time zones, is left out. + var PALETTE_TEXT = 'h1, h2, h3, h4, legend, label, summary, button, a, th, dt, dd, li, p, small, option, .row-title, .row-name, .row-status, .switch-title, .srv-label'; + var PALETTE_OPTIONS = 30; + function paletteTexts(root) { + var out = []; + Array.prototype.forEach.call(root.querySelectorAll(PALETTE_TEXT), function (el) { + if (el.tagName === 'OPTION' && el.parentNode.children.length > PALETTE_OPTIONS) { return; } + if (el.closest('nav, .repo-head')) { return; } + var copy = el.cloneNode(true); + Array.prototype.forEach.call(copy.querySelectorAll('select, textarea, svg, script, style'), function (n) { n.parentNode.removeChild(n); }); + var text = copy.textContent.replace(/\s+/g, ' ').trim(); + if (text.length >= 3 && text.length <= 160 && /\p{L}/u.test(text)) { out.push({ el: el, text: text }); } + }); + return out; + } + + // Reads the settings, admin and organization pages in the palette's list, and a repo's settings + // pages, so every label, button and hint on them can be searched and no word list is kept by hand. + // It fetches as this viewer, so it reads only what they may open, in their language. It runs on the + // first open and keeps the words for the tab, for an hour or until the viewer or the build changes. + var PALETTE_SCAN_KEY = 'forge-palette-scan'; + var PALETTE_SCAN_TTL = 3600000; + var PALETTE_SCAN_AT_ONCE = 4; + var PALETTE_SCAN_PAGES = 120; + var PALETTE_SCANNED = /^\/(settings|admin|org)(\/|\?|$)/; + function paletteScanJobs() { + var jobs = []; + pal.data.items.forEach(function (item) { + if (item.scan) { jobs.push({ key: item.scan, url: item.scan }); } + }); + var here = paletteRepoHere(); + var base = here && here.admin ? here.href : ''; + pal.data.items.some(function (item) { + if (!base && item.kind === 'repo' && item.admin) { base = item.href; } + return !!base; + }); + if (base) { + pal.data.pages.forEach(function (p) { + if (p.admin) { jobs.push({ key: 'repo:' + p.path, url: base + '/' + p.path }); } + }); + } + return jobs.slice(0, PALETTE_SCAN_PAGES); + } + + function paletteScanned(scan) { + pal.scan = scan; + pal.scanGen++; + if (pal.dlg.open) { renderPalette(); } + } + + function paletteScan() { + var key = pal.data.scanKey; + if (!key || pal.scanBusy || (pal.scan.key === key && Date.now() - pal.scan.at < PALETTE_SCAN_TTL)) { return; } + var saved = null; + try { saved = JSON.parse(sessionStorage.getItem(PALETTE_SCAN_KEY) || 'null'); } catch (err) { /* Read the pages again. */ } + if (saved && saved.key === key && Date.now() - saved.at < PALETTE_SCAN_TTL) { paletteScanned(saved); return; } + var jobs = paletteScanJobs(); + var left = jobs.length; + var texts = {}; + if (!left) { return; } + pal.scanBusy = true; + function done() { + left--; + if (left) { next(); return; } + pal.scanBusy = false; + var scan = { key: key, at: Date.now(), texts: texts }; + paletteScanned(scan); + try { sessionStorage.setItem(PALETTE_SCAN_KEY, JSON.stringify(scan)); } catch (err) { /* Too big to keep: read again next tab. */ } + } + function next() { + var job = jobs.shift(); + if (!job) { return; } + fetch(job.url, { headers: { accept: 'text/html' }, credentials: 'same-origin' }).then(function (r) { + return r.ok && !r.redirected ? r.text() : ''; + }).then(function (html) { + var main = html ? new DOMParser().parseFromString(html, 'text/html').querySelector('main') : null; + if (!main) { return; } + var seen = {}; + texts[job.key] = paletteTexts(main).map(function (t) { return t.text; }).filter(function (t) { + if (seen[t]) { return false; } + seen[t] = true; + return true; + }); + }).catch(function () { /* A page that fails is left out of this scan. */ }).then(done); + } + for (var i = 0; i < PALETTE_SCAN_AT_ONCE; i++) { next(); } + } + + // After a jump to words found on a page: opens what hides them, brings them into view and puts the + // reader in their control. The mark goes at the next key or click. + function paletteLand() { + var want = pal.find; + pal.find = ''; + var main = document.querySelector('main'); + if (!want || !main) { return; } + var hit = paletteTexts(main).filter(function (t) { return t.text === want; })[0]; + if (!hit) { return; } + for (var d = hit.el.closest('details'); d; d = d.parentElement && d.parentElement.closest('details')) { d.open = true; } + var row = hit.el.closest('.row-field, .row-line, .srv-field, .switch-row, label, fieldset') || hit.el; + var control = hit.el.matches('button') ? hit.el : row.querySelector('input:not([type="hidden"]), select, textarea, button'); + row.scrollIntoView({ block: 'center' }); + if (control) { control.focus({ preventScroll: true }); } + row.classList.add('palette-hit'); + function clear() { + row.classList.remove('palette-hit'); + document.removeEventListener('pointerdown', clear, true); + document.removeEventListener('keydown', clear, true); + } + document.addEventListener('pointerdown', clear, true); + document.addEventListener('keydown', clear, true); + } + + // The repo this page belongs to, read from its tabs. The first is its Code link, so its path starts + // with owner/name, and a Settings tab says the viewer may manage the repo. + function paletteRepoHere() { + var tabs = document.querySelectorAll('.repo-tabs a'); + if (!tabs.length) { return null; } + var parts = tabs[0].pathname.split('/'); + if (parts.length < 3) { return null; } + var name = parts[1] + '/' + parts[2]; + return { + name: name, + href: '/' + name, + admin: Array.prototype.some.call(tabs, function (a) { return a.pathname === '/' + name + '/settings'; }) + }; + } + // The fewest single-letter typos (a missing, extra or wrong letter, or two letters swapped) between // the token and the start of the word, or more than max when there are too many. function paletteTypos(t, w, max) { @@ -4171,16 +4263,23 @@ } // How well one token matches an item: its label first, then its other words at four fifths of the - // score. Sets item.why to the other word that matched, so the row can say why it is listed. + // score. Sets item.why to the other word that matched, so the row can say why it is listed, and + // item.near when the token only came close: a typo, scattered letters, or letters inside a longer + // word, as "play" is in "display". + var PALETTE_EXACT = 2; + var PALETTE_KEY = /^\S*[._]\S*$/; function paletteToken(t, item) { var m = paletteMeta(item); var best = paletteField(t, m.label), why = ''; + var exact = best >= PALETTE_EXACT; m.terms.forEach(function (term) { - var v = paletteField(t, term) * 0.8; - if (v > best) { best = v; why = /[._]/.test(term.text) || m.label.s.indexOf(term.s) >= 0 ? '' : term.text; } + var raw = paletteField(t, term); + if (raw >= PALETTE_EXACT) { exact = true; } + if (raw * 0.8 > best) { best = raw * 0.8; why = PALETTE_KEY.test(term.text) || m.label.s.indexOf(term.s) >= 0 ? '' : term.text; } }); if (!best && paletteInOrder(t, m.label.s)) { best = 1; } if (why) { item.why = why; } + if (!exact) { item.near = true; } return best; } @@ -4189,6 +4288,7 @@ // wins within a tier: the bonus stays under 0.5. An empty query matches all. function paletteScore(q, item) { item.why = ''; + item.near = false; if (!q) { return 1; } var fq = paletteFold(q).trim(); var m = paletteMeta(item); @@ -4205,7 +4305,17 @@ sum += v; } var best = sum / tokens.length; - if (tokens.length > 1) { best = Math.max(best, paletteField(fq, m.label)); } + if (tokens.length > 1) { + best = Math.max(best, paletteField(fq, m.label)); + // The words side by side in one sentence say more than the same words all over the page. + m.terms.some(function (term) { + if (term.s.indexOf(fq) < 0) { return false; } + best += 1; + item.why = term.text; + item.near = false; + return true; + }); + } return best + bonus; } @@ -4219,7 +4329,7 @@ var href = base + '/' + p.path; if ((p.admin && !admin) || seen[href]) { return; } seen[href] = true; - out.push({ label: label + ' · ' + p.label, href: href, kind: 'repo', terms: p.terms }); + out.push({ label: label + ' · ' + p.label, href: href, kind: 'repo', terms: p.terms, scan: p.admin ? 'repo:' + p.path : '' }); }); } if (current) { add(current.name, current.href, current.admin); } @@ -4237,22 +4347,14 @@ // The destinations to filter: the current repo's tabs first, its other pages, then the fetched list. // The query picks which other repos' pages are worth building. function paletteItems(q) { - var items = [], current = null; - var tabs = document.querySelectorAll('.repo-tabs a'); - if (tabs.length) { - // The first tab is the repo's Code link, so its path starts with owner/name. - var parts = tabs[0].pathname.split('/'); - var repo = parts.length >= 3 ? parts[1] + '/' + parts[2] : ''; - if (repo) { - var admin = false; - Array.prototype.forEach.call(tabs, function (a) { - // Counts sit in a span at the end of the tab ("Issues 3"); the name is the rest. - var name = a.textContent.replace(/\s+/g, ' ').trim().replace(/ \d+$/, ''); - items.push({ label: repo + ' · ' + name, href: a.getAttribute('href') || '', kind: 'repo' }); - if (a.pathname === '/' + repo + '/settings') { admin = true; } - }); - current = { name: repo, href: '/' + repo, admin: admin }; - } + var items = []; + var current = paletteRepoHere(); + if (current) { + Array.prototype.forEach.call(document.querySelectorAll('.repo-tabs a'), function (a) { + // Counts sit in a span at the end of the tab ("Issues 3"); the name is the rest. + var name = a.textContent.replace(/\s+/g, ' ').trim().replace(/ \d+$/, ''); + items.push({ label: current.name + ' · ' + name, href: a.getAttribute('href') || '', kind: 'repo' }); + }); } var known = {}; items.forEach(function (i) { known[i.href] = true; }); @@ -4327,13 +4429,17 @@ var s; if (!pathMode) { s = paletteScore(q, item); } else if (item.label.toLowerCase().indexOf(q) === 0) { s = item.label.length === q.length ? 3.5 : 3; item.why = ''; } - else { s = words && item.kind !== 'file' && item.kind !== 'action' ? paletteScore(words, item) : 0; } + else { s = words && item.kind !== 'file' && item.kind !== 'action' ? Math.min(2.9, paletteScore(words, item)) : 0; } // Above a path match (3), which would otherwise fill the list and cut the actions off. Text typed // after the opening path searches the page's actions by name. if (item.kind === 'action' && idle) { s = 4; } else if (item.kind === 'action' && typed) { var m = paletteScore(typed, item); s = m ? m + 3 : 0; } if (s > 0) { scored.push({ item: item, score: s, idx: idx }); } }); + // A typo is only guessed at when nothing has the letters as typed, or page text would drown the hits. + if (scored.some(function (h) { return !h.item.near; })) { + scored = scored.filter(function (h) { return !h.item.near; }); + } scored.sort(function (a, b) { return b.score - a.score || a.idx - b.idx; }); scored = scored.slice(0, PALETTE_MAX); var kinds = [], groups = {}; @@ -4402,7 +4508,11 @@ if (!r.ok) { throw new Error('status ' + r.status); } return r.json(); }).then(function (json) { - pal.data = { at: Date.now(), items: Array.isArray(json.items) ? json.items : [], pages: Array.isArray(json.repoPages) ? json.repoPages : [] }; + pal.data = { at: Date.now(), items: Array.isArray(json.items) ? json.items : [], pages: Array.isArray(json.repoPages) ? json.repoPages : [], scanKey: json.scanKey || '' }; + pal.data.items.forEach(function (item) { + if (item.kind === 'page' && PALETTE_SCANNED.test(item.href) && item.href.indexOf('#') < 0) { item.scan = item.href; } + }); + paletteScan(); pal.request = null; if (pal.dlg.open) { renderPalette(); } }).catch(function () { @@ -4414,8 +4524,9 @@ // Leaves the palette for a destination. The dialog closes first, then the page loads the same way // a sidebar link does; a link the browser must handle itself goes through location. - function paletteGo(href) { + function paletteGo(href, find) { if (!href) { return; } + pal.find = find || ''; pal.reload = null; pal.dlg.close(); var url = pageUrl(href); @@ -4465,7 +4576,7 @@ // A destructive control is never clicked from here: the palette closes on it, so the reader confirms. function paletteRun(item) { if (!item) { return; } - if (item.kind !== 'action') { paletteGo(item.href); return; } + if (item.kind !== 'action') { paletteGo(item.href, item.why); return; } if (pal.busy) { return; } var el = item.el; // A live update may have replaced the control while the palette was open: use the one there now. diff --git a/crates/forge-web/src/pages/admin_backups.rs b/crates/forge-web/src/pages/admin_backups.rs index 14794ef..2392963 100644 --- a/crates/forge-web/src/pages/admin_backups.rs +++ b/crates/forge-web/src/pages/admin_backups.rs @@ -24,7 +24,7 @@ use crate::live::{Topic, stream_changes}; use crate::pages::admin_users::admin_only; use crate::pages::issues_list::stamp_unix; use crate::state::AppState; -use crate::views::{empty_state, enc, rel_time, shell}; +use crate::views::{enc, rel_time, shell}; /// Runs shown on the page. const RUN_LIMIT: u32 = 20; @@ -137,6 +137,10 @@ async fn backups_view( running: Option, notice: Option, ) -> Result { + let backup_running = + matches!(running, Some(RunKind::Backup)).then(|| g::running_line(lang, RunKind::Backup)); + let fsck_running = + matches!(running, Some(RunKind::Fsck)).then(|| g::running_line(lang, RunKind::Fsck)); Ok(view! {
@@ -148,40 +152,92 @@ async fn backups_view(

(message.as_str())

} -
-

(g::t(lang, K::Settings))

+
if settings.enabled { -
-
(g::t(lang, K::Directory))
(settings.dir.as_str())
-
(g::t(lang, K::BackupInterval))
(settings.interval.as_str())
-
(g::t(lang, K::Retention))
(settings.keep.as_str())
-
(g::t(lang, K::Fsck))
(settings.fsck_interval.as_str())
-
(g::t(lang, K::Healthcheck))
(settings.healthcheck.as_str())
-
+
+ +
+

(g::t(lang, K::Directory))

+

(settings.dir.as_str())

+
+
+
+ +
+

(g::t(lang, K::BackupInterval))

+

(settings.interval.as_str())

+
+
+
+ +
+

(g::t(lang, K::Retention))

+

(settings.keep.as_str())

+
+
+
+ +
+

(g::t(lang, K::Fsck))

+

(settings.fsck_interval.as_str())

+
+
+
+ +
+

(g::t(lang, K::Healthcheck))

+

(settings.healthcheck.as_str())

+
+
} else { -

(g::t(lang, K::ScheduledBackupsOff))

- } - if let Some(kind) = running { -

(g::running_line(lang, kind))

+
+ +
+

(g::t(lang, K::Settings))

+

(g::t(lang, K::ScheduledBackupsOff))

+
+
} -
-
+
+ +
+

(g::kind_name(lang, RunKind::Backup))

+ if let Some(line) = backup_running { +

(line)

+ } +
+ -
+
+
+ +
+

(g::kind_name(lang, RunKind::Fsck))

+ if let Some(line) = fsck_running { +

(line)

+ } +
+
+ if rows.is_empty() { +
+
+ +
+

(g::t(lang, K::NoRunsYet))

+

(g::t(lang, K::BackupsEmptyHint))

+
+
+
+ } else {

(g::t(lang, K::RecentRuns))

- if rows.is_empty() { - empty_state(title: g::t(lang, K::NoRunsYet), hint: Some(g::t(lang, K::BackupsEmptyHint))) { - (g::t(lang, K::RunBackupNow)) - } - } else {
@@ -213,8 +269,8 @@ async fn backups_view(
- }
+ }
}) } diff --git a/crates/forge-web/src/pages/admin_health.rs b/crates/forge-web/src/pages/admin_health.rs index 47076b0..ccc32a4 100644 --- a/crates/forge-web/src/pages/admin_health.rs +++ b/crates/forge-web/src/pages/admin_health.rs @@ -81,17 +81,63 @@ struct Usage { bad: bool, } -/// One fact in the storage card's row of columns. +/// The icon a status row shows. +#[derive(Clone, Copy)] +enum Glyph { + Disk, + Database, + Folder, + Archive, + Queue, + Mail, + Clock, + Sync, +} + +/// The row icon for one glyph: a 24 grid stroke icon, 20px. +#[component] +async fn glyph(kind: Glyph) -> Result { + Ok(view! { + if matches!(kind, Glyph::Disk) { + + } + if matches!(kind, Glyph::Database) { + + } + if matches!(kind, Glyph::Folder) { + + } + if matches!(kind, Glyph::Archive) { + + } + if matches!(kind, Glyph::Queue) { + + } + if matches!(kind, Glyph::Mail) { + + } + if matches!(kind, Glyph::Clock) { + + } + if matches!(kind, Glyph::Sync) { + + } + }) +} + +/// One fact in the storage pane: one row. struct Fact { label: &'static str, + glyph: Glyph, value: String, detail: String, dot: Dot, } -/// One row of the services card. +/// One row of the services pane. struct Service { label: &'static str, + glyph: Glyph, dot: Dot, value: String, detail: String, @@ -258,6 +304,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { let mut facts = vec![Fact { label: at(lang, A::DatabaseFile), + glyph: Glyph::Database, value: db_bytes.map_or_else( || at(lang, A::Unavailable).to_owned(), |b| human_size(lang, b), @@ -267,6 +314,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { }]; facts.push(Fact { label: at(lang, A::Repositories), + glyph: Glyph::Folder, value: counts.repos.to_string(), detail: match repo_bytes { Some(b) => on_disk(lang, &human_size(lang, b)), @@ -281,6 +329,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { let (pct, text) = space(lang, total, avail); Fact { label: at(lang, A::BackupDirectory), + glyph: Glyph::Archive, value: text, detail: backup, dot: if pct >= 90 { Dot::Bad } else { Dot::Neutral }, @@ -288,6 +337,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { } None => Fact { label: at(lang, A::BackupDirectory), + glyph: Glyph::Archive, value: at(lang, A::Unavailable).to_owned(), detail: backup, dot: Dot::Neutral, @@ -296,6 +346,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { } else { Fact { label: at(lang, A::BackupDirectory), + glyph: Glyph::Archive, value: at(lang, A::NotConfigured).to_owned(), detail: String::new(), dot: Dot::Off, @@ -305,6 +356,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { let mut services = vec![ Service { label: at(lang, A::CiQueue), + glyph: Glyph::Queue, dot: Dot::Neutral, value: format!("{} {}", counts.queued_jobs, at(lang, A::QueuedJobs)), detail: format!( @@ -317,6 +369,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { }, Service { label: at(lang, A::MailQueue), + glyph: Glyph::Mail, dot: if failed > 0 { Dot::Bad } else { Dot::Neutral }, value: format!("{pending} {}", at(lang, A::Pending)), detail: format!("{failed} {}", at(lang, A::Failed)), @@ -338,6 +391,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { }; Service { label: at(lang, A::LastBackup), + glyph: Glyph::Clock, dot, value: value.to_owned(), detail: String::new(), @@ -346,6 +400,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { } None if backup_on => Service { label: at(lang, A::LastBackup), + glyph: Glyph::Clock, dot: Dot::Neutral, value: at(lang, A::Never).to_owned(), detail: String::new(), @@ -353,6 +408,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { }, None => Service { label: at(lang, A::LastBackup), + glyph: Glyph::Clock, dot: Dot::Off, value: at(lang, A::NotConfigured).to_owned(), detail: String::new(), @@ -377,6 +433,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { }; Service { label: at(lang, A::Replication), + glyph: Glyph::Sync, dot, value: value.to_owned(), detail: if ok_unix.is_some() { @@ -389,6 +446,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { } None => Service { label: at(lang, A::Replication), + glyph: Glyph::Sync, dot: Dot::Neutral, value: at(lang, A::Never).to_owned(), detail: String::new(), @@ -398,6 +456,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result { } else { Service { label: at(lang, A::Replication), + glyph: Glyph::Sync, dot: Dot::Off, value: at(lang, A::NotConfigured).to_owned(), detail: String::new(), @@ -524,54 +583,50 @@ async fn health_view( (alert_text::settings_link(lang)) } -
-

(at(lang, A::Storage))

- if let Some(u) = usage { -
- (u.used.as_str()) " " (at(lang, A::DiskUsed)) - (u.free_of_total.as_str()) +
+
+ glyph(kind: Glyph::Disk) +
+

(at(lang, A::Storage))

+ if let Some(u) = usage { +

(u.used.as_str()) " " (at(lang, A::DiskUsed)) " · " (u.free_of_total.as_str())

+ +

(u.path.as_str())

+ } else { +

(at(lang, A::Unavailable))

+ }
- -
(u.path.as_str())
- } else { -

(at(lang, A::Unavailable))

- } -
- for f in facts.into_iter() { -
-
(f.label)
-
(f.value.as_str())
+
+ for f in facts.into_iter() { +
+ glyph(kind: f.glyph) +
+

(f.label)

+

(f.value.as_str())

if !f.detail.is_empty() { -
(f.detail.as_str())
+

(f.detail.as_str())

}
- } -
+
+ }
-
-

(at(lang, A::Services))

-
    - for s in services.into_iter() { -
  • - -
    -
    (s.label)
    - if !s.detail.is_empty() || s.stamp.is_some() { -
    - (s.detail.as_str()) - if let Some(stamp) = s.stamp.as_deref() { - if !s.detail.is_empty() { - " · " - } - rel_time(lang: lang, stamp: stamp) - } -
    +
    + for s in services.into_iter() { +
    + glyph(kind: s.glyph) +
    +

    (s.label)

    +

    (s.value.as_str()) + if !s.detail.is_empty() { + " · " (s.detail.as_str()) } -

    -
    (s.value.as_str())
    -
  • - } -
+ if let Some(stamp) = s.stamp.as_deref() { + " · " rel_time(lang: lang, stamp: stamp) + } +

+
+ + }

(meta.as_str())

diff --git a/crates/forge-web/src/pages/admin_mail.rs b/crates/forge-web/src/pages/admin_mail.rs index 99d74bf..9a02bab 100644 --- a/crates/forge-web/src/pages/admin_mail.rs +++ b/crates/forge-web/src/pages/admin_mail.rs @@ -245,28 +245,59 @@ async fn mail_view( // Saved by any admin session: the stream re-renders the settings with the same signal // as the queue (the save bumps it too), and the form keeps what was typed.
-
-

(g::t(lang, K::SmtpServer))

-

(g::t(lang, K::MailTransportNote))

-

(g::t(lang, K::MailTransportInUse)) " " (data.transport)

-
+
+
+ +
+

(g::t(lang, K::SmtpServer))

+

(g::t(lang, K::MailTransportNote))

+

(g::t(lang, K::MailTransportInUse)) " " (data.transport)

+
+
+ - - -
} -
-

(g::t(lang, K::Standby))

+
if data.enabled { -
-
(g::t(lang, K::ReplicationTarget))
(data.target.as_str())
-
(g::t(lang, K::Interval))
(data.interval.as_str())
-
(g::t(lang, K::Healthcheck))
(data.healthcheck)
-
(g::t(lang, K::Database))
(data.db_health)
-
(g::t(lang, K::LastDbSnapshotShipped))
rel_time_or_never(lang: lang, stamp: data.db_last_ok.as_deref())
-
(g::t(lang, K::LastDbAttempt))
rel_time_or_never(lang: lang, stamp: data.db_last_attempt.as_deref())
-
- if !data.db_error.is_empty() { -

(g::t(lang, K::DatabaseErrorPrefix))(data.db_error.as_str())

- } +
+ +
+

(g::t(lang, K::ReplicationTarget))

+

(data.target.as_str())

+
+
+
+ +
+

(g::t(lang, K::Interval))

+

(data.interval.as_str())

+
+
+
+ +
+

(g::t(lang, K::Healthcheck))

+

(data.healthcheck)

+
+
+
+ +
+

(g::t(lang, K::Database))

+

(data.db_health)

+ if !data.db_error.is_empty() { +

(g::t(lang, K::DatabaseErrorPrefix))(data.db_error.as_str())

+ } +
+
+
+ +
+

(g::t(lang, K::LastDbSnapshotShipped))

+

rel_time_or_never(lang: lang, stamp: data.db_last_ok.as_deref())

+
+
+
+ +
+

(g::t(lang, K::LastDbAttempt))

+

rel_time_or_never(lang: lang, stamp: data.db_last_attempt.as_deref())

+
+
} else { -

(g::t(lang, K::ReplicationOff))

+
+ +
+

(g::t(lang, K::Replication))

+

(g::t(lang, K::ReplicationOff))

+
+
} -
- +
+ +
+

(g::t(lang, K::Standby))

+
+
-
-

(g::t(lang, K::Repos))

+
if data.repos.is_empty() { - empty_state(title: g::t(lang, K::NoReposYet), hint: Some(g::t(lang, K::ReposEmptyHint))) { -

(g::t(lang, K::ReplicationConfigHint))

- } +
+ +
+

(g::t(lang, K::NoReposYet))

+

(g::t(lang, K::ReposEmptyHint))

+

(g::t(lang, K::ReplicationConfigHint))

+
+
} else { -
    - for row in data.repos.into_iter() { -
  • -
    -
    - - (row.name.as_str()) -
    -

    (g::t(lang, K::LastSuccess))": " rel_time_or_never(lang: lang, stamp: row.last_ok.as_deref())

    - if !row.error.is_empty() { -

    (row.error.as_str())

    - } -
    - (row.health) -
  • - } -
+ for row in data.repos.into_iter() { +
+ +
+ (row.name.as_str()) +

(row.health) " · " (g::t(lang, K::LastSuccess)) ": " rel_time_or_never(lang: lang, stamp: row.last_ok.as_deref())

+ if !row.error.is_empty() { +

(row.error.as_str())

+ } +
+
+ } }
diff --git a/crates/forge-web/src/pages/admin_runners.rs b/crates/forge-web/src/pages/admin_runners.rs index d83f69a..9c35229 100644 --- a/crates/forge-web/src/pages/admin_runners.rs +++ b/crates/forge-web/src/pages/admin_runners.rs @@ -37,7 +37,7 @@ use crate::pages::ci_runs::{age_text, duration_text, events_response, run_href, use crate::pages::repo_mirrors::stamp_in_tz; use crate::state::AppState; use crate::views::repo_list::{PageLink, pager, pager_links}; -use crate::views::{empty_state, enc, now_unix, relative_time, shell}; +use crate::views::{enc, now_unix, relative_time, shell}; path_param!(runner_id); @@ -345,18 +345,33 @@ async fn runners_view(
(text)
} } -
-
-

(g::t(lang, K::Runners))

- if rows.is_empty() { - empty_state(title: g::t(lang, K::NoRunnersYet), hint: Some(g::t(lang, K::RunnersEmptyHint))) { -
"forge runner register --url  --token  --name  --labels linux,x86_64"
- } - } else { -
-
    - for row in rows.iter() { -
  • +
    +
    + +
    +

    (g::t(lang, K::AddARunner))

    + if rows.is_empty() { +

    (g::t(lang, K::NoRunnersYet))

    + } +
    +
    + (g::t(lang, K::CreateRegistrationToken)) +
    +

    (note.as_str())

    + if rows.is_empty() { +

    (g::t(lang, K::RunnersEmptyHint))

    +
    "forge runner register --url  --token  --name  --labels linux,x86_64"
    + } +
    + + +
    +
    +
    +
    + for row in rows.iter() { +
    +
    @@ -404,22 +419,12 @@ async fn runners_view( confirm_post(lang: lang, csrf: csrf.as_str(), action: row.delete_action.as_str(), label: i18n::t(lang, Key::Delete), message: delete_message(lang, row.name.as_str()), confirm: s(lang, "Yes, delete", "Evet, sil"), danger: true, fields: vec![])
- - } - + } + if !rows.is_empty() { pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang) } -
-

(g::t(lang, K::AddARunner))

-

(note.as_str())

-
- - -
-
- }) } @@ -882,6 +887,7 @@ const TABS: [(&str, &[&str]); 7] = [ ("logs", &[]), ]; +/// The tab's label in the page's own tab row. fn tab_label(lang: Lang, slug: &str) -> &'static str { match slug { "general" => s(lang, "General", "Genel"), @@ -894,17 +900,29 @@ fn tab_label(lang: Lang, slug: &str) -> &'static str { } } -/// The tab slug from `?tab=`; anything unknown is the first tab. +/// The config keys a tab saves. +fn tab_keys(tab: &str) -> Vec<&'static str> { + TABS.iter() + .filter(|(slug, _)| *slug == tab) + .flat_map(|(_, keys)| keys.iter().copied()) + .collect() +} + +/// The tab a name stands for; anything unknown is the first tab. +fn tab_slug(wanted: Option<&str>) -> &'static str { + TABS.iter() + .find(|(slug, _)| Some(*slug) == wanted) + .map_or("general", |(slug, _)| *slug) +} + +/// The tab slug from `?tab=`. fn tab_from_query(cx: &Cx) -> &'static str { let wanted = uri(cx).query().and_then(|query| { form_urlencoded::parse(query.as_bytes()) .find(|(key, _)| key == "tab") .map(|(_, value)| value.into_owned()) }); - TABS.iter() - .map(|(slug, _)| *slug) - .find(|slug| Some(*slug) == wanted.as_deref()) - .unwrap_or("general") + tab_slug(wanted.as_deref()) } /// The human label and the one-line hint of a config field. @@ -1078,12 +1096,9 @@ struct DetailField { } fn detail_fields(lang: Lang, tab: &str, fields: &[FieldRow]) -> Vec { - let keys = TABS - .iter() - .find(|(slug, _)| *slug == tab) - .map_or(&[][..], |(_, keys)| *keys); - keys.iter() - .filter_map(|key| fields.iter().find(|f| f.key == *key)) + tab_keys(tab) + .into_iter() + .filter_map(|key| fields.iter().find(|f| f.key == key)) .map(|f| { let (label, hint) = field_text(lang, f.key); let (kind_label, kind_class) = if f.kind == FieldKind::Live { @@ -1634,7 +1649,7 @@ async fn runner_detail_view( }; let shown = detail_fields(lang, tab, &fields); let identity = identity_rows(lang, &fields); - let editing = !matches!(tab, "identity" | "logs" | "jobs"); + let editing = !matches!(tab, "logs" | "jobs"); let jobs_href = format!("{}?tab=jobs", row.detail_href); let save_action = format!("{}/settings", row.detail_href); let reset_action = row.config_action.clone(); @@ -1766,22 +1781,24 @@ async fn runner_detail_view( (tab_label(lang, slug)) } -
- if editing { -
+ if editing { +
+ -
- for f in shown.iter() { -
-
- + for f in shown.iter() { +
+
+
+ +

(f.hint)

+
+
if f.input == "select" { } -

(f.hint)

if f.has_override { -

- -

+ }
- } -
-
- -
+
+ } + for (i, (label, value)) in identity.iter().enumerate().filter(|_| tab == "identity") { +
+
+ (*label)(g::t(lang, K::SrvKindReadOnly)) + if i == 0 { +

(s(lang, "Set when the runner registered. These cannot be changed from the forge.", "Çalıştırıcı kaydolurken belirlenir. Forge üzerinden değiştirilemez."))

+ } +
+
(value.as_str())
+
+ } + if tab != "identity" { +
+ +
+ }
@@ -1812,7 +1839,10 @@ async fn runner_detail_view(
- } else if tab == "logs" { +
+ } else { +
+ if tab == "logs" { if log.is_empty() {

(s(lang, "No log lines yet. Only a runner from the version that sends its log does so; an older runner sends nothing.", "Henüz günlük satırı yok. Günlüğünü yalnızca bunu destekleyen sürüm gönderir; eski sürüm hiçbir şey göndermez."))

} else { @@ -1870,21 +1900,9 @@ async fn runner_detail_view( } - } else { -

(s(lang, "Set when the runner registered. These cannot be changed from the forge.", "Çalıştırıcı kaydolurken belirlenir. Forge üzerinden değiştirilemez."))

-
- for (label, value) in identity.iter() { -
-
- (*label) - (g::t(lang, K::SrvKindReadOnly)) -
- (value.as_str()) -
- } -
}
+ } }) } @@ -1935,10 +1953,7 @@ async fn runner_save_settings( } let id = path_param::(cx); let state = app_context::(cx); - let tab = TABS - .iter() - .find(|(slug, _)| Some(*slug) == form.get("tab").map(String::as_str)) - .map_or("general", |(slug, _)| *slug); + let tab = tab_slug(form.get("tab").map(String::as_str)); let back = |notice: &str| { see_other(format!( "/admin/runners/{}?tab={tab}¬ice={}", @@ -1950,17 +1965,13 @@ async fn runner_save_settings( return Ok(back_to_list("missing")); }; let current = field_rows(&runner); - let keys = TABS - .iter() - .find(|(slug, _)| *slug == tab) - .map_or(&[][..], |(_, keys)| *keys); let mut saved_live = false; let mut saved_restart = false; - for key in keys { + for key in tab_keys(tab) { let (Some(field), Some(posted), Some(now)) = ( runner_field(key), - form.get(*key), - current.iter().find(|f| f.key == *key), + form.get(key), + current.iter().find(|f| f.key == key), ) else { continue; }; @@ -2037,10 +2048,7 @@ async fn runner_set_config(cx: &Cx, Form(form): Form) -> Result(cx); let back = |notice: &str| { if form.back == "detail" { - let tab = TABS - .iter() - .find(|(slug, _)| *slug == form.tab) - .map_or("general", |(slug, _)| *slug); + let tab = tab_slug(Some(form.tab.as_str())); see_other(format!( "/admin/runners/{}?tab={tab}¬ice={}", enc(id), diff --git a/crates/forge-web/src/pages/admin_server.rs b/crates/forge-web/src/pages/admin_server.rs index 2ad2f76..123309b 100644 --- a/crates/forge-web/src/pages/admin_server.rs +++ b/crates/forge-web/src/pages/admin_server.rs @@ -257,23 +257,34 @@ async fn server_view(

(message.as_str())

} -
+
-
- for r in rows.iter() { -
-
+ for r in rows.iter() { +
+
+ (r.label) (r.kind_label) (r.source_label) if r.pending { (g::t(lang, K::SrvRestartNeeded)) } -
+ + if !r.help.is_empty() { +

(r.help)

+ } + if r.is_secret { +

(r.secret_state) ". " (g::t(lang, K::SrvSecretHint))

+ } + if r.has_override && r.show_file_value { +

(g::t(lang, K::SrvFileValue)) ": " (r.file_value.as_str())

+ } +
+
if r.is_bool { - + } else if r.is_select { } else if r.is_secret { -

(r.secret_state) ". " (g::t(lang, K::SrvSecretHint))

} else if r.fixed { (r.value.as_str()) } else { } - if !r.help.is_empty() { -

(r.help)

- } if r.has_override { -

- if r.show_file_value { - (g::t(lang, K::SrvFileValue)) ": " (r.file_value.as_str()) - } - -

+ }
- } -
+
+ } if any_editable { -
+
} @@ -322,25 +324,31 @@ async fn server_view(
-
-

(s(lang, "Restart server", "Sunucuyu yeniden başlat"))

-

(s(lang, "Stops gracefully and starts again, so a newly installed binary and every setting marked restart needed take effect. Needs a supervisor such as systemd to start it again.", "Düzgünce durdurup yeniden başlatır; böylece yeni kurulan ikili ve \"yeniden başlatma gerekli\" işaretli her ayar devreye girer. Yeniden başlatmak için systemd gibi bir gözetmen gerekir."))

- if restart == Restart::Pending { -

(s(lang, "A restart is in progress.", "Yeniden başlatma sürüyor."))

- } else { -
- (s(lang, "Restart server", "Sunucuyu yeniden başlat")) -
-

(s(lang, "Restart the server now? Requests in flight finish first, and the site is unavailable for a few seconds.", "Sunucu şimdi yeniden başlatılsın mı? Süren istekler önce biter, site birkaç saniye kullanılamaz."))

-
- - - - -
-
-
- } +
+
+ +
+

(s(lang, "Restart server", "Sunucuyu yeniden başlat"))

+

(s(lang, "Stops gracefully and starts again, so a newly installed binary and every setting marked restart needed take effect. Needs a supervisor such as systemd to start it again.", "Düzgünce durdurup yeniden başlatır; böylece yeni kurulan ikili ve \"yeniden başlatma gerekli\" işaretli her ayar devreye girer. Yeniden başlatmak için systemd gibi bir gözetmen gerekir."))

+ if restart == Restart::Pending { +

(s(lang, "A restart is in progress.", "Yeniden başlatma sürüyor."))

+ } +
+ if restart != Restart::Pending { +
+ (s(lang, "Restart server", "Sunucuyu yeniden başlat")) +
+

(s(lang, "Restart the server now? Requests in flight finish first, and the site is unavailable for a few seconds.", "Sunucu şimdi yeniden başlatılsın mı? Süren istekler önce biter, site birkaç saniye kullanılamaz."))

+
+ + + + +
+
+
+ } +
}) @@ -886,7 +894,7 @@ mod tests { // The page offers the button with a confirm step. let page = admin_get(&fx, "/admin/server").await; assert!(page.contains("Restart server")); - assert!(page.contains("confirm-inline")); + assert!(page.contains("/admin/server/restart")); assert!(!page.contains("Restarting...")); let form = format!("csrf={CSRF}&tab=general"); diff --git a/crates/forge-web/src/pages/admin_user_detail.rs b/crates/forge-web/src/pages/admin_user_detail.rs index c3bb945..7b0c3fb 100644 --- a/crates/forge-web/src/pages/admin_user_detail.rs +++ b/crates/forge-web/src/pages/admin_user_detail.rs @@ -193,140 +193,139 @@ async fn detail_body(
(s(lang, "Passkeys", "Geçiş anahtarları"))
(passkey_count.as_str())
- -
-

(g::t(lang, K::CreateAUser))

- if let Some(message) = error { - alert(message: message.as_str()) + for row in rows.into_iter() { +
+ +
+ + if row.linkable { + (row.username.as_str()) + } else { + (row.username.as_str()) + } + +

+ if !row.email.is_empty() { + (row.email.as_str()) " · " + } + (row.role.as_str()) " · " rel_time(lang: lang, stamp: row.created_at.as_str()) +

+
+ if row.deletable { + (i18n::t(lang, Key::Delete)) + } +
} -
- - - - - - -
}) diff --git a/crates/forge-web/src/pages/ci_runs.rs b/crates/forge-web/src/pages/ci_runs.rs index 5fc27d6..ccb935e 100644 --- a/crates/forge-web/src/pages/ci_runs.rs +++ b/crates/forge-web/src/pages/ci_runs.rs @@ -1815,17 +1815,10 @@ fn query_value(cx: &Cx, key: &str) -> Option { .map(|(_, value)| value.into_owned()) } -/// The runs page body. The header (the Run workflow and badge menus, the count) is the list's, and the -/// split view sits in the live region. The selected run is marked in the list and drawn on the right. +/// The runs list: its head with the Run workflow and badge menus, the rows and the pager. The list page +/// and a run's page both keep it at the left, so moving between runs never loses it. #[component] -async fn runs_body( - head: RepoHead, - lang: Lang, - notice: Option<(&'static str, bool)>, - live: Option, - list: ListView, - detail: Option, -) -> Result { +async fn run_side(lang: Lang, list: ListView) -> Result { let ListView { manual, badge, @@ -1837,24 +1830,7 @@ async fn runs_body( page_label, next_scheduled, } = list; - let (fm, fs) = duration_templates(lang); Ok(view! { - repo_head(head: RepoHead { live: String::new(), ..head }) - if let Some((text, is_error)) = notice { - if is_error { - alert(message: text) - } else { -
(text)
- } - } -
-

(g::t(lang, K::Runs)) (total)

@@ -1941,6 +1917,39 @@ async fn runs_body( }
+ }) +} + +/// The runs page body. The header (the Run workflow and badge menus, the count) is the list's, and the +/// split view sits in the live region. The selected run is marked in the list and drawn on the right. +#[component] +async fn runs_body( + head: RepoHead, + lang: Lang, + notice: Option<(&'static str, bool)>, + live: Option, + list: ListView, + detail: Option, +) -> Result { + let (fm, fs) = duration_templates(lang); + Ok(view! { + repo_head(head: RepoHead { live: String::new(), ..head }) + if let Some((text, is_error)) = notice { + if is_error { + alert(message: text) + } else { +
(text)
+ } + } +
+ + run_side(lang: lang, list: list)
if let Some(run) = detail { run_head(lang: lang, run: &run, all_href: None) @@ -2091,7 +2100,7 @@ async fn run_head(lang: Lang, run: &RunDetail, all_href: Option) -> Resu } if let Some(href) = all_href { - (tl::t(lang, TK::AllRuns)) + (tl::t(lang, TK::AllRuns)) }
if let Some(est) = run.est.as_ref() { @@ -2261,6 +2270,7 @@ async fn run_body( bars: Vec, timeline: bool, all_href: String, + list: ListView, ) -> Result { let (fm, fs) = duration_templates(lang); Ok(view! { @@ -2272,7 +2282,16 @@ async fn run_body(
(text)
} } -
+
+ + run_side(lang: lang, list: list) +
run_head(lang: lang, run: &run, all_href: Some(all_href))
run_jobs(lang: lang, run: &run) @@ -2284,6 +2303,7 @@ async fn run_body( history_strip(lang: lang, owner: owner, repo: repo, bars: bars)
+ }) } @@ -2321,7 +2341,7 @@ async fn run_page(cx: &Cx) -> Result { notice, live, page_title, - list: _, + list, detail, } = runs_split(cx, Some(&number), wanted.as_deref()).await?; let Some(run) = detail else { @@ -2335,7 +2355,7 @@ async fn run_page(cx: &Cx) -> Result { let all_href = ci_href(&title_of(&ctx)); Ok(view! { shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(), - run_body(head: head, lang: lang, notice: notice, live: live, run: run, owner: owner, repo: repo, bars: bars, timeline: timeline, all_href: all_href)) + run_body(head: head, lang: lang, notice: notice, live: live, run: run, owner: owner, repo: repo, bars: bars, list: list, timeline: timeline, all_href: all_href)) }) } diff --git a/crates/forge-web/src/pages/ci_tests.rs b/crates/forge-web/src/pages/ci_tests.rs index f40b73e..5d73559 100644 --- a/crates/forge-web/src/pages/ci_tests.rs +++ b/crates/forge-web/src/pages/ci_tests.rs @@ -572,13 +572,13 @@ async fn split_view_draws_the_newest_run_or_the_one_named() { .await .text(); assert!(named.contains(&format!("data-run=\"{}\"", first.number))); - // The run page is the focused view now: it links back to the list, and its one aria-current is the - // selected job, not a run row. + // The run page keeps the list beside it, so the run row and the selected job are both marked. On a + // phone the list gives way to the All runs link. assert!( named.contains(&format!("href=\"{RUN_BASE}\"")), "All runs link" ); - assert_eq!(named.matches("aria-current=\"true\"").count(), 1); + assert_eq!(named.matches("aria-current=\"true\"").count(), 2); // Thirty runs make two pages. Run 1 is on page 2, so page 1 marks no row and draws run 1. for _ in 0..28 { @@ -592,8 +592,9 @@ async fn split_view_draws_the_newest_run_or_the_one_named() { .await .text(); assert!(off_page.contains(&format!("data-run=\"{}\"", first.number))); - // The focused run page draws no run list, so no row can be marked there. - assert!(!off_page.contains("ci-run-list")); + // The list shows the newest page, which does not hold this run: only its selected job is marked. + assert!(off_page.contains("ci-run-list")); + assert_eq!(off_page.matches("aria-current=\"true\"").count(), 1); assert!(off_page.contains(&format!("data-live=\"{RUN_BASE}/events\""))); let rows = get(&fx.app, &format!("{RUN_BASE}?page=2"), tahinli.as_deref()) .await diff --git a/crates/forge-web/src/pages/discussion_settings.rs b/crates/forge-web/src/pages/discussion_settings.rs index 025c234..f813d5c 100644 --- a/crates/forge-web/src/pages/discussion_settings.rs +++ b/crates/forge-web/src/pages/discussion_settings.rs @@ -23,7 +23,8 @@ use crate::views::repo_href; path_param!(owner); path_param!(repo); -/// The settings card with the on/off button. `enabled` is the current state. +/// The settings card: one switch row. `enabled` is the current state. The switch submits the form +/// on change (`data-autosubmit`); an unchecked box sends no `enabled`, which the handler reads as off. #[component] pub(crate) async fn discussions_card( lang: Lang, @@ -32,18 +33,16 @@ pub(crate) async fn discussions_card( enabled: bool, ) -> Result { Ok(view! { -
-

(g::t(lang, K::Discussions))

-

(g::t(lang, K::DiscussionsDescription))

-
+
+ - if enabled { - - - } else { - - - } + + (g::t(lang, K::Discussions)) + (g::t(lang, K::DiscussionsDescription)) + + + +
}) diff --git a/crates/forge-web/src/pages/invites.rs b/crates/forge-web/src/pages/invites.rs index f635bf8..0b02291 100644 --- a/crates/forge-web/src/pages/invites.rs +++ b/crates/forge-web/src/pages/invites.rs @@ -16,6 +16,7 @@ use crate::auth::check_csrf; use crate::i18n::{self, Key, Lang, t}; use crate::mail::account; use crate::pages::admin_users::admin_only; +use crate::pages::passkeys::s; use crate::state::AppState; use crate::views::{alert, shell, user_facing_message}; @@ -44,18 +45,29 @@ async fn invite_body(

(message)

} -
- if let Some(message) = error { - alert(message: message.as_str()) - } -
- - - -
+
+
+ +
+

(s(lang, "Invite by email", "E-posta ile davet et"))

+
+
+ (t(lang, Key::InvitesSubmit)) +
+ if let Some(message) = error { + alert(message: message.as_str()) + } +
+ + + +
+
+
+
}) } diff --git a/crates/forge-web/src/pages/labels_page.rs b/crates/forge-web/src/pages/labels_page.rs index 3074b3e..46cd208 100644 --- a/crates/forge-web/src/pages/labels_page.rs +++ b/crates/forge-web/src/pages/labels_page.rs @@ -22,7 +22,7 @@ use crate::pages::repo::repo_head; use crate::pages::repo_ctx::load_repo; use crate::state::AppState; use crate::views::repo_list::{PageLink, pager, pager_links}; -use crate::views::{empty_state, enc, shell}; +use crate::views::{enc, shell}; path_param!(owner); path_param!(repo); @@ -98,88 +98,99 @@ async fn labels_body( if archived {
(g::t(lang, K::LabelsArchived))
} -
-
+
+ issue_subnav(lang: lang, title: frame.title.clone(), active: "labels".to_owned()) +
+

(g::t(lang, K::Labels))

-
- issue_subnav(lang: lang, title: frame.title.clone(), active: "labels".to_owned()) -
- if empty { - empty_state(title: g::t(lang, K::NoLabelsYet), - if can_triage && !archived { -
+ if can_triage { +
+ +
+

(g::t(lang, K::NewLabel))

+ if empty { +

(g::t(lang, K::NoLabelsYet))

+ } +
+ if empty && !archived { + -
- + + + } +
+ (g::t(lang, K::CreateLabel)) +
+
+ + + + + +
+
+
+
+ } else if empty { +
+ +
+

(g::t(lang, K::NoLabelsYet))

+
+
+ } + for row in rows.iter() { +
+ +
+ (row.name.as_str()) +

+ if !row.description.is_empty() { + (row.description.as_str()) " \u{b7} " + } + (row.open_text.as_str()) +

+
+ if can_triage { +
+ (g::t(lang, K::Edit)) +
+
+ + + + + +
+
+
+ +
} - ) +
} -
-
    - for row in rows.iter() { -
  • - (row.name.as_str()) -

    (row.description.as_str())

    - (row.open_text.as_str()) - if can_triage { -
    - (g::t(lang, K::Edit)) -
    -
    - - - - - -
    -
    - - -
    -
    -
    - } -
  • - } -
-
pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
- if can_triage { -
-

(g::t(lang, K::NewLabel))

-
- - - - -
- -
-
-
- } -
}) } diff --git a/crates/forge-web/src/pages/milestones_page.rs b/crates/forge-web/src/pages/milestones_page.rs index 178c344..4020c94 100644 --- a/crates/forge-web/src/pages/milestones_page.rs +++ b/crates/forge-web/src/pages/milestones_page.rs @@ -26,7 +26,7 @@ use crate::pages::repo_ctx::load_repo; use crate::render::markdown::render_markdown; use crate::state::AppState; use crate::views::repo_list::{PageLink, pager, pager_links}; -use crate::views::{empty_state, enc, shell}; +use crate::views::{enc, shell}; path_param!(owner); path_param!(repo); @@ -133,64 +133,38 @@ async fn milestone_row( let open_text = g::open_milestone_count(lang, row.open); let closed_text = g::closed_milestone_count(lang, row.closed); Ok(view! { -
  • -

    (row.title.as_str())

    -

    - if let Some(due) = row.due.as_deref() { - (g::due_text(lang, due)) - if row.overdue { - " " (g::t(lang, K::Overdue)) +

    + +
    + (row.title.as_str()) +

    + if let Some(due) = row.due.as_deref() { + (g::due_text(lang, due)) + if row.overdue { + " " (g::t(lang, K::Overdue)) + } + } else { + (g::t(lang, K::NoDueDate)) } - } else { - (g::t(lang, K::NoDueDate)) - } -

    - if !row.description_html.is_empty() { -
    (Unescaped::new_unchecked(row.description_html.clone()))
    - } -
    - - + " \u{b7} " + + " " (open_text.as_str()) " \u{b7} " (closed_text.as_str()) - +

    + if !row.description_html.is_empty() { +
    (Unescaped::new_unchecked(row.description_html.clone()))
    + }
    if can_triage { -
    + (g::t(lang, K::Edit)) +
    } -
  • - }) -} - -/// The create form for triage holders. -#[component] -async fn milestone_create_form(lang: Lang, csrf: String, action: String) -> Result { - Ok(view! { -
    -

    (g::t(lang, K::NewMilestone))

    -
    - - - - -
    - -
    -
    -
    + }) } @@ -295,30 +269,55 @@ async fn milestones_body( if frame.archived {
    (g::t(lang, K::MilestonesArchived))
    } -
    -
    -
    - issue_subnav(lang: lang, title: title.clone(), active: "milestones".to_owned()) - state_tabs(lang: lang, title: title.clone(), closed: closed) -
    - if empty { - empty_state(title: empty_text) +
    + issue_subnav(lang: lang, title: title.clone(), active: "milestones".to_owned()) + state_tabs(lang: lang, title: title.clone(), closed: closed) +
    +
    + if can_create { +
    + +
    +

    (g::t(lang, K::NewMilestone))

    + if empty { +

    (empty_text)

    + } +
    +
    + (g::t(lang, K::CreateMilestone)) +
    +
    + + + + + +
    +
    +
    +
    + } else if empty { +
    + +
    +

    (empty_text)

    +
    +
    + } + for row in rows.into_iter() { + milestone_row(lang: lang, row: row, csrf: row_csrf.clone(), can_triage: can_triage) } -
    -
      - for row in rows.into_iter() { - milestone_row(lang: lang, row: row, csrf: row_csrf.clone(), can_triage: can_triage) - } -
    -
    pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
    - if can_create { -
    - milestone_create_form(lang: lang, csrf: csrf.clone(), action: create_action) -
    - } -
    }) } diff --git a/crates/forge-web/src/pages/org_members.rs b/crates/forge-web/src/pages/org_members.rs index 434f4ce..cd089dc 100644 --- a/crates/forge-web/src/pages/org_members.rs +++ b/crates/forge-web/src/pages/org_members.rs @@ -90,85 +90,78 @@ async fn members_body( org_head(name: name.clone(), description: description) org_tabs(lang: lang, name: name, current: "members".to_owned(), repo_count: repo_count, package_count: package_count) org_notice(notice: notice) -
    -
    -
    - - - - - - - - - - for row in rows.iter() { - - - - - +
    + if owner { +
    + +
    +

    (g::t(lang, K::AddMember))

    +

    (g::t(lang, K::OwnersHelp))

    +
    +
    + (g::t(lang, K::AddMemberButton)) +
    +
    + + + + + +
    +
    +
    + } + for row in rows.iter() { +
    + +
    + + + + (row.label.as_str()) + + + if !owner { +

    (if row.is_owner { g::t(lang, K::RoleOwner) } else { g::t(lang, K::RoleMember) })

    } -
    -
    (g::t(lang, K::MemberHeader))(g::t(lang, K::Role))(g::t(lang, K::Remove))
    - - - (row.label.as_str()) - - - if owner { -
    - - - - -
    - } else { - (if row.is_owner { g::t(lang, K::RoleOwner) } else { g::t(lang, K::RoleMember) }) - } -
    - if owner || row.is_self { -
    - "⋯" - -
    - } -
    -
    -
    - if owner { -
    -

    (g::t(lang, K::AddMember))

    -
    - - - -

    (g::t(lang, K::OwnersHelp))

    -
    -
    -
    -
    - } -
    + if owner || row.is_self { +
    + if owner { +
    + + + + +
    + } +
    + "⋯" + +
    +
    + } + + } +
    }) } diff --git a/crates/forge-web/src/pages/org_settings.rs b/crates/forge-web/src/pages/org_settings.rs index d3bed49..86ff480 100644 --- a/crates/forge-web/src/pages/org_settings.rs +++ b/crates/forge-web/src/pages/org_settings.rs @@ -88,80 +88,100 @@ async fn settings_body(
    org_head(name: name, description: description.clone()) org_notice(notice: notice) -
    -
    -

    (g::t(lang, K::Settings))

    -
    - - - - -

    (g::t(lang, K::DefaultRoleHelp))

    - -
    - -
    -
    -
    -
    -
    -

    (t(lang, Key::Avatar))

    - -
    -
    -

    (g::t(lang, K::DeleteOrg))

    -

    (g::t(lang, K::DeleteOrgIntro))

    -
    +
    + + + + + + + +
    + +
    +
    +
    +
    + (t(lang, +
    +

    (t(lang, Key::Avatar))

    +

    (t(lang, Key::AvatarHint))

    +
    +
    +
    - -
    - -
    + + +
    -
    + if has_avatar { +
    + + +
    + } +
    +
    + +
    +
    + +
    +

    (g::t(lang, K::DeleteOrg))

    +

    (g::t(lang, K::DeleteOrgIntro))

    +
    +
    + (g::t(lang, K::DeleteOrg)) +
    +
    + + + +
    +
    +
    -
    + }) } diff --git a/crates/forge-web/src/pages/org_teams.rs b/crates/forge-web/src/pages/org_teams.rs index f7dedb8..735c274 100644 --- a/crates/forge-web/src/pages/org_teams.rs +++ b/crates/forge-web/src/pages/org_teams.rs @@ -24,7 +24,7 @@ use crate::pages::org_ctx::{ }; use crate::pages::passkeys; use crate::state::AppState; -use crate::views::{avatar_url, display_name, empty_state, repo_href, shell}; +use crate::views::{avatar_url, display_name, repo_href, shell}; path_param!(org); path_param!(team); @@ -201,59 +201,61 @@ async fn teams_body( org_head(name: name.clone(), description: description) org_tabs(lang: lang, name: name, current: "teams".to_owned(), repo_count: repo_count, package_count: package_count) org_notice(notice: notice) -
    -
    - if rows.is_empty() { - empty_state(title: g::t(lang, K::NoTeamsYet)) - } else { -
      - for row in rows.iter() { -
    • -
      - (row.name.as_str()) - (g::coverage_text(lang, row.role, row.all_repos)) - if !row.description.is_empty() { - (row.description.as_str()) - } -
      -
    • +
      +
      + +
      +

      (if owner { g::t(lang, K::NewTeam) } else { g::t(lang, K::Teams) })

      +

      (g::t(lang, K::TeamsIntro))

      + if rows.is_empty() { +

      (g::t(lang, K::NoTeamsYet))

      } -
    +
    + if owner { +
    + (g::t(lang, K::CreateTeam)) +
    +
    + + + + + + +
    +
    +
    + } + + for row in rows.iter() { +
    + +
    + (row.name.as_str()) +

    (g::coverage_text(lang, row.role, row.all_repos))

    + if !row.description.is_empty() { +

    (row.description.as_str())

    + } +
    +
    } -

    (g::t(lang, K::TeamsIntro))

    - if owner { -
    -

    (g::t(lang, K::NewTeam))

    -
    - - - - - -
    - -
    -
    -
    - } - }) } @@ -315,130 +317,181 @@ async fn team_body( org_head(name: data.org_name.clone(), description: data.org_description.clone()) org_tabs(lang: lang, name: data.org_name.clone(), current: "teams".to_owned(), repo_count: data.repo_count, package_count: data.package_count) org_notice(notice: notice) -
    -
    -

    (data.team_name.as_str())

    - if has_description { -

    (data.team_description.as_str())

    - } -

    (g::coverage_text(lang, data.team_role, data.team_all_repos))

    +
    +
    + +
    +

    (data.team_name.as_str())

    + if has_description { +

    (data.team_description.as_str())

    + } +

    (g::coverage_text(lang, data.team_role, data.team_all_repos))

    +
    +
    if owner { -
    + - - - + + - -
    - -
    -
    -
    - - -
    + + + +
    + +
    }
    -
    -

    (g::t(lang, K::Members))

    - if data.members.is_empty() { - empty_state(title: g::t(lang, K::NoTeamMembers), +
    +
    + +
    +

    (if owner { g::t(lang, K::AddMember) } else { g::t(lang, K::Members) })

    + if data.members.is_empty() { +

    (g::t(lang, K::NoTeamMembers))

    + } +
    + if owner { +
    + (g::t(lang, K::AddToTeam)) +
    +
    + + + +
    +
    +
    + } +
    + for member in data.members.iter() { +
    + + if owner { - (g::t(lang, K::AddMember)) - }) - } else { -
      - for member in data.members.iter() { -
    • -
      - - - (member.label.as_str()) - +
      + "⋯" + - if owner { -
      - "⋯" - -
      - } -
    • + } -
    - } - if owner { -
    - - - -
    +
    }
    -
    -

    (g::t(lang, K::Repositories))

    - if data.repos.is_empty() { - empty_state(title: g::t(lang, K::NoTeamRepos), - if owner && has_choices { - (g::t(lang, K::LinkRepository)) - }) - } else { -
      - for repo in data.repos.iter() { -
    • -
      - (repo.title.as_str()) +
      +
      + +
      +

      (if owner && has_choices { g::t(lang, K::LinkRepository) } else { g::t(lang, K::Repositories) })

      + if data.repos.is_empty() { +

      (g::t(lang, K::NoTeamRepos))

      + } +
      + if owner && has_choices { + + } +
      + for repo in data.repos.iter() { +
      + + + if owner { +
      + "⋯" + - if owner { -
      - "⋯" - -
      - } -
    • + } -
    - } - if owner && has_choices { - +
    } - + if owner { +
    +
    + +
    +

    (g::t(lang, K::DeleteTeam))

    +
    +
    + + +
    +
    +
    + } }) } diff --git a/crates/forge-web/src/pages/palette.rs b/crates/forge-web/src/pages/palette.rs index cdc0fe6..4146a3e 100644 --- a/crates/forge-web/src/pages/palette.rs +++ b/crates/forge-web/src/pages/palette.rs @@ -6,8 +6,9 @@ //! `views::global_items`, `views::settings_items`, `views::admin_items`), so a page the sidebar or a //! tab bar links to is found here too. Each href is listed once, the first time it appears. //! -//! An item may carry `terms`: what is on that page and other words for it, in both languages, so -//! "password" finds Security. `repoPages` lists the pages of a repo as paths: `assets/nav.js` applies +//! An item may carry `terms`: other words for that page, in both languages, so "2fa" finds Security. +//! What a page itself says needs no listing: the palette reads the pages behind these items, as the +//! viewer, using `scanKey` to know when what it read is out of date. `repoPages` lists the pages of a repo as paths: `assets/nav.js` applies //! them to the current repo, and to a repo named in the query. The palette itself, its typo-tolerant //! matching and keys live in `assets/nav.js`. The actions of the page it is opened on are not listed //! here: a control marked `data-palette-action` is rendered only for a viewer who may use it, and the @@ -413,7 +414,8 @@ async fn palette(cx: &Cx) -> Result { } } - let body = json!({ "items": items, "repoPages": repo_pages(lang) }); + let scan_key = format!("{}:{lang:?}:{}", user.id, forge_ci::build::display()); + let body = json!({ "items": items, "repoPages": repo_pages(lang), "scanKey": scan_key }); let mut response = Response::new(Body::from(body.to_string().into_bytes())); let headers = response.headers_mut(); headers.insert( diff --git a/crates/forge-web/src/pages/passkeys.rs b/crates/forge-web/src/pages/passkeys.rs index 1c9766d..3c6e42b 100644 --- a/crates/forge-web/src/pages/passkeys.rs +++ b/crates/forge-web/src/pages/passkeys.rs @@ -669,33 +669,33 @@ pub async fn passkeys_panel(lang: Lang, csrf: &str, panel: PasskeyPanel) -> Resu let usable = problem.is_none(); let problem_text = problem.map(|why| why.message(lang)); Ok(view! { -
    -
    - -
    -

    +
    +
    + +
    +

    (s(lang, "Passkeys", "Geçiş anahtarları")) (pill_text.as_str())

    if let Some(text) = problem_text { -

    (text)

    +

    (text)

    } else { -

    (s(lang, "Sign in with your fingerprint, face or device PIN. A passkey counts as two factors, so it skips the code step.", "Parmak izi, yüz veya cihaz PIN'inizle giriş yapın. Geçiş anahtarı iki doğrulama sayılır, bu yüzden kod adımı atlanır."))

    +

    (s(lang, "Sign in with your fingerprint, face or device PIN. A passkey counts as two factors, so it skips the code step.", "Parmak izi, yüz veya cihaz PIN'inizle giriş yapın. Geçiş anahtarı iki doğrulama sayılır, bu yüzden kod adımı atlanır."))

    }
    if !items.is_empty() {
      for item in items.into_iter() { -
    • - -
      -

      (item.name.as_str())

      -

      added_status(lang: lang, added: Some(item.created_at.as_str()), used: item.last_used_at.as_deref())

      +
    • + +
      +

      (item.name.as_str())

      +

      added_status(lang: lang, added: Some(item.created_at.as_str()), used: item.last_used_at.as_deref())

      -
      +
      (s(lang, "Rename", "Yeniden adlandır")) -
      +
    } if usable { - +
    - + for row in rows.iter() { +
    + +
    + + if row.label == row.username { + + + (row.label.as_str()) + + } else { + + + (row.label.as_str()) + + } + +
    +
    +
    + + + + +
    +
    + "⋯" + +
    +
    +
    + } + }) } @@ -289,7 +275,7 @@ impl FrameData { } } -/// The page body: repo header with Settings active, the notice, the table, the legend and the add form. +/// The page body: repo header with Settings active, the notice, then the rows pane. #[component] async fn collaborators_body( lang: Lang, @@ -303,6 +289,8 @@ async fn collaborators_body( let add_action = format!("/{}/settings/collaborators/add", frame.title); let header = frame.head; let nav_title = frame.title.clone(); + // A refused add (or role change) reopens the add panel; a missing collaborator does not. + let add_open = matches!(notice, Some((key, true)) if !matches!(key, K::NotCollaborator)); let notice = notice.map(|(key, is_error)| (g::t(lang, key), is_error)); let can_delete = header.can_delete; Ok(view! { @@ -315,18 +303,8 @@ async fn collaborators_body(
    (text)
    } } -
    -
    -

    (g::t(lang, K::Collaborators))

    -

    (g::t(lang, K::CollaboratorsHelp))

    - collaborators_table(lang: lang, rows: rows, role_action: role_action, - remove_action: remove_action, csrf: csrf.clone()) -
    -
    - add_form(lang: lang, add_action: add_action, csrf: csrf) -
    - role_legend(lang: lang) -
    + collaborators_pane(lang: lang, rows: rows, role_action: role_action, + remove_action: remove_action, add_action: add_action, csrf: csrf, add_open: add_open) ) }) } diff --git a/crates/forge-web/src/pages/repo_mirrors.rs b/crates/forge-web/src/pages/repo_mirrors.rs index 1442a1e..706f344 100644 --- a/crates/forge-web/src/pages/repo_mirrors.rs +++ b/crates/forge-web/src/pages/repo_mirrors.rs @@ -37,7 +37,7 @@ use crate::pages::repo_settings::settings_frame; use crate::pages::repo_settings_live::settings_head; use crate::state::AppState; use crate::views::{ - alert, empty_state, enc, now_unix, rel_time_or_never, relative_time, shell, user_facing_message, + alert, enc, now_unix, rel_time_or_never, relative_time, shell, user_facing_message, }; use crate::webhooks::client::{WebhookPolicy, validate_url}; @@ -497,6 +497,8 @@ async fn mirror_form( }) } +/// The add rows (pull, then push), then one row per mirror. Each add row opens its form in place. +/// Archived repos show no add rows. #[component] async fn mirrors_list_body( head: RepoHead, @@ -510,79 +512,100 @@ async fn mirrors_list_body( lang: Lang, ) -> Result { let add_action = mirrors_href(&title); + let empty = rows.is_empty(); let can_pull = pull_form.is_some(); + let pull_open = pull_form.as_ref().is_some_and(|pull| pull.error.is_some()); + let push_open = draft.error.is_some(); Ok(view! { frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, -
    -
    -

    (g::t(lang, K::Mirrors))

    -

    (g::t(lang, K::MirrorsIntro))

    - if rows.is_empty() { - empty_state(title: g::t(lang, K::NoMirrors), - if !archived { - if can_pull { - (g::t(lang, K::AddPullMirror)) - } - (g::t(lang, K::AddPushMirror)) - }) - } else { -
      - for row in rows.iter() { -
    • -
      - -

      - (row.direction)" · "(row.interval.as_str()) - if !row.enabled { - " · "(adm::t(lang, adm::K::Disabled)) - } - " · " - if row.last_sync_at.is_empty() { - (g::t(lang, K::StatusNotRun)) - } else { - (row.sync_prefix)(row.sync_suffix) - } -

      - if !row.error.is_empty() { -
      - (g::t(lang, K::ErrorLabel)) -
      (row.error.as_str())
      -
      - } -
      - if !archived { -
      - - -
      - } -
    • - } -
    - } -
    +
    if !archived { if let Some(pull) = pull_form { -
    -

    (g::t(lang, K::AddPullMirror))

    -

    (g::t(lang, K::AddPullIntro))

    - mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: true, current_url: String::new(), - url: pull.url, username: pull.username, has_secret: false, interval: pull.interval, - enabled: None, error: pull.error, submit: g::t(lang, K::AddPullMirror), direction: "pull", lang: lang) -
    +
    + +
    +

    (g::t(lang, K::AddPullMirror))

    +

    (g::t(lang, K::MirrorsIntro))

    + if empty { +

    (g::t(lang, K::NoMirrors))

    + } else { +

    (g::t(lang, K::AddPullIntro))

    + } +
    +
    + (g::t(lang, K::AddPullMirror)) +
    + mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: true, current_url: String::new(), + url: pull.url, username: pull.username, has_secret: false, interval: pull.interval, + enabled: None, error: pull.error, submit: g::t(lang, K::AddPullMirror), direction: "pull", lang: lang) +
    +
    +
    } -
    -

    (g::t(lang, K::AddPushMirror))

    -

    (g::t(lang, K::AddPushIntro))

    - mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: false, current_url: String::new(), - url: draft.url, username: draft.username, has_secret: false, interval: draft.interval, - enabled: None, error: draft.error, submit: g::t(lang, K::AddPushMirror), direction: "", lang: lang) -
    +
    + +
    +

    (g::t(lang, K::AddPushMirror))

    + if empty && !can_pull { +

    (g::t(lang, K::NoMirrors))

    + } else { +

    (g::t(lang, K::AddPushIntro))

    + } +
    +
    + (g::t(lang, K::AddPushMirror)) +
    + mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: false, current_url: String::new(), + url: draft.url, username: draft.username, has_secret: false, interval: draft.interval, + enabled: None, error: draft.error, submit: g::t(lang, K::AddPushMirror), direction: "", lang: lang) +
    +
    +
    } -
    + if archived && empty { +
    + +
    +

    (g::t(lang, K::NoMirrors))

    +
    +
    + } + for row in rows.iter() { +
    + +
    + + + (row.url.as_str()) + +

    + (row.direction)" · "(row.interval.as_str()) + if !row.enabled { + " · "(adm::t(lang, adm::K::Disabled)) + } + " · " + if row.last_sync_at.is_empty() { + (g::t(lang, K::StatusNotRun)) + } else { + (row.sync_prefix)(row.sync_suffix) + } +

    + if !row.error.is_empty() { +
    + (g::t(lang, K::ErrorLabel)) +
    (row.error.as_str())
    +
    + } +
    + if !archived { +
    + + +
    + } +
    + } + ) }) } @@ -1268,10 +1291,7 @@ mod tests { let (status, _, body) = send(&app, "GET", "/tahinli/proj/settings/mirrors", &cookie, &[]).await; assert_eq!(status, 200, "{body}"); - assert!( - body.contains("

    Yansılar

    "), - "Turkish heading missing" - ); + assert!(body.contains("Yansılar"), "Turkish title missing"); } /// The push form refuses a loopback destination and stores nothing, then adds a good mirror diff --git a/crates/forge-web/src/pages/repo_rename.rs b/crates/forge-web/src/pages/repo_rename.rs index 17960f6..51a525b 100644 --- a/crates/forge-web/src/pages/repo_rename.rs +++ b/crates/forge-web/src/pages/repo_rename.rs @@ -118,50 +118,69 @@ async fn rename_body( transfer_owner, transfer_error, } = forms; + // A form whose submit was refused opens in place, so its message is visible. + let rename_open = rename_error.is_some(); + let transfer_open = transfer_error.is_some(); Ok(view! { repo_head(head: head) settings_frame(lang: lang, title: nav_title, current: "rename", can_delete: can_delete, if let Some(key) = notice {
    (g::t(lang, key))
    } -
    -

    (g::t(lang, K::RenameRepo))

    -

    (g::t(lang, K::RenameHelp))

    -
    - if let Some(message) = rename_error { - alert(message: message.as_str()) - } - - -
    - +
    +
    + +
    +

    (g::t(lang, K::RenameRepo))

    +

    (g::t(lang, K::RenameHelp))

    - +
    + (g::t(lang, K::RenameRepo)) +
    + if let Some(message) = rename_error { + alert(message: message.as_str()) + } +
    + + + +
    +
    +
    +
    if can_delete { -
    -

    (g::t(lang, K::TransferRepo))

    -

    (g::t(lang, K::TransferHelp))(g::t(lang, K::PendingTransfers))

    -
    - if let Some(message) = transfer_error { - alert(message: message.as_str()) - } - - - -
    - +
    +
    + +
    +

    (g::t(lang, K::TransferRepo))

    +

    (g::t(lang, K::TransferHelp))(g::t(lang, K::PendingTransfers))

    - +
    + (g::t(lang, K::TransferRepo)) +
    + if let Some(message) = transfer_error { + alert(message: message.as_str()) + } +
    + + + + +
    +
    +
    +
    } ) diff --git a/crates/forge-web/src/pages/repo_secrets.rs b/crates/forge-web/src/pages/repo_secrets.rs index 339bdca..abc95a5 100644 --- a/crates/forge-web/src/pages/repo_secrets.rs +++ b/crates/forge-web/src/pages/repo_secrets.rs @@ -23,7 +23,7 @@ use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; use crate::pages::repo_settings::settings_frame; use crate::pages::repo_settings_live::settings_head; use crate::state::AppState; -use crate::views::{alert, empty_state, enc, rel_time, shell}; +use crate::views::{alert, enc, rel_time, shell}; path_param!(owner); path_param!(repo); @@ -177,8 +177,8 @@ async fn frame_top( }) } -/// The list, the add form and the delete buttons. `draft_name` and `error` come from a refused add; -/// the value is never passed back, so the textarea is always empty. +/// The add row, then one row per secret with its delete button. Archived repos show no add row. +/// `draft_name` and `error` come from a refused add; the value is never passed back, so the textarea is always empty. #[component] async fn secrets_body( lang: Lang, @@ -193,74 +193,73 @@ async fn secrets_body( ) -> Result { let set_action = secrets_href(&title); let delete_action = format!("{set_action}/delete"); + let add_open = error.is_some(); Ok(view! { frame_top(lang: lang, head: head, title: title.clone(), notice: notice, archived: archived, -
    -
    -

    (g::t(lang, K::Secrets))

    -

    (g::t(lang, K::SecretsHelp))

    - if rows.is_empty() { - empty_state(title: g::t(lang, K::NoSecrets), - if !archived { - (g::t(lang, K::AddOrUpdate)) - }) - } else { -
    - - - - - - - - - - for row in rows.iter() { - - - - - - } - -
    (g::t(lang, K::Name))(g::t(lang, K::LastUpdated))
    (row.name.as_str())rel_time(lang: lang, stamp: row.updated_at.as_str()) - if !archived { -
    - - - -
    - } -
    -
    - } -
    +
    if !archived { -
    -

    (g::t(lang, K::AddOrUpdate))

    - if let Some(message) = error { - - } -
    - - - -

    (g::t(lang, K::SecretLimits))

    -
    - +
    + +
    +

    (g::t(lang, K::AddOrUpdate))

    + if rows.is_empty() { +

    (g::t(lang, K::NoSecrets))

    + } else { +

    (g::t(lang, K::SecretsHelp))

    + } +
    +
    + (g::t(lang, K::SaveSecret)) +
    + if let Some(message) = error { + + } + + + + +

    (g::t(lang, K::SecretLimits))

    +
    + +
    +
    - -
    + +
    + } + if archived && rows.is_empty() { +
    + +
    +

    (g::t(lang, K::NoSecrets))

    +
    +
    + } + for row in rows.iter() { +
    + +
    + (row.name.as_str()) +

    rel_time(lang: lang, stamp: row.updated_at.as_str())

    +
    + if !archived { +
    + + + +
    + } +
    } -
    +
    ) }) } diff --git a/crates/forge-web/src/pages/repo_security.rs b/crates/forge-web/src/pages/repo_security.rs index 3dcbad2..e1ecb24 100644 --- a/crates/forge-web/src/pages/repo_security.rs +++ b/crates/forge-web/src/pages/repo_security.rs @@ -23,7 +23,7 @@ use crate::pages::repo::repo_head; use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; use crate::pages::repo_settings_live::security_live_url; use crate::state::AppState; -use crate::views::{empty_state, rel_time, shell}; +use crate::views::{rel_time, shell}; path_param!(owner); path_param!(repo); @@ -121,73 +121,54 @@ async fn security_body( let open_count = rows.iter().filter(|r| r.open).count(); Ok(view! { repo_head(head: head) -
    -
    -

    (i18n::t(lang, Key::Security))

    - if !enabled { -

    (g::t(lang, K::SecurityOff))

    - } else { -

    (g::dependencies_summary(lang, dependencies, open_count))

    -

    (g::t(lang, K::LockfilesRead))

    - } +
    +
    + +
    +

    (i18n::t(lang, Key::Security))

    + if !enabled { +

    (g::t(lang, K::SecurityOff))

    + } else { +

    (g::dependencies_summary(lang, dependencies, open_count))

    +

    (g::t(lang, K::LockfilesRead))

    + } + if rows.is_empty() { +

    (g::t(lang, K::NoAlerts))

    + } +
    -
    - if rows.is_empty() { - empty_state(title: g::t(lang, K::NoAlerts)) - } else { -
    - - - - - - - - - - - - - - - for row in rows.iter() { - - - - - - - - - - - } - -
    (g::t(lang, K::ColAdvisory))(g::t(lang, K::ColPackage))(g::t(lang, K::ColVersion))(g::t(lang, K::ColSeverity))(g::t(lang, K::ColSummary))(g::t(lang, K::ColState))(g::t(lang, K::ColOpened))
    (row.advisory.as_str())(row.package.as_str())(row.version.as_str())(row.severity.as_str())(row.summary.as_str())(row.state_text)rel_time(lang: lang, stamp: row.created_at.as_str()) - if row.open { -
    - - - - - - -
    - } - if row.dismissed { -
    - - - - - - -
    - } -
    + for row in rows.iter() { +
    + +
    + (row.advisory.as_str()) +

    + (row.package.as_str()) " " (row.version.as_str()) " · " (row.severity.as_str()) " · " (row.state_text) " · " rel_time(lang: lang, stamp: row.created_at.as_str()) +

    +

    (row.summary.as_str())

    +
    + if row.open { +
    + + + + + + +
    + } + if row.dismissed { +
    + + + + + + +
    + }
    } -
    }) } diff --git a/crates/forge-web/src/pages/repo_settings.rs b/crates/forge-web/src/pages/repo_settings.rs index 31ea5ad..f5e3e33 100644 --- a/crates/forge-web/src/pages/repo_settings.rs +++ b/crates/forge-web/src/pages/repo_settings.rs @@ -270,22 +270,34 @@ async fn danger_zone( error: Option, ) -> Result { let action = format!("/{title}/settings/delete"); + let open = error.is_some(); Ok(view! { -
    -

    (g::t(lang, K::DangerZone))

    -

    (g::t(lang, K::DeleteRepoHelp))

    -

    (g::t(lang, K::DeleteTrashHelp))

    - if let Some(message) = error { - alert(message: message.as_str()) - } -
    - - - -
    +
    +

    (g::t(lang, K::DangerZone))

    +
    + +
    +

    (g::t(lang, K::DeleteRepo))

    +

    (g::t(lang, K::DeleteRepoHelp))

    +

    (g::t(lang, K::DeleteTrashHelp))

    +
    +
    + (g::t(lang, K::DeleteRepo)) +
    + if let Some(message) = error { + alert(message: message.as_str()) + } +
    + + + +
    +
    +
    +
    }) } @@ -428,87 +440,95 @@ async fn general_section( }) .collect(); Ok(view! { -
    -

    (g::t(lang, K::General))

    -
    - -
    + } +
    + + +
    + -
      -
    • -
      -

      (g::t(lang, K::VisibilityHeading))

      -

      (current_visibility)

      -
      -
      -
      - (flip_label) -
      -

      (flip_confirm)

      -
      - - - - - -
      -
      -
      -
      -
    • -
    • -
      -

      (g::t(lang, K::ArchiveHeading))

      - if archived { -

      (g::t(lang, K::ArchivedHelp))

      - } else { -

      (g::t(lang, K::ArchiveHelp))

      - } +
      +
      + +
      +

      (g::t(lang, K::VisibilityHeading))

      +

      (current_visibility)

      +
      +
      + (flip_label) +
      +

      (flip_confirm)

      +
      + + + + + +
      -
      - if archived { -
      +
      +
      +
      + +
      +

      (g::t(lang, K::ArchiveHeading))

      + if archived { +

      (g::t(lang, K::ArchivedHelp))

      + } else { +

      (g::t(lang, K::ArchiveHelp))

      + } +
      + if archived { + + + + + + } else { +
      + (g::t(lang, K::ArchiveRepo)) +
      +

      (g::t(lang, K::ArchiveConfirm))

      +
      - - + + +
      - } else { -
      - (g::t(lang, K::ArchiveRepo)) -
      -

      (g::t(lang, K::ArchiveConfirm))

      -
      - - - - -
      -
      -
      - } -
      -
    • -
    +
    + + } +
    }) } @@ -601,7 +621,7 @@ struct RuleCard { draft: RuleDraft, } -/// One switch row: a title with an optional muted line under it, and a toggle on the right. +/// One rule option as a row: a title with an optional muted line under it, and a toggle on the right. #[component] async fn switch_row( name: String, @@ -610,14 +630,16 @@ async fn switch_row( description: Option, ) -> Result { Ok(view! { -

    }) } @@ -445,53 +447,83 @@ async fn appearance_body(page: AppearancePage) -> Result {

    (g::t(lang, K::Appearance))

    -
    - + -
    - +
    + + (g::t(lang, K::SoundPassed)) + (g::t(lang, K::SoundPassedNote)) + + + +
    -
    - (colours) +
    + + (g::t(lang, K::SoundFailed)) + (g::t(lang, K::SoundFailedNote)) + + + + +
    +

    (g::t(lang, K::SoundOwnRuns)) " · " (g::t(lang, K::SoundFootOwn))

    +
    + (colours)
    for choice in tabs.into_iter() {
    -
    -

    (g::t(lang, K::SoundOwnRuns)) " · " (g::t(lang, K::SoundFootOwn))

    -
    - (g::t(lang, K::SoundPassed)) (g::t(lang, K::SoundPassedNote)) - -
    -
    - (g::t(lang, K::SoundFailed)) (g::t(lang, K::SoundFailedNote)) - -
    -
    -
    }) } diff --git a/crates/forge-web/src/pages/settings_export.rs b/crates/forge-web/src/pages/settings_export.rs index 362215b..fdcc711 100644 --- a/crates/forge-web/src/pages/settings_export.rs +++ b/crates/forge-web/src/pages/settings_export.rs @@ -66,48 +66,56 @@ async fn export_view(lang: Lang, csrf: &str, exports: Vec) -> Result

    (g::t(lang, K::ExportTitle))

    -
    -

    (g::t(lang, K::ExportIntro))

    -

    (g::t(lang, K::ExportContents))

    -

    (g::t(lang, K::ExportEmailNote)) " " (ttl_note.as_str())

    -
    - csrf_field(token: csrf) - -
    -
    -
    +
    +
    + +
    +

    (crate::pages::passkeys::s(lang, "Archive", "Arşiv"))

    +

    (g::t(lang, K::ExportIntro))

    +

    (g::t(lang, K::ExportContents))

    +

    (g::t(lang, K::ExportEmailNote)) " " (ttl_note.as_str())

    +
    +
    + csrf_field(token: csrf) + +
    +
    if empty { -

    (g::t(lang, K::ExportNone))

    - } else { -
      - for export in exports.iter() { -
    • -
      - (g::t(lang, K::ExportRequested)) " " rel_time(lang: lang, stamp: export.created_at.as_str()) - if export.state == ExportState::Ready { - - (g::t(lang, K::ExportSize)) ": " (human_size(lang, u64::try_from(export.size).unwrap_or(0))) - " · " (g::expires_label(lang)) " " rel_time(lang: lang, stamp: export.expires_at.as_str()) - - } -
      - if export.state == ExportState::Ready { - (g::t(lang, K::ExportReady)) - (g::t(lang, K::ExportDownload)) - } - if export.state == ExportState::Building { - (g::t(lang, K::ExportBuilding)) - - } - if export.state == ExportState::Failed { - (g::t(lang, K::ExportFailed)) - } -
    • +
      +
      +

      (g::t(lang, K::ExportNone))

      +
      +
      + } + for export in exports.iter() { +
      + +
      + (g::t(lang, K::ExportRequested)) " " rel_time(lang: lang, stamp: export.created_at.as_str()) + if export.state == ExportState::Ready { +

      + (g::t(lang, K::ExportSize)) ": " (human_size(lang, u64::try_from(export.size).unwrap_or(0))) + " · " (g::expires_label(lang)) " " rel_time(lang: lang, stamp: export.expires_at.as_str()) +

      + } + if export.state == ExportState::Building { + + } if let Some(message) = export.error.as_ref() { -
    • alert(message: message.as_str())
    • + alert(message: message.as_str()) } +
      + if export.state == ExportState::Ready { + (g::t(lang, K::ExportReady)) + (g::t(lang, K::ExportDownload)) + } + if export.state == ExportState::Building { + (g::t(lang, K::ExportBuilding)) + } + if export.state == ExportState::Failed { + (g::t(lang, K::ExportFailed)) } -
    +
    }
    diff --git a/crates/forge-web/src/pages/settings_gpg.rs b/crates/forge-web/src/pages/settings_gpg.rs index 7a381a9..4a2eec4 100644 --- a/crates/forge-web/src/pages/settings_gpg.rs +++ b/crates/forge-web/src/pages/settings_gpg.rs @@ -16,7 +16,7 @@ use crate::auth::{require_csrf, require_user}; use crate::i18n::{self, Key, Lang, t}; use crate::signatures; use crate::state::AppState; -use crate::views::{added_status, alert, empty_state, shell, user_facing_message}; +use crate::views::{added_status, alert, shell, user_facing_message}; #[derive(Deserialize)] struct AddKeyForm { @@ -50,44 +50,48 @@ async fn gpg_view( if !available {

    (t(lang, Key::GpgUnavailable))

    } -
    - if keys.is_empty() { - empty_state(title: t(lang, Key::NoGpgKeys), - (t(lang, Key::AddGpgKeyTitle))) - } else { -
      - for key in keys.into_iter() { -
    • -
      - (key.fingerprint.clone()) - (key.emails.join(", ")) - added_status(lang: lang, added: Some(key.created_at.as_str()), used: None) -
      -
      - - - -
      -
    • +
      +
      + +
      +

      (t(lang, Key::AddGpgKeyTitle))

      + if keys.is_empty() { +

      (t(lang, Key::NoGpgKeys))

      } -
    +
    +
    + (t(lang, Key::AddKeyButton)) +
    + if let Some(message) = error { + alert(message: message.as_str()) + } +
    + + + +
    +
    +
    + + for key in keys.into_iter() { +
    + +
    + (key.fingerprint.clone()) +

    (key.emails.join(", ")) " · " added_status(lang: lang, added: Some(key.created_at.as_str()), used: None)

    +
    +
    + + + +
    +
    } -
    -

    (t(lang, Key::AddGpgKeyTitle))

    - if let Some(message) = error { - alert(message: message.as_str()) - } -
    - - - -
    -
    }) } diff --git a/crates/forge-web/src/pages/settings_keys.rs b/crates/forge-web/src/pages/settings_keys.rs index b3e3844..6783e88 100644 --- a/crates/forge-web/src/pages/settings_keys.rs +++ b/crates/forge-web/src/pages/settings_keys.rs @@ -15,7 +15,7 @@ use crate::audit::{self, Actor, Target}; use crate::auth::{require_csrf, require_user}; use crate::i18n::{self, Key, Lang, t, unsupported_key_type}; use crate::state::AppState; -use crate::views::{added_status, alert, empty_state, shell, user_facing_message}; +use crate::views::{added_status, alert, shell, user_facing_message}; /// Algorithms accepted for web-registered keys. `ssh-rsa` is rejected with its own message. const ACCEPTED: &[&str] = &[ @@ -147,49 +147,54 @@ async fn keys_view(

    (t(lang, Key::SshKeys))

    -
    - if keys.is_empty() { - empty_state(title: t(lang, Key::NoSshKeys), - (t(lang, Key::AddSshKeyTitle))) - } else { -
      - for key in keys.into_iter() { -
    • -
      - (key.title.clone()) - (key.algorithm.clone()) - (key.fingerprint.clone()) - added_status(lang: lang, added: Some(key.created_at.as_str()), used: key.last_used_at.as_deref()) -
      -
      - - - -
      -
    • +
      +
      + +
      +

      (t(lang, Key::AddSshKeyTitle))

      + if keys.is_empty() { +

      (t(lang, Key::NoSshKeys))

      + } else { +

      (t(lang, Key::PublicKeyHint))

      } -
    + +
    + (t(lang, Key::AddKeyButton)) +
    + if let Some(message) = error { + alert(message: message.as_str()) + } +
    + + + + +
    +
    +
    + + for key in keys.into_iter() { +
    + +
    + (key.title.clone()) +

    (key.fingerprint.clone()) " · " (key.algorithm.clone()) " · " added_status(lang: lang, added: Some(key.created_at.as_str()), used: key.last_used_at.as_deref())

    +
    +
    + + + +
    +
    }
    -
    -

    (t(lang, Key::AddSshKeyTitle))

    - if let Some(message) = error { - alert(message: message.as_str()) - } -
    - - - - -
    -
    }) } diff --git a/crates/forge-web/src/pages/settings_notifications.rs b/crates/forge-web/src/pages/settings_notifications.rs index c3ac040..75ea9bd 100644 --- a/crates/forge-web/src/pages/settings_notifications.rs +++ b/crates/forge-web/src/pages/settings_notifications.rs @@ -18,7 +18,7 @@ use crate::auth::{require_csrf, require_user}; use crate::i18n::push as push_text; use crate::i18n::{self, Key, Lang, t}; use crate::state::AppState; -use crate::views::{csrf_field, empty_state, rel_time, shell}; +use crate::views::{csrf_field, rel_time, shell}; #[query_params(error = bad_request)] struct NotificationsQuery { @@ -78,78 +78,96 @@ async fn notifications_body(page: NotificationsPage) -> Result {

    (message.as_str())

    } -
    -
    +
    + -
    - - (t(lang, Key::EmailNotifyHelp)) -
    - if let Some(message) = server_note { -

    (message)

    - } - if let Some(message) = unverified_note { -

    (message)

    - } - + + if let Some(message) = server_note { +

    (message)

    + } + if let Some(message) = unverified_note { +

    (message)

    + } +
    -
    -

    (push_text::t(lang, push_text::K::DeviceHeading))

    - (push_text::t(lang, push_text::K::DeviceHelp)) +
    +
    + +
    +

    (push_text::t(lang, push_text::K::DeviceHeading))

    +

    (push_text::t(lang, push_text::K::DeviceHelp))

    + + +
    +
    + + +
    +
    - - -
    - - -
    -
    + csrf_field(token: csrf.as_str()) - - if !can_test { - (push_text::t(lang, push_text::K::TestNoDevices)) - } + +
    +

    (push_text::t(lang, push_text::K::SendTest))

    + if !can_test { +

    (push_text::t(lang, push_text::K::TestNoDevices))

    + } +
    +
    + +
    -
    -

    (push_text::t(lang, push_text::K::DevicesHeading))

    - if devices.is_empty() { - empty_state(title: push_text::t(lang, push_text::K::DevicesEmpty)) +
    +
    + +
    +

    (push_text::t(lang, push_text::K::DevicesHeading))

    + if devices.is_empty() { +

    (push_text::t(lang, push_text::K::DevicesEmpty))

    + } +
    +
    + for device in devices.into_iter() { +
    + +
    + (device.agent_label.as_str()) +

    (push_text::added_label(lang)) " " rel_time(lang: lang, stamp: device.created_at.as_str())

    +

    + if let Some(stamp) = device.last_success_at.as_deref() { + (push_text::last_delivered_label(lang)) " " rel_time(lang: lang, stamp: stamp) + } else { + (push_text::t(lang, push_text::K::NeverDelivered)) + } +

    +
    +
    + csrf_field(token: csrf.as_str()) + + +
    +
    } -
      - for device in devices.into_iter() { -
    • -
      - (device.agent_label.as_str()) - (push_text::added_label(lang)) " " rel_time(lang: lang, stamp: device.created_at.as_str()) - - if let Some(stamp) = device.last_success_at.as_deref() { - (push_text::last_delivered_label(lang)) " " rel_time(lang: lang, stamp: stamp) - } else { - (push_text::t(lang, push_text::K::NeverDelivered)) - } - -
      -
      - csrf_field(token: csrf.as_str()) - - -
      -
    • - } -
    }) diff --git a/crates/forge-web/src/pages/settings_profile.rs b/crates/forge-web/src/pages/settings_profile.rs index b93b8d8..b4b0381 100644 --- a/crates/forge-web/src/pages/settings_profile.rs +++ b/crates/forge-web/src/pages/settings_profile.rs @@ -147,75 +147,89 @@ async fn profile_body(page: ProfilePage) -> Result {

    (message)

    } -
    -
    - -
    - - - (t(lang, Key::DisplayNameHint)) - if let Some(message) = errors.display_name { +
    +
    + (t(lang, +
    +

    (t(lang, Key::Avatar))

    +

    (t(lang, Key::AvatarHint))

    + if let Some(message) = errors.avatar { alert(message: message.as_str()) }
    -
    - - - (t(lang, Key::UsernameHint)) - if let Some(message) = errors.username { - alert(message: message.as_str()) - } -
    -
    - - - (t(lang, Key::AboutHint)) - if let Some(message) = errors.about { - alert(message: message.as_str()) +
    + + + + + + + if has_avatar { +
    + + +
    }
    -
    - - + + + if let Some(message) = errors.display_name { + alert(message: message.as_str()) + } + + if let Some(message) = errors.username { + alert(message: message.as_str()) + } + + if let Some(message) = errors.about { + alert(message: message.as_str()) + } +
    -
    - -
    - - -
    + + + if let Some(message) = errors.timezone { + alert(message: message.as_str()) + } +
    + +
    +
    }) } diff --git a/crates/forge-web/src/pages/settings_security.rs b/crates/forge-web/src/pages/settings_security.rs index abd60a4..49bfe47 100644 --- a/crates/forge-web/src/pages/settings_security.rs +++ b/crates/forge-web/src/pages/settings_security.rs @@ -209,8 +209,8 @@ async fn security_body(page: SecurityPage) -> Result { } = page; let two_factor_on = two_factor.is_some(); let codes_class = match &two_factor { - Some(device) if device.codes_low => "security-row-status warn", - _ => "security-row-status", + Some(device) if device.codes_low => "row-status warn", + _ => "row-status", }; let password_open = password_error.is_some(); let email_open = email_error.is_some(); @@ -260,18 +260,18 @@ async fn security_body(page: SecurityPage) -> Result {

    } -
    -
    - -
    -

    (t(lang, Key::Password))

    +
    +
    + +
    +

    (t(lang, Key::Password))

    if let Some(stamp) = password_changed { -

    (i18n::last_changed_label(lang)) " " rel_time(lang: lang, stamp: stamp.as_str())

    +

    (i18n::last_changed_label(lang)) " " rel_time(lang: lang, stamp: stamp.as_str())

    }
    -
    +
    (t(lang, Key::ChangeAction)) -
    +
    if let Some(message) = password_error { alert(message: message.as_str()) } @@ -295,25 +295,25 @@ async fn security_body(page: SecurityPage) -> Result {
    -
    - -
    -

    (t(lang, Key::Email))

    +
    + +
    +

    (t(lang, Key::Email))

    if stored_email.is_empty() { -

    (t(lang, Key::EmailNoAddress))

    +

    (t(lang, Key::EmailNoAddress))

    } else { -

    (stored_email.as_str()) (" · ")(email_status.as_str()) if let Some(stamp) = email_sent { " " rel_time(lang: lang, stamp: stamp.as_str()) }

    +

    (stored_email.as_str()) (" · ")(email_status.as_str()) if let Some(stamp) = email_sent { " " rel_time(lang: lang, stamp: stamp.as_str()) }

    }
    if show_resend { -
    +
    } -
    +
    (t(lang, Key::ChangeAction)) -
    +
    if let Some(message) = email_error { alert(message: message.as_str()) } @@ -332,25 +332,25 @@ async fn security_body(page: SecurityPage) -> Result {
    -
    -
    - -
    -

    +
    +
    + +
    +

    (t(lang, Key::TwoFactorAuth)) (two_factor_pill_text)

    if !two_factor_on && pending.is_none() { -

    (t(lang, Key::TwoFactorOffIntro))

    +

    (t(lang, Key::TwoFactorOffIntro))

    } if pending.is_some() { -

    (t(lang, Key::SetupInProgress))

    +

    (t(lang, Key::SetupInProgress))

    }
    if two_factor_on { -
    +
    (t(lang, Key::TurnOffTwoFactorButton)) -
    +
    if let Some(message) = disable_error { alert(message: message.as_str()) } @@ -369,7 +369,7 @@ async fn security_body(page: SecurityPage) -> Result {
    } else if pending.is_none() { -
    +
    @@ -377,25 +377,25 @@ async fn security_body(page: SecurityPage) -> Result {
    if let Some(device) = two_factor {
      -
    • - -
      -

      (device.name.as_str())

      -

      added_status(lang: lang, added: device.added.as_deref(), used: device.used.as_deref())

      +
    • + +
      +

      (device.name.as_str())

      +

      added_status(lang: lang, added: device.added.as_deref(), used: device.used.as_deref())

    • -
    • - -
      -

      (t(lang, Key::RecoveryCodes))

      +
    • + +
      +

      (t(lang, Key::RecoveryCodes))

      (device.codes_line.as_str())

      if device.codes_low { -

      (t(lang, Key::CodesRunningLow))

      +

      (t(lang, Key::CodesRunningLow))

      }
      -
      +
      (t(lang, Key::RegenerateCodes)) -
      +
      if let Some(message) = regenerate_error { alert(message: message.as_str()) } @@ -414,7 +414,7 @@ async fn security_body(page: SecurityPage) -> Result {
    } if let Some((secret, uri)) = pending { -
    +

    (t(lang, Key::TwoFactorPendingIntro))

    (t(lang, Key::SecretPrefix)) (secret)

    (t(lang, Key::LinkPrefix)) (uri)

    @@ -439,22 +439,22 @@ async fn security_body(page: SecurityPage) -> Result {
    passkeys_panel(lang: lang, csrf: csrf.as_str(), panel: passkeys)

    -
    +

    (t(lang, Key::DangerZone))

    -
    - -
    -

    (t(lang, Key::DeleteAccount))

    +
    + +
    +

    (t(lang, Key::DeleteAccount))

    if delete_blocked { -

    (t(lang, Key::TransferOrDeleteRepos))

    +

    (t(lang, Key::TransferOrDeleteRepos))

    } else { -

    (t(lang, Key::DeleteAccountIntro))

    +

    (t(lang, Key::DeleteAccountIntro))

    }
    if !delete_blocked { -
    +
    (t(lang, Key::DeleteAccount)) -
    +
    if let Some(message) = delete_error { alert(message: message.as_str()) } @@ -1689,12 +1689,12 @@ mod tests { .await; assert!(reply.body.contains("Current password is incorrect.")); assert!( - reply.body.contains("security-action danger\" open"), + reply.body.contains("row-action danger\" open"), "turn-off panel should stay open: {}", reply.body ); assert!( - !reply.body.contains("security-action\" open"), + !reply.body.contains("row-action\" open"), "only the turn-off panel should be open" ); diff --git a/crates/forge-web/src/pages/settings_sessions.rs b/crates/forge-web/src/pages/settings_sessions.rs index 41e9ad2..771515f 100644 --- a/crates/forge-web/src/pages/settings_sessions.rs +++ b/crates/forge-web/src/pages/settings_sessions.rs @@ -66,24 +66,16 @@ async fn sessions_view( }
    -
    -
      - for session in sessions.into_iter() { -
    • -
      - (session_label(lang, &session)) - (i18n::dated_label(lang, Key::SignedIn)) " " rel_time(lang: lang, stamp: session.created_at.as_str()) " · " (i18n::dated_label(lang, Key::LastSeen)) " " rel_time(lang: lang, stamp: session.last_seen.as_str()) " · " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time(lang: lang, stamp: session.expires_at.as_str()) (address_text(&session)) - if session.id == current_id { - (t(lang, Key::ThisSession)) - } -
      - if session.id != current_id { -
      - - - -
      +
      + for session in sessions.into_iter() { +
      + +
      + (session_label(lang, &session)) + if session.id == current_id { + (t(lang, Key::ThisSession)) } +

      (i18n::dated_label(lang, Key::SignedIn)) " " rel_time(lang: lang, stamp: session.created_at.as_str()) " · " (i18n::dated_label(lang, Key::LastSeen)) " " rel_time(lang: lang, stamp: session.last_seen.as_str()) " · " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time(lang: lang, stamp: session.expires_at.as_str()) (address_text(&session))

      (session_label(lang, &session))

      @@ -93,9 +85,16 @@ async fn sessions_view(
      session_details(lang: lang, csrf: csrf, session: session.clone(), current: session.id == current_id)
      -
    • - } -
    +
    + if session.id != current_id { +
    + + + +
    + } +
    + }
    }) } diff --git a/crates/forge-web/src/pages/settings_tokens.rs b/crates/forge-web/src/pages/settings_tokens.rs index ff0d144..76bc00a 100644 --- a/crates/forge-web/src/pages/settings_tokens.rs +++ b/crates/forge-web/src/pages/settings_tokens.rs @@ -24,7 +24,7 @@ use crate::i18n::releases_ci::{self as rc, K as RC}; use crate::i18n::{self, Key, Lang, t, token_name_length}; use crate::pages::admin_runners::confirm_post; use crate::state::AppState; -use crate::views::{alert, empty_state, rel_time, rel_time_or_never, shell}; +use crate::views::{alert, rel_time, rel_time_or_never, shell}; /// Scopes are fixed to `repo` for M1. const SCOPES: &[&str] = &["repo"]; @@ -100,52 +100,57 @@ async fn tokens_view(

    (t(lang, Key::UseAsPassword))

    } -
    - if tokens.is_empty() { - empty_state(title: t(lang, Key::NoAccessTokens), - (t(lang, Key::NewToken))) - } else { -
      - for token in tokens.into_iter() { -
    • -
      - (token.name.clone()) - (i18n::dated_label(lang, Key::Created)) " " rel_time(lang: lang, stamp: token.created_at.as_str()) " · " (i18n::dated_label(lang, Key::LastUsed)) " " rel_time_or_never(lang: lang, stamp: token.last_used_at.as_deref()) " · " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time_or_never(lang: lang, stamp: token.expires_at.as_deref()) -
      - confirm_post(lang: lang, csrf: csrf, action: "/settings/tokens/delete", label: t(lang, Key::Delete), message: delete_message(lang, token.name.as_str()), confirm: delete_confirm(lang), danger: true, fields: vec![("id", token.id.clone())]) -
    • +
      +
      + +
      +

      (t(lang, Key::NewToken))

      + if tokens.is_empty() { +

      (t(lang, Key::NoAccessTokens))

      } -
    - } -
    -
    -

    (t(lang, Key::NewToken))

    - if let Some(message) = error { - alert(message: message.as_str()) + +
    + (t(lang, Key::CreateToken)) +
    + if let Some(message) = error { + alert(message: message.as_str()) + } +
    + + + + +

    (pk::t(lang, PK::ScopePackagesHelp))

    +

    (t(lang, Key::ScopeNote))

    + +
    +
    +
    + + for token in tokens.into_iter() { +
    + +
    + (token.name.clone()) +

    (i18n::dated_label(lang, Key::Created)) " " rel_time(lang: lang, stamp: token.created_at.as_str()) " · " (i18n::dated_label(lang, Key::LastUsed)) " " rel_time_or_never(lang: lang, stamp: token.last_used_at.as_deref()) " · " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time_or_never(lang: lang, stamp: token.expires_at.as_deref())

    +
    + confirm_post(lang: lang, csrf: csrf, action: "/settings/tokens/delete", label: t(lang, Key::Delete), message: delete_message(lang, token.name.as_str()), confirm: delete_confirm(lang), danger: true, fields: vec![("id", token.id.clone())]) +
    } -
    - - - - -

    (pk::t(lang, PK::ScopePackagesHelp))

    -

    (t(lang, Key::ScopeNote))

    - -
    }) } diff --git a/crates/forge-web/src/pages/wiki.rs b/crates/forge-web/src/pages/wiki.rs index a2134ee..6a65038 100644 --- a/crates/forge-web/src/pages/wiki.rs +++ b/crates/forge-web/src/pages/wiki.rs @@ -685,18 +685,21 @@ async fn wiki_settings_body( enabled: bool, ) -> Result { Ok(view! { -
    -

    (g::t(lang, K::WikiSettings))

    -
    - - +
    - -
    + + }) } diff --git a/style/_account_admin.scss b/style/_account_admin.scss index c18f246..f9db483 100644 --- a/style/_account_admin.scss +++ b/style/_account_admin.scss @@ -214,28 +214,6 @@ dialog.session-dialog { } } -.user-actions, -.user-danger { - h2 { - margin: 0 0 4px; - font-size: 0.9375rem; - } -} - -.user-danger { - border-color: var(--danger); - - h2 { - color: var(--danger); - } -} - -.action-list { - list-style: none; - margin: 0; - padding: 0; -} - .action-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; @@ -254,10 +232,6 @@ dialog.session-dialog { } } -.action-list > .action-row + .action-row { - border-top: 1px solid var(--border); -} - .action-text { min-width: 0; } @@ -407,16 +381,6 @@ dialog.session-dialog { } } -.health-storage, -.health-status { - margin-bottom: 16px; - - h2 { - margin: 0 0 12px; - font-size: 0.9375rem; - } -} - .health-usage-head { display: flex; flex-wrap: wrap; @@ -427,100 +391,11 @@ dialog.session-dialog { } // The data directory's usage bar: 8px tall, the fill turns red at 90%. -.health-storage .meter { - display: block; - width: 100%; - height: 8px; - appearance: none; - border: 0; - border-radius: 4px; - background: var(--surface-2); - overflow: hidden; - - &::-webkit-progress-bar { - background: var(--surface-2); - } - - &::-webkit-progress-value { - background: var(--text-2); - } - - &::-moz-progress-bar { - background: var(--text-2); - } - - &.bad::-webkit-progress-value { - background: var(--bad); - } - - &.bad::-moz-progress-bar { - background: var(--bad); - } -} - .health-path { margin-top: 4px; overflow-wrap: anywhere; } -.health-facts { - display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - gap: 16px; - margin-top: 16px; - - @media (max-width: 640px) { - grid-template-columns: minmax(0, 1fr); - } -} - -.health-fact-value { - margin-top: 2px; - font-size: 0.9375rem; - font-weight: 600; - overflow-wrap: anywhere; - - &.bad { - color: var(--bad); - } - - &.muted { - font-weight: 400; - } -} - -.health-rows { - list-style: none; - margin: 0; - padding: 0; -} - -.health-row { - display: grid; - grid-template-columns: 16px minmax(0, 1fr) auto; - align-items: center; - gap: 8px; - padding: 10px 0; - - & + .health-row { - border-top: 1px solid var(--border); - } - - .health-dot { - justify-self: center; - } -} - -.health-row-value { - text-align: right; - font-variant-numeric: tabular-nums; - overflow-wrap: anywhere; - - &.muted { - color: var(--muted); - } -} - .health-meta { margin: 0 0 16px; } diff --git a/style/_alive_settings.scss b/style/_alive_settings.scss index f88a8cd..5189809 100644 --- a/style/_alive_settings.scss +++ b/style/_alive_settings.scss @@ -237,9 +237,3 @@ white-space: nowrap; } -// The profile avatar's Edit pill sits inside the circle's bottom right, clear of the edge. -.profile-settings-avatar-menu { - left: auto; - right: 30px; - bottom: 30px; -} diff --git a/style/_appearance.scss b/style/_appearance.scss index bb537cf..a20a762 100644 --- a/style/_appearance.scss +++ b/style/_appearance.scss @@ -2,29 +2,6 @@ // the colours. From 1100px: general controls and the sound card on the left, colours on the right, // so the page fits one screen. The form is `display: contents` so its two blocks join this grid. // The sound card sits outside the form: its Play buttons must not be inside it. -.appearance-page { - display: flex; - flex-direction: column; - gap: 16px; - min-width: 0; - - > form.appearance { - display: contents; - } - - .appearance-top { - order: 1; - } - - .sound-card { - order: 2; - } - - .colour-group { - order: 3; - } -} - @media (min-width: 1100px) { .appearance-page { display: grid; @@ -51,15 +28,6 @@ } // Settings: the sound card. The density radios use the sidebar side's segmented pill. -.sound-card { - display: grid; - gap: 8px; - - > p { - margin: 0; - } -} - // A sound-row's name and its quiet note sit on one line, with a gap rather than a typed space. .sound-name { display: flex; diff --git a/style/_canvas_account.scss b/style/_canvas_account.scss index f9616a8..b2f534f 100644 --- a/style/_canvas_account.scss +++ b/style/_canvas_account.scss @@ -120,7 +120,7 @@ } // Security danger zone: the repo names line up with the body text beside the icon. -.card.security-danger .security-row > .security-repos { +.card.security-danger .row-line > .security-repos { padding-left: 36px; } diff --git a/style/_canvas_detail.scss b/style/_canvas_detail.scss index 148a4de..d133a24 100644 --- a/style/_canvas_detail.scss +++ b/style/_canvas_detail.scss @@ -81,89 +81,6 @@ // Labels: one line each, columns line up down the pane. Edit opens under its row and holds Delete, // so a pane of labels is not a pane of red buttons. -.label-list .label-row { - position: relative; - display: grid; - grid-template-columns: 220px minmax(0, 1fr) 80px 56px; - grid-template-rows: 36px auto; - column-gap: 16px; - align-items: center; - padding: 0; - - > .label-chip { - justify-self: start; - max-width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - > .label-desc { - margin: 0; - min-width: 0; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - > .label-open { - text-align: right; - color: var(--text-2); - white-space: nowrap; - } - - > .label-chip, - > .label-desc, - > .label-open { - grid-row: 1; - position: relative; - z-index: 1; - } - - > .label-chip { - grid-column: 1; - } - - > .label-desc { - grid-column: 2; - } - - > .label-open { - grid-column: 3; - } - - > .label-edit { - grid-column: 1 / -1; - grid-row: 1 / span 2; - align-self: start; - min-width: 0; - - > summary { - width: fit-content; - margin-left: auto; - line-height: 36px; - font-size: 13px; - color: var(--text-2); - cursor: pointer; - list-style: none; - position: relative; - z-index: 1; - - &::-webkit-details-marker { - display: none; - } - - &:hover { - color: var(--text); - } - } - - &[open] > summary { - color: var(--text); - } - } -} - .label-edit-body { display: flex; align-items: flex-end; @@ -230,13 +147,6 @@ padding-bottom: 20px; } -@media (min-width: 900px) { - .srv-page form.srv-form .srv-grid { - grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); - max-width: none; - } -} - // File pages: the path row has no rules of its own, the tab row's rule is the only one above it. .browse-bar { border-top: 0; diff --git a/style/_fit_admin.scss b/style/_fit_admin.scss index 8e2d11a..77f3697 100644 --- a/style/_fit_admin.scss +++ b/style/_fit_admin.scss @@ -51,65 +51,6 @@ } } -// Org teams (/org/{org}/teams): the team list and the new-team form side by side. -@media (min-width: 900px) { - .teams-page { - display: grid; - grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); - column-gap: 16px; - align-items: start; - - > :not(.card) { - grid-column: 1 / -1; - } - } -} - -// Server settings (/admin/server): the settings card takes the left column and fills the window, -// and the restart card sits beside it. The settings card runs three across, and four from 1200px. -@media (min-width: 900px) { - .srv-page { - display: grid; - grid-template-columns: minmax(0, 1fr) 260px; - column-gap: 16px; - align-items: start; - - > .page-head, - > .subnav, - > .notice { - grid-column: 1 / -1; - } - } - - // Tighter cells: the field rows sit closer, and the help text lines are shorter. - .srv-form .srv-grid { - grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); - gap: 8px 16px; - } - - .srv-form .srv-field { - gap: 4px; - } - - .srv-form .srv-field > p.small { - line-height: 1.3; - } -} - -// From 1200px the settings take three across, wide enough for a label and its two badges; from -// 1680px four. -@media (min-width: 1200px) { - .srv-form .srv-grid { - grid-template-columns: repeat(3, minmax(0, 1fr)); - } -} - -@media (min-width: 1680px) { - .srv-form .srv-grid { - grid-template-columns: repeat(4, minmax(0, 1fr)); - } -} - // Mail settings (/admin/mail): the SMTP form runs three fields across, the actions span the row. @media (min-width: 900px) { form.stack[action="/admin/mail"] { diff --git a/style/_lang_admin.scss b/style/_lang_admin.scss index 05a201a..ecb3a67 100644 --- a/style/_lang_admin.scss +++ b/style/_lang_admin.scss @@ -25,8 +25,8 @@ $page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > mai } // Two panes: the list takes the window, and the form beside it stays a form's width. - .shell-site > .shell-body > main:has(> .card ~ .card), - .shell-site > .shell-body > main > [data-live]:not(.srv-page):not(.health-page):not(.user-page):not(.teams-page):not(.runner-detail):has(> .card ~ .card) { + .shell-site > .shell-body > main:not(:has(> .rows-pane)):has(> .card ~ .card), + .shell-site > .shell-body > main > [data-live]:not(.srv-page):not(.health-page):not(.user-page):not(.teams-page):not(.runner-detail):not(:has(> .rows-pane)):has(> .card ~ .card) { grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem); } } @@ -41,8 +41,8 @@ $page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > mai // A form in a pane is a column of its own: 720px at most, left aligned. The mail form keeps its // three-field row. -.shell-site main .card > form:not(.inline-form):not(.srv-form):not([action="/admin/mail"]), -.shell-site main .card > form.stack:not(.srv-form):not([action="/admin/mail"]) { +.shell-site main .card > form:not(.inline-form):not(.srv-form):not([action="/admin/mail"]):not(:has(> .row-line)), +.shell-site main .card > form.stack:not(.srv-form):not([action="/admin/mail"]):not(:has(> .row-line)) { max-width: 720px; } @@ -84,10 +84,6 @@ $page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > mai @extend %mono-label; } -.shell-site main .user-danger > h2 { - color: var(--danger); -} - // Panes side by side end at the same height. A card's bottom margin would shorten a stretched pane // by 16px, so the split's and the grids' cards drop it; the grid gap already spaces them. .fit-split > .card, @@ -135,13 +131,3 @@ $page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > mai scrollbar-width: thin; } -// The settings card and the restart card start on one line. -@media (min-width: 900px) { - .srv-page > .card { - margin-top: 0; - } - - .srv-page > .card.fit-pane { - align-self: start; - } -} diff --git a/style/_lang_ci.scss b/style/_lang_ci.scss index b943c77..8dfbd86 100644 --- a/style/_lang_ci.scss +++ b/style/_lang_ci.scss @@ -11,7 +11,7 @@ // The runs list (480px, as the canvas) and the selected run fill the window down to the footer. @media (min-width: 900px) { .ci-split.fit-pane { - grid-template-columns: minmax(0, 480px) minmax(0, 1fr); + grid-template-columns: clamp(340px, 25vw, 480px) minmax(0, 1fr); align-items: stretch; gap: 12px; padding: 0; @@ -51,11 +51,44 @@ } } -// Between phone and desktop the panes stack, as the rest of the site does. +// A run's page keeps the runs list at the left, in the same place, so a click only changes the right. +.ci-split > .ci-run { + display: flex; + flex-direction: column; + gap: 12px; + min-width: 0; + min-height: 0; + + > .ci-tl-main { + flex: 1 1 0; + min-height: 0; + } +} + +@media (min-width: 900px) { + .ci-split.fit-pane:has(> .ci-run) { + height: calc(100dvh - var(--pane-top, 107px) - 20px); + } + + .ci-split > .ci-run { + overflow: hidden; + } + + .ci-all-runs { + display: none; + } +} + +// Between phone and desktop the panes stack, as the rest of the site does. On a run's page the run +// comes first and All runs leads back, or it would sit under a whole list. @media (max-width: 899px) { .ci-split { grid-template-columns: minmax(0, 1fr); } + + .ci-split:has(> .ci-run) > .ci-side { + display: none; + } } // The detail's empty state reads from the left, inside its pane. diff --git a/style/_look.scss b/style/_look.scss index 241a3b6..394852f 100644 --- a/style/_look.scss +++ b/style/_look.scss @@ -48,7 +48,7 @@ th, .ci-art-title, .ci-warnings-title, .import-log-title, -.security-row-title, +.row-title, .notif-group-head, .profile-section-head, .mx-caption, @@ -67,7 +67,6 @@ th, .release-card, .newrepo-card, .newrepo-mirror, -.security-panel, .ci-side, .ci-main, .import-sources, diff --git a/style/_palette.scss b/style/_palette.scss index e86c2af..202850e 100644 --- a/style/_palette.scss +++ b/style/_palette.scss @@ -120,11 +120,28 @@ dialog.palette { } } +.palette-list li[role="option"]:has(.palette-why) { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 16px; +} + .palette-why { - float: right; - margin-left: 12px; + flex: 0 1 55%; + overflow: hidden; color: var(--muted); font-size: 0.75rem; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; +} + +// Where a search led: the setting it found, until the next key or click. +.palette-hit { + outline: 2px solid var(--accent); + outline-offset: -2px; + border-radius: var(--radius-sm); } .palette-note { diff --git a/style/_system.scss b/style/_system.scss index c46b48d..1a6edc2 100644 --- a/style/_system.scss +++ b/style/_system.scss @@ -661,27 +661,6 @@ main .side-picker > legend { margin-bottom: 16px; } -.org-split { - display: grid; - grid-template-columns: minmax(0, 1fr); - align-items: start; - gap: 16px; - - > .card { - margin: 0; - } - - > .card > h3 { - margin: 0 0 12px; - color: var(--muted); - font-family: var(--mono); - font-size: 12px; - font-weight: 500; - letter-spacing: 0.08em; - text-transform: uppercase; - } -} - @media (min-width: 900px) { .org-split:has(> .card ~ .card) { grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem); @@ -834,8 +813,3 @@ form.stack[action="/admin/mail"], } } } - -.org-split > .card > h2 { - margin: 0 0 4px; - font-size: 16px; -} diff --git a/style/main.scss b/style/main.scss index cbca9bc..7971c2d 100644 --- a/style/main.scss +++ b/style/main.scss @@ -2243,13 +2243,6 @@ code { margin-top: 8px; } -.org-settings-grid { - display: grid; - grid-template-columns: minmax(0, 1fr); - gap: 16px; - align-items: start; -} - @media (min-width: 900px) { .org-settings-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); @@ -2478,48 +2471,6 @@ code { min-width: 0; } -.appearance-top { - // Theme and Language share the width; the sidebar toggle takes its own width. Rows size to their - // content, so the helper text under a select is never clipped. - display: grid; - grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; - grid-auto-rows: auto; - align-items: start; - gap: 16px 24px; - min-width: 0; - height: auto; - overflow: visible; - - @media (max-width: 720px) { - grid-template-columns: minmax(0, 1fr); - } - - // Each field: label row, control row, then optional helper text. The label rows are all the - // same height, so the three labels share a baseline and the three controls sit on one line. - > label, - > fieldset { - display: grid; - grid-template-rows: auto var(--control-h) auto; - gap: 4px; - min-width: 0; - height: auto; - overflow: visible; - align-content: start; - } - - > label > span, - > fieldset > legend { - line-height: 1.25rem; - } - - > label > small { - display: block; - font-size: 0.8125rem; - line-height: 1.45; - overflow-wrap: anywhere; - } -} - // The sidebar side (appearance settings): the same segmented pill as the New repository // visibility toggle (.segmented.snippet-segmented), sized to --control-h like the selects. .side-picker { @@ -3141,36 +3092,6 @@ code { // labels & milestones // Label list and create/edit forms on the labels page. Chips get their colors from labels.css. -.label-list, -.milestone-list { - list-style: none; - margin: 0; - padding: 0; -} - -.label-row, -.milestone-row { - padding: 12px 0; - border-bottom: 1px solid var(--border); - - &:last-child { - border-bottom: none; - } - - h3 { - margin: 0 0 4px; - font-size: 1rem; - - a { - color: var(--text); - } - } - - p { - margin: 4px 0; - } -} - .label-head { display: flex; flex-wrap: wrap; @@ -3252,17 +3173,6 @@ code { margin-left: 0; } -.label-row, -.milestone-row { - .remove-form { - margin: 0; - } -} - -.milestone-row .markdown-body { - margin: 4px 0; -} - @media (max-width: 600px) { .milestone-progress progress { width: 100%; @@ -7173,82 +7083,24 @@ button.ci-job-last { margin-top: 4px; } -.profile-settings-avatar { - display: flex; - flex-direction: column; - gap: 10px; - min-width: 0; - - small { - font-size: 0.8125rem; - line-height: 1.45; - } -} - -.profile-settings-avatar-frame { - position: relative; - width: 180px; - height: 180px; -} - .profile-settings-avatar-img { - display: block; - width: 180px; - height: 180px; + flex: none; + width: 40px; + height: 40px; box-sizing: border-box; border: 1px solid var(--border); } -// The Edit pill sits over the bottom-left edge of the circle. -.profile-settings-avatar-menu { - position: absolute; - left: 6px; - bottom: 10px; - - > summary { - display: inline-flex; - align-items: center; - height: 32px; - padding: 0 14px; - border: 1px solid var(--border-strong); - border-radius: var(--radius-full); - background: var(--surface); - box-shadow: var(--shadow); - color: var(--text); - font-size: 0.8125rem; - font-weight: 500; - cursor: pointer; - - &:hover { - background: var(--surface-2); - } - } - - &[open] > summary { - border-color: var(--border-strong); - } -} - -.profile-settings-avatar-list { - left: 0; - right: auto; - top: calc(100% + 8px); - min-width: 220px; -} - .profile-settings-avatar-upload { - display: flex; - flex-direction: column; - align-items: stretch; + position: relative; + flex-direction: row; + align-items: center; + gap: 8px; margin: 0; - - > button { - margin: 4px 14px 10px; - } } -// The file input stays in the tab order but is visually hidden. Its label is the visible item. -.profile-settings-avatar-upload .profile-settings-avatar-file { +// The file input stays in the tab order but is visually hidden. Its label is the visible button. +.profile-settings-avatar-file { position: absolute; width: 1px; height: 1px; @@ -7262,10 +7114,15 @@ button.ci-job-last { } .profile-settings-avatar-item { - display: block; - padding: 8px 14px; + display: inline-flex; + flex-direction: row; + align-items: center; + height: var(--control-h); + padding: 0 12px; + border: 1px solid var(--border-strong); + border-radius: var(--radius-md); color: var(--text); - font-size: 0.875rem; + font-size: 0.8125rem; white-space: nowrap; cursor: pointer; @@ -7274,15 +7131,9 @@ button.ci-job-last { } } -.profile-settings-avatar-upload .profile-settings-avatar-file:focus-visible + .profile-settings-avatar-item { - outline: 2px solid var(--accent); - outline-offset: -2px; -} - -.profile-settings-avatar-remove { - margin: 0; - padding-top: 6px; - border-top: 1px solid var(--border); +.profile-settings-avatar-file:focus-visible + .profile-settings-avatar-item { + outline: 2px solid var(--focus); + outline-offset: 2px; } @media (max-width: 48rem) { @@ -7291,9 +7142,6 @@ button.ci-job-last { gap: 24px; } - .profile-settings-avatar { - order: -1; - } } // --------------------------------------------------------------------------- @@ -7302,7 +7150,7 @@ button.ci-job-last { // zone is its own card with a red border. // --------------------------------------------------------------------------- -.security-card { +.rows-pane { padding: 0; overflow: hidden; @@ -7311,9 +7159,10 @@ button.ci-job-last { } } -.security-row { +.row-line { position: relative; display: flex; + flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; @@ -7321,18 +7170,18 @@ button.ci-job-last { min-width: 0; // While an action is open its summary stays on this heading row, so keep the title clear of it. - &:has(> .security-action[open]) > .security-row-main { + &:has(> .row-action[open]) > .row-main { padding-right: 150px; } } -.security-block { +.rows-block { display: flex; flex-direction: column; min-width: 0; } -.security-icon { +.row-icon { flex: none; width: 20px; height: 20px; @@ -7343,7 +7192,7 @@ button.ci-job-last { stroke-linejoin: round; } -.security-row-main { +.row-main { flex: 1 1 200px; min-width: 0; display: flex; @@ -7351,8 +7200,9 @@ button.ci-job-last { gap: 2px; } -.security-row-title { +.row-title { display: flex; + flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; @@ -7365,7 +7215,7 @@ button.ci-job-last { padding: 0; } -.security-row-status { +.row-status { margin: 0; font-size: 0.8125rem; line-height: 1.45; @@ -7410,11 +7260,174 @@ button.ci-job-last { } } -.security-inline-form { +.row-form { + margin: 0; +} + +// The rows pattern, shared by every settings, admin and list page: one pane that hugs its content, +// rows of icon, label or name, one line of status, and the actions at the right end. A form opens +// in place under its row from a `.row-action`, so no page keeps an empty pane beside a form. +.rows-pane { + display: block; + align-self: start; + justify-self: stretch; + width: 100%; + min-width: 0; +} + +.row-name { + display: block; + overflow: hidden; + color: var(--text); + font-size: 0.875rem; + font-weight: 600; + line-height: 1.4; + text-overflow: ellipsis; + white-space: nowrap; + + a { + color: inherit; + } +} + +.row-actions { + display: flex; + flex: none; + align-items: center; + gap: 8px; + margin-left: auto; +} + +.row-count { + padding: 0 7px; + border: 1px solid var(--border); + border-radius: var(--radius-full); + color: var(--muted); + font-family: var(--mono); + font-size: 11px; + letter-spacing: 0; +} + +// A setting on one row: its label and hint at the left, its control at the right. +.row-field { + align-items: center; + + > .row-control { + display: flex; + flex: 0 1 22rem; + align-items: center; + justify-content: flex-end; + gap: 8px; + min-width: 0; + + > input:not([type="checkbox"], [type="radio"]), + > select, + > textarea { + width: 100%; + } + } +} + +.row-foot { + display: flex; + align-items: center; + gap: 8px; + padding: 12px 20px; +} + +.row-main > .badge { + width: fit-content; +} + +// Rows inside a form in a pane: the form is only a wrapper, and its rows keep their hairlines. +.rows-pane form:not(.row-form, .profile-settings-avatar-upload) { + display: block; + max-width: none; + margin: 0; + + > .row-line + .row-line, + > .row-foot { + border-top: 1px solid var(--border); + } +} + +form.rows-pane { + max-width: none; +} + +.row-line.event-choices { + display: flex; + padding: 16px 20px; + + > .row-main, + > .row-control { + flex: 1 1 100%; + } + + > .row-control { + flex-wrap: wrap; + justify-content: flex-start; + gap: 8px 24px; + } +} + +.row-line > .row-form, +.row-actions > .row-form { + display: flex; + align-items: center; + gap: 8px; +} + +.row-title .srv-label { + margin: 0; + color: inherit; + font: inherit; +} + +// A setting is a row like any other, not the stacked label and control of the stat cells above it. +.srv-form .srv-field.row-line { + flex-direction: row; + gap: 10px 16px; +} + +// A colour picker holds a whole row of swatches, so it takes the row. +.colour-line > .colour-picker { + flex: 1 1 100%; + min-width: 0; +} + +.rows-pane > .colour-group { + padding: 16px 20px; + border-width: 1px 0 0; + border-radius: 0; +} + +// The rule editor's switches are rows inside its own panes. +.switch-list > .row-line { + padding: 10px 0; + + & + .row-line { + border-top: 1px solid var(--border); + } +} + +.rows-section { margin: 0; + padding: 12px 20px 8px; +} + +@media (max-width: 600px) { + .row-field > .row-control { + flex-basis: 100%; + justify-content: flex-start; + } + + .row-foot { + padding: 12px 16px; + } } -.security-action { +.row-action { margin-left: auto; > summary { @@ -7458,19 +7471,19 @@ button.ci-job-last { } // Lines up with the title, past the row icon (20px) and its gap (16px). - > .security-panel { + > .row-panel { width: auto; margin-left: 36px; } } } -.security-panel { +.row-panel { display: flex; flex-direction: column; gap: 12px; width: 100%; - max-width: 420px; + max-width: 720px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border); @@ -7504,7 +7517,7 @@ button.ci-job-last { // Passkeys: the add form sits under the list, aligned with the row text. Both the add form and the // login button stay hidden until nav.js sees that the browser supports passkeys. .passkey-add { - max-width: none; + max-width: 776px; margin: 0; padding: 4px 20px 18px 56px; @@ -7573,11 +7586,11 @@ button.ci-job-last { color: var(--bad); } - .security-row-title { + .row-title { color: var(--bad); } - .security-icon { + .row-icon { stroke: var(--bad); } @@ -7589,13 +7602,13 @@ button.ci-job-last { } @media (max-width: 600px) { - .security-row { + .row-line { align-items: flex-start; padding: 14px 16px; } // The icon sits on the title's first line (20px box, 1.4 line of 15px) instead of mid-row. - .security-row > .security-icon { + .row-line > .row-icon { margin-top: 0.5px; } @@ -7716,8 +7729,10 @@ button.ci-job-last { gap: 8px; } -.srv-form .actions { - margin-top: 16px; +.srv-page { + display: flex; + flex-direction: column; + gap: 16px; } // Runner page: the name with its state pill on the left, the actions (back link, restart) on the