On a phone the sheet runs to the screen's edges with a hairline above and below instead of a box inside the padded page, so rows get the width the gutter and ring took, and a sheet that hugs its form takes the whole width there
Browse files at this commitc4521945d1d84b16f46a04e3ea9ecedd951d69eeParent: 729df69All checks have passed
Show checks
ci/buildSucceededDetails
- style
- on a phone the sheet runs to the screen's edges with a hairline above and below instead of a box inside the padded page, so rows get the width the gutter and ring took, and a sheet that hugs its form takes the whole width there
- a public repository shows no visibility tag and a private one says Private as a plain fact in its row (Private · ★ 2 · updated ...), on lists, pinned repos and the repo head
- a repo row on a phone is its name, description and facts with room above and below 🔧 chore: the audit shooter gives up on a page that never finishes sending instead of hanging the run
9 changed files +76 -28
- crates/forge-web-base/src/i18n/mod.rs +4 -4
- crates/forge-web/src/pages/profile.rs +8 -4
- crates/forge-web/src/pages/repo.rs +5 -4
- crates/forge-web/src/views/mod.rs +2 -2
- crates/forge-web/src/views/repo_list.rs +8 -8
- docs/ui-language.md +5 -2
- scripts/audit/shoot.py +16 -4
- style/_min_menus.scss +12 -0
- style/_one.scss +16 -0
crates/forge-web-base/src/i18n/mod.rsmodified+4 -4
| @@ -1203,10 +1203,10 @@ pub fn deleted_user(lang: Lang) -> &'static str { | ||
| 1203 | 1203 | /// The visibility badge text: "public" or "herkese açık", "private" or "özel". |
| 1204 | 1204 | pub fn visibility_label(lang: Lang, visibility: forge_core::Visibility) -> &'static str { |
| 1205 | 1205 | match (lang, visibility) { |
| 1206 | - (Lang::En, forge_core::Visibility::Public) => "public", | |
| 1207 | - (Lang::En, forge_core::Visibility::Private) => "private", | |
| 1208 | - (Lang::Tr, forge_core::Visibility::Public) => "herkese açık", | |
| 1209 | - (Lang::Tr, forge_core::Visibility::Private) => "özel", | |
| 1206 | + (Lang::En, forge_core::Visibility::Public) => "Public", | |
| 1207 | + (Lang::En, forge_core::Visibility::Private) => "Private", | |
| 1208 | + (Lang::Tr, forge_core::Visibility::Public) => "Herkese açık", | |
| 1209 | + (Lang::Tr, forge_core::Visibility::Private) => "Özel", | |
| 1210 | 1210 | } |
| 1211 | 1211 | } |
| 1212 | 1212 |
crates/forge-web/src/pages/profile.rsmodified+8 -4
| @@ -39,7 +39,7 @@ use crate::views::find::{Finder, finder_field}; | ||
| 39 | 39 | use crate::views::heatmap::{Calendar, DayDetail, contribution_calendar}; |
| 40 | 40 | use crate::views::parts::{SubPart, head}; |
| 41 | 41 | use crate::views::repo_list::{ |
| 42 | - PageLink, RepoRow, SortLink, badge_class, pager, pager_links, repo_rows, sort_chips, | |
| 42 | + PageLink, RepoRow, SortLink, pager, pager_links, private_fact, repo_rows, sort_chips, | |
| 43 | 43 | }; |
| 44 | 44 | use crate::views::{ |
| 45 | 45 | NavItem, avatar_url, enc, now_unix, profile_items, repo_href, shell, user_href, |
| @@ -752,11 +752,15 @@ async fn profile_card( | ||
| 752 | 752 | for card in cards.into_iter() { |
| 753 | 753 | <li class="line repo-item" data-kb-row=""> |
| 754 | 754 | <a class="name repo-name" href=(repo_href(&card.repo.owner_name, &card.repo.name, "", ""))>(format!("{}/{}", card.repo.owner_name, card.repo.name))</a> |
| 755 | - <span class=(badge_class(card.repo.visibility))>(i18n::visibility_label(lang, card.repo.visibility))</span> | |
| 756 | 755 | if !card.repo.description.is_empty() { |
| 757 | - <span class="val" title=(card.repo.description.as_str())>(card.repo.description.as_str())</span> | |
| 756 | + <span class="val repo-desc" title=(card.repo.description.as_str())>(card.repo.description.as_str())</span> | |
| 758 | 757 | } |
| 759 | - <span class="val">"\u{2605} " (card.stars.to_string())</span> | |
| 758 | + <span class="val repo-stats"> | |
| 759 | + if let Some(private) = private_fact(lang, card.repo.visibility) { | |
| 760 | + (private) | |
| 761 | + } | |
| 762 | + "\u{2605} " (card.stars.to_string()) | |
| 763 | + </span> | |
| 760 | 764 | </li> |
| 761 | 765 | } |
| 762 | 766 | </ul> |
crates/forge-web/src/pages/repo.rsmodified+5 -4
| @@ -33,7 +33,6 @@ use crate::pages::tree::{ | ||
| 33 | 33 | }; |
| 34 | 34 | use crate::state::AppState; |
| 35 | 35 | use crate::views::parts::{SubPart, head_sub}; |
| 36 | -use crate::views::repo_list::badge_class; | |
| 37 | 36 | use crate::views::{now_unix, ref_selector, relative_time, repo_href, repo_tabs, shell}; |
| 38 | 37 | |
| 39 | 38 | path_param!(owner); |
| @@ -119,7 +118,6 @@ pub async fn repo_head( | ||
| 119 | 118 | .. |
| 120 | 119 | } = head; |
| 121 | 120 | let is_code = active == "code"; |
| 122 | - let badge = badge_class(visibility); | |
| 123 | 121 | let private = matches!(visibility, forge_core::Visibility::Private); |
| 124 | 122 | let vis = i18n::visibility_label(lang, visibility); |
| 125 | 123 | let shown_title = title.unwrap_or_else(|| tab_title(lang, active, &name)); |
| @@ -159,7 +157,10 @@ pub async fn repo_head( | ||
| 159 | 157 | if !description.is_empty() { |
| 160 | 158 | parts.push(SubPart::text(description.as_str())); |
| 161 | 159 | } |
| 162 | - parts.push(SubPart::text(vis)); | |
| 160 | + // Public is the usual case and says nothing; only a private repo says so. | |
| 161 | + if private { | |
| 162 | + parts.push(SubPart::text(vis)); | |
| 163 | + } | |
| 163 | 164 | parts.push(SubPart::text(watch_count)); |
| 164 | 165 | parts.push(SubPart::text(fork_count)); |
| 165 | 166 | if let Some((source_owner, source_name)) = forked_from { |
| @@ -208,7 +209,7 @@ pub async fn repo_head( | ||
| 208 | 209 | watch_form(lang: lang, action: action, csrf: csrf, level: level, watchers: watchers) |
| 209 | 210 | } |
| 210 | 211 | } else if private { |
| 211 | - <span class=(badge)>(vis)</span> | |
| 212 | + <span class="hint">(vis)</span> | |
| 212 | 213 | } |
| 213 | 214 | (child) |
| 214 | 215 | </div> |
crates/forge-web/src/views/mod.rsmodified+2 -2
| @@ -1919,11 +1919,11 @@ mod tests { | ||
| 1919 | 1919 | assert_eq!(i18n::deleted_user(Lang::Tr), "Silinmiş kullanıcı"); |
| 1920 | 1920 | assert_eq!( |
| 1921 | 1921 | i18n::visibility_label(Lang::Tr, forge_core::Visibility::Public), |
| 1922 | - "herkese açık" | |
| 1922 | + "Herkese açık" | |
| 1923 | 1923 | ); |
| 1924 | 1924 | assert_eq!( |
| 1925 | 1925 | i18n::visibility_label(Lang::En, forge_core::Visibility::Private), |
| 1926 | - "private" | |
| 1926 | + "Private" | |
| 1927 | 1927 | ); |
| 1928 | 1928 | } |
| 1929 | 1929 |
crates/forge-web/src/views/repo_list.rsmodified+8 -8
| @@ -11,12 +11,10 @@ use crate::i18n::{self, Lang}; | ||
| 11 | 11 | use crate::pages::issue_parts::When; |
| 12 | 12 | use crate::views::repo_href; |
| 13 | 13 | |
| 14 | -/// CSS class for a visibility badge. | |
| 15 | -pub fn badge_class(visibility: Visibility) -> &'static str { | |
| 16 | - match visibility { | |
| 17 | - Visibility::Public => "badge public", | |
| 18 | - Visibility::Private => "badge private", | |
| 19 | - } | |
| 14 | +/// The fact a row leads with when the repo is private ("Private · "); public says nothing, it is | |
| 15 | +/// the usual case. | |
| 16 | +pub fn private_fact(lang: Lang, visibility: Visibility) -> Option<String> { | |
| 17 | + (visibility == Visibility::Private).then(|| format!("{} \u{b7} ", i18n::visibility_label(lang, visibility))) | |
| 20 | 18 | } |
| 21 | 19 | |
| 22 | 20 | /// One listed repo, formatted for display. |
| @@ -45,7 +43,7 @@ impl RepoRow { | ||
| 45 | 43 | } |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | -/// The repo rows: name, visibility badge, a one-line description, stars and the last update. | |
| 46 | +/// The repo rows: name, a one-line description, then Private (when it is), stars and the last update. | |
| 49 | 47 | #[component] |
| 50 | 48 | pub async fn repo_rows(rows: Vec<RepoRow>, lang: Lang) -> Result<impl View> { |
| 51 | 49 | let (before, after) = g::updated_parts(lang); |
| @@ -54,11 +52,13 @@ pub async fn repo_rows(rows: Vec<RepoRow>, lang: Lang) -> Result<impl View> { | ||
| 54 | 52 | for row in rows.into_iter() { |
| 55 | 53 | <li class="line repo-item" data-kb-row=""> |
| 56 | 54 | <a class="name repo-name" href=(row.href.as_str())>(row.title.as_str())</a> |
| 57 | - <span class=(badge_class(row.visibility))>(i18n::visibility_label(lang, row.visibility))</span> | |
| 58 | 55 | if !row.description.is_empty() { |
| 59 | 56 | <span class="val repo-desc" title=(row.description.as_str())>(row.description.as_str())</span> |
| 60 | 57 | } |
| 61 | 58 | <span class="val repo-stats"> |
| 59 | + if let Some(private) = private_fact(lang, row.visibility) { | |
| 60 | + (private) | |
| 61 | + } | |
| 62 | 62 | "\u{2605} " (row.stars.to_string()) |
| 63 | 63 | (before) |
| 64 | 64 | <time data-rel="true" datetime=(row.when.iso.as_str()) title=(row.when.absolute.as_str())>(row.when.relative.as_str())</time> |
docs/ui-language.mdmodified+5 -2
| @@ -47,7 +47,8 @@ Sections never go in the rail: they go in `.tabs`. | ||
| 47 | 47 | |
| 48 | 48 | `<a class="line" data-kb-row=""><span class="name">..</span><span class="val">..</span></a>` when the item |
| 49 | 49 | has its own page. Otherwise the row shows everything at once: its facts in the one `.val`, joined with |
| 50 | -" · ", and its actions right after them on the same line. A confirm opens in place of its word, on the row. | |
| 50 | +" · ", and its actions right after them on the same line. A state that is the usual case (a public repository) | |
| 51 | +says nothing; the unusual one is a plain fact in the `.val` ("Private · ★ 2"), never a tag. A confirm opens in place of its word, on the row. | |
| 51 | 52 | |
| 52 | 53 | ```html |
| 53 | 54 | <div class="line"> |
| @@ -171,7 +172,9 @@ Turkish page shows no English, an English page no Turkish. | ||
| 171 | 172 | nav.js reads. |
| 172 | 173 | - Signed-in preferences live in the database. |
| 173 | 174 | - A setting must visibly change something, or it goes. |
| 174 | -- A phone (390px) is one column: no sideways scroll, tabs scroll inside their row. | |
| 175 | +- A phone (390px) is one column: no sideways scroll, tabs scroll inside their row. The sheet runs to | |
| 176 | + the screen's edges with a hairline above and below, never a box inside the padded page, and a | |
| 177 | + `fit` sheet takes the whole width there. | |
| 175 | 178 | - Pages fit one screen where they can: use tabs and the rail, not stacked unrelated topics. |
| 176 | 179 | |
| 177 | 180 | ## Fixed places |
scripts/audit/shoot.pymodified+16 -4
| @@ -299,7 +299,12 @@ class Chromium: | ||
| 299 | 299 | def cmd(self, method, params=None): |
| 300 | 300 | self.msgid += 1 |
| 301 | 301 | self._send({"id": self.msgid, "method": method, "params": params or {}}) |
| 302 | + # A steady trickle of events keeps the socket's own timeout from ever firing, so the | |
| 303 | + # command carries its own deadline. | |
| 304 | + end = time.time() + 60 | |
| 302 | 305 | while True: |
| 306 | + if time.time() > end: | |
| 307 | + raise RuntimeError(f"{method}: timed out") | |
| 303 | 308 | msg = self._recv_msg() |
| 304 | 309 | if msg.get("id") == self.msgid: |
| 305 | 310 | if "error" in msg: |
| @@ -333,8 +338,9 @@ class Chromium: | ||
| 333 | 338 | self.events = [] |
| 334 | 339 | self.cmd("Page.navigate", {"url": url}) |
| 335 | 340 | self.wait_event("Page.loadEventFired") |
| 336 | - self.evaluate("document.fonts ? document.fonts.ready.then(() => 1) : 1") | |
| 337 | - self.evaluate("new Promise(r => requestAnimationFrame(() => requestAnimationFrame(() => r(1))))") | |
| 341 | + # Each wait is raced with a timer: a page whose fonts or frames never settle still gets shot. | |
| 342 | + self.evaluate("Promise.race([document.fonts ? document.fonts.ready.then(() => 1) : 1, new Promise(r => setTimeout(() => r(0), 3000))])") | |
| 343 | + self.evaluate("Promise.race([new Promise(r => requestAnimationFrame(() => requestAnimationFrame(() => r(1)))), new Promise(r => setTimeout(() => r(0), 1000))])") | |
| 338 | 344 | height = self.evaluate("Math.max(document.documentElement.scrollHeight, document.body ? document.body.scrollHeight : 0)") or self.h |
| 339 | 345 | height = max(self.h, min(int(height), MAX_H)) |
| 340 | 346 | r = self.cmd("Page.captureScreenshot", {"format": "png", "captureBeyondViewport": True, |
| @@ -521,7 +527,7 @@ def cookie_for(auth, theme): | ||
| 521 | 527 | |
| 522 | 528 | |
| 523 | 529 | def status_of(url): |
| 524 | - r = raw_request(PROXY + url, headers={"Accept": "text/html"}) | |
| 530 | + r = raw_request(PROXY + url, headers={"Accept": "text/html"}, timeout=20) | |
| 525 | 531 | st = str(r.status) |
| 526 | 532 | if r.status in (301, 302, 303, 307, 308): |
| 527 | 533 | loc = r.headers.get("Location", "").replace(PROXY, "") |
| @@ -575,7 +581,13 @@ def main(): | ||
| 575 | 581 | eff = "anon" if AREAS[slug] == "auth" else auth |
| 576 | 582 | STATE["cookie"] = cookie_for(eff, theme) |
| 577 | 583 | ts = time.time() |
| 578 | - code, st = status_of(url) | |
| 584 | + try: | |
| 585 | + code, st = status_of(url) | |
| 586 | + except OSError as e: | |
| 587 | + # A page that never finishes sending (an event stream) is skipped, not fatal. | |
| 588 | + row["errors"][vlabel] = str(e)[:200] | |
| 589 | + print(f"[shoot] FAIL {url} {vlabel}: {e}", flush=True) | |
| 590 | + continue | |
| 579 | 591 | tstat = time.time() - ts |
| 580 | 592 | row["status"][eff] = st |
| 581 | 593 | if eff == "anon" and code in (301, 302, 303, 307, 308) and "/login" in st: |
style/_min_menus.scssmodified+12 -0
| @@ -148,6 +148,18 @@ | ||
| 148 | 148 | .repo-item .val { |
| 149 | 149 | white-space: normal; |
| 150 | 150 | } |
| 151 | + | |
| 152 | + // A repo row on a phone: the name, then its facts as two quiet lines, with room above and below | |
| 153 | + // so the divider never touches the words. | |
| 154 | + .repo-list > .line.repo-item { | |
| 155 | + row-gap: 2px; | |
| 156 | + padding-top: 10px; | |
| 157 | + padding-bottom: 10px; | |
| 158 | + } | |
| 159 | + | |
| 160 | + .repo-list > .line.repo-item > .repo-desc { | |
| 161 | + flex: 1 1 100%; | |
| 162 | + } | |
| 151 | 163 | } |
| 152 | 164 | |
| 153 | 165 | // The pins menu opens from its own words, as a panel with the menu's padding, over the page. |
style/_one.scssmodified+16 -0
| @@ -1333,6 +1333,22 @@ main > .tabs { | ||
| 1333 | 1333 | box-shadow: 0 0 0 1px var(--border); |
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | +// A phone has no room for a box inside the page: the sheet runs to the screen's edges with a | |
| 1337 | +// hairline above and below, so its rows get the width the gutter and ring took. | |
| 1338 | +@media (max-width: 700px) { | |
| 1339 | + .sheet { | |
| 1340 | + margin-right: calc(-1 * var(--gutter)); | |
| 1341 | + margin-left: calc(-1 * var(--gutter)); | |
| 1342 | + border-radius: 0; | |
| 1343 | + box-shadow: 0 -1px 0 var(--border), 0 1px 0 var(--border); | |
| 1344 | + } | |
| 1345 | + | |
| 1346 | + // A sheet that hugs its form on a wide screen takes the whole width here too, so no half band. | |
| 1347 | + main > .sheet.fit { | |
| 1348 | + align-self: stretch; | |
| 1349 | + } | |
| 1350 | +} | |
| 1351 | + | |
| 1336 | 1352 | // A panel opened inside the sheet lies over the page, so the sheet stops cutting while it is open. |
| 1337 | 1353 | .sheet:has(details[open] > :is(.menu-list, .pop-panel, .status-list)) { |
| 1338 | 1354 | overflow: visible; |