Every line starts on its sheet's text edge: server settings rows share the forms' label column and sit on the topic's edge instead of 18px in, the README text, a secret's row and a word action leading a line or an attach row line up with the rest, and a wrapped filter on a phone starts at the edge
Browse files at this commit27b4555b194b8214ba13930d5a6f158281ed4343Parent: 656d478Some checks failed
Show checks
ci/buildjob was cancelledDetails
- style
- every line starts on its sheet's text edge: server settings rows share the forms' label column and sit on the topic's edge instead of 18px in, the README text, a secret's row and a word action leading a line or an attach row line up with the rest, and a wrapped filter on a phone starts at the edge
- Exact and Aa sit inside the search field so they never wrap under it
- the repository head drops the latest commit's message, keeping its sha, author and age
- Convert to draft joins the merge line
- the mail password says not set in its field instead of a line under it
- org settings say Default role and Members can create repositories
- replication off says only that 🔧 chore: the audit's measure flags lines a few pixels off their sheet's text edge
11 changed files +117 -41
- crates/forge-e2e/tests/e2e/browse_e2e.rs +4 -4
- crates/forge-web-base/src/i18n/admin.rs +2 -10
- crates/forge-web-base/src/i18n/orgs.rs +4 -4
- crates/forge-web/src/pages/admin_mail.rs +1 -4
- crates/forge-web/src/pages/pull_view.rs +3 -5
- crates/forge-web/src/pages/repo_side.rs +0 -1
- crates/forge-web/src/views/find.rs +8 -8
- scripts/audit/measure.ts +29 -0
- style/_authoring.scss +4 -0
- style/_one.scss +35 -3
- style/_one_admin.scss +27 -2
crates/forge-e2e/tests/e2e/browse_e2e.rsmodified+4 -4
| @@ -124,8 +124,8 @@ fn element_texts(body: &str, selector: &str) -> Vec<String> { | ||
| 124 | 124 | .collect() |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | -/// Checks the latest commit in a repo page's head line: its short sha and subject, both linking to | |
| 128 | -/// the commit, and the commit count label. | |
| 127 | +/// Checks the latest commit in a repo page's head line: its short sha linking to the commit, no | |
| 128 | +/// subject, and the commit count label. | |
| 129 | 129 | fn assert_latest_bar(body: &str, what: &str, subject: &str, oid: &str, count: &str) { |
| 130 | 130 | assert_eq!(element_texts(body, ".head-sub").len(), 1, "{what}: one head line"); |
| 131 | 131 | let shas = element_texts(body, ".head-sub a.mono"); |
| @@ -133,8 +133,8 @@ fn assert_latest_bar(body: &str, what: &str, subject: &str, oid: &str, count: &s | ||
| 133 | 133 | assert_eq!(shas[0].trim(), &oid[..7], "{what}: short sha"); |
| 134 | 134 | let links = element_texts(body, ".head-sub a[href*=\"/commit/\"]"); |
| 135 | 135 | assert!( |
| 136 | - links.iter().any(|l| l.trim() == subject), | |
| 137 | - "{what}: the head line must show {subject:?}, got {links:?}" | |
| 136 | + !links.iter().any(|l| l.trim() == subject), | |
| 137 | + "{what}: the head line must not show the subject {subject:?}, got {links:?}" | |
| 138 | 138 | ); |
| 139 | 139 | let parts = element_texts(body, ".head-sub span"); |
| 140 | 140 | assert!( |
crates/forge-web-base/src/i18n/admin.rsmodified+2 -10
| @@ -86,7 +86,6 @@ pub enum K { | ||
| 86 | 86 | MailSettingsSaved, |
| 87 | 87 | MovedToGhost, |
| 88 | 88 | NoEntries, |
| 89 | - NoPasswordStored, | |
| 90 | 89 | NoReposYet, |
| 91 | 90 | NoRunnersYet, |
| 92 | 91 | NoRunnerWithId, |
| @@ -319,8 +318,6 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 319 | 318 | (MovedToGhost, Tr) => "Hayalet kullanıcıya taşınanlar:", |
| 320 | 319 | (NoEntries, En) => "No entries.", |
| 321 | 320 | (NoEntries, Tr) => "Kayıt yok.", |
| 322 | - (NoPasswordStored, En) => "No password is stored.", | |
| 323 | - (NoPasswordStored, Tr) => "Kayıtlı parola yok.", | |
| 324 | 321 | (NoReposYet, En) => "No repos yet.", |
| 325 | 322 | (NoReposYet, Tr) => "Henüz depo yok.", |
| 326 | 323 | (NoRunnersYet, En) => "No runners registered yet.", |
| @@ -345,12 +342,8 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 345 | 342 | (RemovedWithAccount, Tr) => "Hesapla birlikte silinenler:", |
| 346 | 343 | (Replication, En) => "Replication", |
| 347 | 344 | (Replication, Tr) => "Çoğaltma", |
| 348 | - (ReplicationOff, En) => { | |
| 349 | - "Replication is off. Set target, identity_file and known_hosts_file in the [replication] section to turn it on." | |
| 350 | - } | |
| 351 | - (ReplicationOff, Tr) => { | |
| 352 | - "Çoğaltma kapalı. Açmak için [replication] bölümünde target, identity_file ve known_hosts_file ayarlarını yapın." | |
| 353 | - } | |
| 345 | + (ReplicationOff, En) => "Replication is off.", | |
| 346 | + (ReplicationOff, Tr) => "Çoğaltma kapalı.", | |
| 354 | 347 | (Repos, En) => "Repos", |
| 355 | 348 | (Repos, Tr) => "Depolar", |
| 356 | 349 | (Retention, En) => "Retention", |
| @@ -637,7 +630,6 @@ mod tests { | ||
| 637 | 630 | K::MailSettingsSaved, |
| 638 | 631 | K::MovedToGhost, |
| 639 | 632 | K::NoEntries, |
| 640 | - K::NoPasswordStored, | |
| 641 | 633 | K::NoReposYet, |
| 642 | 634 | K::NoRunnersYet, |
| 643 | 635 | K::NoRunnerWithId, |
crates/forge-web-base/src/i18n/orgs.rsmodified+4 -4
| @@ -218,10 +218,10 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 218 | 218 | (Description, Tr) => "Açıklama", |
| 219 | 219 | (DisplayNameLabel, En) => "Display name", |
| 220 | 220 | (DisplayNameLabel, Tr) => "Görünen ad", |
| 221 | - (DefaultRoleLabel, En) => "Default role on the organization's repositories", | |
| 222 | - (DefaultRoleLabel, Tr) => "Kuruluş depolarında varsayılan rol", | |
| 223 | - (MembersCanCreate, En) => "Members can create repositories for this organization", | |
| 224 | - (MembersCanCreate, Tr) => "Üyeler bu kuruluş için depo oluşturabilir", | |
| 221 | + (DefaultRoleLabel, En) => "Default role", | |
| 222 | + (DefaultRoleLabel, Tr) => "Varsayılan rol", | |
| 223 | + (MembersCanCreate, En) => "Members can create repositories", | |
| 224 | + (MembersCanCreate, Tr) => "Üyeler depo oluşturabilir", | |
| 225 | 225 | (SaveSettings, En) => "Save settings", |
| 226 | 226 | (SaveSettings, Tr) => "Ayarları kaydet", |
| 227 | 227 | (DeleteOrg, En) => "Delete organization", |
crates/forge-web/src/pages/admin_mail.rsmodified+1 -4
| @@ -257,11 +257,8 @@ async fn mail_view( | ||
| 257 | 257 | </div> |
| 258 | 258 | <div class="field"> |
| 259 | 259 | <label for="mail-password">(i18n::t(lang, Key::Password))</label> |
| 260 | - <input id="mail-password" type="password" name="password" autocomplete="new-password" maxlength="1024"> | |
| 260 | + <input id="mail-password" type="password" name="password" autocomplete="new-password" maxlength="1024" placeholder=(g::t(lang, if data.has_password { K::SrvSecretSet } else { K::SrvSecretNotSet }))> | |
| 261 | 261 | </div> |
| 262 | - if !data.has_password { | |
| 263 | - <p class="state">(g::t(lang, K::NoPasswordStored))</p> | |
| 264 | - } | |
| 265 | 262 | </div> |
| 266 | 263 | </section> |
| 267 | 264 | <section class="sec"> |
crates/forge-web/src/pages/pull_view.rsmodified+3 -5
| @@ -364,6 +364,9 @@ async fn merge_box( | ||
| 364 | 364 | if let Some(summary) = checks { |
| 365 | 365 | checks_summary(summary: summary, lang: StatusLang(lang)) |
| 366 | 366 | } |
| 367 | + if let Some((action, label)) = draft_toggle { | |
| 368 | + post_act(label: label, action: action.as_str(), csrf: flow_csrf.as_str()) | |
| 369 | + } | |
| 367 | 370 | </div> |
| 368 | 371 | if !required.is_empty() { |
| 369 | 372 | <div> |
| @@ -448,11 +451,6 @@ async fn merge_box( | ||
| 448 | 451 | <button type="submit" class="primary">(enable_auto)</button> |
| 449 | 452 | </form> |
| 450 | 453 | } |
| 451 | - if let Some((action, label)) = draft_toggle { | |
| 452 | - <div class="line"> | |
| 453 | - post_act(label: label, action: action.as_str(), csrf: flow_csrf.as_str()) | |
| 454 | - </div> | |
| 455 | - } | |
| 456 | 454 | </section> |
| 457 | 455 | }) |
| 458 | 456 | } |
crates/forge-web/src/pages/repo_side.rsmodified+0 -1
| @@ -265,7 +265,6 @@ pub fn code_sub( | ||
| 265 | 265 | let mut sha = SubPart::link(bar.short.as_str(), bar.last.href.as_str()); |
| 266 | 266 | sha.class = "mono"; |
| 267 | 267 | parts.push(sha); |
| 268 | - parts.push(SubPart::link(bar.last.summary.as_str(), bar.last.href.as_str())); | |
| 269 | 268 | parts.push(SubPart::text(bar.author.as_str())); |
| 270 | 269 | parts.push(SubPart::text(bar.last.age.as_str())); |
| 271 | 270 | } |
crates/forge-web/src/views/find.rsmodified+8 -8
| @@ -172,15 +172,15 @@ pub async fn finder_field( | ||
| 172 | 172 | <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg> |
| 173 | 173 | <label class="sr-only" for=(id)>(placeholder)</label> |
| 174 | 174 | <input id=(id) type="search" name="q" value=(finder.q.as_str()) placeholder=(placeholder) data-live-search="" autocomplete="off"> |
| 175 | + <label class="find-opt" title=(s(lang, "Exact", "Tam"))> | |
| 176 | + <input type="checkbox" name="exact" value="1" checked=(finder.exact) data-autosubmit="true"> | |
| 177 | + <span>(s(lang, "Exact", "Tam"))</span> | |
| 178 | + </label> | |
| 179 | + <label class="find-opt" title=(s(lang, "Match case", "Büyük/küçük harf"))> | |
| 180 | + <input type="checkbox" name="case" value="1" checked=(finder.case) data-autosubmit="true"> | |
| 181 | + <span>"Aa"</span> | |
| 182 | + </label> | |
| 175 | 183 | </div> |
| 176 | - <label class="find-opt" title=(s(lang, "Only the text as typed, as one piece", "Yalnızca yazılan metin, tek parça olarak"))> | |
| 177 | - <input type="checkbox" name="exact" value="1" checked=(finder.exact) data-autosubmit="true"> | |
| 178 | - <span>(s(lang, "Exact", "Tam"))</span> | |
| 179 | - </label> | |
| 180 | - <label class="find-opt" title=(s(lang, "Keep upper and lower case apart", "Büyük ve küçük harfi ayırt et"))> | |
| 181 | - <input type="checkbox" name="case" value="1" checked=(finder.case) data-autosubmit="true"> | |
| 182 | - <span>"Aa"</span> | |
| 183 | - </label> | |
| 184 | 184 | <button type="submit" class="sr-only">(s(lang, "Search", "Ara"))</button> |
| 185 | 185 | </div> |
| 186 | 186 | }) |
scripts/audit/measure.tsmodified+29 -0
| @@ -224,6 +224,35 @@ const ALIGN = `((root) => { | ||
| 224 | 224 | const t = line(e), b = e.getBoundingClientRect(); |
| 225 | 225 | if (t !== b && b.width - t.width > 120 && b.width > 2 * t.width) bad.push('stretched action ' + Math.round(b.width) + 'px for ' + Math.round(t.width) + 'px of words: ' + name(e)); |
| 226 | 226 | } |
| 227 | + // Every line of a sheet starts on the sheet's text edge, or clearly away from it: a few pixels in reads as a slip. | |
| 228 | + for (const sheet of root.querySelectorAll('.sheet')) { | |
| 229 | + if (!seen(sheet) || sheet.parentElement.closest('.sheet')) continue; | |
| 230 | + const sc = getComputedStyle(sheet), sr = sheet.getBoundingClientRect(); | |
| 231 | + const edge = sr.left + parseFloat(sc.borderLeftWidth) + parseFloat(sc.paddingLeft); | |
| 232 | + const items = []; | |
| 233 | + const walk = document.createTreeWalker(sheet, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT); | |
| 234 | + for (let n = walk.nextNode(); n && items.length < 2000; n = walk.nextNode()) { | |
| 235 | + const host = n.nodeType === 3 ? n.parentElement : n; | |
| 236 | + if (host.closest('pre, .markdown-body, .sr-only, table, .diff, .log, .tree, svg, [hidden], details:not([open]) > :not(summary)')) continue; | |
| 237 | + let r; | |
| 238 | + const pill = host.closest('button, summary, a, label, .tag, .pill'); | |
| 239 | + if (pill && sheet.contains(pill) && getComputedStyle(pill).backgroundColor !== 'rgba(0, 0, 0, 0)') { if (n !== pill) continue; r = pill.getBoundingClientRect(); } | |
| 240 | + else if (n.nodeType === 3) { if (!n.textContent.trim()) continue; const g = document.createRange(); g.selectNodeContents(n); r = g.getClientRects()[0]; } | |
| 241 | + else if (n.matches('img, input:not([type=hidden]), select, textarea, button, svg')) r = n.getBoundingClientRect(); | |
| 242 | + if (!r || !r.width || !r.height || getComputedStyle(host).visibility === 'hidden') continue; | |
| 243 | + items.push({ r, host }); | |
| 244 | + } | |
| 245 | + const starts = items.filter((a) => !items.some((b) => b !== a && b.r.left < a.r.left - 1 && b.r.top < a.r.bottom - 2 && b.r.bottom > a.r.top + 2)); | |
| 246 | + const count = new Map(); | |
| 247 | + for (const a of starts) { const k = Math.round(a.r.left - edge); count.set(k, (count.get(k) || 0) + 1); } | |
| 248 | + if (!count.size) continue; | |
| 249 | + const main = [...count].sort((x, y) => y[1] - x[1])[0][0]; | |
| 250 | + for (const a of starts) { | |
| 251 | + const off = Math.round(a.r.left - edge) - main; | |
| 252 | + if (Math.abs(off) < 3 || Math.abs(off) > 40) continue; | |
| 253 | + bad.push('line starts ' + off + 'px off the sheet text edge: ' + name(a.host)); | |
| 254 | + } | |
| 255 | + } | |
| 227 | 256 | for (const form of root.querySelectorAll('.fields')) { |
| 228 | 257 | if (!seen(form) || form.getBoundingClientRect().width < 500) continue; |
| 229 | 258 | const fields = [...form.querySelectorAll('.field')].filter((f) => seen(f) && f.closest('.fields') === form && getComputedStyle(f).display === 'grid'); |
style/_authoring.scssmodified+4 -0
| @@ -7,6 +7,10 @@ | ||
| 7 | 7 | gap: 0.6rem; |
| 8 | 8 | min-height: 1.6rem; |
| 9 | 9 | margin-top: 0.25rem; |
| 10 | + | |
| 11 | + > :is(.link-button, .act):first-child { | |
| 12 | + margin-left: -10px; | |
| 13 | + } | |
| 10 | 14 | } |
| 11 | 15 | |
| 12 | 16 | .md-status { |
style/_one.scssmodified+35 -3
| @@ -1328,7 +1328,7 @@ main > .tabs { | ||
| 1328 | 1328 | // A readme in a sheet: its text starts on the tools row's inset, the canvas's 22px under the row. |
| 1329 | 1329 | .sheet .readme { |
| 1330 | 1330 | margin: 0; |
| 1331 | - padding: 22px 28px 28px; | |
| 1331 | + padding: 22px 18px 28px; | |
| 1332 | 1332 | |
| 1333 | 1333 | .markdown-body, |
| 1334 | 1334 | .readme-text { |
| @@ -1432,7 +1432,14 @@ a.line:hover .name, | ||
| 1432 | 1432 | color: var(--text); |
| 1433 | 1433 | } |
| 1434 | 1434 | |
| 1435 | +.line > :is(a.act, button.act, summary.act):first-child, | |
| 1436 | +.line > .act-form:first-child > .act, | |
| 1437 | +.line > details.reveal:first-child > summary.act { | |
| 1438 | + margin-left: -10px; | |
| 1439 | +} | |
| 1440 | + | |
| 1435 | 1441 | .sheet > .sec > .line, |
| 1442 | +.sheet > .sec > div:not([class]) > .line, | |
| 1436 | 1443 | .sheet > .sec > .commits-list > .line, |
| 1437 | 1444 | .sheet > .sec > .commits-list > .row-open > .line, |
| 1438 | 1445 | .sheet > .sec > .row-open > .line { |
| @@ -3440,6 +3447,10 @@ nav.pager.pager-numbered { | ||
| 3440 | 3447 | font-size: 14px; |
| 3441 | 3448 | font-weight: 500; |
| 3442 | 3449 | |
| 3450 | + @media (max-width: 700px) { | |
| 3451 | + margin-left: 0; | |
| 3452 | + } | |
| 3453 | + | |
| 3443 | 3454 | select { |
| 3444 | 3455 | width: auto; |
| 3445 | 3456 | max-width: 220px; |
| @@ -3642,14 +3653,35 @@ details.log-group { | ||
| 3642 | 3653 | } |
| 3643 | 3654 | } |
| 3644 | 3655 | |
| 3645 | -// In a rail the search takes the rail's width, its options on the line under it. | |
| 3656 | +// Exact and Aa sit inside the field at its end, so they never wrap under it. | |
| 3657 | +.list-find.list-find .plain-search:has(> .find-opt) { | |
| 3658 | + width: 320px; | |
| 3659 | + padding-right: 4px; | |
| 3660 | + gap: 6px; | |
| 3661 | + | |
| 3662 | + > .find-opt { | |
| 3663 | + flex: none; | |
| 3664 | + height: 24px; | |
| 3665 | + padding: 0 8px; | |
| 3666 | + border-radius: 12px; | |
| 3667 | + font-size: 12px; | |
| 3668 | + } | |
| 3669 | + | |
| 3670 | + > .find-opt:has(> input:checked) { | |
| 3671 | + background: var(--surface); | |
| 3672 | + } | |
| 3673 | +} | |
| 3674 | + | |
| 3675 | +// In a rail the search takes the rail's width. | |
| 3646 | 3676 | .rail .list-find { |
| 3647 | 3677 | display: flex; |
| 3648 | 3678 | width: 100%; |
| 3649 | 3679 | |
| 3650 | - &.list-find .plain-search { | |
| 3680 | + &.list-find .plain-search, | |
| 3681 | + &.list-find .plain-search:has(> .find-opt) { | |
| 3651 | 3682 | flex: 1 1 100%; |
| 3652 | 3683 | width: auto; |
| 3684 | + min-width: 0; | |
| 3653 | 3685 | } |
| 3654 | 3686 | } |
| 3655 | 3687 |
style/_one_admin.scssmodified+27 -2
| @@ -87,9 +87,17 @@ $repo: 'main:has(> section.repo-head .tab.active[href$="/settings"])'; | ||
| 87 | 87 | |
| 88 | 88 | // Server settings: one setting a line. Its name, then its control on one fixed width, then its notes, |
| 89 | 89 | // so every control and every note starts on the same edge. A page is short enough to need no scroll. |
| 90 | +#{$admin} .sheet:has(.srv-row) { | |
| 91 | + --label-w: 210px; | |
| 92 | + | |
| 93 | + .fields { | |
| 94 | + --label-w: 210px; | |
| 95 | + } | |
| 96 | +} | |
| 97 | + | |
| 90 | 98 | #{$admin} .srv-row { |
| 91 | 99 | display: grid; |
| 92 | - grid-template-columns: 210px 280px minmax(0, 1fr); | |
| 100 | + grid-template-columns: var(--label-w) 280px minmax(0, 1fr); | |
| 93 | 101 | column-gap: 16px; |
| 94 | 102 | align-items: center; |
| 95 | 103 | min-height: 52px; |
| @@ -142,10 +150,22 @@ $repo: 'main:has(> section.repo-head .tab.active[href$="/settings"])'; | ||
| 142 | 150 | } |
| 143 | 151 | } |
| 144 | 152 | |
| 153 | +#{$admin} .srv-row:not(:has(+ .srv-row)):not(:has(+ .srv-save)) { | |
| 154 | + border-bottom: 0; | |
| 155 | +} | |
| 156 | + | |
| 145 | 157 | // Save sits under the controls, on their edge. |
| 146 | 158 | #{$admin} .srv-save { |
| 147 | 159 | margin: 0; |
| 148 | - padding: 14px 18px 16px calc(18px + 210px + 16px); | |
| 160 | + padding: 14px 18px 16px calc(18px + var(--label-w) + 16px); | |
| 161 | +} | |
| 162 | + | |
| 163 | +#{$admin} .sec .srv-row { | |
| 164 | + padding-inline: 0; | |
| 165 | +} | |
| 166 | + | |
| 167 | +#{$admin} .sec .srv-save { | |
| 168 | + padding-inline: calc(var(--label-w) + 16px) 0; | |
| 149 | 169 | } |
| 150 | 170 | |
| 151 | 171 | @media (max-width: 700px) { |
| @@ -158,6 +178,11 @@ $repo: 'main:has(> section.repo-head .tab.active[href$="/settings"])'; | ||
| 158 | 178 | #{$admin} .srv-save { |
| 159 | 179 | padding-left: 14px; |
| 160 | 180 | } |
| 181 | + | |
| 182 | + #{$admin} .sec .srv-row, | |
| 183 | + #{$admin} .sec .srv-save { | |
| 184 | + padding-inline: 0; | |
| 185 | + } | |
| 161 | 186 | } |
| 162 | 187 | |
| 163 | 188 | // The server form takes the sheet's width, so its rows reach the same edge as the topic rules. |