forge
Explore
Log in

Don't you dare go Hollow

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 commit

c4521945d1d84b16f46a04e3ea9ecedd951d69eeAhmet Kaan GümüşParent: 729df69
All checks have passed
Show checks
  • 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
Show full message
💄 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
crates/forge-web-base/src/i18n/mod.rsmodified+4 -4
@@ -1203,10 +1203,10 @@ pub fn deleted_user(lang: Lang) -> &'static str {
12031203 /// The visibility badge text: "public" or "herkese açık", "private" or "özel".
12041204 pub fn visibility_label(lang: Lang, visibility: forge_core::Visibility) -> &'static str {
12051205 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",
12101210 }
12111211 }
12121212
crates/forge-web/src/pages/profile.rsmodified+8 -4
@@ -39,7 +39,7 @@ use crate::views::find::{Finder, finder_field};
3939 use crate::views::heatmap::{Calendar, DayDetail, contribution_calendar};
4040 use crate::views::parts::{SubPart, head};
4141 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,
4343 };
4444 use crate::views::{
4545 NavItem, avatar_url, enc, now_unix, profile_items, repo_href, shell, user_href,
@@ -752,11 +752,15 @@ async fn profile_card(
752752 for card in cards.into_iter() {
753753 <li class="line repo-item" data-kb-row="">
754754 <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>
756755 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>
758757 }
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>
760764 </li>
761765 }
762766 </ul>
crates/forge-web/src/pages/repo.rsmodified+5 -4
@@ -33,7 +33,6 @@ use crate::pages::tree::{
3333 };
3434 use crate::state::AppState;
3535 use crate::views::parts::{SubPart, head_sub};
36-use crate::views::repo_list::badge_class;
3736 use crate::views::{now_unix, ref_selector, relative_time, repo_href, repo_tabs, shell};
3837
3938 path_param!(owner);
@@ -119,7 +118,6 @@ pub async fn repo_head(
119118 ..
120119 } = head;
121120 let is_code = active == "code";
122- let badge = badge_class(visibility);
123121 let private = matches!(visibility, forge_core::Visibility::Private);
124122 let vis = i18n::visibility_label(lang, visibility);
125123 let shown_title = title.unwrap_or_else(|| tab_title(lang, active, &name));
@@ -159,7 +157,10 @@ pub async fn repo_head(
159157 if !description.is_empty() {
160158 parts.push(SubPart::text(description.as_str()));
161159 }
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+ }
163164 parts.push(SubPart::text(watch_count));
164165 parts.push(SubPart::text(fork_count));
165166 if let Some((source_owner, source_name)) = forked_from {
@@ -208,7 +209,7 @@ pub async fn repo_head(
208209 watch_form(lang: lang, action: action, csrf: csrf, level: level, watchers: watchers)
209210 }
210211 } else if private {
211- <span class=(badge)>(vis)</span>
212+ <span class="hint">(vis)</span>
212213 }
213214 (child)
214215 </div>
crates/forge-web/src/views/mod.rsmodified+2 -2
@@ -1919,11 +1919,11 @@ mod tests {
19191919 assert_eq!(i18n::deleted_user(Lang::Tr), "Silinmiş kullanıcı");
19201920 assert_eq!(
19211921 i18n::visibility_label(Lang::Tr, forge_core::Visibility::Public),
1922- "herkese açık"
1922+ "Herkese açık"
19231923 );
19241924 assert_eq!(
19251925 i18n::visibility_label(Lang::En, forge_core::Visibility::Private),
1926- "private"
1926+ "Private"
19271927 );
19281928 }
19291929
crates/forge-web/src/views/repo_list.rsmodified+8 -8
@@ -11,12 +11,10 @@ use crate::i18n::{self, Lang};
1111 use crate::pages::issue_parts::When;
1212 use crate::views::repo_href;
1313
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)))
2018 }
2119
2220 /// One listed repo, formatted for display.
@@ -45,7 +43,7 @@ impl RepoRow {
4543 }
4644 }
4745
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.
4947 #[component]
5048 pub async fn repo_rows(rows: Vec<RepoRow>, lang: Lang) -> Result<impl View> {
5149 let (before, after) = g::updated_parts(lang);
@@ -54,11 +52,13 @@ pub async fn repo_rows(rows: Vec<RepoRow>, lang: Lang) -> Result<impl View> {
5452 for row in rows.into_iter() {
5553 <li class="line repo-item" data-kb-row="">
5654 <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>
5855 if !row.description.is_empty() {
5956 <span class="val repo-desc" title=(row.description.as_str())>(row.description.as_str())</span>
6057 }
6158 <span class="val repo-stats">
59+ if let Some(private) = private_fact(lang, row.visibility) {
60+ (private)
61+ }
6262 "\u{2605} " (row.stars.to_string())
6363 (before)
6464 <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`.
4747
4848 `<a class="line" data-kb-row=""><span class="name">..</span><span class="val">..</span></a>` when the item
4949 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.
5152
5253 ```html
5354 <div class="line">
@@ -171,7 +172,9 @@ Turkish page shows no English, an English page no Turkish.
171172 nav.js reads.
172173 - Signed-in preferences live in the database.
173174 - 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.
175178 - Pages fit one screen where they can: use tabs and the rail, not stacked unrelated topics.
176179
177180 ## Fixed places
scripts/audit/shoot.pymodified+16 -4
@@ -299,7 +299,12 @@ class Chromium:
299299 def cmd(self, method, params=None):
300300 self.msgid += 1
301301 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
302305 while True:
306+ if time.time() > end:
307+ raise RuntimeError(f"{method}: timed out")
303308 msg = self._recv_msg()
304309 if msg.get("id") == self.msgid:
305310 if "error" in msg:
@@ -333,8 +338,9 @@ class Chromium:
333338 self.events = []
334339 self.cmd("Page.navigate", {"url": url})
335340 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))])")
338344 height = self.evaluate("Math.max(document.documentElement.scrollHeight, document.body ? document.body.scrollHeight : 0)") or self.h
339345 height = max(self.h, min(int(height), MAX_H))
340346 r = self.cmd("Page.captureScreenshot", {"format": "png", "captureBeyondViewport": True,
@@ -521,7 +527,7 @@ def cookie_for(auth, theme):
521527
522528
523529 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)
525531 st = str(r.status)
526532 if r.status in (301, 302, 303, 307, 308):
527533 loc = r.headers.get("Location", "").replace(PROXY, "")
@@ -575,7 +581,13 @@ def main():
575581 eff = "anon" if AREAS[slug] == "auth" else auth
576582 STATE["cookie"] = cookie_for(eff, theme)
577583 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
579591 tstat = time.time() - ts
580592 row["status"][eff] = st
581593 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 @@
148148 .repo-item .val {
149149 white-space: normal;
150150 }
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+ }
151163 }
152164
153165 // 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 {
13331333 box-shadow: 0 0 0 1px var(--border);
13341334 }
13351335
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+
13361352 // A panel opened inside the sheet lies over the page, so the sheet stops cutting while it is open.
13371353 .sheet:has(details[open] > :is(.menu-list, .pop-panel, .status-list)) {
13381354 overflow: visible;