diff --git a/crates/forge-web-base/src/i18n/mod.rs b/crates/forge-web-base/src/i18n/mod.rs index 4d255bd..ca2764f 100644 --- a/crates/forge-web-base/src/i18n/mod.rs +++ b/crates/forge-web-base/src/i18n/mod.rs @@ -1203,10 +1203,10 @@ pub fn deleted_user(lang: Lang) -> &'static str { /// The visibility badge text: "public" or "herkese açık", "private" or "özel". pub fn visibility_label(lang: Lang, visibility: forge_core::Visibility) -> &'static str { match (lang, visibility) { - (Lang::En, forge_core::Visibility::Public) => "public", - (Lang::En, forge_core::Visibility::Private) => "private", - (Lang::Tr, forge_core::Visibility::Public) => "herkese açık", - (Lang::Tr, forge_core::Visibility::Private) => "özel", + (Lang::En, forge_core::Visibility::Public) => "Public", + (Lang::En, forge_core::Visibility::Private) => "Private", + (Lang::Tr, forge_core::Visibility::Public) => "Herkese açık", + (Lang::Tr, forge_core::Visibility::Private) => "Özel", } } diff --git a/crates/forge-web/src/pages/profile.rs b/crates/forge-web/src/pages/profile.rs index 2c311ad..0a14446 100644 --- a/crates/forge-web/src/pages/profile.rs +++ b/crates/forge-web/src/pages/profile.rs @@ -39,7 +39,7 @@ use crate::views::find::{Finder, finder_field}; use crate::views::heatmap::{Calendar, DayDetail, contribution_calendar}; use crate::views::parts::{SubPart, head}; use crate::views::repo_list::{ - PageLink, RepoRow, SortLink, badge_class, pager, pager_links, repo_rows, sort_chips, + PageLink, RepoRow, SortLink, pager, pager_links, private_fact, repo_rows, sort_chips, }; use crate::views::{ NavItem, avatar_url, enc, now_unix, profile_items, repo_href, shell, user_href, @@ -752,11 +752,15 @@ async fn profile_card( for card in cards.into_iter() {
  • (format!("{}/{}", card.repo.owner_name, card.repo.name)) - (i18n::visibility_label(lang, card.repo.visibility)) if !card.repo.description.is_empty() { - (card.repo.description.as_str()) + (card.repo.description.as_str()) } - "\u{2605} " (card.stars.to_string()) + + if let Some(private) = private_fact(lang, card.repo.visibility) { + (private) + } + "\u{2605} " (card.stars.to_string()) +
  • } diff --git a/crates/forge-web/src/pages/repo.rs b/crates/forge-web/src/pages/repo.rs index 72bdeaf..8b6f898 100644 --- a/crates/forge-web/src/pages/repo.rs +++ b/crates/forge-web/src/pages/repo.rs @@ -33,7 +33,6 @@ use crate::pages::tree::{ }; use crate::state::AppState; use crate::views::parts::{SubPart, head_sub}; -use crate::views::repo_list::badge_class; use crate::views::{now_unix, ref_selector, relative_time, repo_href, repo_tabs, shell}; path_param!(owner); @@ -119,7 +118,6 @@ pub async fn repo_head( .. } = head; let is_code = active == "code"; - let badge = badge_class(visibility); let private = matches!(visibility, forge_core::Visibility::Private); let vis = i18n::visibility_label(lang, visibility); let shown_title = title.unwrap_or_else(|| tab_title(lang, active, &name)); @@ -159,7 +157,10 @@ pub async fn repo_head( if !description.is_empty() { parts.push(SubPart::text(description.as_str())); } - parts.push(SubPart::text(vis)); + // Public is the usual case and says nothing; only a private repo says so. + if private { + parts.push(SubPart::text(vis)); + } parts.push(SubPart::text(watch_count)); parts.push(SubPart::text(fork_count)); if let Some((source_owner, source_name)) = forked_from { @@ -208,7 +209,7 @@ pub async fn repo_head( watch_form(lang: lang, action: action, csrf: csrf, level: level, watchers: watchers) } } else if private { - (vis) + (vis) } (child) diff --git a/crates/forge-web/src/views/mod.rs b/crates/forge-web/src/views/mod.rs index 6e5bccb..70bc526 100644 --- a/crates/forge-web/src/views/mod.rs +++ b/crates/forge-web/src/views/mod.rs @@ -1919,11 +1919,11 @@ mod tests { assert_eq!(i18n::deleted_user(Lang::Tr), "Silinmiş kullanıcı"); assert_eq!( i18n::visibility_label(Lang::Tr, forge_core::Visibility::Public), - "herkese açık" + "Herkese açık" ); assert_eq!( i18n::visibility_label(Lang::En, forge_core::Visibility::Private), - "private" + "Private" ); } diff --git a/crates/forge-web/src/views/repo_list.rs b/crates/forge-web/src/views/repo_list.rs index 9414460..dea43e1 100644 --- a/crates/forge-web/src/views/repo_list.rs +++ b/crates/forge-web/src/views/repo_list.rs @@ -11,12 +11,10 @@ use crate::i18n::{self, Lang}; use crate::pages::issue_parts::When; use crate::views::repo_href; -/// CSS class for a visibility badge. -pub fn badge_class(visibility: Visibility) -> &'static str { - match visibility { - Visibility::Public => "badge public", - Visibility::Private => "badge private", - } +/// The fact a row leads with when the repo is private ("Private · "); public says nothing, it is +/// the usual case. +pub fn private_fact(lang: Lang, visibility: Visibility) -> Option { + (visibility == Visibility::Private).then(|| format!("{} \u{b7} ", i18n::visibility_label(lang, visibility))) } /// One listed repo, formatted for display. @@ -45,7 +43,7 @@ impl RepoRow { } } -/// The repo rows: name, visibility badge, a one-line description, stars and the last update. +/// The repo rows: name, a one-line description, then Private (when it is), stars and the last update. #[component] pub async fn repo_rows(rows: Vec, lang: Lang) -> Result { let (before, after) = g::updated_parts(lang); @@ -54,11 +52,13 @@ pub async fn repo_rows(rows: Vec, lang: Lang) -> Result { for row in rows.into_iter() {
  • (row.title.as_str()) - (i18n::visibility_label(lang, row.visibility)) if !row.description.is_empty() { (row.description.as_str()) } + if let Some(private) = private_fact(lang, row.visibility) { + (private) + } "\u{2605} " (row.stars.to_string()) (before) diff --git a/docs/ui-language.md b/docs/ui-language.md index 142638a..0f52156 100644 --- a/docs/ui-language.md +++ b/docs/ui-language.md @@ -47,7 +47,8 @@ Sections never go in the rail: they go in `.tabs`. `....` when the item has its own page. Otherwise the row shows everything at once: its facts in the one `.val`, joined with -" · ", and its actions right after them on the same line. A confirm opens in place of its word, on the row. +" · ", and its actions right after them on the same line. A state that is the usual case (a public repository) +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. ```html
    @@ -171,7 +172,9 @@ Turkish page shows no English, an English page no Turkish. nav.js reads. - Signed-in preferences live in the database. - A setting must visibly change something, or it goes. -- A phone (390px) is one column: no sideways scroll, tabs scroll inside their row. +- A phone (390px) is one column: no sideways scroll, tabs scroll inside their row. The sheet runs to + the screen's edges with a hairline above and below, never a box inside the padded page, and a + `fit` sheet takes the whole width there. - Pages fit one screen where they can: use tabs and the rail, not stacked unrelated topics. ## Fixed places diff --git a/scripts/audit/shoot.py b/scripts/audit/shoot.py index 8e1bdff..3224c91 100755 --- a/scripts/audit/shoot.py +++ b/scripts/audit/shoot.py @@ -299,7 +299,12 @@ class Chromium: def cmd(self, method, params=None): self.msgid += 1 self._send({"id": self.msgid, "method": method, "params": params or {}}) + # A steady trickle of events keeps the socket's own timeout from ever firing, so the + # command carries its own deadline. + end = time.time() + 60 while True: + if time.time() > end: + raise RuntimeError(f"{method}: timed out") msg = self._recv_msg() if msg.get("id") == self.msgid: if "error" in msg: @@ -333,8 +338,9 @@ class Chromium: self.events = [] self.cmd("Page.navigate", {"url": url}) self.wait_event("Page.loadEventFired") - self.evaluate("document.fonts ? document.fonts.ready.then(() => 1) : 1") - self.evaluate("new Promise(r => requestAnimationFrame(() => requestAnimationFrame(() => r(1))))") + # Each wait is raced with a timer: a page whose fonts or frames never settle still gets shot. + self.evaluate("Promise.race([document.fonts ? document.fonts.ready.then(() => 1) : 1, new Promise(r => setTimeout(() => r(0), 3000))])") + self.evaluate("Promise.race([new Promise(r => requestAnimationFrame(() => requestAnimationFrame(() => r(1)))), new Promise(r => setTimeout(() => r(0), 1000))])") height = self.evaluate("Math.max(document.documentElement.scrollHeight, document.body ? document.body.scrollHeight : 0)") or self.h height = max(self.h, min(int(height), MAX_H)) r = self.cmd("Page.captureScreenshot", {"format": "png", "captureBeyondViewport": True, @@ -521,7 +527,7 @@ def cookie_for(auth, theme): def status_of(url): - r = raw_request(PROXY + url, headers={"Accept": "text/html"}) + r = raw_request(PROXY + url, headers={"Accept": "text/html"}, timeout=20) st = str(r.status) if r.status in (301, 302, 303, 307, 308): loc = r.headers.get("Location", "").replace(PROXY, "") @@ -575,7 +581,13 @@ def main(): eff = "anon" if AREAS[slug] == "auth" else auth STATE["cookie"] = cookie_for(eff, theme) ts = time.time() - code, st = status_of(url) + try: + code, st = status_of(url) + except OSError as e: + # A page that never finishes sending (an event stream) is skipped, not fatal. + row["errors"][vlabel] = str(e)[:200] + print(f"[shoot] FAIL {url} {vlabel}: {e}", flush=True) + continue tstat = time.time() - ts row["status"][eff] = st if eff == "anon" and code in (301, 302, 303, 307, 308) and "/login" in st: diff --git a/style/_min_menus.scss b/style/_min_menus.scss index ddbb22e..78159d1 100644 --- a/style/_min_menus.scss +++ b/style/_min_menus.scss @@ -148,6 +148,18 @@ .repo-item .val { white-space: normal; } + + // A repo row on a phone: the name, then its facts as two quiet lines, with room above and below + // so the divider never touches the words. + .repo-list > .line.repo-item { + row-gap: 2px; + padding-top: 10px; + padding-bottom: 10px; + } + + .repo-list > .line.repo-item > .repo-desc { + flex: 1 1 100%; + } } // The pins menu opens from its own words, as a panel with the menu's padding, over the page. diff --git a/style/_one.scss b/style/_one.scss index 1889861..6b3db34 100644 --- a/style/_one.scss +++ b/style/_one.scss @@ -1333,6 +1333,22 @@ main > .tabs { box-shadow: 0 0 0 1px var(--border); } +// A phone has no room for a box inside the page: the sheet runs to the screen's edges with a +// hairline above and below, so its rows get the width the gutter and ring took. +@media (max-width: 700px) { + .sheet { + margin-right: calc(-1 * var(--gutter)); + margin-left: calc(-1 * var(--gutter)); + border-radius: 0; + box-shadow: 0 -1px 0 var(--border), 0 1px 0 var(--border); + } + + // A sheet that hugs its form on a wide screen takes the whole width here too, so no half band. + main > .sheet.fit { + align-self: stretch; + } +} + // A panel opened inside the sheet lies over the page, so the sheet stops cutting while it is open. .sheet:has(details[open] > :is(.menu-list, .pop-panel, .status-list)) { overflow: visible;