forge
Explore
Log in

Don't you dare go Hollow

The decided One Page design now covers the whole app: every button, field, choice row, dropdown, popover and menu shares one kit (38px fields, 32px small buttons and choices, 280px inputs, 560px text areas, 130px label column, 20px menus with 34px rows), every page is one narrow column of head, tabs, sheet and quiet text actions under what they act on, and docs/ui-language.md holds the rules

Browse files at this commit

fd174b4fb40c988564507486ee5e8f624a9f9a1dAhmet Kaan GümüşParent: 949180b
All checks have passed
Show checks
  • style
    • the decided One Page design now covers the whole app: every button, field, choice row, dropdown, popover and menu shares one kit (38px fields, 32px small buttons and choices, 280px inputs, 560px text areas, 130px label column, 20px menus with 34px rows), every page is one narrow column of head, tabs, sheet and quiet text actions under what they act on, and docs/ui-language.md holds the rules
    • the four older style layers are gone in favour of style/_one*.scss
    • Ember on Anvil is the default look, and accounts that never chose colours move with it
    • settings Keys shows one kind at a time with SSH, GPG and tokens at their own addresses
    • run alerts are one row
    • issue and pull lists share one row with the tick beside the title on a phone
    • a pull's state badge has the colours of an issue's
    • the CI list opens each run on its own page and marks none as current
    • a queued job says No output yet
    • the review panel offers Approve and Request changes only to people who are not the pull's author, and Discard only when something is pending
Show full message
💄 style: the decided One Page design now covers the whole app: every button, field, choice row, dropdown, popover and menu shares one kit (38px fields, 32px small buttons and choices, 280px inputs, 560px text areas, 130px label column, 20px menus with 34px rows), every page is one narrow column of head, tabs, sheet and quiet text actions under what they act on, and docs/ui-language.md holds the rules; the four older style layers are gone in favour of style/_one*.scss; Ember on Anvil is the default look, and accounts that never chose colours move with it; settings Keys shows one kind at a time with SSH, GPG and tokens at their own addresses; run alerts are one row; issue and pull lists share one row with the tick beside the title on a phone; a pull's state badge has the colours of an issue's; the CI list opens each run on its own page and marks none as current; a queued job says No output yet; the review panel offers Approve and Request changes only to people who are not the pull's author, and Discard only when something is pending
✨ feat: a page you may not open shows a styled Not allowed page, and a signed-out visitor is sent to log in and back; the login page links to Forgot password and, when sign-up is open, Create an account
🐛 fix: admin and settings styles no longer key on English labels, so Turkish pages keep their layout; Turkish health uptime, server setting options, session device names and read-only hints are translated; health counts active alerts; an empty repo no longer shows a Branches heading
✅ test: scripts/audit/mock.py fills runners, CI history and graphs, scripts/audit/paths.py lists every page, and seven measured passes (light, dark, Turkish, signed out, panels open, 390 to 2560 wide) end with no problems

170 changed files +10662 -9677

crates/forge-core/migrations/0072_ember_anvil_default.sqladded+19 -0
@@ -0,0 +1,19 @@
1+-- Ember on Anvil becomes the look of a new account. An account that never chose its colours moves
2+-- with the default; one that chose keeps its choice. SQLite cannot change a column's default in
3+-- place, so each column is replaced.
4+ALTER TABLE users RENAME COLUMN accent TO accent_old;
5+ALTER TABLE users RENAME COLUMN accent_dark TO accent_dark_old;
6+ALTER TABLE users RENAME COLUMN base_light TO base_light_old;
7+ALTER TABLE users RENAME COLUMN base_dark TO base_dark_old;
8+ALTER TABLE users ADD COLUMN accent TEXT NOT NULL DEFAULT 'ember';
9+ALTER TABLE users ADD COLUMN accent_dark TEXT NOT NULL DEFAULT 'ember';
10+ALTER TABLE users ADD COLUMN base_light TEXT NOT NULL DEFAULT 'anvil';
11+ALTER TABLE users ADD COLUMN base_dark TEXT NOT NULL DEFAULT 'anvil';
12+UPDATE users SET accent = accent_old, accent_dark = accent_dark_old,
13+ base_light = base_light_old, base_dark = base_dark_old
14+WHERE NOT (accent_old = 'sage' AND accent_dark_old = 'sage'
15+ AND base_light_old = 'fern' AND base_dark_old = 'fern');
16+ALTER TABLE users DROP COLUMN accent_old;
17+ALTER TABLE users DROP COLUMN accent_dark_old;
18+ALTER TABLE users DROP COLUMN base_light_old;
19+ALTER TABLE users DROP COLUMN base_dark_old;
crates/forge-core/src/model.rsmodified+4 -4
@@ -48,13 +48,13 @@ pub struct User {
4848 /// Language code, e.g. "en"; "auto" uses the instance default.
4949 pub language: String,
5050 /// Accent colour for the light theme: the id of a palette in forge-web's `accent_palette.rs`.
51- /// "sage" is the default.
51+ /// "ember" is the default.
5252 pub accent: String,
53- /// Accent colour for the dark theme, chosen separately from `accent`. "sage" is the default.
53+ /// Accent colour for the dark theme, chosen separately from `accent`. "ember" is the default.
5454 pub accent_dark: String,
55- /// Base (neutral background, surface and text) set for the light theme. "fern" is the default.
55+ /// Base (neutral background, surface and text) set for the light theme. "anvil" is the default.
5656 pub base_light: String,
57- /// Base set for the dark theme. "fern" is the default.
57+ /// Base set for the dark theme. "anvil" is the default.
5858 pub base_dark: String,
5959 /// Which side the main shell sidebar sits on: "left" (the default) or "right".
6060 pub sidebar_side: String,
crates/forge-core/src/server_settings.rsmodified+1 -1
@@ -164,7 +164,7 @@ pub static FIELDS: &[Field] = &[
164164 L,
165165 Ty::Choice(BANNER_LEVEL),
166166 "Banner level",
167- "info or warning.",
167+ "Info or warning.",
168168 ),
169169 f(
170170 "banner.expires",
crates/forge-core/src/store/migrate.rsmodified+1 -0
@@ -117,6 +117,7 @@ pub const MIGRATIONS: &[(u32, &str)] = &[
117117 include_str!("../../migrations/0070_pull_viewed_files.sql"),
118118 ),
119119 (71, include_str!("../../migrations/0071_ci_job_steps.sql")),
120+ (72, include_str!("../../migrations/0072_ember_anvil_default.sql")),
120121 ];
121122
122123 /// The highest migration version this binary knows about.
crates/forge-core/src/store/ui_prefs.rsmodified+2 -2
@@ -15,11 +15,11 @@ pub const AUTO: &str = "auto";
1515
1616 /// The accent colour a new user gets. It must match the default palette in forge-web's
1717 /// `accent_palette.rs`, which a test there checks.
18-pub const DEFAULT_ACCENT: &str = "sage";
18+pub const DEFAULT_ACCENT: &str = "ember";
1919
2020 /// The base colour set a new user gets, for both themes. It must match the default base in
2121 /// forge-web's `accent_palette.rs`, which a test there checks.
22-pub const DEFAULT_BASE: &str = "fern";
22+pub const DEFAULT_BASE: &str = "anvil";
2323
2424 /// The sidebar sides, in the order the settings page lists them.
2525 pub const SIDEBAR_SIDES: &[&str] = &["left", "right"];
crates/forge-e2e/tests/e2e/browse_e2e.rsmodified+12 -15
@@ -124,25 +124,22 @@ fn element_texts(body: &str, selector: &str) -> Vec<String> {
124124 .collect()
125125 }
126126
127-/// Checks the dock of a repo page: one dock, with the subject of the commit, its short sha, the
128-/// commit count label and the subject's absolute time in its title.
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.
129129 fn assert_latest_bar(body: &str, what: &str, subject: &str, oid: &str, count: &str) {
130- let docks = element_texts(body, ".canvas-dock");
131- assert_eq!(docks.len(), 1, "{what}: exactly one dock");
132- let subjects = element_texts(body, ".canvas-dock .dock-subject");
133- assert_eq!(subjects.len(), 1, "{what}: dock must show the subject");
134- assert_eq!(subjects[0].trim(), subject, "{what}: dock subject");
135- let shas = element_texts(body, ".canvas-dock .dock-sha");
136- assert_eq!(shas.len(), 1, "{what}: dock must show the sha");
137- assert_eq!(shas[0].trim(), &oid[..7], "{what}: dock short sha");
138- let counts = element_texts(body, ".canvas-dock .dock-count");
130+ assert_eq!(element_texts(body, ".head-sub").len(), 1, "{what}: one head line");
131+ let shas = element_texts(body, ".head-sub a.mono");
132+ assert_eq!(shas.len(), 1, "{what}: the head line must show the sha");
133+ assert_eq!(shas[0].trim(), &oid[..7], "{what}: short sha");
134+ let links = element_texts(body, ".head-sub a[href*=\"/commit/\"]");
139135 assert!(
140- counts.iter().any(|c| c.trim() == count),
141- "{what}: dock must show {count:?}, got {counts:?}"
136+ links.iter().any(|l| l.trim() == subject),
137+ "{what}: the head line must show {subject:?}, got {links:?}"
142138 );
139+ let parts = element_texts(body, ".head-sub span");
143140 assert!(
144- !attr_values(body, ".canvas-dock .dock-subject", "title").is_empty(),
145- "{what}: dock subject needs an absolute time in its title"
141+ parts.iter().any(|c| c.trim() == count),
142+ "{what}: the head line must show {count:?}, got {parts:?}"
146143 );
147144 }
148145
crates/forge-e2e/tests/e2e/ci_e2e.rsmodified+2 -2
@@ -577,8 +577,8 @@ async fn run_page_lists_a_jobs_steps_and_a_step_opens_its_part_of_the_log() {
577577 .await;
578578 assert_eq!(page.status, 200, "GET run page");
579579 assert!(
580- page.body.contains("ci-tl-stepname") && page.body.contains("Compile"),
581- "the rail lists the step names: {}",
580+ page.body.contains("class=\"lab\"") && page.body.contains("Compile"),
581+ "the strip lists the step names: {}",
582582 page.body
583583 );
584584 assert!(
crates/forge-e2e/tests/e2e/community_i18n_e2e.rsmodified+2 -2
@@ -51,7 +51,7 @@ async fn snippets_page_follows_the_browser_language() {
5151 let body = turkish.text().await.expect("read body");
5252 assert!(body.contains("<html lang=\"tr\""), "html lang is tr");
5353 assert!(
54- body.contains("<h1 class=\"sr-only\">Parçacıklar</h1>"),
54+ body.contains("<h1>Parçacıklar</h1>"),
5555 "Turkish heading"
5656 );
5757 assert!(
@@ -68,7 +68,7 @@ async fn snippets_page_follows_the_browser_language() {
6868 .expect("GET /snippets (en)");
6969 let body = english.text().await.expect("read body");
7070 assert!(
71- body.contains("<h1 class=\"sr-only\">Snippets</h1>"),
71+ body.contains("<h1>Snippets</h1>"),
7272 "English heading"
7373 );
7474 assert!(body.contains("No snippets to show."), "English empty state");
crates/forge-e2e/tests/e2e/i18n_e2e.rsmodified+1 -1
@@ -168,7 +168,7 @@ async fn releases_page_follows_the_stored_turkish_language() {
168168 .await;
169169 assert_eq!(releases.status, 200, "releases page");
170170 assert!(
171- releases.body.contains("<h2>Sürümler</h2>"),
171+ releases.body.contains("<h1>Sürümler</h1>"),
172172 "Turkish heading"
173173 );
174174 assert!(releases.body.contains("Yeni sürüm"), "Turkish new button");
crates/forge-e2e/tests/e2e/pulls_e2e.rsmodified+1 -1
@@ -23,7 +23,7 @@ const REPO_PATH: &str = "/tahinli/r";
2323 /// Text of the first state badge on a page, e.g. `Open`, `Closed` or `Merged`.
2424 fn state_badge(body: &str) -> String {
2525 let doc = scraper::Html::parse_document(body);
26- let selector = scraper::Selector::parse(".issue-badge").expect("selector");
26+ let selector = scraper::Selector::parse(".head-sub > .badge, .head-sub > .issue-badge").expect("selector");
2727 doc.select(&selector)
2828 .next()
2929 .map(|el| el.text().collect::<String>().trim().to_owned())
crates/forge-e2e/tests/e2e/section_nav_e2e.rsmodified+3 -2
@@ -216,9 +216,10 @@ async fn settings_pages_get_the_settings_tabs() {
216216 assert_eq!(page.status, 200, "GET {path}");
217217 assert_tabs(&page.body, current, &tabs);
218218 }
219- // GPG keys and tokens moved into the Keys tab; their old addresses go there.
219+ // GPG keys and tokens are kinds of the Keys tab, each at its own address.
220220 for path in ["/settings/gpg", "/settings/tokens"] {
221221 let page = env.http.get(path, Some(&session)).await;
222- assert_eq!(page.status, 303, "GET {path}");
222+ assert_eq!(page.status, 200, "GET {path}");
223+ assert_tabs(&page.body, "/settings/keys", &tabs);
223224 }
224225 }
crates/forge-e2e/tests/e2e/ui_prefs_e2e.rsmodified+6 -3
@@ -59,8 +59,11 @@ fn checked_radio(body: &str, name: &str) -> Option<String> {
5959 /// The option value that is selected in the `<select name="...">` on a page.
6060 fn selected_option(body: &str, select: &str) -> Option<String> {
6161 let doc = scraper::Html::parse_document(body);
62- let selector = scraper::Selector::parse(&format!("select[name=\"{select}\"] option[selected]"))
63- .expect("selector");
62+ // A select's chosen option, or the pressed button of a choice row.
63+ let selector = scraper::Selector::parse(&format!(
64+ "select[name=\"{select}\"] option[selected], button[name=\"{select}\"][aria-pressed=\"true\"]"
65+ ))
66+ .expect("selector");
6467 doc.select(&selector)
6568 .next()
6669 .and_then(|el| el.value().attr("value"))
@@ -227,7 +230,7 @@ async fn light_and_dark_colours_save_independently_and_render_on_html() {
227230 let session = login(&env.http, "tahinli", PW).await;
228231
229232 let page = env.http.get("/settings/appearance", Some(&session)).await;
230- let defaults = ["sage", "sage", "fern", "fern"].map(str::to_owned);
233+ let defaults = ["ember", "ember", "anvil", "anvil"].map(str::to_owned);
231234 assert_eq!(checked_colours(&page.body), defaults.clone().map(Some));
232235 assert_eq!(html_colours(&page.body), defaults.map(Some));
233236 let csrf = input_value(&page.body, "csrf");
crates/forge-web-base/src/accent.rsmodified+4 -3
@@ -310,11 +310,11 @@ mod tests {
310310 fn the_presets_are_offered_in_picker_order_and_removed_ids_are_not() {
311311 assert_eq!(
312312 ids().collect::<Vec<_>>(),
313- ["sage", "spark", "ocean", "plum", "rose", "gold", "ember"]
313+ ["ember", "sage", "spark", "ocean", "plum", "rose", "gold"]
314314 );
315315 assert_eq!(
316316 base_ids().collect::<Vec<_>>(),
317- ["fern", "spark", "graphite", "dusk", "ink", "anvil"]
317+ ["anvil", "fern", "spark", "graphite", "dusk", "ink"]
318318 );
319319 for id in ["ochre", "teal", "Sage", "sage ", "terracotta"] {
320320 assert!(!is_offered(id), "{id}");
@@ -389,7 +389,8 @@ mod tests {
389389 accent_tokens(215, 50, false).accent
390390 );
391391 assert_eq!(swatch("hue-215", true), accent_tokens(215, 50, true).accent);
392- assert_eq!(swatch("terracotta", false), swatch("sage", false));
392+ // A removed id falls back to the default, Ember.
393+ assert_eq!(swatch("terracotta", false), swatch("ember", false));
393394 let (bg, text) = base_swatch("fern", false);
394395 assert_eq!((bg.as_str(), text.as_str()), ("#F6F8F5", "#1E2420"));
395396 let (bg, text) = base_swatch("hue-215", true);
crates/forge-web-base/src/accent_palette.rsmodified+62 -62
@@ -27,7 +27,7 @@ pub struct Palette {
2727 }
2828
2929 /// The palette used when none is stored, and for anonymous visitors. It must be `PALETTES[0]`.
30-pub const DEFAULT: &str = "sage";
30+pub const DEFAULT: &str = "ember";
3131
3232 /// One token: the custom property it becomes and the field of `Tokens` that holds its value.
3333 pub struct TokenVar {
@@ -83,6 +83,34 @@ pub const TOKEN_VARS: &[TokenVar] = &[
8383 /// here: style/_heatmap.scss mixes them from `--accent`/`--accent-ink` and the base's surface,
8484 /// so they follow every accent and base.
8585 pub const PALETTES: &[Palette] = &[
86+ // Ember: iron at working heat, a soft red-orange; copper in light.
87+ Palette {
88+ id: "ember",
89+ light: Tokens {
90+ accent: "#B44D1A",
91+ accent_ink: "#8F3A12",
92+ accent_soft: "#F8E9DF",
93+ accent_text: "#FFFFFF",
94+ focus: "#8F3A12",
95+ public_bg: "#F9E4D6",
96+ public_text: "#8F3A12",
97+ note: "#8F3A12",
98+ hunk_bg: "#FBF0E8",
99+ hunk_text: "#883611",
100+ },
101+ dark: Tokens {
102+ accent: "#E8894A",
103+ accent_ink: "#FFB27A",
104+ accent_soft: "#3A2518",
105+ accent_text: "#1A0E06",
106+ focus: "#FFB27A",
107+ public_bg: "#3A2416",
108+ public_text: "#FFC69A",
109+ note: "#FFB27A",
110+ hunk_bg: "#24180F",
111+ hunk_text: "#F0A066",
112+ },
113+ },
86114 // Sage: the original forge colour.
87115 Palette {
88116 id: "sage",
@@ -253,34 +281,6 @@ pub const PALETTES: &[Palette] = &[
253281 hunk_text: "#E8BC4A",
254282 },
255283 },
256- // Ember: iron at working heat, a soft red-orange; copper in light.
257- Palette {
258- id: "ember",
259- light: Tokens {
260- accent: "#B44D1A",
261- accent_ink: "#8F3A12",
262- accent_soft: "#F9E4D6",
263- accent_text: "#FFFFFF",
264- focus: "#8F3A12",
265- public_bg: "#F9E4D6",
266- public_text: "#8F3A12",
267- note: "#8F3A12",
268- hunk_bg: "#FBF0E8",
269- hunk_text: "#883611",
270- },
271- dark: Tokens {
272- accent: "#E8894A",
273- accent_ink: "#FFB27A",
274- accent_soft: "#3A2416",
275- accent_text: "#1A0E06",
276- focus: "#FFB27A",
277- public_bg: "#3A2416",
278- public_text: "#FFC69A",
279- note: "#FFB27A",
280- hunk_bg: "#24180F",
281- hunk_text: "#F0A066",
282- },
283- },
284284 ];
285285
286286 /// The neutral colour tokens one base sets in one theme. The values are CSS colours;
@@ -309,7 +309,7 @@ pub struct Base {
309309 }
310310
311311 /// The base used when none is stored, and for anonymous visitors. It must be `BASES[0]`.
312-pub const BASE_DEFAULT: &str = "fern";
312+pub const BASE_DEFAULT: &str = "anvil";
313313
314314 /// One base token: the custom property it becomes and the field of `BaseTokens` that holds its
315315 /// value.
@@ -373,6 +373,38 @@ pub const BASE_TOKEN_VARS: &[BaseTokenVar] = &[
373373 /// Every base on offer, in the order the picker lists them. `fern` is the original forge
374374 /// neutral set.
375375 pub const BASES: &[Base] = &[
376+ // Anvil: warm soot and cooled steel in dark, ash in light.
377+ Base {
378+ id: "anvil",
379+ light: BaseTokens {
380+ bg: "#F6F5F3",
381+ surface: "#FFFFFF",
382+ surface_2: "#EFEEEB",
383+ text: "#191816",
384+ text_2: "#3F3C37",
385+ muted: "#5F5C56",
386+ border: "#E3E1DD",
387+ border_strong: "#C9C6BF",
388+ code_bg: "#EFEEEB",
389+ private_bg: "#EFEEEB",
390+ private_text: "#3F3C37",
391+ ln_text: "#5F5C56",
392+ },
393+ dark: BaseTokens {
394+ bg: "#141312",
395+ surface: "#1D1C1A",
396+ surface_2: "#292724",
397+ text: "#F2F0EB",
398+ text_2: "#D6D2CA",
399+ muted: "#AAA69D",
400+ border: "#2F2D2A",
401+ border_strong: "#55524C",
402+ code_bg: "#292724",
403+ private_bg: "#292724",
404+ private_text: "#D6D2CA",
405+ ln_text: "#AAA69D",
406+ },
407+ },
376408 // Fern: the original forge neutrals, green-tinted in light and slate in dark.
377409 Base {
378410 id: "fern",
@@ -534,36 +566,4 @@ pub const BASES: &[Base] = &[
534566 ln_text: "#9C9C98",
535567 },
536568 },
537- // Anvil: warm soot and cooled steel in dark, ash in light.
538- Base {
539- id: "anvil",
540- light: BaseTokens {
541- bg: "#F5F2EE",
542- surface: "#FFFDFB",
543- surface_2: "#ECE7E1",
544- text: "#1C1916",
545- text_2: "#3D3631",
546- muted: "#6E645B",
547- border: "#E2DBD3",
548- border_strong: "#CDC3B8",
549- code_bg: "#EFEAE4",
550- private_bg: "#ECE7E1",
551- private_text: "#3D3631",
552- ln_text: "#6A6058",
553- },
554- dark: BaseTokens {
555- bg: "#131211",
556- surface: "#1B1917",
557- surface_2: "#24211E",
558- text: "#ECE6DF",
559- text_2: "#CFC6BC",
560- muted: "#9C9187",
561- border: "#2F2B27",
562- border_strong: "#3E3934",
563- code_bg: "#0E0D0C",
564- private_bg: "#24211E",
565- private_text: "#CFC6BC",
566- ln_text: "#9C9187",
567- },
568- },
569569 ];
crates/forge-web-base/src/i18n/accounts.rsmodified+15 -0
@@ -236,6 +236,21 @@ pub fn meta_line(lang: Lang, uptime: &str, version: &str, build: &str, date: &st
236236 }
237237
238238 /// `3d 4h`, `5h 2m` or `7m`, for the uptime.
239+/// [`duration_short`] in the viewer's language: Turkish says "1 sa 5 dk".
240+pub fn duration_short_in(lang: Lang, secs: u64) -> String {
241+ if lang == Lang::En {
242+ return duration_short(secs);
243+ }
244+ let (d, h, m) = (secs / 86_400, secs % 86_400 / 3_600, secs % 3_600 / 60);
245+ if d > 0 {
246+ format!("{d} g {h} sa")
247+ } else if h > 0 {
248+ format!("{h} sa {m} dk")
249+ } else {
250+ format!("{m} dk")
251+ }
252+}
253+
239254 pub fn duration_short(secs: u64) -> String {
240255 let (d, h, m) = (secs / 86_400, secs % 86_400 / 3_600, secs % 3_600 / 60);
241256 if d > 0 {
crates/forge-web-base/src/i18n/admin.rsmodified+2 -2
@@ -560,8 +560,8 @@ pub fn t(lang: Lang, key: K) -> &'static str {
560560 (SecurityLogTitle, Tr) => "Güvenlik günlüğü",
561561 (SecurityNone, En) => "None (plain text)",
562562 (SecurityNone, Tr) => "Yok (düz metin)",
563- (SendMailCheckbox, En) => " Send mail",
564- (SendMailCheckbox, Tr) => " E-posta gönder",
563+ (SendMailCheckbox, En) => "Send mail",
564+ (SendMailCheckbox, Tr) => "E-posta gönder",
565565 (SendTestMailToMe, En) => "Send test mail to me",
566566 (SendTestMailToMe, Tr) => "Bana test e-postası gönder",
567567 (Settings, En) => "Settings",
crates/forge-web-base/src/i18n/releases_ci.rsmodified+2 -2
@@ -428,8 +428,8 @@ pub fn t(lang: Lang, key: K) -> &'static str {
428428 }
429429 (Tag, En) => "Tag",
430430 (Tag, Tr) => "Etiket",
431- (TargetBranch, En) => "Target branch (used only when the tag is created)",
432- (TargetBranch, Tr) => "Hedef dal (yalnızca etiket oluşturulurken kullanılır)",
431+ (TargetBranch, En) => "Target branch",
432+ (TargetBranch, Tr) => "Hedef dal",
433433 (Title, En) => "Title",
434434 (Title, Tr) => "Başlık",
435435 (ReleaseNotes, En) => "Release notes (Markdown)",
crates/forge-web-base/src/i18n/server_settings.rsmodified+1 -1
@@ -20,7 +20,7 @@ pub fn field_tr(key: &str) -> Option<(&'static str, &'static str)> {
2020 "Duyuru bandı",
2121 "Her sayfada üst bilginin altında gösterilen tek satır. Boş bırakılırsa gizlenir.",
2222 ),
23- "banner.level" => ("Bant düzeyi", "info veya warning."),
23+ "banner.level" => ("Bant düzeyi", "Bilgi ya da uyarı."),
2424 "banner.expires" => (
2525 "Bant bitiş zamanı (UTC)",
2626 "YYYY-MM-DD HH:MM biçiminde. Boş bırakılırsa bant temizlenene kadar kalır.",
crates/forge-web/assets/nav.jsmodified+34 -386
@@ -223,6 +223,14 @@
223223 function followTail() {
224224 var pre = document.querySelector('[data-live-log]');
225225 if (!pre || pre.querySelector('.ll-sel')) { return; }
226+ // A failed run opens at its first error, a third of the way down the log.
227+ var fail = pre.getAttribute('data-fail-at');
228+ var line = fail ? pre.querySelector('[id="L' + fail + '"]') : null;
229+ if (line) {
230+ line.classList.add('bad');
231+ pre.scrollTop = line.getBoundingClientRect().top - pre.getBoundingClientRect().top + pre.scrollTop - pre.clientHeight / 3;
232+ return;
233+ }
226234 pre.scrollTop = pre.hasAttribute('data-log-start') ? 0 : pre.scrollHeight;
227235 }
228236
@@ -863,202 +871,6 @@
863871 closeDropdowns(e.target && e.target.nodeType === 1 ? e.target : null);
864872 }, false);
865873
866- // The profile corner can be dragged anywhere on the window. A press records its start; it becomes a
867- // drag after CORNER_SLOP px of movement, and then the panel follows the pointer, clamped to the
868- // window. The released position is kept as fractions of the free space, so it holds at any size.
869- var CORNER_SLOP = 5;
870- var cornerPress = null; // { el, id, x, y, left, top, dragging } from a press to its release
871- var cornerSwallow = false; // the click that ends a drag must not open the menu or the bell
872-
873- function parseCorner(text) {
874- var parts = String(text || '').split(',');
875- if (parts.length !== 2) { return null; }
876- var x = parseFloat(parts[0]), y = parseFloat(parts[1]);
877- if (!isFinite(x) || !isFinite(y)) { return null; }
878- return [Math.min(1, Math.max(0, x)), Math.min(1, Math.max(0, y))];
879- }
880- // [x, y] fractions of the stored position, or null for the default corner. Kept current by drags and resets.
881- var cornerSaved = parseCorner(document.body.dataset.cornerPos);
882-
883- // Registered before the bell's click listener below, so it runs first and stops the click that
884- // follows a drag once.
885- window.addEventListener('click', function (e) {
886- if (!cornerSwallow) { return; }
887- cornerSwallow = false;
888- e.preventDefault();
889- e.stopImmediatePropagation();
890- }, true);
891-
892- function cornerEl() { return document.querySelector('.corner-float'); }
893-
894- // The menu opens down when the panel is in the top half of the window, and anchors to the right
895- // edge when the panel is in the right half. The default corner (no attribute) opens up, as before.
896- function cornerDirection(el, left, top, w, h) {
897- if (top + h / 2 < window.innerHeight / 2) { el.setAttribute('data-open', 'down'); } else { el.removeAttribute('data-open'); }
898- if (left + w / 2 > window.innerWidth / 2) { el.setAttribute('data-side', 'right'); } else { el.removeAttribute('data-side'); }
899- }
900-
901- // Places the panel at (left, top) in px, clamped so the whole panel stays in the window.
902- function cornerPlace(el, left, top) {
903- var w = el.offsetWidth, h = el.offsetHeight;
904- left = Math.max(0, Math.min(left, window.innerWidth - w));
905- top = Math.max(0, Math.min(top, window.innerHeight - h));
906- el.style.left = left + 'px';
907- el.style.top = top + 'px';
908- el.style.right = 'auto';
909- el.style.bottom = 'auto';
910- cornerDirection(el, left, top, w, h);
911- }
912-
913- // Puts the panel where the stored position says, or in the default corner. It does nothing while a
914- // drag runs, so a re-render or a resize does not pull the panel from under the pointer.
915- function cornerApply() {
916- var el = cornerEl();
917- if (!el || (cornerPress && cornerPress.dragging)) { return; }
918- if (cornerSaved) {
919- cornerPlace(el, cornerSaved[0] * (window.innerWidth - el.offsetWidth), cornerSaved[1] * (window.innerHeight - el.offsetHeight));
920- return;
921- }
922- el.style.left = '';
923- el.style.top = '';
924- el.style.right = '';
925- el.style.bottom = '';
926- var r = el.getBoundingClientRect();
927- cornerDirection(el, r.left, r.top, el.offsetWidth, el.offsetHeight);
928- }
929-
930- // Saves one account preference through /-/prefs, signed in only (the CSRF token comes from the
931- // panel). Saves go one after another, and `read` gives the value at the moment of sending, so the
932- // last one sent holds the newest value. A failure is ignored: the next load shows what the server has.
933- var prefsChain = Promise.resolve();
934- function prefSave(key, read) {
935- prefsChain = prefsChain.then(function () {
936- var el = document.querySelector('.corner-float[data-prefs-csrf]');
937- var body = new URLSearchParams({ csrf: el ? el.getAttribute('data-prefs-csrf') : '', key: key, value: read() });
938- return fetch('/-/prefs', { method: 'POST', credentials: 'same-origin', body: body });
939- }).catch(function () { });
940- }
941-
942- document.addEventListener('pointerdown', function (e) {
943- cornerSwallow = false;
944- var el = e.target && e.target.closest ? e.target.closest('.corner-float') : null;
945- if (!el || e.button !== 0) { cornerPress = null; return; }
946- var r = el.getBoundingClientRect();
947- cornerPress = { el: el, id: e.pointerId, x: e.clientX, y: e.clientY, left: r.left, top: r.top, dragging: false };
948- });
949-
950- document.addEventListener('pointermove', function (e) {
951- var p = cornerPress;
952- if (!p || e.pointerId !== p.id) { return; }
953- if (!p.dragging) {
954- if (Math.hypot(e.clientX - p.x, e.clientY - p.y) < CORNER_SLOP) { return; }
955- p.dragging = true;
956- // A drag ends any hover the mouse started: the menu or the bell closes, and a pending open is dropped.
957- clearTimeout(hoverTimer);
958- hoverTimer = 0;
959- hoverHide();
960- try { p.el.setPointerCapture(p.id); } catch (err) { }
961- p.el.classList.add('dragging');
962- }
963- cornerPlace(p.el, p.left + e.clientX - p.x, p.top + e.clientY - p.y);
964- });
965-
966- function cornerEnd(e) {
967- var p = cornerPress;
968- if (!p || e.pointerId !== p.id) { return; }
969- cornerPress = null;
970- if (!p.dragging) { return; }
971- p.el.classList.remove('dragging');
972- if (e.type === 'pointercancel') { cornerApply(); return; }
973- cornerSwallow = true;
974- // A swap that replaced the panel during the drag leaves the new one to the stored position.
975- if (!p.el.isConnected) { cornerApply(); return; }
976- var room = { x: window.innerWidth - p.el.offsetWidth, y: window.innerHeight - p.el.offsetHeight };
977- var x = room.x > 0 ? Math.round(10000 * (parseFloat(p.el.style.left) || 0) / room.x) / 10000 : 0;
978- var y = room.y > 0 ? Math.round(10000 * (parseFloat(p.el.style.top) || 0) / room.y) / 10000 : 0;
979- x = Math.min(1, Math.max(0, x));
980- y = Math.min(1, Math.max(0, y));
981- cornerSaved = [x, y];
982- prefSave('corner_pos', function () { return x + ',' + y; });
983- }
984- document.addEventListener('pointerup', cornerEnd);
985- document.addEventListener('pointercancel', cornerEnd);
986-
987- // A double click on the panel, not on a link or a button, returns it to the default corner.
988- document.addEventListener('dblclick', function (e) {
989- var target = e.target;
990- if (!target || !target.closest || target.closest('a, button, input, select, textarea, summary, label, [role="button"]')) { return; }
991- var el = target.closest('.corner-float');
992- if (!el) { return; }
993- cornerSaved = null;
994- prefSave('corner_pos', function () { return ''; });
995- cornerApply();
996- });
997-
998- document.addEventListener('forge:swapped', cornerApply);
999- window.addEventListener('resize', cornerApply);
1000- cornerApply();
1001-
1002- // Below 900px the profile corner covers the page the reader is reading, so it steps aside
1003- // (corner-away) while they scroll down and comes back when they scroll up, near the top or at the
1004- // end. It stays put while its menu, the bell popover or a drag is open. The scroll listener is on
1005- // the document in the capture phase, so it survives a swap that replaces the body. Inner lists and
1006- // log tails scroll on their own: their events are skipped, as the window's scroll targets the document.
1007- var cornerNarrow = window.matchMedia ? window.matchMedia('(max-width: 899px)') : null;
1008- var cornerY = window.scrollY; // the scroll position last seen
1009- var cornerRun = 0; // the distance scrolled since the direction last turned
1010- var cornerWant = false; // whether the corner should step aside
1011- var CORNER_STEP = 8; // the run that hides the corner, or brings it back
1012- var CORNER_TOP = 40; // within this of the top the corner always shows
1013-
1014- // True while the corner must stay in view: its menu is open, a bell popover is open, or it is dragged.
1015- function cornerBusy(el) {
1016- if (el.classList.contains('dragging')) { return true; }
1017- if (document.querySelector('details.corner[open]')) { return true; }
1018- return Array.prototype.some.call(document.querySelectorAll('.bell-pop'), isPeekOpen);
1019- }
1020-
1021- // Applies the wanted state to the corner as it is now (a swap replaces it). Only below 900px.
1022- function cornerAway() {
1023- var el = cornerEl();
1024- if (!el) { return; }
1025- var on = cornerWant && cornerNarrow && cornerNarrow.matches && !cornerBusy(el);
1026- el.classList.toggle('corner-away', !!on);
1027- }
1028-
1029- function cornerScrolled(e) {
1030- if (e.target !== document) { return; }
1031- var y = window.scrollY;
1032- var dy = y - cornerY;
1033- cornerY = y;
1034- if (y <= CORNER_TOP || y >= document.documentElement.scrollHeight - window.innerHeight - 2) {
1035- cornerRun = 0;
1036- cornerWant = false;
1037- } else {
1038- // A run keeps its direction; a turn starts a new one.
1039- cornerRun = (dy > 0 && cornerRun >= 0) || (dy < 0 && cornerRun <= 0) ? cornerRun + dy : dy;
1040- if (cornerRun > CORNER_STEP) { cornerWant = true; }
1041- else if (cornerRun < -CORNER_STEP) { cornerWant = false; }
1042- }
1043- cornerAway();
1044- }
1045-
1046- // A page swap moves the scroll (to the top on a link) before this runs, so the anchor is taken now.
1047- // The corner keeps its state across a live refresh, and shows again at the top.
1048- document.addEventListener('forge:swapped', function () {
1049- cornerY = window.scrollY;
1050- cornerRun = 0;
1051- if (cornerY <= CORNER_TOP) { cornerWant = false; }
1052- cornerAway();
1053- });
1054- // A menu, popover or details opened or closed may make the corner busy: it is checked again.
1055- document.addEventListener('toggle', cornerAway, true);
1056- window.addEventListener('resize', function () {
1057- if (!cornerNarrow || !cornerNarrow.matches) { cornerWant = false; }
1058- cornerAway();
1059- });
1060- document.addEventListener('scroll', cornerScrolled, { capture: true, passive: true });
1061-
1062874 // A mouse that rests on the profile corner opens its account menu, or the bell popover on the bell,
1063875 // after a short rest; when it leaves, the menu or popover it opened closes. Touch and keyboard
1064876 // keep the click. hoverOn names what the mouse opened; hoverWait says whether the pending timer
@@ -1070,8 +882,8 @@
1070882 var hoverWait = ''; // 'show' or 'hide': what the pending timer does
1071883 var hoverMute = false; // a click on the bell: it stays shut until the mouse leaves the bell
1072884
1073- // The part of the corner a node belongs to: 'bell' for the bell and its popover (tested first, as
1074- // the popover sits inside the panel), 'menu' for the rest of the panel, null elsewhere.
885+ // The part of the profile a node belongs to: 'bell' for the notifications row and its popover
886+ // (tested first, as they sit inside the menu), 'menu' for the rest, null elsewhere.
1075887 function hoverKind(node) {
1076888 if (!node || !node.closest) { return null; }
1077889 if (node.closest('.corner-bell, .bell-pop')) { return 'bell'; }
@@ -1089,16 +901,16 @@
1089901 return !!(pop && isPeekOpen(pop));
1090902 }
1091903
1092- // Opens the menu or the bell popover for a resting mouse. One the reader opened by click or keyboard
1093- // is left alone.
904+ // Opens the menu, or the bell popover beside it, for a resting mouse. A menu the reader opened by
905+ // click or keyboard is left alone. The popover sits inside the menu, so the menu stays open under it.
1094906 function hoverShow(kind) {
1095- if (hoverOn && hoverOn !== kind) { hoverHide(); }
1096- if (hoverIsOpen(kind) && hoverOn !== kind) { return; }
907+ if (!hoverOn && hoverIsOpen(kind)) { return; }
908+ var details = document.querySelector('details.corner');
909+ var pop = document.querySelector('.bell-pop');
1097910 if (kind === 'menu') {
1098- var details = document.querySelector('details.corner');
911+ try { if (pop) { pop.hidePopover(); } } catch (err) { }
1099912 if (details) { details.open = true; }
1100913 } else {
1101- var pop = document.querySelector('.bell-pop');
1102914 try { if (pop) { pop.showPopover(); } } catch (err) { }
1103915 }
1104916 hoverOn = kind;
@@ -1106,12 +918,11 @@
1106918
1107919 // Closes what the mouse opened, and forgets it.
1108920 function hoverHide() {
1109- if (hoverOn === 'menu') {
1110- var details = document.querySelector('details.corner');
1111- if (details) { details.open = false; }
1112- } else if (hoverOn === 'bell') {
921+ if (hoverOn) {
1113922 var pop = document.querySelector('.bell-pop');
923+ var details = document.querySelector('details.corner');
1114924 try { if (pop) { pop.hidePopover(); } } catch (err) { }
925+ if (details) { details.open = false; }
1115926 }
1116927 hoverOn = null;
1117928 }
@@ -1120,7 +931,7 @@
1120931 // corner cancels a pending show, and starts a hide only when nothing is pending, so moving across the
1121932 // page does not keep pushing the hide back.
1122933 document.addEventListener('pointerover', function (e) {
1123- if (e.pointerType !== 'mouse' || cornerPress) { return; }
934+ if (e.pointerType !== 'mouse') { return; }
1124935 var kind = hoverKind(e.target);
1125936 if (hoverMute) {
1126937 if (kind === 'bell') { return; }
@@ -1151,11 +962,9 @@
1151962 });
1152963
1153964 // A click on the menu's summary, while the mouse holds it open, does nothing: the menu stays open.
1154- // A chip link inside the summary still goes where it leads. Registered after the drag's swallow
1155- // listener, so that one runs first.
1156965 window.addEventListener('click', function (e) {
1157966 if (hoverOn !== 'menu' || !e.target || !e.target.closest) { return; }
1158- if (!e.target.closest('summary.corner-btn') || e.target.closest('a')) { return; }
967+ if (!e.target.closest('summary.corner-btn')) { return; }
1159968 e.preventDefault();
1160969 }, true);
1161970
@@ -1171,22 +980,18 @@
1171980 try { return pop.matches(':popover-open'); } catch (err) { return false; }
1172981 }
1173982
1174- // Under the bell, opening upward: the popover's bottom sits 6px above the bell's top, and its left
1175- // edge follows the bell but stays inside the viewport.
1176- // When the panel sits in the top half (data-open="down" on it), the popover opens below the bell.
983+ // Beside the menu, level with the notifications row. When the window has no room for that, under
984+ // the row. Either way it stays inside the window.
1177985 function placePeek(bell, pop) {
1178986 if (!bell) { return; }
1179987 var r = bell.getBoundingClientRect();
1180- var left = Math.max(8, Math.min(r.left, window.innerWidth - pop.offsetWidth - 8));
988+ var menu = bell.closest('.corner-menu');
989+ var right = (menu ? menu.getBoundingClientRect().right : r.right) + 8;
990+ var beside = right + pop.offsetWidth + 8 <= window.innerWidth;
991+ var left = beside ? right : Math.max(8, Math.min(r.left, window.innerWidth - pop.offsetWidth - 8));
1181992 pop.style.left = left + 'px';
1182- var corner = bell.closest('.corner-float');
1183- if (corner && corner.getAttribute('data-open') === 'down') {
1184- pop.style.top = (r.bottom + 6) + 'px';
1185- pop.style.bottom = 'auto';
1186- } else {
1187- pop.style.top = 'auto';
1188- pop.style.bottom = (window.innerHeight - r.top + 6) + 'px';
1189- }
993+ pop.style.top = (beside ? r.top - 8 : r.bottom + 6) + 'px';
994+ pop.style.bottom = 'auto';
1190995 }
1191996
1192997 // Fills the popover's list with the server's fragment. The popover stays invisible until then, so it
@@ -1307,139 +1112,6 @@
13071112 if (hoverOn && !hoverIsOpen(hoverOn)) { hoverOn = null; }
13081113 });
13091114
1310- // Repo home resize: a drag on the separator between the file tree and the README sets the tree's
1311- // width, the --tree-w property of the .repo-home grid. The width is kept in localStorage and applied
1312- // to each repo home on load and after every swap. The README takes the rest of the row.
1313- var TREE_KEY = 'forge-tree-w'; // signed-out visitors keep the width in localStorage
1314- // Signed in, the width is the account's tree_width preference. The variable starts from the page's
1315- // data-tree-w and follows every change, so a swap never reads back an older value.
1316- var signedIn = document.body.dataset.signedIn === 'true';
1317- var treeAccount = parseFloat(document.body.dataset.treeW) || 0;
1318- var treeTimer = null;
1319- var TREE_MIN = 220; // px, the narrowest the tree goes
1320- var README_MIN = 360; // px, room the drag always leaves for the README
1321- var TREE_STEP = 16; // px per arrow key; Shift moves 64px
1322- var treeDrag = null; // { grid, id, x, w, moved } while a pointer drag runs
1323-
1324- function treeLoad() {
1325- if (signedIn) { return treeAccount; }
1326- try { return parseFloat(localStorage.getItem(TREE_KEY)) || 0; } catch (err) { return 0; }
1327- }
1328-
1329- function treeStore(px) {
1330- if (signedIn) {
1331- treeAccount = px ? Math.round(px) : 0;
1332- // One save once the changes settle, not one per step of a drag or a key repeat.
1333- clearTimeout(treeTimer);
1334- treeTimer = setTimeout(function () {
1335- treeTimer = null;
1336- prefSave('tree_width', function () { return treeAccount ? String(treeAccount) : ''; });
1337- }, 300);
1338- return;
1339- }
1340- try {
1341- if (px) { localStorage.setItem(TREE_KEY, String(Math.round(px))); } else { localStorage.removeItem(TREE_KEY); }
1342- } catch (err) { }
1343- }
1344-
1345- // The widest the tree can be: the grid less the splitter, the two gaps and the README's minimum.
1346- function treeMax(grid) {
1347- var split = grid.querySelector('[data-repo-split]');
1348- var gap = parseFloat(getComputedStyle(grid).columnGap) || 0;
1349- var max = grid.getBoundingClientRect().width - split.getBoundingClientRect().width - 2 * gap - README_MIN;
1350- return Math.max(TREE_MIN, Math.floor(max));
1351- }
1352-
1353- // Sets the tree width (clamped) and keeps the separator's aria values in step with it.
1354- function treeSet(grid, px) {
1355- var split = grid.querySelector('[data-repo-split]');
1356- var max = treeMax(grid);
1357- var w = Math.min(max, Math.max(TREE_MIN, Math.round(px)));
1358- grid.style.setProperty('--tree-w', w + 'px');
1359- split.setAttribute('aria-valuemin', String(TREE_MIN));
1360- split.setAttribute('aria-valuemax', String(max));
1361- split.setAttribute('aria-valuenow', String(w));
1362- return w;
1363- }
1364-
1365- function treeWidth(grid) {
1366- return grid.querySelector('.repo-main').getBoundingClientRect().width;
1367- }
1368-
1369- // Applies the stored width to one repo home (or the default when none is stored). Below 900px the
1370- // splitter is hidden and the columns stack, so there is nothing to set.
1371- function treeApply(grid) {
1372- var split = grid && grid.querySelector('[data-repo-split]');
1373- if (!split || getComputedStyle(split).display === 'none') { return; }
1374- var saved = treeLoad();
1375- if (saved) { treeSet(grid, saved); return; }
1376- grid.style.removeProperty('--tree-w');
1377- split.setAttribute('aria-valuemin', String(TREE_MIN));
1378- split.setAttribute('aria-valuemax', String(treeMax(grid)));
1379- split.setAttribute('aria-valuenow', String(Math.round(treeWidth(grid))));
1380- }
1381-
1382- function treeApplyAll() {
1383- document.querySelectorAll('.repo-home').forEach(treeApply);
1384- }
1385-
1386- treeApplyAll();
1387- document.addEventListener('forge:swapped', treeApplyAll);
1388-
1389- document.addEventListener('pointerdown', function (e) {
1390- var split = e.target.closest && e.target.closest('[data-repo-split]');
1391- var grid = split && split.closest('.repo-home');
1392- if (!grid || e.button !== 0 || getComputedStyle(split).display === 'none') { return; }
1393- e.preventDefault();
1394- split.setPointerCapture(e.pointerId);
1395- treeDrag = { grid: grid, id: e.pointerId, x: e.clientX, w: treeWidth(grid), moved: false };
1396- root.classList.add('tree-resizing');
1397- });
1398-
1399- document.addEventListener('pointermove', function (e) {
1400- if (!treeDrag || e.pointerId !== treeDrag.id) { return; }
1401- if (e.clientX !== treeDrag.x) { treeDrag.moved = true; }
1402- treeSet(treeDrag.grid, treeDrag.w + e.clientX - treeDrag.x);
1403- });
1404-
1405- function treeEnd(e) {
1406- if (!treeDrag || e.pointerId !== treeDrag.id) { return; }
1407- var drag = treeDrag;
1408- treeDrag = null;
1409- root.classList.remove('tree-resizing');
1410- if (drag.moved) { treeStore(treeWidth(drag.grid)); }
1411- }
1412- document.addEventListener('pointerup', treeEnd);
1413- document.addEventListener('pointercancel', treeEnd);
1414-
1415- // Double-click resets the split to the default.
1416- document.addEventListener('dblclick', function (e) {
1417- var split = e.target.closest && e.target.closest('[data-repo-split]');
1418- var grid = split && split.closest('.repo-home');
1419- if (!grid) { return; }
1420- grid.style.removeProperty('--tree-w');
1421- treeStore(null);
1422- treeApply(grid);
1423- });
1424-
1425- // Arrow keys move the separator; Home resets it.
1426- document.addEventListener('keydown', function (e) {
1427- var split = e.target.closest && e.target.closest('[data-repo-split]');
1428- var grid = split && split.closest('.repo-home');
1429- if (!grid) { return; }
1430- if (e.key === 'Home') {
1431- grid.style.removeProperty('--tree-w');
1432- treeStore(null);
1433- treeApply(grid);
1434- } else if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
1435- var step = e.shiftKey ? 64 : TREE_STEP;
1436- treeStore(treeSet(grid, treeWidth(grid) + (e.key === 'ArrowRight' ? step : -step)));
1437- } else {
1438- return;
1439- }
1440- e.preventDefault();
1441- });
1442-
14431115 // Escape closes the open dropdowns and returns focus to the summary of the one that held it.
14441116 document.addEventListener('keydown', function (e) {
14451117 if (e.key !== 'Escape') { return; }
@@ -2340,28 +2012,6 @@
23402012 // ends, so while any is listed the JSON is fetched again every 30 s.
23412013 var activitySeq = 0; // a fetch's number: only the newest answer is drawn
23422014 var activityTimer = null; // the next refetch while finished runs are listed
2343- var SVG_NS = 'http://www.w3.org/2000/svg';
2344- // The icons the server draws in the chips, as [element, attributes] pairs.
2345- var CHIP_ICONS = {
2346- review: [['path', { d: 'M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z' }], ['circle', { cx: '12', cy: '12', r: '3' }]],
2347- mention: [['circle', { cx: '12', cy: '12', r: '4' }], ['path', { d: 'M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94' }]],
2348- failing: [['path', { d: 'M6 6l12 12M18 6 6 18' }]]
2349- };
2350-
2351- // An icon element built from CHIP_ICONS, the same markup the server writes.
2352- function chipIcon(kind) {
2353- var svg = document.createElementNS(SVG_NS, 'svg');
2354- svg.setAttribute('class', 'ico');
2355- svg.setAttribute('viewBox', '0 0 24 24');
2356- svg.setAttribute('aria-hidden', 'true');
2357- CHIP_ICONS[kind].forEach(function (part) {
2358- var el = document.createElementNS(SVG_NS, part[0]);
2359- Object.keys(part[1]).forEach(function (k) { el.setAttribute(k, part[1][k]); });
2360- svg.appendChild(el);
2361- });
2362- return svg;
2363- }
2364-
23652015 // A link target from the server, used only when it is a path on this site.
23662016 function localHref(href) {
23672017 return typeof href === 'string' && href.charAt(0) === '/' && href.charAt(1) !== '/' ? href : '';
@@ -2475,9 +2125,9 @@
24752125 return item ? item.href : '/notifications';
24762126 };
24772127 var chips = [
2478- { kind: 'review', cls: 'chip chip-review', n: json.reviews, tpl: 'data-review', href: newest('review') },
2479- { kind: 'mention', cls: 'chip chip-mention', n: json.mentions, tpl: 'data-mention', href: newest('mention') },
2480- { kind: 'failing', cls: 'chip chip-failing', n: json.failing, tpl: 'data-failing', href: json.failing_href || '/notifications' }
2128+ { kind: 'review', cls: 'corner-link chip-review', n: json.reviews, tpl: 'data-review', href: newest('review') },
2129+ { kind: 'mention', cls: 'corner-link chip-mention', n: json.mentions, tpl: 'data-mention', href: newest('mention') },
2130+ { kind: 'failing', cls: 'corner-link chip-failing', n: json.failing, tpl: 'data-failing', href: json.failing_href || '/notifications' }
24812131 ];
24822132 box.textContent = '';
24832133 chips.forEach(function (c) {
@@ -2487,9 +2137,7 @@
24872137 var chip = document.createElement('a');
24882138 chip.className = c.cls;
24892139 chip.setAttribute('href', c.href);
2490- chip.setAttribute('title', tpl.split('{n}').join(String(n)));
2491- chip.appendChild(chipIcon(c.kind));
2492- chip.appendChild(document.createTextNode(String(n)));
2140+ chip.textContent = tpl.split('{n}').join(String(n));
24932141 box.appendChild(chip);
24942142 });
24952143 }
@@ -6630,7 +6278,7 @@
66306278 function (a) { return (a.getAttribute('href') || '').indexOf(base + '/') === 0; });
66316279 tab.classList.toggle('tab-live', going);
66326280 }
6633- setIcon(going || !!document.querySelector('.ci-run .ci-state.ci-running'));
6281+ setIcon(going || !!document.querySelector('.ci-run h1.live'));
66346282 }
66356283
66366284 function queueSync() {
crates/forge-web/src/pages/admin_backups.rsmodified+16 -20
@@ -24,7 +24,7 @@ use crate::live::{Topic, stream_changes};
2424 use crate::pages::admin_users::admin_only;
2525 use crate::pages::issues_list::stamp_unix;
2626 use crate::state::AppState;
27-use crate::views::parts::post_act;
27+use crate::views::parts::{SubPart, head, post_act};
2828 use crate::views::{enc, rel_time, shell};
2929
3030 /// Runs shown on the page.
@@ -142,13 +142,25 @@ async fn backups_view(
142142 matches!(running, Some(RunKind::Backup)).then(|| g::running_line(lang, RunKind::Backup));
143143 let fsck_running =
144144 matches!(running, Some(RunKind::Fsck)).then(|| g::running_line(lang, RunKind::Fsck));
145+ let sub = vec![SubPart::text(g::t(lang, K::BackupsIntro))];
145146 Ok(view! {
146- <div data-live="/admin/backups/events">
147- <h1 class="sr-only">(g::t(lang, K::Backups))</h1>
148- <p class="hint">(g::t(lang, K::BackupsIntro))</p>
147+ head(title: g::t(lang, K::Backups), sub: sub,
148+ <form id="run-backup" method="post" action="/admin/backups/run" class="act-form">
149+ <input type="hidden" name="csrf" value=(csrf.as_str())>
150+ <button type="submit" class="button">(g::t(lang, K::RunBackupNow))</button>
151+ </form>
152+ post_act(label: g::t(lang, K::RunFsckNow), action: "/admin/backups/fsck", csrf: csrf.as_str())
153+ )
149154 if let Some(message) = notice {
150155 <p class="state" role="status">(message.as_str())</p>
151156 }
157+ <div class="sheet" data-live="/admin/backups/events">
158+ if let Some(line) = backup_running {
159+ <p class="state">(line)</p>
160+ }
161+ if let Some(line) = fsck_running {
162+ <p class="state">(line)</p>
163+ }
152164 <section class="sec">
153165 if settings.enabled {
154166 <h2>(crate::pages::passkeys::s(lang, "Configuration", "Yapılandırma"))</h2>
@@ -177,22 +189,6 @@ async fn backups_view(
177189 <p class="state">(g::t(lang, K::ScheduledBackupsOff))</p>
178190 }
179191 </section>
180- <section class="sec">
181- <h2>(crate::pages::passkeys::s(lang, "Run now", "Şimdi çalıştır"))</h2>
182- if let Some(line) = backup_running {
183- <p class="state">(line)</p>
184- }
185- if let Some(line) = fsck_running {
186- <p class="state">(line)</p>
187- }
188- <div class="acts">
189- <form id="run-backup" method="post" action="/admin/backups/run" class="act-form">
190- <input type="hidden" name="csrf" value=(csrf.as_str())>
191- <button type="submit" class="act">(g::t(lang, K::RunBackupNow))</button>
192- </form>
193- post_act(label: g::t(lang, K::RunFsckNow), action: "/admin/backups/fsck", csrf: csrf.as_str())
194- </div>
195- </section>
196192 <section class="sec">
197193 <h2>(g::t(lang, K::RecentRuns))</h2>
198194 if rows.is_empty() {
crates/forge-web/src/pages/admin_health.rsmodified+68 -118
@@ -1,8 +1,8 @@
1-//! Page: instance health for admins (`/admin/health`). A summary line, a storage topic with the data
2-//! disk's usage bar, and a services topic. Every number is a cheap query or a short external probe
3-//! (`df`), so there is no polling; reloading the page, or opening it again, reads fresh values. The
4-//! tree size of the repos (`du`) walks every repo, so a background task caches it (see
5-//! [`spawn_repo_size`]) and the page only reads the cache. Non-admins get 404.
1+//! Page: instance health for admins (`/admin/health`). A summary line, then one sheet with the alerts,
2+//! a storage topic with the data disk's usage bar, and a services topic. Every number is a cheap query
3+//! or a short external probe (`df`), so there is no polling; reloading the page, or opening it again,
4+//! reads fresh values. The tree size of the repos (`du`) walks every repo, so a background task caches
5+//! it (see [`spawn_repo_size`]) and the page only reads the cache. Non-admins get 404.
66
77 use std::path::Path;
88 use std::sync::Mutex;
@@ -19,16 +19,17 @@ use topcoat::router::response::Response;
1919 use topcoat::router::{page, query_params, route};
2020 use topcoat::view::{View, component, view};
2121
22-use crate::i18n::accounts::{A, duration_short, meta_line, needs_attention, on_disk, t as at};
22+use crate::i18n::accounts::{A, duration_short, duration_short_in, meta_line, needs_attention, on_disk, t as at};
2323 use crate::i18n::alerts as alert_text;
2424 use crate::i18n::{self, Lang};
2525 use crate::live::{Topic, stream_changes};
2626 use crate::pages::admin_users::admin_only;
2727 use crate::state::AppState;
28+use crate::views::parts::{SubPart, head};
2829 use crate::views::repo_list::{PageLink, pager, pager_links};
2930 use crate::views::{human_size, now_unix, rel_time, shell};
3031
31-/// Active alerts per page of the alerts card. Each row is about 56px tall, so three keep the card
32+/// Active alerts per page of the alerts topic. Each row is about 56px tall, so three keep the sheet
3233 /// short enough to fit the window.
3334 const ALERTS_PER_PAGE: usize = 3;
3435
@@ -81,59 +82,17 @@ struct Usage {
8182 bad: bool,
8283 }
8384
84-/// The icon a status row shows.
85-#[derive(Clone, Copy)]
86-enum Glyph {
87- Database,
88- Folder,
89- Archive,
90- Queue,
91- Mail,
92- Clock,
93- Sync,
94-}
95-
96-/// The row icon for one glyph: a 24 grid stroke icon, 20px.
97-#[component]
98-async fn glyph(kind: Glyph) -> Result<impl View> {
99- Ok(view! {
100- if matches!(kind, Glyph::Database) {
101- <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><ellipse cx="12" cy="6" rx="8" ry="3"/><path d="M4 6v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6"/><path d="M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/></svg>
102- }
103- if matches!(kind, Glyph::Folder) {
104- <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg>
105- }
106- if matches!(kind, Glyph::Archive) {
107- <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="4" width="18" height="5" rx="1"/><path d="M5 9v10h14V9M10 13h4"/></svg>
108- }
109- if matches!(kind, Glyph::Queue) {
110- <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01"/></svg>
111- }
112- if matches!(kind, Glyph::Mail) {
113- <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></svg>
114- }
115- if matches!(kind, Glyph::Clock) {
116- <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg>
117- }
118- if matches!(kind, Glyph::Sync) {
119- <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h13l-3-3M20 17H7l3 3"/></svg>
120- }
121- })
122-}
123-
124-/// One fact in the storage pane: one row.
85+/// One fact in the storage topic: one row.
12586 struct Fact {
12687 label: &'static str,
127- glyph: Glyph,
12888 value: String,
12989 detail: String,
13090 dot: Dot,
13191 }
13292
133-/// One row of the services pane.
93+/// One row of the services topic.
13494 struct Service {
13595 label: &'static str,
136- glyph: Glyph,
13796 dot: Dot,
13897 value: String,
13998 detail: String,
@@ -300,7 +259,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
300259
301260 let mut facts = vec![Fact {
302261 label: at(lang, A::DatabaseFile),
303- glyph: Glyph::Database,
304262 value: db_bytes.map_or_else(
305263 || at(lang, A::Unavailable).to_owned(),
306264 |b| human_size(lang, b),
@@ -310,7 +268,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
310268 }];
311269 facts.push(Fact {
312270 label: at(lang, A::Repositories),
313- glyph: Glyph::Folder,
314271 value: counts.repos.to_string(),
315272 detail: match repo_bytes {
316273 Some(b) => on_disk(lang, &human_size(lang, b)),
@@ -325,7 +282,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
325282 let (pct, text) = space(lang, total, avail);
326283 Fact {
327284 label: at(lang, A::BackupDirectory),
328- glyph: Glyph::Archive,
329285 value: text,
330286 detail: backup,
331287 dot: if pct >= 90 { Dot::Bad } else { Dot::Neutral },
@@ -333,7 +289,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
333289 }
334290 None => Fact {
335291 label: at(lang, A::BackupDirectory),
336- glyph: Glyph::Archive,
337292 value: at(lang, A::Unavailable).to_owned(),
338293 detail: backup,
339294 dot: Dot::Neutral,
@@ -342,7 +297,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
342297 } else {
343298 Fact {
344299 label: at(lang, A::BackupDirectory),
345- glyph: Glyph::Archive,
346300 value: at(lang, A::NotConfigured).to_owned(),
347301 detail: String::new(),
348302 dot: Dot::Off,
@@ -352,7 +306,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
352306 let mut services = vec![
353307 Service {
354308 label: at(lang, A::CiQueue),
355- glyph: Glyph::Queue,
356309 dot: Dot::Neutral,
357310 value: format!("{} {}", counts.queued_jobs, at(lang, A::QueuedJobs)),
358311 detail: format!(
@@ -365,7 +318,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
365318 },
366319 Service {
367320 label: at(lang, A::MailQueue),
368- glyph: Glyph::Mail,
369321 dot: if failed > 0 { Dot::Bad } else { Dot::Neutral },
370322 value: format!("{pending} {}", at(lang, A::Pending)),
371323 detail: format!("{failed} {}", at(lang, A::Failed)),
@@ -387,7 +339,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
387339 };
388340 Service {
389341 label: at(lang, A::LastBackup),
390- glyph: Glyph::Clock,
391342 dot,
392343 value: value.to_owned(),
393344 detail: String::new(),
@@ -396,7 +347,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
396347 }
397348 None if backup_on => Service {
398349 label: at(lang, A::LastBackup),
399- glyph: Glyph::Clock,
400350 dot: Dot::Neutral,
401351 value: at(lang, A::Never).to_owned(),
402352 detail: String::new(),
@@ -404,7 +354,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
404354 },
405355 None => Service {
406356 label: at(lang, A::LastBackup),
407- glyph: Glyph::Clock,
408357 dot: Dot::Off,
409358 value: at(lang, A::NotConfigured).to_owned(),
410359 detail: String::new(),
@@ -429,7 +378,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
429378 };
430379 Service {
431380 label: at(lang, A::Replication),
432- glyph: Glyph::Sync,
433381 dot,
434382 value: value.to_owned(),
435383 detail: if ok_unix.is_some() {
@@ -442,7 +390,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
442390 }
443391 None => Service {
444392 label: at(lang, A::Replication),
445- glyph: Glyph::Sync,
446393 dot: Dot::Neutral,
447394 value: at(lang, A::Never).to_owned(),
448395 detail: String::new(),
@@ -452,7 +399,6 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
452399 } else {
453400 Service {
454401 label: at(lang, A::Replication),
455- glyph: Glyph::Sync,
456402 dot: Dot::Off,
457403 value: at(lang, A::NotConfigured).to_owned(),
458404 detail: String::new(),
@@ -460,7 +406,10 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> {
460406 }
461407 });
462408
463- let uptime = uptime_secs().map_or_else(|| at(lang, A::Unavailable).to_owned(), duration_short);
409+ let uptime = uptime_secs().map_or_else(
410+ || at(lang, A::Unavailable).to_owned(),
411+ |secs| duration_short_in(lang, secs),
412+ );
464413 let build = format!(
465414 "{}{}",
466415 forge_ci::build::commit(),
@@ -535,7 +484,7 @@ async fn health_view(
535484 pages: u64,
536485 nav: (Vec<PageLink>, Option<String>, Option<String>),
537486 ) -> Result<impl View> {
538- // The heading counts every active alert; the card lists the current page of them.
487+ // The heading counts every active alert; the sheet lists the current page of them.
539488 let count = total;
540489 let (links, prev, next) = nav;
541490 let Health {
@@ -545,6 +494,8 @@ async fn health_view(
545494 meta,
546495 attention,
547496 } = health;
497+ // An active alert needs attention as much as a failing service does.
498+ let attention = attention + count;
548499 let summary_dot = if attention > 0 { Dot::Bad } else { Dot::Ok };
549500 let summary = if attention > 0 {
550501 needs_attention(lang, attention)
@@ -552,68 +503,67 @@ async fn health_view(
552503 at(lang, A::Fine).to_owned()
553504 };
554505 Ok(view! {
555- <div data-live="/admin/health/events" class="health-page">
556- <h1 class="sr-only">(at(lang, A::Health))</h1>
506+ head(title: at(lang, A::Health), sub: vec![SubPart::text(at(lang, A::HealthIntro))], live: Some("/admin/health/events"))
557507 <p class="state">
558508 <span class=(format!("health-dot {}", summary_dot.class()))></span>
559509 " " (summary)
560510 </p>
561- <p class="hint">(at(lang, A::HealthIntro))</p>
562- if count > 0 {
563- <section class="sec" role="alert">
564- <h2>(alert_text::banner_heading(lang, count))</h2>
565- for a in alerts.into_iter() {
511+ <div class="sheet">
512+ if count > 0 {
513+ <section class="sec" role="alert">
514+ <h2>(alert_text::banner_heading(lang, count))</h2>
515+ for a in alerts.into_iter() {
516+ <div class="line" data-kb-row="">
517+ <span class="name">(a.title.as_str())</span>
518+ <span class="val">since_line(lang: lang, stamp: a.stamp.as_str())</span>
519+ </div>
520+ if !a.body.is_empty() {
521+ <p class="hint">(a.body.as_str())</p>
522+ }
523+ }
524+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
525+ <div class="acts">
526+ <a class="act" href="/admin/server?tab=alerts">(alert_text::settings_link(lang))</a>
527+ </div>
528+ </section>
529+ }
530+ <section class="sec">
531+ <h2>(at(lang, A::Storage))</h2>
532+ if let Some(u) = usage {
533+ <p class="state"><strong>(u.used.as_str())</strong> " " (at(lang, A::DiskUsed)) " · " (u.free_of_total.as_str())</p>
534+ <progress class=(if u.bad { "meter bad" } else { "meter" }) max="100" value=(u.pct.to_string())></progress>
535+ <p class="hint health-path">(u.path.as_str())</p>
536+ } else {
537+ <p class="state">(at(lang, A::Unavailable))</p>
538+ }
539+ for f in facts.into_iter() {
566540 <div class="line" data-kb-row="">
567- <span class="name">(a.title.as_str())</span>
568- <span class="val">since_line(lang: lang, stamp: a.stamp.as_str())</span>
541+ <span class="name">(f.label)</span>
542+ <span class=(format!("val {}", f.dot.value_class()))>(f.value.as_str())</span>
569543 </div>
570- if !a.body.is_empty() {
571- <p class="hint">(a.body.as_str())</p>
544+ if !f.detail.is_empty() {
545+ <p class="hint health-path">(f.detail.as_str())</p>
572546 }
573547 }
574- pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
575- <div class="acts">
576- <a class="act" href="/admin/server?tab=alerts">(alert_text::settings_link(lang))</a>
577- </div>
548+ <p class="hint">(meta.as_str())</p>
578549 </section>
579- }
580- <section class="sec">
581- <h2>(at(lang, A::Storage))</h2>
582- if let Some(u) = usage {
583- <p class="state"><strong>(u.used.as_str())</strong> " " (at(lang, A::DiskUsed)) " · " (u.free_of_total.as_str())</p>
584- <progress class=(if u.bad { "meter bad" } else { "meter" }) max="100" value=(u.pct.to_string())></progress>
585- <p class="hint health-path">(u.path.as_str())</p>
586- } else {
587- <p class="state">(at(lang, A::Unavailable))</p>
588- }
589- for f in facts.into_iter() {
590- <div class="line" data-kb-row="">
591- <span class="name">glyph(kind: f.glyph) (f.label)</span>
592- <span class=(format!("val {}", f.dot.value_class()))>(f.value.as_str())</span>
593- </div>
594- if !f.detail.is_empty() {
595- <p class="hint health-path">(f.detail.as_str())</p>
550+ <section class="sec">
551+ <h2>(at(lang, A::Services))</h2>
552+ for s in services.into_iter() {
553+ <div class="line" data-kb-row="">
554+ <span class="name">(s.label)</span>
555+ <span class="val">
556+ <span class=(format!("health-dot {}", s.dot.class()))></span> <span class=(s.dot.value_class())>(s.value.as_str())</span>
557+ if !s.detail.is_empty() {
558+ " · " (s.detail.as_str())
559+ }
560+ if let Some(stamp) = s.stamp.as_deref() {
561+ " · " rel_time(lang: lang, stamp: stamp)
562+ }
563+ </span>
564+ </div>
596565 }
597- }
598- <p class="hint">(meta.as_str())</p>
599- </section>
600- <section class="sec">
601- <h2>(at(lang, A::Services))</h2>
602- for s in services.into_iter() {
603- <div class="line" data-kb-row="">
604- <span class="name">glyph(kind: s.glyph) (s.label)</span>
605- <span class="val">
606- <span class=(format!("health-dot {}", s.dot.class()))></span> <span class=(s.dot.value_class())>(s.value.as_str())</span>
607- if !s.detail.is_empty() {
608- " · " (s.detail.as_str())
609- }
610- if let Some(stamp) = s.stamp.as_deref() {
611- " · " rel_time(lang: lang, stamp: stamp)
612- }
613- </span>
614- </div>
615- }
616- </section>
566+ </section>
617567 </div>
618568 })
619569 }
crates/forge-web/src/pages/admin_mail.rsmodified+15 -15
@@ -33,7 +33,7 @@ use crate::mail::{enqueue, live, templates};
3333 use crate::pages::admin_users::admin_only;
3434 use crate::pages::ci_runs::{changed_event, events_response};
3535 use crate::state::AppState;
36-use crate::views::parts::{confirm_act, post_act};
36+use crate::views::parts::{SubPart, confirm_act, head, post_act};
3737 use crate::views::{enc, rel_time, shell};
3838
3939 /// Rows shown in the queue at most.
@@ -218,20 +218,20 @@ async fn mail_view(
218218 .as_ref()
219219 .map(|q| q.filter_param.clone())
220220 .unwrap_or_default();
221+ let sub = vec![SubPart::text(g::t(lang, K::MailIntro))];
221222 Ok(view! {
222- <h1 class="sr-only">(g::t(lang, K::Mail))</h1>
223- <nav class="sub" aria-label=(g::t(lang, K::Mail))>
224- <a href="/admin/mail" aria-current=(settings_on.then_some("page"))>(g::t(lang, K::MailTabSettings))</a>
225- <a href="/admin/mail?tab=queue" aria-current=((!settings_on).then_some("page"))>(g::t(lang, K::MailTabQueue))</a>
226- </nav>
227- <p class="hint">(g::t(lang, K::MailIntro))</p>
223+ head(title: g::t(lang, K::Mail), sub: sub)
228224 if let Some(message) = notice {
229225 <p class="state" role="status">(message.as_str())</p>
230226 }
227+ <nav class="tabs" aria-label=(g::t(lang, K::Mail))>
228+ <a href="/admin/mail" aria-current=(settings_on.then_some("page"))>(g::t(lang, K::MailTabSettings))</a>
229+ <a href="/admin/mail?tab=queue" aria-current=((!settings_on).then_some("page"))>(g::t(lang, K::MailTabQueue))</a>
230+ </nav>
231231 if settings_on {
232232 // Saved by any admin session: the stream re-renders the settings with the same signal
233233 // as the queue (the save bumps it too), and the form keeps what was typed.
234- <div data-live="/admin/mail/events">
234+ <div class="sheet" data-live="/admin/mail/events">
235235 <form method="post" action="/admin/mail">
236236 <input type="hidden" name="csrf" value=(csrf.as_str())>
237237 <section class="sec" id="smtp">
@@ -293,13 +293,13 @@ async fn mail_view(
293293 </form>
294294 </div>
295295 } else if let Some(queue) = data.queue {
296- <nav class="sub" aria-label=(g::t(lang, K::MailTabQueue))>
297- for chip in queue.chips.into_iter() {
298- <a href=(chip.href.as_str()) aria-current=(chip.current.then_some("page"))>(chip.label) " (" (chip.count) ")"</a>
299- }
300- </nav>
301- <p class="hint">(g::t(lang, K::MailQueueIntro))</p>
302- <div data-live="/admin/mail/events">
296+ <div class="sheet" data-live="/admin/mail/events">
297+ <div class="sheet-tools">
298+ for chip in queue.chips.into_iter() {
299+ <a class="act" href=(chip.href.as_str()) aria-current=(chip.current.then_some("page"))>(chip.label) " (" (chip.count) ")"</a>
300+ }
301+ </div>
302+ <p class="hint">(g::t(lang, K::MailQueueIntro))</p>
303303 if queue.rows.is_empty() {
304304 if queue.filter_param.is_empty() {
305305 <p class="state">(g::t(lang, K::MailQueueEmpty))</p>
crates/forge-web/src/pages/admin_replication.rsmodified+6 -10
@@ -27,7 +27,7 @@ use crate::i18n::{self, Lang};
2727 use crate::live::{Topic, stream_changes};
2828 use crate::pages::admin_users::admin_only;
2929 use crate::state::AppState;
30-use crate::views::parts::post_act;
30+use crate::views::parts::{SubPart, head, post_act};
3131 use crate::views::{enc, rel_time_or_never, shell};
3232
3333 #[query_params(error = bad_request)]
@@ -188,13 +188,15 @@ async fn replication_view(
188188 data: PageData,
189189 notice: Option<String>,
190190 ) -> Result<impl View> {
191+ let sub = vec![SubPart::text(g::t(lang, K::ReplicationIntro))];
191192 Ok(view! {
192- <div data-live="/admin/replication/events">
193- <h1 class="sr-only">(g::t(lang, K::Replication))</h1>
194- <p class="hint">(g::t(lang, K::ReplicationIntro))</p>
193+ head(title: g::t(lang, K::Replication), sub: sub,
194+ post_act(label: g::t(lang, K::ReconcileNow), action: "/admin/replication/reconcile", csrf: csrf.as_str())
195+ )
195196 if let Some(message) = notice {
196197 <p class="state" role="status">(message.as_str())</p>
197198 }
199+ <div class="sheet" data-live="/admin/replication/events">
198200 if data.enabled {
199201 <section class="sec">
200202 <h2>(crate::pages::passkeys::s(lang, "Target and schedule", "Hedef ve zamanlama"))</h2>
@@ -235,12 +237,6 @@ async fn replication_view(
235237 <p class="state">(g::t(lang, K::ReplicationOff))</p>
236238 </section>
237239 }
238- <section class="sec">
239- <h2>(g::t(lang, K::Standby))</h2>
240- <div class="acts">
241- post_act(label: g::t(lang, K::ReconcileNow), action: "/admin/replication/reconcile", csrf: csrf.as_str())
242- </div>
243- </section>
244240 <section class="sec">
245241 <h2>(g::t(lang, K::Repos))</h2>
246242 if data.repos.is_empty() {
crates/forge-web/src/pages/admin_runners.rsmodified+198 -316
@@ -36,13 +36,13 @@ use crate::pages::admin_users::admin_only;
3636 use crate::pages::ci_runs::{age_text, duration_text, events_response, run_href, state_text};
3737 use crate::pages::repo_mirrors::stamp_in_tz;
3838 use crate::state::AppState;
39-use crate::views::parts::{confirm_act, post_act, reveal};
39+use crate::views::parts::{SubPart, confirm_act, head, post_act, reveal};
4040 use crate::views::repo_list::{PageLink, pager, pager_links};
4141 use crate::views::{alert, enc, now_unix, relative_time, shell};
4242
4343 path_param!(runner_id);
4444
45-/// Runners per page on the list. Six rows fit the window beside the "Add a runner" card.
45+/// Runners per page on the list.
4646 const PER_PAGE: usize = 6;
4747
4848 /// The list's query: the page, and the notice word that a paging link keeps.
@@ -179,11 +179,8 @@ struct RunnerRow {
179179 can_restart: bool,
180180 /// A restart that was asked for and has not happened yet.
181181 restart_pending: Option<RestartMode>,
182- /// The concurrency shown in the input: the admin's override, else what the runner reports.
182+ /// The concurrency: the admin's override, else what the runner reports. Empty when neither.
183183 concurrency: String,
184- /// "UI", "runner.toml" or empty when the runner has not reported.
185- concurrency_source: &'static str,
186- has_override: bool,
187184 running: u32,
188185 /// The build the runner reported, or empty for an older runner.
189186 build: String,
@@ -192,24 +189,16 @@ struct RunnerRow {
192189 /// "up to date", "outdated" or "unknown", with the `.ci-state` class the detail page colours it with.
193190 build_label: &'static str,
194191 build_class: &'static str,
195- /// "ok", "warn" or "muted": how the version status is coloured on the list.
196- build_tone: &'static str,
197- /// The concurrency the admin set or the runner reported, for the load meter's maximum.
198- /// Empty when the runner has not reported one.
199- concurrency_max: u32,
200- /// What it is doing now, then disabled and restart-pending when they apply, joined with " · ".
192+ /// What it is doing now, and restart pending when that applies, joined with " · ".
201193 status: String,
202- /// The id of the concurrency input, unique per runner on the list.
203- field_id: String,
204194 }
205195
206-/// How the runner's reported build compares with this server's: the label, the `.ci-state` class
207-/// and the list tone.
208-fn build_badge(lang: Lang, runner: &CiRunner) -> (&'static str, &'static str, &'static str) {
196+/// How the runner's reported build compares with this server's: the label and the `.ci-state` class.
197+fn build_badge(lang: Lang, runner: &CiRunner) -> (&'static str, &'static str) {
209198 match build::compare(runner.reported.build.as_deref(), &build::display()) {
210- Freshness::UpToDate => (s(lang, "up to date", "güncel"), "ci-success", "ok"),
211- Freshness::Outdated => (s(lang, "outdated", "eski"), "ci-queued", "warn"),
212- Freshness::Unknown => (s(lang, "unknown", "bilinmiyor"), "runner-disabled", "muted"),
199+ Freshness::UpToDate => (s(lang, "up to date", "güncel"), "ci-success"),
200+ Freshness::Outdated => (s(lang, "outdated", "eski"), "ci-queued"),
201+ Freshness::Unknown => (s(lang, "unknown", "bilinmiyor"), "runner-disabled"),
213202 }
214203 }
215204
@@ -226,10 +215,10 @@ fn dot_of(lang: Lang, runner: &CiRunner, now: i64) -> (&'static str, &'static st
226215 }
227216 }
228217
229-/// The effective concurrency as a number to show, and where it comes from.
230-fn concurrency_of(runner: &CiRunner) -> (String, &'static str) {
218+/// The effective concurrency as a number to show. Empty when neither the admin nor the runner set one.
219+fn concurrency_of(runner: &CiRunner) -> String {
231220 if let Some(n) = runner.concurrency_override {
232- return (n.to_string(), "UI");
221+ return n.to_string();
233222 }
234223 let base = runner
235224 .reported
@@ -242,10 +231,7 @@ fn concurrency_of(runner: &CiRunner) -> (String, &'static str) {
242231 .and_then(|n| u32::try_from(n).ok())
243232 })
244233 .map(|n| n.to_string());
245- match base {
246- Some(n) => (n, "runner.toml"),
247- None => (String::new(), ""),
248- }
234+ base.unwrap_or_default()
249235 }
250236
251237 fn runner_row(runner: &CiRunner, tz: &str, lang: Lang, now: i64) -> RunnerRow {
@@ -260,10 +246,9 @@ fn runner_row(runner: &CiRunner, tz: &str, lang: Lang, now: i64) -> RunnerRow {
260246 }
261247 None => (i18n::t(lang, Key::Never).to_owned(), String::new()),
262248 };
263- let (concurrency, concurrency_source) = concurrency_of(runner);
264- let (build_label, build_class, build_tone) = build_badge(lang, runner);
249+ let concurrency = concurrency_of(runner);
250+ let (build_label, build_class) = build_badge(lang, runner);
265251 let (dot_class, state_text) = dot_of(lang, runner, now);
266- let concurrency_max = concurrency.parse().unwrap_or(0);
267252 let doing = if runner.running_jobs == 0 {
268253 s(lang, "idle", "boşta").to_owned()
269254 } else {
@@ -273,13 +258,9 @@ fn runner_row(runner: &CiRunner, tz: &str, lang: Lang, now: i64) -> RunnerRow {
273258 }
274259 };
275260 let mut parts = vec![doing];
276- if runner.disabled {
277- parts.push(g::t(lang, K::Disabled).to_owned());
278- }
279261 if runner.restart.is_some() {
280262 parts.push(s(lang, "restart pending", "yeniden başlatma bekliyor").to_owned());
281263 }
282- let field_id = format!("conc-{}", enc(&runner.id));
283264 RunnerRow {
284265 name: runner.name.clone(),
285266 labels: runner.labels.join(" · "),
@@ -297,8 +278,6 @@ fn runner_row(runner: &CiRunner, tz: &str, lang: Lang, now: i64) -> RunnerRow {
297278 can_restart: runner.supports_restart(),
298279 restart_pending: runner.restart.as_ref().map(|r| r.mode),
299280 concurrency,
300- concurrency_source,
301- has_override: runner.concurrency_override.is_some(),
302281 running: runner.running_jobs,
303282 build_short: runner
304283 .reported
@@ -309,10 +288,7 @@ fn runner_row(runner: &CiRunner, tz: &str, lang: Lang, now: i64) -> RunnerRow {
309288 build: runner.reported.build.clone().unwrap_or_default(),
310289 build_label,
311290 build_class,
312- build_tone,
313- concurrency_max,
314291 status: parts.join(" · "),
315- field_id,
316292 }
317293 }
318294
@@ -357,8 +333,12 @@ async fn runners_view(
357333 ) -> Result<impl View> {
358334 let (links, prev, next) = nav;
359335 Ok(view! {
360- <div data-live="/admin/runners/events">
361- <h1 class="sr-only">(g::t(lang, K::CiRunners))</h1>
336+ head(title: g::t(lang, K::CiRunners), live: Some("/admin/runners/events"),
337+ <form method="post" action="/admin/runners/tokens">
338+ <input type="hidden" name="csrf" value=(csrf.as_str())>
339+ <button type="submit" class="primary">(g::t(lang, K::CreateRegistrationToken))</button>
340+ </form>
341+ )
362342 if let Some((text, is_error)) = notice {
363343 if is_error {
364344 alert(message: text)
@@ -366,69 +346,33 @@ async fn runners_view(
366346 <p class="state" role="status">(text)</p>
367347 }
368348 }
369- <section class="sec">
370- <h2>(g::t(lang, K::AddARunner))</h2>
371- if rows.is_empty() {
372- <p class="state">(g::t(lang, K::NoRunnersYet))</p>
373- }
374- <div class="acts">
375- reveal(label: g::t(lang, K::CreateRegistrationToken), id: Some("add-runner"),
376- <p class="hint">(note.as_str())</p>
377- if rows.is_empty() {
378- <p class="hint">(g::t(lang, K::RunnersEmptyHint))</p>
379- <pre><code>"forge runner register --url <forge-url> --token <token> --name <name> --labels linux,x86_64"</code></pre>
380- }
381- <form method="post" action="/admin/runners/tokens" class="fields">
382- <input type="hidden" name="csrf" value=(csrf.as_str())>
383- <button type="submit" class="primary">(g::t(lang, K::CreateRegistrationToken))</button>
384- </form>
385- )
386- </div>
387- </section>
388- <section class="sec">
389- for row in rows.iter() {
390- <details class="row-open">
391- <summary class="line" data-kb-row="">
392- <span class=(row.dot_class) role="img" aria-label=(row.state_text) title=(row.state_text)></span>
349+ <div class="sheet">
350+ <section class="sec">
351+ if rows.is_empty() {
352+ <p class="state">(g::t(lang, K::NoRunnersYet))</p>
353+ }
354+ for row in rows.iter() {
355+ <a class="line" data-kb-row="" href=(row.detail_href.as_str())>
393356 <span class="name">(row.name.as_str())</span>
357+ if !row.labels.is_empty() {
358+ <span class="val"><span class="runner-labels">(row.labels.as_str())</span></span>
359+ }
360+ <span class="val"><span class=(row.dot_class) role="img" aria-label=(row.state_text) title=(row.state_text)></span>" "(row.state_text)</span>
394361 <span class="val">(row.status.as_str())</span>
395- </summary>
396- <div class="opened">
397- <p class="hint">
398- if !row.labels.is_empty() {
399- <span class="runner-labels">(row.labels.as_str())</span>
400- " · "
401- }
402- (s(lang, "seen", "görüldü"))" "<time data-rel="true" datetime=(row.last_seen_at.as_str()) title=(row.last_seen_full.as_str())>(row.last_seen.as_str())</time>
403- </p>
404- <div class="runner-version" title=(row.build.as_str())>
405- if !row.build_short.is_empty() {
406- <code class="runner-hash">(row.build_short.as_str())</code>
407- }
408- if row.build_tone == "ok" {
409- <span class="runner-status"><span class="runner-tick" aria-hidden="true">"✓"</span>" "(row.build_label)</span>
410- } else {
411- <span class=(format!("runner-status {}", row.build_tone))>(row.build_label)</span>
412- }
413- </div>
414- concurrency_form(lang: lang, csrf: csrf.as_str(), action: row.config_action.as_str(), id: row.field_id.as_str(), key: "concurrency", value: row.concurrency.as_str(), source: row.concurrency_source, has_override: row.has_override, back: "list", running: row.running, max: row.concurrency_max)
415- <div class="acts">
416- <a class="act" href=(row.detail_href.as_str())>(s(lang, "Open", "Aç"))</a>
417- if row.disabled {
418- post_act(label: g::t(lang, K::Enable), action: row.toggle_action.as_str(), csrf: csrf.as_str(), fields: vec![("disabled".to_owned(), "0".to_owned())])
419- } else {
420- confirm_post(lang: lang, csrf: csrf.as_str(), action: row.toggle_action.as_str(), label: g::t(lang, K::Disable), message: disable_message(lang, row.name.as_str()), confirm: s(lang, "Yes, disable", "Evet, devre dışı bırak"), danger: false, fields: vec![("disabled", "1".into())])
421- }
422- restart_control(lang: lang, csrf: csrf.as_str(), action: row.restart_action.as_str(), back: "list", can_restart: row.can_restart, pending: row.restart_pending)
423- 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![])
424- </div>
425- </div>
426- </details>
427- }
428- if !rows.is_empty() {
429- pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
430- }
431- </section>
362+ </a>
363+ }
364+ if !rows.is_empty() {
365+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
366+ }
367+ </section>
368+ <section class="sec">
369+ <h2>(g::t(lang, K::AddARunner))</h2>
370+ <p class="hint">(note.as_str())</p>
371+ if rows.is_empty() {
372+ <p class="hint">(g::t(lang, K::RunnersEmptyHint))</p>
373+ <pre><code>"forge runner register --url <forge-url> --token <token> --name <name> --labels linux,x86_64"</code></pre>
374+ }
375+ </section>
432376 </div>
433377 })
434378 }
@@ -443,7 +387,8 @@ fn list_href(page: u64, notice: &str) -> String {
443387 }
444388 }
445389
446-/// A text link that asks first, in place; the POST only fires from the confirm button.
390+/// A text link that asks first, in place; the POST only fires from the confirm button. For actions
391+/// that are not destructive, so the confirm button is soft.
447392 #[component]
448393 pub(crate) async fn confirm_post(
449394 lang: Lang,
@@ -452,12 +397,11 @@ pub(crate) async fn confirm_post(
452397 label: &'static str,
453398 message: String,
454399 confirm: &'static str,
455- danger: bool,
456400 fields: Vec<(&'static str, String)>,
457401 ) -> Result<impl View> {
458402 Ok(view! {
459403 <details class="reveal">
460- <summary class=(if danger { "act danger" } else { "act" })>(label)</summary>
404+ <summary class="act">(label)</summary>
461405 <form class="opened" method="post" action=(action)>
462406 <input type="hidden" name="csrf" value=(csrf)>
463407 for (name, value) in fields.iter() {
@@ -465,25 +409,14 @@ pub(crate) async fn confirm_post(
465409 }
466410 <p class="hint">(message)</p>
467411 <div class="acts">
468- <button type="submit" class=(if danger { "act danger" } else { "act" })>(confirm)</button>
469- <button type="button" class="act quiet" data-close-details="">(s(lang, "Cancel", "Vazgeç"))</button>
412+ <button type="submit" class="small">(confirm)</button>
413+ <button type="button" class="act" data-close-details="">(s(lang, "Cancel", "Vazgeç"))</button>
470414 </div>
471415 </form>
472416 </details>
473417 })
474418 }
475419
476-/// The tooltip of the concurrency input: where the shown value comes from.
477-fn source_title(lang: Lang, source: &str) -> String {
478- match (source, lang) {
479- ("", _) => String::new(),
480- ("UI", Lang::Tr) => "Değer arayüzden ayarlandı".to_owned(),
481- ("UI", _) => "Value set in the UI".to_owned(),
482- (other, Lang::Tr) => format!("Değer {other} dosyasından"),
483- (other, _) => format!("Value from {other}"),
484- }
485-}
486-
487420 fn delete_message(lang: Lang, name: &str) -> String {
488421 match lang {
489422 Lang::Tr => format!("{name} silinsin mi? Makinenin sonrasında yeniden kaydolması gerekir."),
@@ -512,19 +445,16 @@ async fn restart_control(
512445 ) -> Result<impl View> {
513446 Ok(view! {
514447 if pending.is_some() {
515- <p class="state">(if pending == Some(RestartMode::Now) { s(lang, "Restarting now...", "Şimdi yeniden başlatılıyor...") } else { s(lang, "Restarting after the current jobs...", "Mevcut işlerden sonra yeniden başlatılıyor...") })</p>
448+ <p class="hint">(if pending == Some(RestartMode::Now) { s(lang, "Restarting now...", "Şimdi yeniden başlatılıyor...") } else { s(lang, "Restarting after the current jobs...", "Mevcut işlerden sonra yeniden başlatılıyor...") })</p>
516449 } else if can_restart {
517- <details class="reveal">
518- <summary class="act">(s(lang, "Restart", "Yeniden başlat"))</summary>
519- <div class="opened">
520- <p class="hint">(s(lang, "Restart this runner? It stops taking new jobs first.", "Bu çalıştırıcı yeniden başlatılsın mı? Önce yeni iş almayı bırakır."))</p>
521- <p class="hint">(s(lang, "The running jobs finish, then it restarts.", "Çalışan işler biter, sonra yeniden başlar."))</p>
522- <div class="acts">
523- post_act(label: s(lang, "Restart after current jobs", "Mevcut işlerden sonra yeniden başlat"), action: action, csrf: csrf, fields: vec![("mode".to_owned(), "drain".to_owned()), ("back".to_owned(), back.to_owned())])
524- confirm_act(lang: lang, label: s(lang, "Restart now", "Şimdi yeniden başlat"), action: action, csrf: csrf, fields: vec![("mode".to_owned(), "now".to_owned()), ("back".to_owned(), back.to_owned())], note: Some(s(lang, "The running jobs end as cancelled and can be run again.", "Çalışan işler iptal edilmiş olarak biter ve yeniden çalıştırılabilir.").to_owned()))
525- </div>
450+ reveal(label: s(lang, "Restart", "Yeniden başlat"),
451+ <p class="hint">(s(lang, "Restart this runner? It stops taking new jobs first.", "Bu çalıştırıcı yeniden başlatılsın mı? Önce yeni iş almayı bırakır."))</p>
452+ <p class="hint">(s(lang, "The running jobs finish, then it restarts.", "Çalışan işler biter, sonra yeniden başlar."))</p>
453+ <div class="acts">
454+ post_act(label: s(lang, "Restart after current jobs", "Mevcut işlerden sonra yeniden başlat"), action: action, csrf: csrf, fields: vec![("mode".to_owned(), "drain".to_owned()), ("back".to_owned(), back.to_owned())])
455+ confirm_act(lang: lang, label: s(lang, "Restart now", "Şimdi yeniden başlat"), action: action, csrf: csrf, fields: vec![("mode".to_owned(), "now".to_owned()), ("back".to_owned(), back.to_owned())], note: Some(s(lang, "The running jobs end as cancelled and can be run again.", "Çalışan işler iptal edilmiş olarak biter ve yeniden çalıştırılabilir.").to_owned()))
526456 </div>
527- </details>
457+ )
528458 } else {
529459 <p class="hint">(s(lang, "Runner too old, update it first", "Çalıştırıcı çok eski, önce güncelleyin"))</p>
530460 }
@@ -534,24 +464,9 @@ async fn restart_control(
534464 /// Above this many slots the running jobs show as a meter, not as one pip per slot.
535465 const PIP_MAX: u32 = 16;
536466
537-/// The load cell of a runner, in two parts: the jobs running, as a pip per concurrency slot (a
538-/// meter past `PIP_MAX`), and the concurrency as a stepper. The − and + buttons step the input
539-/// (nav.js); Save shows only once the value has changed, and stays visible without JavaScript. A
540-/// reset button shows while an override is set.
467+/// The load of a runner: the jobs running, as a pip per concurrency slot, or a meter past `PIP_MAX`.
541468 #[component]
542-async fn concurrency_form(
543- lang: Lang,
544- csrf: &str,
545- action: &str,
546- id: &str,
547- key: &str,
548- value: &str,
549- source: &'static str,
550- has_override: bool,
551- back: &'static str,
552- running: u32,
553- max: u32,
554-) -> Result<impl View> {
469+async fn load_meter(lang: Lang, running: u32, max: u32) -> Result<impl View> {
555470 let running_text = running.to_string();
556471 let meter_max = max.max(1).to_string();
557472 let use_pips = (1..=PIP_MAX).contains(&max);
@@ -569,35 +484,15 @@ async fn concurrency_form(
569484 Lang::Tr => format!("{running}/{max} iş çalışıyor"),
570485 };
571486 Ok(view! {
572- <form method="post" action=(action) class="fields runner-load" data-dirty-form="">
573- <input type="hidden" name="csrf" value=(csrf)>
574- <input type="hidden" name="key" value=(key)>
575- <input type="hidden" name="back" value=(back)>
576- <div class="field">
577- <label for=(id)>(s(lang, "Concurrency", "Eşzamanlılık"))</label>
578- <div class="runner-stepper">
579- <button type="button" class="runner-step" data-step="-1" aria-label=(s(lang, "Fewer", "Azalt"))>"−"</button>
580- <input id=(id) type="number" name="value" value=(value) min="1" max="64" step="1" inputmode="numeric" required="required" title=(source_title(lang, source))>
581- <button type="button" class="runner-step" data-step="1" aria-label=(s(lang, "More", "Artır"))>"+"</button>
582- </div>
583- <div class="runner-running">
584- <span class="runner-count"><span class="runner-n">(running_text.as_str())</span>" "<span class="muted">(s(lang, "running", "çalışıyor"))</span></span>
585- if use_pips {
586- <span class="runner-pips" role="img" aria-label=(pips_label.as_str())>
587- for pip in pips.iter() {
588- <span class=(*pip)></span>
589- }
590- </span>
591- } else {
592- <progress class="runner-meter" value=(running_text.as_str()) max=(meter_max.as_str()) aria-label=(s(lang, "Running jobs", "Çalışan işler"))></progress>
593- }
594- </div>
595- </div>
596- <button type="submit" class="primary runner-save">(s(lang, "Save", "Kaydet"))</button>
597- if has_override {
598- <button type="submit" name="reset" value="1" class="act" formnovalidate="formnovalidate" title=(s(lang, "Use the runner.toml value", "runner.toml değerini kullan"))>(s(lang, "Use the runner.toml value", "runner.toml değerini kullan"))</button>
599- }
600- </form>
487+ if use_pips {
488+ <span class="runner-pips" role="img" aria-label=(pips_label.as_str())>
489+ for pip in pips.iter() {
490+ <span class=(*pip)></span>
491+ }
492+ </span>
493+ } else {
494+ <progress class="runner-meter" value=(running_text.as_str()) max=(meter_max.as_str()) aria-label=(s(lang, "Running jobs", "Çalışan işler"))></progress>
495+ }
601496 })
602497 }
603498
@@ -609,23 +504,24 @@ async fn token_view(
609504 expiry: String,
610505 ) -> Result<impl View> {
611506 Ok(view! {
612- <h1 class="sr-only">(g::t(lang, K::RegistrationToken))</h1>
507+ head(title: g::t(lang, K::RegistrationToken))
613508 <p class="state" role="status"><strong>(g::t(lang, K::CopyTokenNow))</strong></p>
614509 <p class="hint">(expiry.as_str())</p>
615- <section class="sec" data-once="">
616- <h2>(g::t(lang, K::Token))</h2>
617- <div class="copy-box">
618- <code id="reg-token">(token.as_str())</code>
619- <button type="button" class="act" data-copy="reg-token" data-copied=(s(lang, "Copied", "Kopyalandı")) data-failed=(s(lang, "Failed", "Başarısız"))>(s(lang, "Copy", "Kopyala"))</button>
620- </div>
621- <h2>(g::t(lang, K::RegisterARunner))</h2>
622- <p class="hint">(g::t(lang, K::ReplacePrefix))<code>"<name>"</code>(g::t(lang, K::ReplaceSuffix))</p>
623- <div class="copy-box">
624- <code id="reg-command">(command.as_str())</code>
625- <button type="button" class="act" data-copy="reg-command" data-copied=(s(lang, "Copied", "Kopyalandı")) data-failed=(s(lang, "Failed", "Başarısız"))>(s(lang, "Copy", "Kopyala"))</button>
626- </div>
627- <p class="sub"><a href="/admin/runners">(g::t(lang, K::BackToRunners))</a></p>
628- </section>
510+ <div class="sheet">
511+ <div class="sheet-tools"><strong>(g::t(lang, K::Token))</strong> <a class="act" href="/admin/runners">(g::t(lang, K::BackToRunners))</a></div>
512+ <section class="sec" data-once="">
513+ <div class="copy-box">
514+ <code id="reg-token">(token.as_str())</code>
515+ <button type="button" class="act" data-copy="reg-token" data-copied=(s(lang, "Copied", "Kopyalandı")) data-failed=(s(lang, "Failed", "Başarısız"))>(s(lang, "Copy", "Kopyala"))</button>
516+ </div>
517+ <h2>(g::t(lang, K::RegisterARunner))</h2>
518+ <p class="hint">(g::t(lang, K::ReplacePrefix))<code>"<name>"</code>(g::t(lang, K::ReplaceSuffix))</p>
519+ <div class="copy-box">
520+ <code id="reg-command">(command.as_str())</code>
521+ <button type="button" class="act" data-copy="reg-command" data-copied=(s(lang, "Copied", "Kopyalandı")) data-failed=(s(lang, "Failed", "Başarısız"))>(s(lang, "Copy", "Kopyala"))</button>
522+ </div>
523+ </section>
524+ </div>
629525 })
630526 }
631527
@@ -847,8 +743,10 @@ fn sel(on: bool) -> Option<&'static str> {
847743 on.then_some("selected")
848744 }
849745
850-/// The detail page tabs: slug and the config keys on it. `jobs`, `identity` and `logs` are read-only.
851-const TABS: [(&str, &[&str]); 7] = [
746+/// The detail page tabs: slug and the config keys on it. `overview`, `jobs`, `identity` and `logs`
747+/// are read-only.
748+const TABS: [(&str, &[&str]); 8] = [
749+ ("overview", &[]),
852750 (
853751 "general",
854752 &["concurrency", "labels", "executor", "auto_update"],
@@ -882,6 +780,7 @@ const TABS: [(&str, &[&str]); 7] = [
882780 /// The tab's label in the page's own tab row.
883781 fn tab_label(lang: Lang, slug: &str) -> &'static str {
884782 match slug {
783+ "overview" => s(lang, "Overview", "Özet"),
885784 "general" => s(lang, "General", "Genel"),
886785 "limits" => s(lang, "Limits", "Sınırlar"),
887786 "storage" => s(lang, "Storage", "Depolama"),
@@ -900,11 +799,11 @@ fn tab_keys(tab: &str) -> Vec<&'static str> {
900799 .collect()
901800 }
902801
903-/// The tab a name stands for; anything unknown is the first tab.
802+/// The tab a name stands for; anything unknown is the overview.
904803 fn tab_slug(wanted: Option<&str>) -> &'static str {
905804 TABS.iter()
906805 .find(|(slug, _)| Some(*slug) == wanted)
907- .map_or("general", |(slug, _)| *slug)
806+ .map_or("overview", |(slug, _)| *slug)
908807 }
909808
910809 /// The tab slug from `?tab=`.
@@ -1636,7 +1535,12 @@ async fn runner_detail_view(
16361535 };
16371536 let shown = detail_fields(lang, tab, &fields);
16381537 let identity = identity_rows(lang, &fields);
1639- let editing = !matches!(tab, "logs" | "jobs");
1538+ let editing = !matches!(tab, "overview" | "logs" | "jobs");
1539+ let slots = row.concurrency.parse::<u32>().unwrap_or(0);
1540+ let mut sub = vec![SubPart::text(row.state_text)];
1541+ if row.restart_pending.is_some() {
1542+ sub.push(SubPart::text(s(lang, "restart pending", "yeniden başlatma bekliyor")));
1543+ }
16401544 let jobs_href = format!("{}?tab=jobs", row.detail_href);
16411545 let save_action = format!("{}/settings", row.detail_href);
16421546 let reset_action = row.config_action.clone();
@@ -1658,15 +1562,15 @@ async fn runner_detail_view(
16581562 // A runner that has reported nothing has no figures to show, only the note below.
16591563 let has_host = !metrics.empty || runner.reported.cpus.is_some();
16601564 Ok(view! {
1661- <div data-live="/admin/runners/events" class="runner-detail">
1662- <h1 class="h1">(runner.name.as_str())</h1>
1663- <p class="hint runner-state"><span class=(row.dot_class)></span>(row.state_text)
1664- if row.restart_pending.is_some() {
1665- " · "
1666- <span class="runner-off">(s(lang, "restart pending", "yeniden başlatma bekliyor"))</span>
1565+ head(title: runner.name.as_str(), sub: sub, live: Some("/admin/runners/events"),
1566+ restart_control(lang: lang, csrf: csrf.as_str(), action: row.restart_action.as_str(), back: "detail", can_restart: row.can_restart, pending: row.restart_pending)
1567+ if row.disabled {
1568+ post_act(label: g::t(lang, K::Enable), action: row.toggle_action.as_str(), csrf: csrf.as_str(), fields: vec![("disabled".to_owned(), "0".to_owned())])
1569+ } else {
1570+ confirm_post(lang: lang, csrf: csrf.as_str(), action: row.toggle_action.as_str(), label: g::t(lang, K::Disable), message: disable_message(lang, row.name.as_str()), confirm: s(lang, "Yes, disable", "Evet, devre dışı bırak"), fields: vec![("disabled", "1".into())])
16671571 }
1668- </p>
1669- <p class="sub"><a href="/admin/runners">(g::t(lang, K::BackToRunners))</a></p>
1572+ confirm_act(lang: lang, label: i18n::t(lang, Key::Delete), action: row.delete_action.as_str(), csrf: csrf.as_str(), note: Some(delete_message(lang, row.name.as_str())))
1573+ )
16701574 if let Some((text, is_error)) = notice {
16711575 if is_error {
16721576 alert(message: text)
@@ -1674,30 +1578,26 @@ async fn runner_detail_view(
16741578 <p class="state" role="status">(text)</p>
16751579 }
16761580 }
1677- <section class="sec">
1678- <h2>(s(lang, "Status", "Durum"))</h2>
1679- <p class="state">(s(lang, "Running jobs", "Çalışan işler")) " " <a href=(jobs_href.as_str())>(in_use.as_str())</a></p>
1680- <p class="hint">(g::t(lang, K::LastSeen)) " " <time data-rel="true" datetime=(row.last_seen_at.as_str()) title=(row.last_seen_full.as_str())>(row.last_seen.as_str())</time></p>
1681- <p class="hint">(s(lang, "Build", "Derleme")) " " <span title=(row.build.as_str())>(if row.build_short.is_empty() { "-" } else { row.build_short.as_str() })</span> " " <span class=(format!("ci-state {}", row.build_class))>(row.build_label)</span></p>
1682- <p class="hint">(s(lang, "Runner version", "Çalıştırıcı sürümü")) " " (version.as_str())</p>
1683- <div class="acts">
1684- restart_control(lang: lang, csrf: csrf.as_str(), action: row.restart_action.as_str(), back: "detail", can_restart: row.can_restart, pending: row.restart_pending)
1685- if row.disabled {
1686- post_act(label: g::t(lang, K::Enable), action: row.toggle_action.as_str(), csrf: csrf.as_str(), fields: vec![("disabled".to_owned(), "0".to_owned())])
1687- } else {
1688- confirm_post(lang: lang, csrf: csrf.as_str(), action: row.toggle_action.as_str(), label: g::t(lang, K::Disable), message: disable_message(lang, row.name.as_str()), confirm: s(lang, "Yes, disable", "Evet, devre dışı bırak"), danger: false, fields: vec![("disabled", "1".into())])
1689- }
1690- 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![])
1691- </div>
1692- </section>
1693- <section class="sec">
1694- <h2>(s(lang, "Last hour", "Son bir saat"))</h2>
1581+ <nav class="tabs" aria-label=(s(lang, "Configuration", "Yapılandırma"))>
1582+ for (slug, _) in TABS.iter() {
1583+ <a href=(format!("{}?tab={}", row.detail_href, slug)) aria-current=(current(*slug == tab))>(tab_label(lang, slug))</a>
1584+ }
1585+ </nav>
1586+ <div class="sheet">
1587+ if tab == "overview" {
1588+ <section class="sec">
1589+ <h2>(s(lang, "Status", "Durum"))</h2>
1590+ <div class="line"><span class="name">(s(lang, "Running jobs", "Çalışan işler"))</span><span class="val"><a href=(jobs_href.as_str())>(in_use.as_str())</a> " " load_meter(lang: lang, running: row.running, max: slots)</span></div>
1591+ <div class="line"><span class="name">(g::t(lang, K::LastSeen))</span><span class="val"><time data-rel="true" datetime=(row.last_seen_at.as_str()) title=(row.last_seen_full.as_str())>(row.last_seen.as_str())</time></span></div>
1592+ <div class="line"><span class="name">(s(lang, "Build", "Derleme"))</span><span class="val"><span title=(row.build.as_str())>(if row.build_short.is_empty() { "-" } else { row.build_short.as_str() })</span> " " <span class=(format!("ci-state {}", row.build_class))>(row.build_label)</span></span></div>
1593+ <div class="line"><span class="name">(s(lang, "Runner version", "Çalıştırıcı sürümü"))</span><span class="val">(version.as_str())</span></div>
1594+ </section>
16951595 if has_host {
16961596 <div class="mx-panels">
16971597 for (c, fact) in metrics.charts.iter().zip(facts.iter()) {
1698- <div class="mx-panel">
1598+ <section class="sec mx-panel">
16991599 <div class="mx-head">
1700- <p class="mx-caption">(c.caption.as_str())</p>
1600+ <h2 class="mx-caption">(c.caption.as_str())</h2>
17011601 if !fact.is_empty() {
17021602 <p class="hint mx-facts">(fact.as_str())</p>
17031603 }
@@ -1741,40 +1641,46 @@ async fn runner_detail_view(
17411641 }
17421642 </svg>
17431643 }
1744- </div>
1644+ </section>
17451645 }
17461646 </div>
17471647 }
17481648 if metrics.empty {
1749- <p class="hint">(s(lang, "No metrics yet. A runner sends them from this version on; an older one sends nothing.", "Henüz ölçüm yok. Ölçümleri bu sürümden itibaren çalıştırıcı gönderir; eski sürüm hiçbir şey göndermez."))</p>
1649+ <section class="sec">
1650+ <p class="hint">(s(lang, "No metrics yet. A runner sends them from this version on; an older one sends nothing.", "Henüz ölçüm yok. Ölçümleri bu sürümden itibaren çalıştırıcı gönderir; eski sürüm hiçbir şey göndermez."))</p>
1651+ </section>
17501652 } else {
1751- <details class="mx-table">
1752- <summary>(s(lang, "Show as table", "Tablo olarak göster"))</summary>
1753- <div class="table-wrap mx-table-scroll">
1754- <table class="table">
1755- <thead><tr><th>(s(lang, "Time (UTC)", "Saat (UTC)"))</th><th>(s(lang, "CPU", "CPU"))</th><th>(s(lang, "Memory", "Bellek"))</th><th>(s(lang, "Received", "Alınan"))</th><th>(s(lang, "Sent", "Gönderilen"))</th></tr></thead>
1756- <tbody>
1757- for row in metrics.rows.iter() {
1758- <tr>
1759- <td class="nowrap">(row.time.as_str())</td>
1760- <td class="nowrap">(row.cpu.as_str())</td>
1761- <td class="nowrap">(row.mem.as_str())</td>
1762- <td class="nowrap">(row.rx.as_str())</td>
1763- <td class="nowrap">(row.tx.as_str())</td>
1764- </tr>
1765- }
1766- </tbody>
1767- </table>
1768- </div>
1769- </details>
1770- }
1771- </section>
1772- <nav class="tabs" aria-label=(s(lang, "Configuration", "Yapılandırma"))>
1773- for (slug, _) in TABS.iter() {
1774- <a href=(format!("{}?tab={}", row.detail_href, slug)) aria-current=(current(*slug == tab))>(tab_label(lang, slug))</a>
1653+ <section class="sec">
1654+ <details class="mx-table">
1655+ <summary class="act">(s(lang, "Show as table", "Tablo olarak göster"))</summary>
1656+ <div class="table-wrap mx-table-scroll">
1657+ <table class="table">
1658+ <thead><tr><th>(s(lang, "Time (UTC)", "Saat (UTC)"))</th><th>(s(lang, "CPU", "CPU"))</th><th>(s(lang, "Memory", "Bellek"))</th><th>(s(lang, "Received", "Alınan"))</th><th>(s(lang, "Sent", "Gönderilen"))</th></tr></thead>
1659+ <tbody>
1660+ for row in metrics.rows.iter() {
1661+ <tr>
1662+ <td class="nowrap">(row.time.as_str())</td>
1663+ <td class="nowrap">(row.cpu.as_str())</td>
1664+ <td class="nowrap">(row.mem.as_str())</td>
1665+ <td class="nowrap">(row.rx.as_str())</td>
1666+ <td class="nowrap">(row.tx.as_str())</td>
1667+ </tr>
1668+ }
1669+ </tbody>
1670+ </table>
1671+ </div>
1672+ </details>
1673+ </section>
17751674 }
1776- </nav>
1777- if editing {
1675+ } else if tab == "identity" {
1676+ <section class="sec">
1677+ for (label, value) in identity.iter() {
1678+ <div class="line"><span class="name">(*label)</span><span class="val"><code class="srv-fixed">(value.as_str())</code></span></div>
1679+ }
1680+ <p class="hint">(g::t(lang, K::SrvKindReadOnly))</p>
1681+ <p class="hint">(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."))</p>
1682+ </section>
1683+ } else if editing {
17781684 <section class="sec">
17791685 <form method="post" action=(save_action.as_str()) class="fields">
17801686 <input type="hidden" name="csrf" value=(csrf.as_str())>
@@ -1806,18 +1712,7 @@ async fn runner_detail_view(
18061712 }
18071713 </div>
18081714 }
1809- for (i, (label, value)) in identity.iter().enumerate().filter(|_| tab == "identity") {
1810- <div class="field">
1811- <p class="state">(*label) " " <code class="srv-fixed">(value.as_str())</code></p>
1812- <p class="hint">(g::t(lang, K::SrvKindReadOnly))</p>
1813- if i == 0 {
1814- <p class="hint">(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."))</p>
1815- }
1816- </div>
1817- }
1818- if tab != "identity" {
1819- <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button>
1820- }
1715+ <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button>
18211716 </form>
18221717 <form id="rn-reset" method="post" action=(reset_action.as_str())>
18231718 <input type="hidden" name="csrf" value=(csrf.as_str())>
@@ -1826,68 +1721,40 @@ async fn runner_detail_view(
18261721 <input type="hidden" name="reset" value="1">
18271722 </form>
18281723 </section>
1829- } else {
1830- <section class="sec">
1831- if tab == "logs" {
1724+ } else if tab == "logs" {
1725+ if !log.is_empty() {
1726+ <div class="sheet-tools"><strong>(s(lang, "Runner log", "Çalıştırıcı günlüğü"))</strong> <button type="button" class="act" data-copy="runner-log" data-copied=(rc::t(lang, rc::K::CopyDone)) data-failed=(rc::t(lang, rc::K::CopyFailed))>(s(lang, "Copy all", "Tümünü kopyala"))</button></div>
1727+ }
1728+ <section class="sec">
18321729 if log.is_empty() {
18331730 <p class="hint">(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."))</p>
18341731 } else {
1835- <div class="runner-log-bar">
1836- <button type="button" class="act" data-copy="runner-log" data-copied=(rc::t(lang, rc::K::CopyDone)) data-failed=(rc::t(lang, rc::K::CopyFailed))>(s(lang, "Copy all", "Tümünü kopyala"))</button>
1837- </div>
18381732 <pre id="runner-log" class="ci-log runner-log" role="log" aria-label=(s(lang, "Runner log", "Çalıştırıcı günlüğü"))>
18391733 for row in log.iter() {
18401734 <span class=(row.class)><span class="runner-log-time">(row.time.as_str())</span>" "<span class="runner-log-level">(row.level.as_str())</span>" "<span class="runner-log-chip">(row.chip)</span>" "(row.text.as_str())"\n"</span>
18411735 }
18421736 </pre>
18431737 }
1844- } else if tab == "jobs" {
1738+ </section>
1739+ } else {
1740+ <section class="sec">
18451741 <h2>(s(lang, "Running now", "Şu an çalışan"))</h2>
18461742 if running_jobs.is_empty() {
18471743 <p class="hint">(s(lang, "Not running any job.", "Hiçbir iş çalıştırmıyor."))</p>
1848- } else {
1849- <div class="table-wrap">
1850- <table class="table queue-table">
1851- <thead><tr><th>(s(lang, "Job", "İş"))</th><th>(s(lang, "Repo", "Depo"))</th><th>(s(lang, "Run", "Çalıştırma"))</th><th>(s(lang, "Running for", "Çalışma süresi"))</th><th>(s(lang, "Waited", "Bekleme"))</th></tr></thead>
1852- <tbody>
1853- for job in running_jobs.iter() {
1854- <tr>
1855- <td>(job.name.as_str())</td>
1856- <td class="nowrap">(job.repo.as_str())</td>
1857- <td class="nowrap"><a href=(job.run_href.as_str())>(job.run_text.as_str())</a></td>
1858- <td class="nowrap">(job.duration.as_str())</td>
1859- <td class="nowrap">(job.waited.as_str())</td>
1860- </tr>
1861- }
1862- </tbody>
1863- </table>
1864- </div>
18651744 }
1745+ for job in running_jobs.iter() {
1746+ <div class="line"><span class="name">(job.name.as_str())</span><span class="val">(job.repo.as_str())</span><span class="val"><a href=(job.run_href.as_str())>(job.run_text.as_str())</a></span><span class="val">(job.duration.as_str()) " · " (s(lang, "waited", "bekleme")) " " (job.waited.as_str())</span></div>
1747+ }
1748+ </section>
1749+ <section class="sec">
18661750 <h2>(s(lang, "Recent", "Son"))</h2>
18671751 if recent_jobs.is_empty() {
18681752 <p class="hint">(s(lang, "No finished jobs yet.", "Henüz biten iş yok."))</p>
1869- } else {
1870- <div class="table-wrap">
1871- <table class="table queue-table">
1872- <thead><tr><th>(s(lang, "Job", "İş"))</th><th>(s(lang, "Repo", "Depo"))</th><th>(s(lang, "Run", "Çalıştırma"))</th><th>(s(lang, "State", "Durum"))</th><th>(s(lang, "Took", "Süre"))</th><th>(s(lang, "Waited", "Bekleme"))</th><th>(s(lang, "Finished", "Bitiş"))</th></tr></thead>
1873- <tbody>
1874- for job in recent_jobs.iter() {
1875- <tr>
1876- <td>(job.name.as_str())</td>
1877- <td class="nowrap">(job.repo.as_str())</td>
1878- <td class="nowrap"><a href=(job.run_href.as_str())>(job.run_text.as_str())</a></td>
1879- <td><span class=(job.state_class.as_str())>(job.state_text.as_str())</span></td>
1880- <td class="nowrap">(job.duration.as_str())</td>
1881- <td class="nowrap">(job.waited.as_str())</td>
1882- <td class="nowrap"><time data-rel="true" datetime=(job.finished_at.as_str())>(job.finished_ago.as_str())</time></td>
1883- </tr>
1884- }
1885- </tbody>
1886- </table>
1887- </div>
18881753 }
1889- }
1890- </section>
1754+ for job in recent_jobs.iter() {
1755+ <div class="line"><span class="name">(job.name.as_str())</span><span class="val">(job.repo.as_str())</span><span class="val"><a href=(job.run_href.as_str())>(job.run_text.as_str())</a></span><span class="val"><span class=(job.state_class.as_str())>(job.state_text.as_str())</span></span><span class="val">(job.duration.as_str()) " · " (s(lang, "waited", "bekleme")) " " (job.waited.as_str())</span><span class="val"><time data-rel="true" datetime=(job.finished_at.as_str())>(job.finished_ago.as_str())</time></span></div>
1756+ }
1757+ </section>
18911758 }
18921759 </div>
18931760 })
@@ -2351,7 +2218,7 @@ mod tests {
23512218 .expect("disable");
23522219 let (_, page) = send(&router, "GET", "/admin/runners", Some(ADMIN_TOKEN), None).await;
23532220 assert!(page.contains(r#"class="runner-dot is-disabled""#));
2354- assert!(page.contains(r#"<span class="val">idle · disabled</span>"#));
2221+ assert!(page.contains(r#"<span class="val">idle</span>"#));
23552222 }
23562223
23572224 // Scenario: restart is capability-gated and audited, then the runner is disabled, enabled and deleted.
@@ -2376,7 +2243,8 @@ mod tests {
23762243 assert_eq!(status, 403);
23772244
23782245 // A runner that never advertised the capability: the button is off and the post refused.
2379- let (_, list) = send(&router, "GET", "/admin/runners", Some(ADMIN_TOKEN), None).await;
2246+ let runner_page = format!("/admin/runners/{}", runner.id);
2247+ let (_, list) = send(&router, "GET", &runner_page, Some(ADMIN_TOKEN), None).await;
23802248 assert!(list.contains("Runner too old, update it first"), "{list}");
23812249 let (status, _) = send(
23822250 &router,
@@ -2401,7 +2269,7 @@ mod tests {
24012269 )
24022270 .await
24032271 .unwrap();
2404- let (_, list) = send(&router, "GET", "/admin/runners", Some(ADMIN_TOKEN), None).await;
2272+ let (_, list) = send(&router, "GET", &runner_page, Some(ADMIN_TOKEN), None).await;
24052273 assert!(list.contains("Restart after current jobs"));
24062274 assert!(list.contains("Restart now"));
24072275 let (status, _) = send(
@@ -2417,7 +2285,7 @@ mod tests {
24172285 store.runner_restart(&runner.id).await.unwrap(),
24182286 Some(RestartMode::Drain)
24192287 );
2420- let (_, list) = send(&router, "GET", "/admin/runners", Some(ADMIN_TOKEN), None).await;
2288+ let (_, list) = send(&router, "GET", &runner_page, Some(ADMIN_TOKEN), None).await;
24212289 assert!(list.contains("restart pending"));
24222290 let entries = store
24232291 .list_audit(&Default::default(), None, 50)
@@ -2441,7 +2309,7 @@ mod tests {
24412309 )
24422310 .await
24432311 .unwrap();
2444- let (_, list) = send(&router, "GET", "/admin/runners", Some(ADMIN_TOKEN), None).await;
2312+ let (_, list) = send(&router, "GET", &runner_page, Some(ADMIN_TOKEN), None).await;
24452313 assert!(!list.contains("restart pending"));
24462314
24472315 // Disable, then enable again.
@@ -2580,9 +2448,16 @@ mod tests {
25802448 store.list_runners().await.unwrap()[0].concurrency_override,
25812449 Some(3)
25822450 );
2583- let (_, list) = send(&router, "GET", "/admin/runners", Some(ADMIN_TOKEN), None).await;
2451+ let (_, list) = send(
2452+ &router,
2453+ "GET",
2454+ &format!("{detail_uri}?tab=general"),
2455+ Some(ADMIN_TOKEN),
2456+ None,
2457+ )
2458+ .await;
25842459 assert!(list.contains(r#"value="3""#));
2585- assert!(list.contains("Use the runner.toml value"));
2460+ assert!(list.contains("Reset to runner.toml"));
25862461 assert!(list.contains(r#"data-live="/admin/runners/events""#));
25872462
25882463 // Out of range, wrong kind of field and a read-only field change nothing.
@@ -2612,7 +2487,14 @@ mod tests {
26122487 )
26132488 .await;
26142489 assert_eq!(status, 303);
2615- let (status, detail) = send(&router, "GET", &detail_uri, Some(ADMIN_TOKEN), None).await;
2490+ let (status, detail) = send(
2491+ &router,
2492+ "GET",
2493+ &format!("{detail_uri}?tab=general"),
2494+ Some(ADMIN_TOKEN),
2495+ None,
2496+ )
2497+ .await;
26162498 assert_eq!(status, 200);
26172499 assert!(detail.contains("Concurrency"));
26182500 assert!(detail.contains(r#"data-live="/admin/runners/events""#));
crates/forge-web/src/pages/admin_server.rsmodified+96 -72
@@ -38,7 +38,7 @@ use crate::pages::ci_runs::{changed_event, events_response};
3838 use crate::pages::passkeys::s;
3939 use crate::self_update;
4040 use crate::state::AppState;
41-use crate::views::parts::{confirm_act, reveal};
41+use crate::views::parts::{RailItem, SubPart, confirm_act, head, rail, reveal};
4242 use crate::views::{enc, shell};
4343
4444 #[query_params(error = bad_request)]
@@ -128,6 +128,22 @@ pub(crate) fn tab_label(lang: Lang, group: Group) -> &'static str {
128128 )
129129 }
130130
131+/// The words for a choice's stored value. Values that are names (smtp, s3, eu) read as they are.
132+fn option_label(lang: Lang, option: &str) -> String {
133+ let (en, tr) = match option {
134+ "" => return g::t(lang, K::SrvEmpty).to_owned(),
135+ "closed" => ("Closed", "Kapalı"),
136+ "invite" => ("Invite only", "Yalnızca davetle"),
137+ "open" => ("Open", "Açık"),
138+ "all" => ("Everyone", "Herkes"),
139+ "admin" => ("Admins only", "Yalnızca yöneticiler"),
140+ "info" => ("Info", "Bilgi"),
141+ "warning" => ("Warning", "Uyarı"),
142+ other => return other.to_owned(),
143+ };
144+ s(lang, en, tr).to_owned()
145+}
146+
131147 fn row(lang: Lang, view: &FieldView) -> Row {
132148 let field: &Field = view.field;
133149 let kind_label = match field.kind {
@@ -145,11 +161,7 @@ fn row(lang: Lang, view: &FieldView) -> Row {
145161 .iter()
146162 .map(|option| OptionRow {
147163 value: (*option).to_owned(),
148- label: if option.is_empty() {
149- g::t(lang, K::SrvEmpty).to_owned()
150- } else {
151- (*option).to_owned()
152- },
164+ label: option_label(lang, option),
153165 selected: *option == view.value,
154166 })
155167 .collect(),
@@ -385,25 +397,26 @@ async fn server_view(
385397 ),
386398 _ => "/admin/server/events".to_owned(),
387399 };
400+ let items: Vec<RailItem> = Group::ALL
401+ .into_iter()
402+ .map(|g_tab| RailItem {
403+ name: tab_label(lang, g_tab).to_owned(),
404+ val: String::new(),
405+ href: format!("/admin/server?cat={}", g_tab.slug()),
406+ current: g_tab == group,
407+ })
408+ .collect();
409+ let sub = vec![
410+ SubPart::text(g::t(lang, K::ServerSettingsIntro)),
411+ SubPart::mono(format!(
412+ "{} {}",
413+ s(lang, "Version", "Sürüm"),
414+ forge_ci::build::display()
415+ )),
416+ ];
388417 Ok(view! {
418+ head(title: g::t(lang, K::ServerSettings), sub: sub)
389419 <div data-live=(live.as_str())>
390- <h1 class="sr-only">(g::t(lang, K::ServerSettings))</h1>
391- <form class="plain-search" method="get" action="/admin/server" role="search">
392- <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>
393- <label class="sr-only" for="server-search">(search_label)</label>
394- <input id="server-search" type="search" name="q" value=(q.as_str()) placeholder=(search_label) data-live-search="" autocomplete="off">
395- </form>
396- <nav class="sub" aria-label=(g::t(lang, K::ServerSettings))>
397- for g_tab in Group::ALL.into_iter() {
398- if g_tab == group {
399- <a aria-current="page" href=(format!("/admin/server?cat={}", g_tab.slug()))>(tab_label(lang, g_tab))</a>
400- } else {
401- <a href=(format!("/admin/server?cat={}", g_tab.slug()))>(tab_label(lang, g_tab))</a>
402- }
403- }
404- </nav>
405- <p class="hint">(g::t(lang, K::ServerSettingsIntro))</p>
406- <p class="hint">(s(lang, "Version", "Sürüm")) " " (forge_ci::build::display())</p>
407420 if restart == Restart::Pending {
408421 <p class="state" role="status" aria-live="polite"><strong>(s(lang, "Restarting...", "Yeniden başlatılıyor..."))</strong> " " (s(lang, "This page comes back by itself when the server is up again.", "Sunucu tekrar ayağa kalkınca bu sayfa kendiliğinden geri gelir."))</p>
409422 } else if restart == Restart::Done {
@@ -412,60 +425,71 @@ async fn server_view(
412425 if let Some(message) = notice {
413426 <p class="state" role="status">(message.as_str())</p>
414427 }
415- if let Some(hits) = search {
416- <section class="sec">
417- <h2>(s(lang, "Results", "Sonuçlar"))</h2>
418- if hits.is_empty() {
419- <p class="state">(s(lang, "No setting matches.", "Eşleşen ayar yok."))</p>
420- }
421- for hit in hits.iter() {
422- <a class="line" href=(format!("/admin/server?cat={}#srv-{}", hit.group.slug(), hit.key))>
423- <span class="name">(hit.label)</span>
424- <span class="val">(tab_label(lang, hit.group))</span>
425- </a>
428+ <div class="work">
429+ rail(label: g::t(lang, K::ServerSettings), items: items,
430+ <form class="plain-search" method="get" action="/admin/server" role="search">
431+ <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>
432+ <label class="sr-only" for="server-search">(search_label)</label>
433+ <input id="server-search" type="search" name="q" value=(q.as_str()) placeholder=(search_label) data-live-search="" autocomplete="off">
434+ </form>
435+ )
436+ <div class="sheet">
437+ if let Some(hits) = search {
438+ <section class="sec">
439+ <h2>(s(lang, "Results", "Sonuçlar"))</h2>
440+ if hits.is_empty() {
441+ <p class="state">(s(lang, "No setting matches.", "Eşleşen ayar yok."))</p>
442+ }
443+ for hit in hits.iter() {
444+ <a class="line" href=(format!("/admin/server?cat={}#srv-{}", hit.group.slug(), hit.key))>
445+ <span class="name">(hit.label)</span>
446+ <span class="val">(tab_label(lang, hit.group))</span>
447+ </a>
448+ }
449+ </section>
450+ } else {
451+ <section class="sec">
452+ <h2>(tab_label(lang, group))</h2>
453+ <form method="post" action="/admin/server" class="fields">
454+ <input type="hidden" name="csrf" value=(csrf.as_str())>
455+ <input type="hidden" name="tab" value=(tab)>
456+ for block in blocks.iter() {
457+ if block.len() > 1 {
458+ <div class="field-pair">
459+ for r in block.iter() {
460+ srv_row(lang: lang, row: r)
461+ }
462+ </div>
463+ } else {
464+ for r in block.iter() {
465+ srv_row(lang: lang, row: r)
466+ }
467+ }
468+ }
469+ if any_editable {
470+ <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button>
471+ }
472+ </form>
473+ </section>
426474 }
427- </section>
428- } else {
429- <section class="sec">
430- <h2>(tab_label(lang, group))</h2>
431- <form method="post" action="/admin/server" class="fields">
475+ <form id="srv-reset" method="post" action="/admin/server/reset">
432476 <input type="hidden" name="csrf" value=(csrf.as_str())>
433477 <input type="hidden" name="tab" value=(tab)>
434- for block in blocks.iter() {
435- if block.len() > 1 {
436- <div class="field-pair">
437- for r in block.iter() {
438- srv_row(lang: lang, row: r)
439- }
440- </div>
441- } else {
442- for r in block.iter() {
443- srv_row(lang: lang, row: r)
444- }
445- }
478+ </form>
479+ <section class="sec">
480+ <h2>(s(lang, "Restart server", "Sunucuyu yeniden başlat"))</h2>
481+ <p class="hint">(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."))</p>
482+ if restart == Restart::Pending {
483+ <p class="state">(s(lang, "A restart is in progress.", "Yeniden başlatma sürüyor."))</p>
446484 }
447- if any_editable {
448- <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button>
485+ if restart != Restart::Pending {
486+ <div class="acts">
487+ confirm_act(lang: lang, label: s(lang, "Restart server", "Sunucuyu yeniden başlat"), action: "/admin/server/restart", csrf: csrf.as_str(), fields: vec![("tab".to_owned(), tab.to_owned())], note: Some(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.").to_owned()))
488+ </div>
449489 }
450- </form>
451- </section>
452- }
453- <form id="srv-reset" method="post" action="/admin/server/reset">
454- <input type="hidden" name="csrf" value=(csrf.as_str())>
455- <input type="hidden" name="tab" value=(tab)>
456- </form>
457- <section class="sec">
458- <h2>(s(lang, "Restart server", "Sunucuyu yeniden başlat"))</h2>
459- <p class="hint">(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."))</p>
460- if restart == Restart::Pending {
461- <p class="state">(s(lang, "A restart is in progress.", "Yeniden başlatma sürüyor."))</p>
462- }
463- if restart != Restart::Pending {
464- <div class="acts">
465- confirm_act(lang: lang, label: s(lang, "Restart server", "Sunucuyu yeniden başlat"), action: "/admin/server/restart", csrf: csrf.as_str(), fields: vec![("tab".to_owned(), tab.to_owned())], note: Some(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.").to_owned()))
466- </div>
467- }
468- </section>
490+ </section>
491+ </div>
492+ </div>
469493 </div>
470494 })
471495 }
crates/forge-web/src/pages/admin_user_detail.rsmodified+20 -24
@@ -26,7 +26,7 @@ use crate::live::{Topic, stream_changes};
2626 use crate::pages::admin_users::admin_only;
2727 use crate::pages::passkeys::s;
2828 use crate::state::AppState;
29-use crate::views::parts::{confirm_act, post_act, reveal};
29+use crate::views::parts::{confirm_act, head, post_act, reveal};
3030 use crate::views::{alert, enc, rel_time, rel_time_or_never, shell, user_facing_message};
3131
3232 #[query_params(error = bad_request)]
@@ -198,9 +198,12 @@ async fn detail_body(
198198 passkey_count
199199 );
200200 Ok(view! {
201- <div data-live=(live.as_str())>
202- <a class="act back-act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
203- <h1 class="h1">(target.username.as_str())</h1>
201+ head(title: target.username.as_str())
202+ <div class="sheet" data-live=(live.as_str())>
203+ <div class="sheet-tools">
204+ <a class="act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
205+ <a class="act" href=(profile.as_str())>(profile_label)</a>
206+ </div>
204207 <p class="hint">
205208 if !email.is_empty() {
206209 (email.as_str()) " · "
@@ -216,9 +219,6 @@ async fn detail_body(
216219 <section class="sec">
217220 <h2>(access_title)</h2>
218221 <p class="state">(access_state.as_str())</p>
219- <div class="acts">
220- <a class="act" href=(profile.as_str())>(profile_label)</a>
221- </div>
222222 if suspended {
223223 <p class="hint">(suspended_note.as_str())</p>
224224 <div class="acts">
@@ -238,9 +238,7 @@ async fn detail_body(
238238 <label for="suspend-reason">(at(lang, A::SuspendReason))</label>
239239 <input id="suspend-reason" type="text" name="reason" maxlength="300" autocomplete="off">
240240 </div>
241- <div class="acts">
242- <button type="submit" class="act danger">(suspend_title)</button>
243- </div>
241+ <button type="submit" class="danger small">(suspend_title)</button>
244242 </form>
245243 )
246244 </div>
@@ -310,24 +308,22 @@ async fn org_body(lang: Lang, csrf: &str, org: User, members: usize) -> Result<i
310308 let delete_action = format!("{base}/delete");
311309 let profile = format!("/{}", enc(&org.username));
312310 let members = members.to_string();
313- let access_title = s(lang, "Access", "Erişim");
314311 let profile_label = s(lang, "Open profile", "Profili aç");
315312 Ok(view! {
316- <a class="act back-act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
317- <h1 class="h1">(org.username.as_str())</h1>
318- <p class="hint">(og::t(lang, OG::Members)) " " (members.as_str())</p>
319- <section class="sec">
320- <h2>(access_title)</h2>
321- <div class="acts">
313+ head(title: org.username.as_str())
314+ <div class="sheet">
315+ <div class="sheet-tools">
316+ <a class="act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
322317 <a class="act" href=(profile.as_str())>(profile_label)</a>
323318 </div>
324- </section>
325- <section class="sec">
326- <h2>(i18n::t(lang, Key::Delete))</h2>
327- <div class="acts">
328- confirm_act(lang: lang, label: g::t(lang, K::DeleteOrgTitle), action: delete_action.as_str(), csrf: csrf)
329- </div>
330- </section>
319+ <p class="hint">(og::t(lang, OG::Members)) " " (members.as_str())</p>
320+ <section class="sec">
321+ <h2>(i18n::t(lang, Key::Delete))</h2>
322+ <div class="acts">
323+ confirm_act(lang: lang, label: g::t(lang, K::DeleteOrgTitle), action: delete_action.as_str(), csrf: csrf)
324+ </div>
325+ </section>
326+ </div>
331327 })
332328 }
333329
crates/forge-web/src/pages/admin_users.rsmodified+111 -98
@@ -22,7 +22,7 @@ use crate::i18n::{self, Key, Lang};
2222 use crate::live::{Topic, stream_changes};
2323 use crate::pages::passkeys::s;
2424 use crate::state::AppState;
25-use crate::views::parts::reveal;
25+use crate::views::parts::{head, reveal};
2626 use crate::views::repo_list::{pager, pager_links};
2727 use crate::views::{alert, enc, rel_time, shell, user_facing_message};
2828
@@ -221,18 +221,7 @@ async fn users_view(
221221 let people_href = users_href(&q, Kind::People, 1);
222222 let orgs_href = users_href(&q, Kind::Organizations, 1);
223223 Ok(view! {
224- <div data-live="/admin/users/events">
225- <h1 class="sr-only">(g::t(lang, K::Users))</h1>
226- <form class="plain-search" method="get" action="/admin/users" role="search">
227- <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>
228- <label class="sr-only" for="user-search">(search_label)</label>
229- <input id="user-search" type="search" name="q" value=(q.as_str()) placeholder=(search_label) data-live-search="" autocomplete="off">
230- <input type="hidden" name="kind" value=(kind.key())>
231- </form>
232- <nav class="sub" aria-label=(filter_label)>
233- <a href=(all_href.as_str()) aria-current=((kind == Kind::All).then_some("page"))>(all_label.as_str())</a>
234- <a href=(people_href.as_str()) aria-current=((kind == Kind::People).then_some("page"))>(people_label.as_str())</a>
235- <a href=(orgs_href.as_str()) aria-current=((kind == Kind::Organizations).then_some("page"))>(orgs_label.as_str())</a>
224+ head(title: g::t(lang, K::Users),
236225 reveal(label: g::t(lang, K::CreateUser), id: Some("create-user"), open: open,
237226 if let Some(message) = error {
238227 alert(message: message.as_str())
@@ -259,34 +248,48 @@ async fn users_view(
259248 <button type="submit" class="primary">(g::t(lang, K::CreateUser))</button>
260249 </form>
261250 )
251+ )
252+ <nav class="tabs" aria-label=(filter_label)>
253+ <a href=(all_href.as_str()) aria-current=((kind == Kind::All).then_some("page"))>(all_label.as_str())</a>
254+ <a href=(people_href.as_str()) aria-current=((kind == Kind::People).then_some("page"))>(people_label.as_str())</a>
255+ <a href=(orgs_href.as_str()) aria-current=((kind == Kind::Organizations).then_some("page"))>(orgs_label.as_str())</a>
262256 </nav>
263- if empty {
264- <p class="state">(s(lang, "No account matches.", "Eşleşen hesap yok."))</p>
265- }
266- for row in rows.into_iter() {
267- if row.linkable {
268- <a class="line" href=(row.href.as_str()) data-kb-row="">
269- <span class="name">(row.username.as_str())</span>
270- <span class="val">
271- if !row.email.is_empty() {
272- (row.email.as_str()) " · "
273- }
274- (row.role.as_str()) " · " rel_time(lang: lang, stamp: row.created_at.as_str())
275- </span>
276- </a>
277- } else {
278- <div class="line" data-kb-row="">
279- <span class="name">(row.username.as_str())</span>
280- <span class="val">
281- if !row.email.is_empty() {
282- (row.email.as_str()) " · "
283- }
284- (row.role.as_str()) " · " rel_time(lang: lang, stamp: row.created_at.as_str())
285- </span>
286- </div>
257+ <div class="sheet" data-live="/admin/users/events">
258+ <div class="sheet-tools">
259+ <form class="plain-search" method="get" action="/admin/users" role="search">
260+ <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>
261+ <label class="sr-only" for="user-search">(search_label)</label>
262+ <input id="user-search" type="search" name="q" value=(q.as_str()) placeholder=(search_label) data-live-search="" autocomplete="off">
263+ <input type="hidden" name="kind" value=(kind.key())>
264+ </form>
265+ </div>
266+ if empty {
267+ <p class="state">(s(lang, "No account matches.", "Eşleşen hesap yok."))</p>
287268 }
288- }
289- pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
269+ for row in rows.into_iter() {
270+ if row.linkable {
271+ <a class="line" href=(row.href.as_str()) data-kb-row="">
272+ <span class="name">(row.username.as_str())</span>
273+ <span class="val">
274+ if !row.email.is_empty() {
275+ (row.email.as_str()) " · "
276+ }
277+ (row.role.as_str()) " · " rel_time(lang: lang, stamp: row.created_at.as_str())
278+ </span>
279+ </a>
280+ } else {
281+ <div class="line" data-kb-row="">
282+ <span class="name">(row.username.as_str())</span>
283+ <span class="val">
284+ if !row.email.is_empty() {
285+ (row.email.as_str()) " · "
286+ }
287+ (row.role.as_str()) " · " rel_time(lang: lang, stamp: row.created_at.as_str())
288+ </span>
289+ </div>
290+ }
291+ }
292+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
290293 </div>
291294 })
292295 }
@@ -481,50 +484,56 @@ async fn delete_body(
481484 let action = format!("/admin/users/{}/delete", enc(&target.id));
482485 let prompt = g::type_to_confirm(lang, &target.username);
483486 Ok(view! {
484- <a class="act back-act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
485- <h1 class="sr-only">(g::t(lang, K::DeleteUser))</h1>
486- if let Some(message) = error {
487- alert(message: message.as_str())
488- }
489- if let Some(message) = refusal {
490- alert(message: message.as_str())
491- }
492- <p class="state">(g::t(lang, K::DeletesAccount))<strong>(target.username.as_str())</strong>(g::t(lang, K::DeleteAccountRest))</p>
493- if has_repos {
494- <p class="hint">(g::t(lang, K::TransferOrDeleteFirst))</p>
495- <ul class="item-list">
496- for name in repos.into_iter() {
497- <li>(name)</li>
498- }
499- </ul>
500- }
501- if let Some(impact) = impact {
502- <section class="sec">
503- <h2>(g::t(lang, K::WhatHappens))</h2>
504- <p class="hint">(g::t(lang, K::MovedToGhost))</p>
505- <ul class="item-list">
506- for line in impact.moved.into_iter() {
507- <li>(line)</li>
508- }
509- </ul>
510- <p class="hint">(g::t(lang, K::RemovedWithAccount))</p>
511- <ul class="item-list">
512- for line in impact.removed.into_iter() {
513- <li>(line)</li>
514- }
515- </ul>
516- </section>
517- <form method="post" action=(action.as_str()) class="fields">
518- <input type="hidden" name="csrf" value=(csrf)>
519- <div class="field">
520- <label for="confirm-username">(prompt.as_str())</label>
521- <input id="confirm-username" type="text" name="confirm_username" autocomplete="off" required=(true)>
522- </div>
523- <div class="acts">
524- <button type="submit" class="act danger">(g::t(lang, K::DeleteUser))</button>
525- </div>
526- </form>
527- }
487+ head(title: g::t(lang, K::DeleteUser))
488+ <div class="sheet">
489+ <div class="sheet-tools">
490+ <a class="act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
491+ </div>
492+ if let Some(message) = error {
493+ alert(message: message.as_str())
494+ }
495+ if let Some(message) = refusal {
496+ alert(message: message.as_str())
497+ }
498+ <p class="state">(g::t(lang, K::DeletesAccount))<strong>(target.username.as_str())</strong>(g::t(lang, K::DeleteAccountRest))</p>
499+ if has_repos {
500+ <section class="sec">
501+ <p class="hint">(g::t(lang, K::TransferOrDeleteFirst))</p>
502+ <ul class="item-list">
503+ for name in repos.into_iter() {
504+ <li>(name)</li>
505+ }
506+ </ul>
507+ </section>
508+ }
509+ if let Some(impact) = impact {
510+ <section class="sec">
511+ <h2>(g::t(lang, K::WhatHappens))</h2>
512+ <p class="hint">(g::t(lang, K::MovedToGhost))</p>
513+ <ul class="item-list">
514+ for line in impact.moved.into_iter() {
515+ <li>(line)</li>
516+ }
517+ </ul>
518+ <p class="hint">(g::t(lang, K::RemovedWithAccount))</p>
519+ <ul class="item-list">
520+ for line in impact.removed.into_iter() {
521+ <li>(line)</li>
522+ }
523+ </ul>
524+ </section>
525+ <section class="sec">
526+ <form method="post" action=(action.as_str()) class="fields">
527+ <input type="hidden" name="csrf" value=(csrf)>
528+ <div class="field">
529+ <label for="confirm-username">(prompt.as_str())</label>
530+ <input id="confirm-username" type="text" name="confirm_username" autocomplete="off" required=(true)>
531+ </div>
532+ <button type="submit" class="danger small">(g::t(lang, K::DeleteUser))</button>
533+ </form>
534+ </section>
535+ }
536+ </div>
528537 })
529538 }
530539
@@ -540,22 +549,26 @@ async fn org_delete_note(
540549 let settings = format!("/org/{}/settings", enc(&target.username));
541550 let profile = format!("/{}", enc(&target.username));
542551 Ok(view! {
543- <a class="act back-act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
544- <h1 class="sr-only">(g::t(lang, K::DeleteOrgTitle))</h1>
545- <p class="state"><strong>(target.username.as_str())</strong>(g::t(lang, K::OrgNotAUser))</p>
546- if has_repos {
547- <p class="hint">(g::t(lang, K::OrgReposFirst))</p>
548- <ul class="item-list">
549- for name in repos.into_iter() {
550- <li>(name)</li>
552+ head(title: g::t(lang, K::DeleteOrgTitle))
553+ <div class="sheet">
554+ <div class="sheet-tools">
555+ <a class="act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
556+ if is_owner {
557+ <a class="act" href=(settings.as_str())>(g::t(lang, K::OpenOrgSettings))</a>
558+ } else {
559+ <a class="act" href=(profile.as_str())>(g::t(lang, K::ViewOrg))</a>
551560 }
552- </ul>
553- }
554- <div class="acts">
555- if is_owner {
556- <a class="act" href=(settings.as_str())>(g::t(lang, K::OpenOrgSettings))</a>
557- } else {
558- <a class="act" href=(profile.as_str())>(g::t(lang, K::ViewOrg))</a>
561+ </div>
562+ <p class="state"><strong>(target.username.as_str())</strong>(g::t(lang, K::OrgNotAUser))</p>
563+ if has_repos {
564+ <section class="sec">
565+ <p class="hint">(g::t(lang, K::OrgReposFirst))</p>
566+ <ul class="item-list">
567+ for name in repos.into_iter() {
568+ <li>(name)</li>
569+ }
570+ </ul>
571+ </section>
559572 }
560573 </div>
561574 })
crates/forge-web/src/pages/audit_log.rsmodified+72 -52
@@ -17,6 +17,7 @@ use crate::live::{Topic, stream_changes};
1717 use crate::pages::admin_users::admin_only;
1818 use crate::pages::issues_list::list_href;
1919 use crate::state::AppState;
20+use crate::views::parts::{SubPart, head};
2021 use crate::views::{rel_time, shell};
2122
2223 /// Entries per page of the admin audit log, under its filter bar.
@@ -101,21 +102,38 @@ async fn audit_table(lang: Lang, rows: Vec<RowView>, show_actor: bool) -> Result
101102 <p class="state">(g::t(lang, K::NoEntries))</p>
102103 } else {
103104 for row in rows.into_iter() {
104- <div class="line" data-kb-row="">
105- <span class="name"><code>(row.action.as_str())</code></span>
106- <span class="val">
107- rel_time(lang: lang, stamp: row.when.as_str())
108- if show_actor {
109- " · " (row.actor.as_str())
110- }
111- " · " (row.target.as_str())
112- </span>
113- </div>
114- if !row.ip.is_empty() {
115- <p class="hint">"IP " (row.ip.as_str())</p>
116- }
117- if !row.details.is_empty() {
118- <p class="hint"><code>(row.details.as_str())</code></p>
105+ if row.ip.is_empty() && row.details.is_empty() {
106+ <div class="line" data-kb-row="">
107+ <span class="name"><code>(row.action.as_str())</code></span>
108+ <span class="val">
109+ rel_time(lang: lang, stamp: row.when.as_str())
110+ if show_actor {
111+ " · " (row.actor.as_str())
112+ }
113+ " · " (row.target.as_str())
114+ </span>
115+ </div>
116+ } else {
117+ <details class="row-open" data-kb-row="">
118+ <summary class="line">
119+ <span class="name"><code>(row.action.as_str())</code></span>
120+ <span class="val">
121+ rel_time(lang: lang, stamp: row.when.as_str())
122+ if show_actor {
123+ " · " (row.actor.as_str())
124+ }
125+ " · " (row.target.as_str())
126+ </span>
127+ </summary>
128+ <div class="opened">
129+ if !row.ip.is_empty() {
130+ <p class="hint">"IP " (row.ip.as_str())</p>
131+ }
132+ if !row.details.is_empty() {
133+ <p class="hint"><code>(row.details.as_str())</code></p>
134+ }
135+ </div>
136+ </details>
119137 }
120138 }
121139 }
@@ -132,37 +150,37 @@ async fn admin_audit_view(
132150 rows: Vec<RowView>,
133151 older_href: Option<String>,
134152 ) -> Result<impl View> {
153+ let sub = vec![SubPart::text(g::t(lang, K::AuditIntro))];
135154 Ok(view! {
136- <div data-live=(live.as_str())>
137- <h1 class="sr-only">(g::t(lang, K::AuditLog))</h1>
138- <p class="hint">(g::t(lang, K::AuditIntro))</p>
139- <form method="get" action="/admin/audit">
140- <div class="plain-search">
141- <label class="sr-only" for="audit-actor">(g::t(lang, K::ActorUsername))</label>
142- <input id="audit-actor" type="search" name="actor" value=(actor.as_str()) placeholder=(g::t(lang, K::ActorUsername)) data-live-search="" autocomplete="off">
143- <button type="submit" class="sr-only">(g::t(lang, K::Filter))</button>
144- </div>
145- <div class="sub">
146- <label>
147- (g::t(lang, K::ActionLabel)) " "
148- <select name="action" data-autosubmit="true">
149- <option value="" selected=(action.is_empty())>(g::t(lang, K::AllActions))</option>
150- for known in AuditAction::ALL.iter().copied() {
151- <option value=(known.as_str()) selected=(known.as_str() == action.as_str())>(known.as_str())</option>
152- }
153- </select>
154- </label>
155+ head(title: g::t(lang, K::AuditLog), sub: sub)
156+ <div class="sheet" data-live=(live.as_str())>
157+ <div class="sheet-tools">
158+ <form method="get" action="/admin/audit">
159+ <div class="plain-search">
160+ <label class="sr-only" for="audit-actor">(g::t(lang, K::ActorUsername))</label>
161+ <input id="audit-actor" type="search" name="actor" value=(actor.as_str()) placeholder=(g::t(lang, K::ActorUsername)) data-live-search="" autocomplete="off">
162+ <button type="submit" class="sr-only">(g::t(lang, K::Filter))</button>
163+ </div>
164+ <label>
165+ (g::t(lang, K::ActionLabel)) " "
166+ <select name="action" data-autosubmit="true">
167+ <option value="" selected=(action.is_empty())>(g::t(lang, K::AllActions))</option>
168+ for known in AuditAction::ALL.iter().copied() {
169+ <option value=(known.as_str()) selected=(known.as_str() == action.as_str())>(known.as_str())</option>
170+ }
171+ </select>
172+ </label>
173+ </form>
155174 </div>
156- </form>
157- if let Some(message) = notice {
158- <p class="state" role="status">(message.as_str())</p>
159- }
160- audit_table(lang: lang, rows: rows, show_actor: true)
161- if let Some(href) = older_href {
162- <nav class="sub">
163- <a href=(href.as_str())>(g::t(lang, K::Older))</a>
164- </nav>
165- }
175+ if let Some(message) = notice {
176+ <p class="state" role="status">(message.as_str())</p>
177+ }
178+ audit_table(lang: lang, rows: rows, show_actor: true)
179+ if let Some(href) = older_href {
180+ <div class="acts">
181+ <a class="act" href=(href.as_str())>(g::t(lang, K::Older))</a>
182+ </div>
183+ }
166184 </div>
167185 })
168186 }
@@ -173,15 +191,17 @@ async fn own_log_view(
173191 rows: Vec<RowView>,
174192 older_href: Option<String>,
175193 ) -> Result<impl View> {
194+ let sub = vec![SubPart::text(g::t(lang, K::OwnLogIntro))];
176195 Ok(view! {
177- <h1 class="sr-only">(g::t(lang, K::SecurityLogTitle))</h1>
178- <p class="hint">(g::t(lang, K::OwnLogIntro))</p>
179- audit_table(lang: lang, rows: rows, show_actor: false)
180- if let Some(href) = older_href {
181- <nav class="sub">
182- <a href=(href.as_str())>(g::t(lang, K::Older))</a>
183- </nav>
184- }
196+ head(title: g::t(lang, K::SecurityLogTitle), sub: sub)
197+ <div class="sheet">
198+ audit_table(lang: lang, rows: rows, show_actor: false)
199+ if let Some(href) = older_href {
200+ <div class="acts">
201+ <a class="act" href=(href.as_str())>(g::t(lang, K::Older))</a>
202+ </div>
203+ }
204+ </div>
185205 })
186206 }
187207
crates/forge-web/src/pages/blame.rsmodified+20 -24
@@ -19,13 +19,12 @@ use crate::pages::blob::{Line, text_lines};
1919 use crate::pages::ref_live;
2020 use crate::pages::repo::repo_head;
2121 use crate::pages::repo_ctx::load_repo;
22-use crate::pages::tree::{MAX_BLOB_BYTES, path_crumbs, read_file, resolve};
22+use crate::pages::passkeys::s;
23+use crate::pages::tree::{MAX_BLOB_BYTES, read_file, resolve};
2324 use crate::render::emoji::emojify;
2425 use crate::state::AppState;
2526 use crate::views::commit_line::commit_line;
26-use crate::views::{
27- Crumb, breadcrumb, human_size, iso_time, now_unix, relative_time, repo_href, shell, short_oid,
28-};
27+use crate::views::{human_size, iso_time, now_unix, relative_time, repo_href, shell, short_oid};
2928
3029 path_param!(owner);
3130 path_param!(repo);
@@ -116,9 +115,9 @@ async fn blame_table(rows: Vec<Row>, lang: Lang) -> Result<impl View> {
116115 <div class="blame-top">
117116 <a class="mono" href=(meta.commit_href.as_str())>(meta.short.as_str())</a>
118117 <span class="blame-author">(meta.author.as_str())</span>
119- <time class="muted" data-rel="true" datetime=(meta.iso.as_str())>(meta.age.as_str())</time>
118+ <time class="hint" data-rel="true" datetime=(meta.iso.as_str())>(meta.age.as_str())</time>
120119 if let Some(prior) = meta.prior_href {
121- <a class="blame-prior" href=(prior.as_str()) title=(b::t(lang, b::K::BlamePrior)) aria-label=(b::t(lang, b::K::BlamePrior))>"↶"</a>
120+ <a class="blame-prior" href=(prior.as_str()) title=(b::t(lang, b::K::BlamePrior)) aria-label=(b::t(lang, b::K::BlamePrior))>(s(lang, "Prior", "Önceki"))</a>
122121 }
123122 </div>
124123 <a class="blame-summary" href=(meta.commit_href.as_str()) title=(meta.summary.as_str())>commit_line(subject: meta.summary.clone())</a>
@@ -204,7 +203,6 @@ async fn blame_page(cx: &Cx) -> Result<impl View> {
204203 "commits",
205204 &format!("{ref_name}/{file}"),
206205 );
207- let crumbs: Vec<Crumb> = path_crumbs(repo, &ref_name, "blob", &file);
208206 let title = format!(
209207 "{}/{} \u{b7} {} \u{b7} {file}",
210208 repo.owner_name,
@@ -225,24 +223,22 @@ async fn blame_page(cx: &Cx) -> Result<impl View> {
225223 Ok(view! {
226224 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
227225 repo_head(head: header)
228- <div class="browse-bar">
229- breadcrumb(lang: lang, crumbs: crumbs)
226+ <div class="sheet">
227+ <div class="sheet-tools">
228+ <strong>(file_name)</strong>
229+ <span class="mono">(size)</span>
230+ <a class="act" href=(blob_href.as_str())>(b::t(lang, b::K::BlameBackToFile))</a>
231+ <a class="act" href=(history.as_str())>(g::t(lang, K::HistoryLink))</a>
232+ </div>
233+ <section class="file" data-lines="">
234+ if let Some(text) = message {
235+ <p class="state">(text)</p>
236+ }
237+ if has_rows {
238+ blame_table(rows: rows, lang: lang)
239+ }
240+ </section>
230241 </div>
231- <section class="file" data-lines="">
232- <header class="file-head">
233- <span class="hint">(b::t(lang, b::K::BlameTitle)) " \u{b7} " (size)</span>
234- <nav class="acts file-actions" aria-label=(g::t(lang, K::FileNav))>
235- <a class="act" href=(blob_href.as_str())>(b::t(lang, b::K::BlameBackToFile))</a>
236- <a class="act" href=(history.as_str())>(g::t(lang, K::HistoryLink))</a>
237- </nav>
238- </header>
239- if let Some(text) = message {
240- <p class="state">(text)</p>
241- }
242- if has_rows {
243- blame_table(rows: rows, lang: lang)
244- }
245- </section>
246242 )
247243 })
248244 }
crates/forge-web/src/pages/blob.rsmodified+98 -43
@@ -11,21 +11,26 @@ use topcoat::view::{Unescaped, View, component, view};
1111
1212 use crate::i18n::browse as b;
1313 use crate::i18n::code::{self as g, K};
14+use crate::i18n::misc::{self as mi, K as MK};
1415 use crate::i18n::{self};
1516 use crate::lfs::has_object;
1617 use crate::lfs_pointer;
1718 use crate::pages::code_live::{follows_branch, live_url};
1819 use crate::pages::finder::file_finder;
1920 use crate::pages::media::media_url;
20-use crate::pages::refs::load_refs;
21+use crate::pages::passkeys::s;
22+use crate::pages::refs::{load_refs, ref_links};
2123 use crate::pages::repo::repo_head;
2224 use crate::pages::repo_ctx::load_repo;
23-use crate::pages::tree::{link_context, path_crumbs, read_file, resolve};
25+use crate::pages::repo_side::{code_sub, commit_strip, run_pips, run_rows, tree_facts};
26+use crate::pages::tree::{
27+ entry_rows, last_commits, latest_bar, link_context, read_dir, read_file, resolve, tree_table,
28+};
2429 use crate::raw::raw_url;
2530 use crate::render::highlight::highlight_lines;
2631 use crate::render::markdown::render_markdown;
2732 use crate::state::AppState;
28-use crate::views::{Crumb, breadcrumb, human_size, repo_href, shell};
33+use crate::views::{human_size, now_unix, ref_selector, repo_href, shell};
2934
3035 const IMAGE_EXTS: [&str; 8] = ["png", "jpg", "jpeg", "gif", "webp", "avif", "svg", "ico"];
3136 const MARKDOWN_EXTS: [&str; 2] = ["md", "markdown"];
@@ -255,9 +260,7 @@ async fn blob_page(cx: &Cx) -> Result<impl View> {
255260 let finder_owner = repo.owner_name.clone();
256261 let finder_repo = repo.name.clone();
257262 let finder_ref = ref_name.clone();
258- let crumbs: Vec<Crumb> = path_crumbs(repo, &ref_name, "blob", &file);
259263 let title = format!("{}/{} \u{b7} {file}", repo.owner_name, repo.name);
260- let size = human_size(lang, blob.size);
261264
262265 let kind = viewer.kind;
263266 let is_text = kind == "text";
@@ -271,19 +274,69 @@ async fn blob_page(cx: &Cx) -> Result<impl View> {
271274
272275 let refs = load_refs(ctx.path.clone()).await?;
273276 let follows = follows_branch(&refs, &ref_name);
277+ // The head and the rail describe the folder the file sits in, as the folder page does.
278+ let siblings = read_dir(ctx.path.clone(), commit.clone(), dir.clone())
279+ .await?
280+ .unwrap_or_default();
281+ let names: Vec<String> = siblings.iter().map(|e| e.name.clone()).collect();
282+ let root_names: Vec<String> = if dir.is_empty() {
283+ names.clone()
284+ } else {
285+ read_dir(ctx.path.clone(), commit.clone(), String::new())
286+ .await?
287+ .unwrap_or_default()
288+ .into_iter()
289+ .map(|e| e.name)
290+ .collect()
291+ };
292+ let (last, bar, strip, runs) = tokio::join!(
293+ last_commits(state, &ctx.path, &commit, &dir, &names),
294+ latest_bar(state, repo, &ctx.path, &commit, "", lang, ctx.viewer_tz()),
295+ commit_strip(state, repo, &ctx.path, &commit),
296+ run_rows(state, lang, repo),
297+ );
298+ let runs = runs?;
299+ let facts = tree_facts(state, repo, &ctx.path, &commit, &root_names).await?;
300+ let pips = run_pips(&runs);
301+ let sub = code_sub(lang, bar, Some(facts), None, Vec::new(), strip.total);
302+ let (branches, tags) = ref_links(&refs, &ref_name, &repo.default_branch, repo);
303+ let branches_href = repo_href(&repo.owner_name, &repo.name, "branches", "");
304+ let tags_href = repo_href(&repo.owner_name, &repo.name, "tags", "");
305+ let rows = entry_rows(
306+ lang,
307+ repo,
308+ &ref_name,
309+ &dir,
310+ siblings,
311+ &last,
312+ now_unix(),
313+ ctx.viewer_tz(),
314+ );
274315 let mut header = ctx.head(state, "code").await?;
275316 header.live = live_url(&repo.owner_name, &repo.name, &refs, &ref_name);
317+ let size = human_size(lang, blob.size);
318+ let size_line = if is_text {
319+ format!("{} {}, {size}", lines.len(), s(lang, "lines", "satır"))
320+ } else {
321+ size
322+ };
276323 Ok(view! {
277324 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
278- repo_head(head: header)
279- <div class="browse-bar" data-live-code=(follows.then_some("true")) data-live-gone=(g::t(lang, K::LivePathGone))>
280- breadcrumb(lang: lang, crumbs: crumbs)
281- file_finder(lang: lang, owner: finder_owner, repo: finder_repo, ref_name: finder_ref)
282- </div>
283- <section class="file" data-lines="" data-permalink=(permalink.as_str())>
284- <header class="file-head">
285- <span class="hint">(size)</span>
286- <nav class="acts file-actions" aria-label=(g::t(lang, K::FileNav))>
325+ repo_head(head: header, sub: sub, pips: pips)
326+ <div class="work">
327+ <nav class="rail" aria-label=(s(lang, "Files", "Dosyalar"))>
328+ <div class="rail-head browse-bar" data-live-code=(follows.then_some("true")) data-live-gone=(g::t(lang, K::LivePathGone))>
329+ <h2>(s(lang, "Files", "Dosyalar"))</h2>
330+ ref_selector(lang: lang, label: mi::t(lang, MK::RefLabel), current: ref_name.clone(), branches: branches, tags: tags,
331+ branches_href: branches_href, tags_href: tags_href)
332+ file_finder(lang: lang, owner: finder_owner, repo: finder_repo, ref_name: finder_ref)
333+ </div>
334+ tree_table(rows: rows, lang: lang, current: Some(file_name.clone()))
335+ </nav>
336+ <div class="sheet">
337+ <div class="sheet-tools">
338+ <strong>(file_name.clone())</strong>
339+ <span class="mono">(size_line)</span>
287340 if let Some((label, href)) = toggle {
288341 <a class="act" href=(href)>(label)</a>
289342 }
@@ -295,36 +348,38 @@ async fn blob_page(cx: &Cx) -> Result<impl View> {
295348 <a class="act" href=(history)>(g::t(lang, K::HistoryLink))</a>
296349 <a class="act" href=(raw.clone())>(g::t(lang, K::RawLink))</a>
297350 <a class="act" href=(download_href) download=(download_name)>(g::t(lang, K::DownloadLink))</a>
298- </nav>
299- </header>
300- if kind == "image" {
301- <div class="file-image">
302- <img src=(raw.clone()) alt=(image_alt)>
303351 </div>
304- }
305- if kind == "markdown" {
306- <div class="markdown-body">(Unescaped::new_unchecked(html))</div>
307- }
308- if kind == "text" {
309- file_table(lines: lines)
310- }
311- if kind == "lfs" {
312- <p class="state">(note.clone())</p>
313- }
314- if kind == "binary" {
315- <p class="state">(note.clone())</p>
316- }
317- if kind == "symlink" {
318- <p class="state">(g::t(lang, K::SymlinkPrefix)) <code>(note.clone())</code></p>
319- }
320- if kind == "submodule" {
321- <p class="state">(g::t(lang, K::SubmodulePrefix)) <code>(note.clone())</code> (g::t(lang, K::SubmoduleSuffix))</p>
322- }
323- if truncated {
324- <p class="hint">(g::t(lang, K::TruncatedPrefix))
325- <a href=(raw)>(g::t(lang, K::ViewFullRaw))</a> "."</p>
326- }
327- </section>
352+ <section class="file" data-lines="" data-permalink=(permalink.as_str())>
353+ if kind == "image" {
354+ <div class="file-image">
355+ <img src=(raw.clone()) alt=(image_alt)>
356+ </div>
357+ }
358+ if kind == "markdown" {
359+ <div class="markdown-body">(Unescaped::new_unchecked(html))</div>
360+ }
361+ if kind == "text" {
362+ file_table(lines: lines)
363+ }
364+ if kind == "lfs" {
365+ <p class="state">(note.clone())</p>
366+ }
367+ if kind == "binary" {
368+ <p class="state">(note.clone())</p>
369+ }
370+ if kind == "symlink" {
371+ <p class="state">(g::t(lang, K::SymlinkPrefix)) <code>(note.clone())</code></p>
372+ }
373+ if kind == "submodule" {
374+ <p class="state">(g::t(lang, K::SubmodulePrefix)) <code>(note.clone())</code> (g::t(lang, K::SubmoduleSuffix))</p>
375+ }
376+ if truncated {
377+ <p class="hint">(g::t(lang, K::TruncatedPrefix))
378+ <a href=(raw)>(g::t(lang, K::ViewFullRaw))</a> "."</p>
379+ }
380+ </section>
381+ </div>
382+ </div>
328383 )
329384 })
330385 }
crates/forge-web/src/pages/branches.rsmodified+11 -10
@@ -147,7 +147,7 @@ async fn branch_table(
147147 <summary class="line">
148148 <a class="name" href=(row.href.as_str())>(row.name.as_str())</a>
149149 if row.is_default {
150- <span class="badge public">(g::t(lang, K::DefaultBadge))</span>
150+ <span class="hint">(g::t(lang, K::DefaultBadge))</span>
151151 }
152152 <span class="val">(row.author.as_str()) " · " <time data-rel="true" datetime=(row.iso.as_str())>(row.age.as_str())</time>
153153 if let Some(counts) = row.counts {
@@ -159,7 +159,7 @@ async fn branch_table(
159159 </summary>
160160 <div class="opened">
161161 if let Some(last) = row.last {
162- <p class="state"><a href=(last.href.as_str())>commit_line(subject: last.summary.clone())</a></p>
162+ <p><a href=(last.href.as_str())>commit_line(subject: last.summary.clone())</a></p>
163163 }
164164 <div class="acts">
165165 if let Some(pr) = row.pr_href {
@@ -274,7 +274,12 @@ async fn branches_page(cx: &Cx) -> Result<impl View> {
274274 header.live = ref_live::live_url(&ctx.repo.owner_name, &ctx.repo.name);
275275 Ok(view! {
276276 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
277- repo_head(head: header)
277+ repo_head(head: header,
278+ if can_write {
279+ new_branch_form(lang: lang, action: action.clone(), csrf: csrf.clone(),
280+ default_branch: default_branch, options: options)
281+ }
282+ )
278283 if let Some((key, is_error)) = notice {
279284 if is_error {
280285 alert(message: b::t(lang, key))
@@ -282,16 +287,12 @@ async fn branches_page(cx: &Cx) -> Result<impl View> {
282287 <p class="state" role="status">(b::t(lang, key))</p>
283288 }
284289 }
285- if can_write {
286- <div class="acts">
287- new_branch_form(lang: lang, action: action.clone(), csrf: csrf.clone(),
288- default_branch: default_branch, options: options)
289- </div>
290- }
291290 if empty {
292291 <p class="state">(g::t(lang, K::NothingHere))</p>
293292 } else {
294- branch_table(rows: rows, lang: lang, csrf: csrf.clone(), delete_action: delete_action, can_delete: can_write)
293+ <div class="sheet">
294+ branch_table(rows: rows, lang: lang, csrf: csrf.clone(), delete_action: delete_action, can_delete: can_write)
295+ </div>
295296 }
296297 )
297298 })
crates/forge-web/src/pages/ci_estimate.rsmodified+0 -13
@@ -7,7 +7,6 @@
77 use std::collections::{HashMap, HashSet};
88
99 use forge_core::ci::{JobSample, JobState, StepSample};
10-use serde::Deserialize;
1110
1211 use crate::i18n::Lang;
1312 use crate::i18n::releases_ci as rc;
@@ -24,18 +23,6 @@ pub struct Step {
2423 pub finished: Option<i64>,
2524 }
2625
27-/// The `needs` of a job spec, read from its JSON. A spec that does not read has none.
28-pub fn needs_of(spec_json: &str) -> Vec<String> {
29- #[derive(Deserialize, Default)]
30- #[serde(default)]
31- struct Needs {
32- needs: Vec<String>,
33- }
34- serde_json::from_str::<Needs>(spec_json)
35- .map(|spec| spec.needs)
36- .unwrap_or_default()
37-}
38-
3926 /// The expected duration of `job` on `git_ref`, in seconds: the median of its durations in the newest
4027 /// five successful runs on that branch, or in the newest five on any branch when the branch has fewer
4128 /// than `MIN_SAMPLES`. None when neither has enough.
crates/forge-web/src/pages/ci_fail.rsmodified+64 -94
@@ -2,8 +2,6 @@
22 //! its log around the first error, and a link to that line in the job page's numbered log. Steps are
33 //! not stored, so the failed job is the unit. The log is untrusted: its lines are rendered as text.
44
5-use std::ops::Range;
6-
75 use topcoat::Result;
86 use topcoat::view::{View, component, view};
97
@@ -16,12 +14,8 @@ use crate::pages::ci_job::log_tail;
1614 use crate::pages::ci_runs::{job_href, strip_ansi};
1715 use crate::state::AppState;
1816
19-/// Most lines the block shows.
17+/// How far after the first error line its reason and place are looked for.
2018 const WINDOW: usize = 30;
21-/// Lines kept before the first error.
22-const BEFORE: usize = 5;
23-/// Lines shown when no line matches an error pattern.
24-const FALLBACK: usize = 20;
2519 /// Patterns that mark an error line. Matching is case-sensitive, which keeps prose such as "error
2620 /// handling" out. `FAILED` also covers `test result: FAILED`.
2721 const PATTERNS: [&str; 6] = [
@@ -40,28 +34,6 @@ fn first_error(lines: &[String]) -> Option<usize> {
4034 .position(|line| PATTERNS.iter().any(|pattern| line.contains(pattern)))
4135 }
4236
43-/// The indices of the lines to show for a failed step's log: at most 30 lines, starting 5 lines before
44-/// the first line that matches an error pattern. With no match, the last 20 lines.
45-pub(crate) fn error_range(lines: &[String]) -> Range<usize> {
46- let len = lines.len();
47- match first_error(lines) {
48- Some(hit) => {
49- let start = hit.saturating_sub(BEFORE).min(len.saturating_sub(WINDOW));
50- start..(start + WINDOW).min(len)
51- }
52- None => len.saturating_sub(FALLBACK)..len,
53- }
54-}
55-
56-/// One shown line: its number in the whole job log, its text without ANSI codes, and whether it is
57-/// the first error.
58-#[derive(Clone)]
59-pub(crate) struct FailLine {
60- no: u64,
61- text: String,
62- hit: bool,
63-}
64-
6537 /// The values of the failure block, read once per run page.
6638 #[derive(Clone)]
6739 pub(crate) struct FailFirst {
@@ -71,7 +43,30 @@ pub(crate) struct FailFirst {
7143 has_log: bool,
7244 /// The job's number for the first error line, when a line matched.
7345 line_no: Option<u64>,
74- lines: Vec<FailLine>,
46+ /// The first error line itself, when the job has no message of its own.
47+ error: Option<String>,
48+ /// Where the error points, `file:line`, from the lines right after it.
49+ place: Option<String>,
50+}
51+
52+impl FailFirst {
53+ /// The log line the page opens at.
54+ pub(crate) fn line_no(&self) -> Option<u64> {
55+ self.line_no
56+ }
57+}
58+
59+/// The `file:line` in a compiler's or test's lines around an error: the first word that ends in
60+/// digits after a colon and holds a dot.
61+fn place_in(lines: &[String]) -> Option<String> {
62+ lines.iter().flat_map(|line| line.split_whitespace()).find_map(|word| {
63+ let word = word.trim_matches(|c: char| matches!(c, '(' | ')' | ','));
64+ let mut parts = word.split(':');
65+ let file = parts.next()?;
66+ let line = parts.next()?;
67+ (file.contains('.') && !file.contains("::") && !line.is_empty() && line.bytes().all(|b| b.is_ascii_digit()))
68+ .then(|| format!("{}:{line}", file.rsplit('/').next().unwrap_or(file)))
69+ })
7570 }
7671
7772 /// Reads the failed job's log tail (the same bounded read as the job page) and picks the lines to show.
@@ -88,92 +83,67 @@ pub(crate) async fn read(
8883 all.pop();
8984 }
9085 let hit = first_error(&all);
91- let range = error_range(&all);
92- let start = range.start;
93- let lines = all[range]
94- .iter()
95- .enumerate()
96- .map(|(k, text)| {
97- let index = start + k;
98- FailLine {
99- no: tail.first_line + index as u64,
100- text: text.clone(),
101- hit: hit == Some(index),
102- }
103- })
104- .collect();
86+ // A test's FAILED line is followed by the error that says why, so the later `error:` reads better.
87+ let reason = hit.map(|index| {
88+ all[index..]
89+ .iter()
90+ .take(WINDOW)
91+ .find(|line| line.trim_start().starts_with("error"))
92+ .unwrap_or(&all[index])
93+ .trim()
94+ .to_owned()
95+ });
96+ let place = hit.and_then(|index| place_in(&all[index..(index + WINDOW).min(all.len())]));
10597 Ok(FailFirst {
10698 job_name: job_name.to_owned(),
10799 job_href: job_href(title, job_id),
108100 message: message.to_owned(),
109101 has_log: !all.is_empty(),
110102 line_no: hit.map(|index| tail.first_line + index as u64),
111- lines,
103+ error: reason,
104+ place,
112105 })
113106 }
114107
115-/// The failure block. The job's name links to its page; the first error links to its line there.
108+/// The failure row, pinned above the log, which opens at the first error line: why it failed, the
109+/// place in the code, and a link to that line in the job's log.
116110 #[component]
117111 pub(crate) async fn fail_first_block(lang: Lang, fail: FailFirst) -> Result<impl View> {
118112 let line_href = fail.line_no.map(|no| format!("{}#L{no}", fail.job_href));
113+ let why = if fail.message.is_empty() {
114+ fail.error.clone().unwrap_or_else(|| fail.job_name.clone())
115+ } else {
116+ fail.message.clone()
117+ };
119118 Ok(view! {
120- <section class="fail-first" data-fail-first="true">
121- <p class="fail-first-head">
122- <span class="fail-first-tag">(g::t(lang, K::FailHeading))</span>
123- " " <a href=(fail.job_href.as_str())>(fail.job_name.as_str())</a>
124- </p>
125- if !fail.message.is_empty() {
126- <p class="fail-first-msg">(fail.message.as_str())</p>
119+ <div class="why" data-fail-first="true">
120+ <span>(why.as_str())</span>
121+ if let Some(place) = fail.place.as_ref() {
122+ <code>(place.as_str())</code>
123+ }
124+ if let Some(href) = line_href.as_ref() {
125+ <a class="act danger" href=(href.as_str())>(g::t(lang, K::FailOpenLog))</a>
127126 }
128127 if !fail.has_log {
129- <p class="muted small">(g::t(lang, K::FailNoLog))</p>
130- } else {
131- if let (Some(href), Some(no)) = (line_href.as_ref(), fail.line_no) {
132- <p class="small"><a href=(href.as_str())>(g::t(lang, K::FailOpenLog))</a> " \u{b7} " (g::t(lang, K::FailLine)) " " (no)</p>
133- } else {
134- <p class="muted small">(g::t(lang, K::FailNoError))</p>
135- }
136- <div class="fail-first-log">
137- for line in fail.lines.iter() {
138- <div class=(if line.hit { "fail-first-ln fail-first-hit" } else { "fail-first-ln" })><i>(line.no)</i><span>(line.text.as_str())</span></div>
139- }
140- </div>
128+ <span class="hint">(g::t(lang, K::FailNoLog))</span>
129+ } else if line_href.is_none() {
130+ <span class="hint">(g::t(lang, K::FailNoError))</span>
141131 }
142- </section>
132+ </div>
143133 })
144134 }
145135
146136 #[cfg(test)]
147137 mod tests {
148- use super::{FALLBACK, WINDOW, error_range};
149-
150- fn lines(count: usize) -> Vec<String> {
151- (0..count).map(|i| format!("line {i}")).collect()
152- }
153-
154- #[test]
155- fn the_first_error_opens_a_window_of_at_most_thirty_lines() {
156- let mut log = lines(40);
157- log[12] = "error[E0425]: cannot find value".to_owned();
158- log[20] = "error: later one".to_owned();
159- let range = error_range(&log);
160- assert_eq!(range, 7..37);
161- assert!(range.len() <= WINDOW);
162- assert!(range.contains(&12));
163- }
164-
165- #[test]
166- fn a_match_near_the_end_keeps_a_full_window() {
167- let mut log = lines(40);
168- log[39] = "thread 'x' panicked at src/lib.rs:3".to_owned();
169- assert_eq!(error_range(&log), 10..40);
170- }
138+ use super::place_in;
171139
172140 #[test]
173- fn without_an_error_the_last_lines_are_shown() {
174- let log = lines(100);
175- assert_eq!(error_range(&log), (100 - FALLBACK)..100);
176- assert_eq!(error_range(&lines(5)), 0..5);
177- assert_eq!(error_range(&[]), 0..0);
141+ fn the_place_of_an_error_is_its_file_and_line() {
142+ let lines = [
143+ "error: stream closed".to_owned(),
144+ " --> crates/forge-e2e/tests/e2e/wiki_e2e.rs:212:9".to_owned(),
145+ ];
146+ assert_eq!(place_in(&lines).as_deref(), Some("wiki_e2e.rs:212"));
147+ assert_eq!(place_in(&["test a::b::c ... FAILED".to_owned()]), None);
178148 }
179149 }
crates/forge-web/src/pages/ci_job.rsmodified+79 -81
@@ -38,7 +38,6 @@ use crate::pages::ci_runs::{
3838 age_text, can_write, changed_event, commit_reachable_for, dock_bars, duration_text,
3939 events_response, job_href, run_href, state_text, strip_ansi,
4040 };
41-use crate::pages::repo::repo_head;
4241 use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo, still_readable};
4342 use crate::state::AppState;
4443 use crate::views::timeline::{StripBar, history_strip};
@@ -433,93 +432,92 @@ async fn job_body(
433432 repo: String,
434433 bars: Vec<StripBar>,
435434 ) -> Result<impl View> {
435+ let archived = head.archived;
436436 Ok(view! {
437- repo_head(head: RepoHead { live: String::new(), ..head })
438- <div data-live=(live.as_str()) data-live-state=(job.fingerprint.as_str()) class="ci-job fit-pane">
439- <header class="ci-tl-head">
440- <div class="ci-tl-headmain">
441- <div class="ci-tl-line">
442- <span class="ci-tl-no"><a href=(job.run_href.as_str())>(g::t(lang, K::RunNumber)) (job.run_number)</a></span>
443- <h2 class="ci-tl-title ci-job-title">(job.name.as_str())</h2>
444- if let Some((action, csrf)) = job.rerun.as_ref() {
445- <div class="acts ci-tl-actions">
446- <form method="post" action=(action.as_str()) class="act-form">
447- <input type="hidden" name="csrf" value=(csrf.as_str())>
448- <button type="submit" class="act" data-palette-action="post">(g::t(lang, K::RerunJob))</button>
449- </form>
450- </div>
451- }
452- </div>
453- <div class="ci-tl-meta">
454- <span class=(job.state_class.as_str())>(job.state.as_str())</span>
455- if !job.runner.is_empty() {
456- <span class="muted">(g::t(lang, K::Runner)) " " (job.runner.as_str())</span>
457- }
458- if !job.exit_code.is_empty() {
459- <span class="muted">(g::t(lang, K::Exit)) " " (job.exit_code.as_str())</span>
460- }
461- if !job.duration.is_empty() {
462- <span class="ci-tl-dur">(g::t(lang, K::Duration)) " " (job.duration.as_str())</span>
463- }
437+ if archived {
438+ <p class="state" role="status">(crate::i18n::code::t(lang, crate::i18n::code::K::ArchivedNotice))</p>
439+ }
440+ <div data-live=(live.as_str()) data-live-state=(job.fingerprint.as_str()) class="ci-job">
441+ <section class="head">
442+ <div class="head-title">
443+ <h1>(job.name.as_str())</h1>
444+ if let Some((action, csrf)) = job.rerun.as_ref() {
445+ <form method="post" action=(action.as_str()) class="act-form">
446+ <input type="hidden" name="csrf" value=(csrf.as_str())>
447+ <button type="submit" class="primary" data-palette-action="post">(g::t(lang, K::RerunJob))</button>
448+ </form>
449+ }
450+ </div>
451+ <p class="head-sub">
452+ <a href=(job.run_href.as_str())>(g::t(lang, K::RunNumber)) " " (job.run_number)</a>
453+ <span class="sep" aria-hidden="true">"·"</span>
454+ <span class=(job.state_class.as_str())>(job.state.as_str())</span>
455+ if !job.runner.is_empty() {
456+ <span class="sep" aria-hidden="true">"·"</span>
457+ <span>(g::t(lang, K::Runner)) " " (job.runner.as_str())</span>
458+ }
459+ if !job.exit_code.is_empty() {
460+ <span class="sep" aria-hidden="true">"·"</span>
461+ <span>(g::t(lang, K::Exit)) " " (job.exit_code.as_str())</span>
462+ }
463+ if !job.duration.is_empty() {
464+ <span class="sep" aria-hidden="true">"·"</span>
465+ <span class="ci-tl-dur">(g::t(lang, K::Duration)) " " (job.duration.as_str())</span>
466+ }
467+ if !job.started.is_empty() {
468+ <span class="sep" aria-hidden="true">"·"</span>
469+ <span>(g::t(lang, K::Started)) " " <time datetime=(job.started_full.as_str()) data-rel="true" title=(full_date(job.started_full.as_str()))>(job.started.as_str())</time></span>
470+ }
471+ if !job.finished.is_empty() {
472+ <span class="sep" aria-hidden="true">"·"</span>
473+ <span>(g::t(lang, K::Finished)) " " <time datetime=(job.finished_full.as_str()) data-rel="true" title=(full_date(job.finished_full.as_str()))>(job.finished.as_str())</time></span>
474+ }
475+ </p>
476+ </section>
477+ <div class="sheet ci-tl-log">
478+ <div class="sheet-tools ci-logbar ci-tl-logbar">
479+ <strong>(g::t(lang, K::Log))</strong>
480+ <div class="ci-tl-tools">
481+ <input type="search" class="ci-logsearch" data-log-q="true" placeholder=(g::t(lang, K::LogSearch)) aria-label=(g::t(lang, K::LogSearch)) autocomplete="off" spellcheck="false">
482+ <span class="ci-logcount" data-log-count="true" data-none=(g::t(lang, K::LogNoMatches)) aria-live="polite"></span>
483+ <button type="button" class="act" data-log-prev="true" aria-label=(g::t(lang, K::LogPrev)) title=(g::t(lang, K::LogPrev))>"\u{2191}"</button>
484+ <button type="button" class="act" data-log-next="true" aria-label=(g::t(lang, K::LogNext)) title=(g::t(lang, K::LogNext))>"\u{2193}"</button>
485+ <button type="button" class="act" data-copy-log=(job.log_href.as_str()) data-palette-action="click" data-copied=(g::t(lang, K::CopyDone)) data-failed=(g::t(lang, K::CopyFailed))>(g::t(lang, K::CopyLog))</button>
486+ <a class="act" href=(job.log_href.as_str())>(g::t(lang, K::FullLog))</a>
487+ <span class="ci-logfold" data-log-fold-box="true" hidden="hidden">
488+ <button type="button" class="act" data-log-fold="close">(g::t(lang, K::LogCollapseAll))</button>
489+ <button type="button" class="act" data-log-fold="open">(g::t(lang, K::LogExpandAll))</button>
490+ </span>
464491 </div>
465492 </div>
466- </header>
467- <div class="ci-tl-main">
468- <section class="ci-pane ci-tl-jobs">
469- <h2 class="ci-tl-label">(crate::pages::passkeys::s(lang, "Details", "Ayrıntılar"))</h2>
470- <div class="ci-tl-pad ci-tl-facts">
471- if !job.started.is_empty() {
472- <p class="muted small">(g::t(lang, K::Started)) " " <time datetime=(job.started_full.as_str()) data-rel="true" title=(full_date(job.started_full.as_str()))>(job.started.as_str())</time></p>
473- }
474- if !job.finished.is_empty() {
475- <p class="muted small">(g::t(lang, K::Finished)) " " <time datetime=(job.finished_full.as_str()) data-rel="true" title=(full_date(job.finished_full.as_str()))>(job.finished.as_str())</time></p>
476- }
477- if !job.message.is_empty() {
478- <p>(job.message.as_str())</p>
479- }
480- if let Some(kills) = job.oom_kills {
481- <p class="alert" title=(format!("oom_kill {kills}"))>(if matches!(lang, Lang::Tr) { "sonlandırıldı: bellek yetersiz" } else { "killed: out of memory" })</p>
493+ if !job.message.is_empty() {
494+ <p class="why"><span>(job.message.as_str())</span></p>
495+ }
496+ if let Some(kills) = job.oom_kills {
497+ <p class="alert" title=(format!("oom_kill {kills}"))>(if matches!(lang, Lang::Tr) { "sonlandırıldı: bellek yetersiz" } else { "killed: out of memory" })</p>
498+ }
499+ if truncated {
500+ <p class="hint">(g::t(lang, K::LogTruncated))</p>
501+ }
502+ <pre class="ci-log ci-tl-code" data-live-log="true" data-offset=(log_offset.as_str()) data-first=(first_line.as_str())>(log.as_str())</pre>
503+ if !artifacts.is_empty() {
504+ <div class="sec">
505+ <h2>(g::t(lang, K::Artifacts))</h2>
506+ for artifact in artifacts.iter() {
507+ <div class="line">
508+ <span class="name"><a href=(artifact.href.as_str())>(artifact.name.as_str())</a></span>
509+ <span class="val">(artifact.size.as_str())</span>
510+ </div>
482511 }
483512 </div>
484- if !artifacts.is_empty() {
485- <h3 class="ci-tl-label ci-tl-pad">(g::t(lang, K::Artifacts))</h3>
486- <ul class="ci-artifacts ci-tl-pad">
487- for artifact in artifacts.iter() {
488- <li><a href=(artifact.href.as_str())>(artifact.name.as_str())</a> " (" (artifact.size.as_str()) ")"</li>
489- }
490- </ul>
491- }
492- </section>
493- <section class="ci-pane ci-tl-log">
494- <div class="ci-logbar ci-tl-logbar">
495- <div class="ci-tl-tabs">
496- <span class="ci-tl-label ci-tl-tab-log">(g::t(lang, K::Log))</span>
497- </div>
498- <div class="ci-tl-tools">
499- <input type="search" class="ci-logsearch" data-log-q="true" placeholder=(g::t(lang, K::LogSearch)) aria-label=(g::t(lang, K::LogSearch)) autocomplete="off" spellcheck="false">
500- <span class="ci-logcount" data-log-count="true" data-none=(g::t(lang, K::LogNoMatches)) aria-live="polite"></span>
501- <button type="button" class="act" data-log-prev="true" aria-label=(g::t(lang, K::LogPrev)) title=(g::t(lang, K::LogPrev))>"\u{2191}"</button>
502- <button type="button" class="act" data-log-next="true" aria-label=(g::t(lang, K::LogNext)) title=(g::t(lang, K::LogNext))>"\u{2193}"</button>
503- <button type="button" class="act" data-copy-log=(job.log_href.as_str()) data-palette-action="click" data-copied=(g::t(lang, K::CopyDone)) data-failed=(g::t(lang, K::CopyFailed))>(g::t(lang, K::CopyLog))</button>
504- <a class="act" href=(job.log_href.as_str())>(g::t(lang, K::FullLog))</a>
505- <span class="ci-logfold" data-log-fold-box="true" hidden="hidden">
506- <button type="button" class="act" data-log-fold="close">(g::t(lang, K::LogCollapseAll))</button>
507- <button type="button" class="act" data-log-fold="open">(g::t(lang, K::LogExpandAll))</button>
508- </span>
509- </div>
513+ }
514+ <div class="sec ci-dock">
515+ <p class="hint">(crate::pages::passkeys::s(lang, "bar height is lines changed", "çubuk yüksekliği değişen satır sayısıdır"))</p>
516+ <div class="dock-history">
517+ history_strip(lang: lang, owner: owner, repo: repo, bars: bars)
510518 </div>
511- if truncated {
512- <p class="muted small ci-tl-pad">(g::t(lang, K::LogTruncated))</p>
513- }
514- <pre class="ci-log ci-tl-code" data-live-log="true" data-offset=(log_offset.as_str()) data-first=(first_line.as_str())>(log.as_str())</pre>
515- </section>
516- </div>
517- <section class="ci-pane ci-dock">
518- <p class="ci-dock-note">(crate::pages::passkeys::s(lang, "bar height is lines changed", "çubuk yüksekliği değişen satır sayısıdır"))</p>
519- <div class="dock-history">
520- history_strip(lang: lang, owner: owner, repo: repo, bars: bars)
521519 </div>
522- </section>
520+ </div>
523521 </div>
524522 })
525523 }
crates/forge-web/src/pages/ci_runs.rsmodified+411 -369
@@ -48,7 +48,7 @@ use crate::pages::repo::repo_head;
4848 use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo, still_readable};
4949 use crate::pages::repo_side::{commit_strip, run_states, strip_bars};
5050 use crate::state::AppState;
51-use crate::views::commit_line::{commit_line, headline};
51+use crate::views::commit_line::commit_line;
5252 use crate::views::timeline::{StripBar, history_strip};
5353 use crate::views::{
5454 alert, empty_state, enc, human_size, now_unix, rel_time, relative_time, shell, short_oid,
@@ -203,7 +203,11 @@ pub(crate) fn duration_text(lang: Lang, started: Option<&str>, finished: Option<
203203 return String::new();
204204 };
205205 let end = finished.and_then(unix_of).unwrap_or_else(now_unix);
206- let secs = (end - start).max(0);
206+ secs_text(lang, (end - start).max(0))
207+}
208+
209+/// A length of time as the CI pages write it: minutes and seconds, or seconds alone under a minute.
210+fn secs_text(lang: Lang, secs: i64) -> String {
207211 if secs >= 60 {
208212 g::duration_minutes(lang, secs / 60, secs % 60)
209213 } else {
@@ -249,6 +253,48 @@ pub fn run_finished(state: &RunState) -> bool {
249253 )
250254 }
251255
256+/// The run page's headline, a sentence about the state: `Failed in <job>`, `Running <job>`, `Passed in
257+/// <took>`. Returns the class it takes: `bad` for a failure, `live` while running, else none.
258+fn run_headline(lang: Lang, state: RunState, job: &str, took: &str) -> (String, &'static str) {
259+ let (text, class) = run_headline_text(lang, state, job, took);
260+ // A state word alone is a sentence here, so it starts with a capital: `Queued`, not `queued`.
261+ let mut chars = text.chars();
262+ let text = match chars.next() {
263+ Some(first) => first.to_uppercase().chain(chars).collect(),
264+ None => text,
265+ };
266+ (text, class)
267+}
268+
269+fn run_headline_text(lang: Lang, state: RunState, job: &str, took: &str) -> (String, &'static str) {
270+ match state {
271+ RunState::Failure | RunState::Error => {
272+ let text = match (lang, job.is_empty()) {
273+ (_, true) => state_text(lang, state.as_str()),
274+ (Lang::Tr, false) => format!("{job} başarısız"),
275+ (Lang::En, false) => format!("Failed in {job}"),
276+ };
277+ (text, "bad")
278+ }
279+ RunState::Running => {
280+ let text = match (lang, job.is_empty()) {
281+ (_, true) => state_text(lang, state.as_str()),
282+ (Lang::Tr, false) => format!("{job} çalışıyor"),
283+ (Lang::En, false) => format!("Running {job}"),
284+ };
285+ (text, "live")
286+ }
287+ RunState::Success if !took.is_empty() => {
288+ let text = match lang {
289+ Lang::Tr => format!("{took} içinde geçti"),
290+ Lang::En => format!("Passed in {took}"),
291+ };
292+ (text, "")
293+ }
294+ _ => (state_text(lang, state.as_str()), ""),
295+ }
296+}
297+
252298 /// A ref as the lists show it: `refs/heads/main` reads `main`, and so does a tag without its prefix.
253299 fn short_ref(git_ref: &str) -> &str {
254300 git_ref
@@ -350,6 +396,8 @@ struct RunRow {
350396 duration: String,
351397 /// Unix seconds the duration counts from while the run is live, for the client's local ticker.
352398 since: Option<String>,
399+ /// The state tone of the row's tick: `bad`, `live`, `skip`, `wait` or empty for passed.
400+ tick: &'static str,
353401 /// The run's start and the list's scale, which the ticker needs to grow the running segments.
354402 origin: String,
355403 scale: String,
@@ -424,15 +472,13 @@ struct JobLine {
424472 /// The job's steps, a dropdown under its row. Every job has its lines; only the selected job's
425473 /// step carries the log's mark.
426474 steps: Vec<StepLine>,
427- /// The job's bar along the bottom of its row: one segment per step. Empty for a job with no steps.
428- step_bar: Vec<Rect>,
475+ /// The state tone of the job's tick: `bad`, `live`, `done` or empty.
476+ tick: &'static str,
429477 }
430478
431479 /// One step of a job, drawn as a line under its row in the jobs pane.
432480 struct StepLine {
433481 name: String,
434- /// The classes of the step's mark, which carry its state's colour.
435- mark: &'static str,
436482 duration: String,
437483 /// Unix seconds a running step's duration counts from.
438484 since: Option<String>,
@@ -450,6 +496,10 @@ struct StepLine {
450496 expected_secs: Option<String>,
451497 /// The state class of the step's progress bar, which sets its fill colour.
452498 state_class: &'static str,
499+ /// The strip segment's tone: `bad`, `live`, `skip` or empty for a passed step.
500+ seg: &'static str,
501+ /// The segment's share of the job's strip, as `fr1`..`fr40`, by the step's duration.
502+ fr: String,
453503 }
454504
455505 /// One artifact of the run: its download link, the job that made it, its name and size.
@@ -464,8 +514,9 @@ struct ArtifactLine {
464514 struct RunDetail {
465515 number: i64,
466516 title: String,
467- state: String,
468- state_class: String,
517+ /// The head's sentence about the state, and its class (`bad`, `live` or empty).
518+ headline: String,
519+ headline_class: &'static str,
469520 trigger: String,
470521 branch: String,
471522 /// The commit's page. None when a force push overwrote the commit.
@@ -743,8 +794,6 @@ const STEP_H: i64 = 20;
743794 const BAR_DY: i64 = 9;
744795 const BAR_H: i64 = 22;
745796 /// The narrowest segment of a job's step bar, and the gap between segments, in its SVG units.
746-const STEP_BAR_MIN: i64 = 8;
747-const STEP_BAR_GAP: i64 = 6;
748797 /// The narrowest a box is drawn, so a short lead-in or job still shows.
749798 const MIN_BOX_W: i64 = 3;
750799 /// The most intervals an axis has, so its ticks stay readable.
@@ -1318,7 +1367,7 @@ fn step_job_state(state: StepState) -> JobState {
13181367 }
13191368
13201369 /// The steps of a job as the timeline draws them. A step whose start does not read is left out.
1321-fn step_spans(steps: &[JobStep], job: JobState) -> Vec<StepSpan> {
1370+fn step_spans(steps: &[JobStep], job: JobState, job_end: Option<i64>) -> Vec<StepSpan> {
13221371 steps
13231372 .iter()
13241373 .filter_map(|step| {
@@ -1326,49 +1375,13 @@ fn step_spans(steps: &[JobStep], job: JobState) -> Vec<StepSpan> {
13261375 name: step.name.clone(),
13271376 state: step_job_state(step.state(job)),
13281377 start: unix_of(&step.started_at)?,
1329- end: step.finished_at.as_deref().and_then(unix_of),
1378+ // A step left open ends with its job.
1379+ end: step.finished_at.as_deref().and_then(unix_of).or(job_end),
13301380 })
13311381 })
13321382 .collect()
13331383 }
13341384
1335-/// A step's share of its job's bar: its state, its elapsed seconds and, while it runs, its expected ones.
1336-struct BarStep {
1337- state: StepState,
1338- elapsed: i64,
1339- expected: Option<i64>,
1340-}
1341-
1342-/// The bar along a job's row: one segment per step, as wide as its seconds (a running step counts the
1343-/// larger of its elapsed and expected seconds), with a gap between segments. A running step with an
1344-/// estimate is a track of its full width with its elapsed share filled in the accent.
1345-fn step_bar(steps: &[BarStep]) -> Vec<Rect> {
1346- let weight = |step: &BarStep| step.expected.unwrap_or(0).max(step.elapsed).max(1);
1347- let total: i64 = steps.iter().map(weight).sum();
1348- let gaps = STEP_BAR_GAP * (steps.len() as i64 - 1).max(0);
1349- // Every segment gets its least first, so 32 short steps beside a long one still all fit.
1350- let room = (LIST_BAR_W - gaps - STEP_BAR_MIN * steps.len() as i64).max(0);
1351- let mut rects = Vec::with_capacity(steps.len() + 1);
1352- let mut x = 0;
1353- for step in steps {
1354- let weight = weight(step);
1355- let w = STEP_BAR_MIN + weight * room / total;
1356- match (step.state, step.expected) {
1357- (StepState::Running, Some(expected)) => {
1358- rects.push(Rect::new("ci-sbar-track", x, 0, w, 3));
1359- let done = step.elapsed.min(expected) * w / weight;
1360- rects.push(Rect::new("ci-sbar-run", x, 0, done, 3));
1361- }
1362- (StepState::Running, None) => rects.push(Rect::new("ci-sbar-run", x, 0, w, 3)),
1363- (StepState::Passed, _) => rects.push(Rect::new("ci-sbar-pass", x, 0, w, 3)),
1364- (StepState::Failed, _) => rects.push(Rect::new("ci-sbar-fail", x, 0, w, 3)),
1365- (StepState::Cancelled, _) => rects.push(Rect::new("ci-sbar-off", x, 0, w, 3)),
1366- }
1367- x += w + STEP_BAR_GAP;
1368- }
1369- rects
1370-}
1371-
13721385 /// The rail's step lines of a job and the bar under its row. Every job gets its lines, the dropdown
13731386 /// under its row; `wanted` marks the step the log shows and is passed for the selected job only. A
13741387 /// running step's expected time comes from the repo's step samples.
@@ -1381,25 +1394,31 @@ fn job_steps(
13811394 wanted: Option<i64>,
13821395 now: i64,
13831396 lang: Lang,
1384-) -> (Vec<StepLine>, Vec<Rect>) {
1397+) -> Vec<StepLine> {
13851398 let mut lines = Vec::with_capacity(steps.len());
1386- let mut bar = Vec::with_capacity(steps.len());
1387- for step in steps {
1399+ // A step left open ends with its job: only a step of a job still going runs until now.
1400+ let elapsed_of: Vec<i64> = steps
1401+ .iter()
1402+ .map(|step| {
1403+ unix_of(&step.started_at).map_or(0, |at| {
1404+ let end = step
1405+ .finished_at
1406+ .as_deref()
1407+ .and_then(unix_of)
1408+ .or(job.finished)
1409+ .unwrap_or(now);
1410+ (end - at).max(0)
1411+ })
1412+ })
1413+ .collect();
1414+ let total: u64 = elapsed_of.iter().map(|secs| u64::try_from(*secs).unwrap_or(0)).sum();
1415+ for (step, elapsed) in steps.iter().zip(elapsed_of) {
13881416 let state = step.state(job.state);
13891417 let running = state == StepState::Running;
13901418 let started = unix_of(&step.started_at);
1391- let elapsed = started.map_or(0, |at| {
1392- let end = step.finished_at.as_deref().and_then(unix_of).unwrap_or(now);
1393- (end - at).max(0)
1394- });
13951419 let expected = running
13961420 .then(|| ci_estimate::step_expected(samples, &run.git_ref, &job.name, &step.name))
13971421 .flatten();
1398- bar.push(BarStep {
1399- state,
1400- elapsed,
1401- expected,
1402- });
14031422 // A step of a job whose log was pruned has no part of the log to open.
14041423 let href = (job.log_bytes != 0).then(|| format!("{pick}&step={}", step.seq));
14051424 // Only a running step with an estimate has a share; one without is indeterminate, never a guess.
@@ -1408,17 +1427,11 @@ fn job_steps(
14081427 .map(|secs| (elapsed * 100 / secs).min(99).to_string());
14091428 lines.push(StepLine {
14101429 name: step.name.clone(),
1411- mark: match state {
1412- StepState::Passed => "ci-st-pass",
1413- StepState::Running => "ci-st-run",
1414- StepState::Failed => "ci-st-fail",
1415- StepState::Cancelled => "ci-st-off",
1430+ duration: if started.is_some() {
1431+ secs_text(lang, elapsed)
1432+ } else {
1433+ String::new()
14161434 },
1417- duration: duration_text(
1418- lang,
1419- Some(step.started_at.as_str()),
1420- step.finished_at.as_deref(),
1421- ),
14221435 since: started.filter(|_| running).map(|at| at.to_string()),
14231436 expected: expected.map(|secs| format!("~{}", span_text(secs))),
14241437 selected: href.is_some() && wanted == Some(step.seq),
@@ -1438,9 +1451,16 @@ fn job_steps(
14381451 StepState::Failed => "ci-sp-fail",
14391452 StepState::Cancelled => "ci-sp-off",
14401453 },
1454+ seg: match state {
1455+ StepState::Passed => "",
1456+ StepState::Running => "live",
1457+ StepState::Failed => "bad",
1458+ StepState::Cancelled => "skip",
1459+ },
1460+ fr: crate::views::parts::seg_fr(u64::try_from(elapsed).unwrap_or(0), total),
14411461 });
14421462 }
1443- (lines, step_bar(&bar))
1463+ lines
14441464 }
14451465
14461466 /// "test OOM" for a failed run: the first failed job's message, or its name and state.
@@ -1575,11 +1595,16 @@ async fn usernames(
15751595
15761596 /// A small form that POSTs the CSRF token to `action`, with one button.
15771597 #[component]
1578-async fn action_button(action: String, csrf: String, label: &'static str) -> Result<impl View> {
1598+async fn action_button(
1599+ action: String,
1600+ csrf: String,
1601+ label: &'static str,
1602+ primary: bool,
1603+) -> Result<impl View> {
15791604 Ok(view! {
15801605 <form method="post" action=(action.as_str()) class="act-form">
15811606 <input type="hidden" name="csrf" value=(csrf.as_str())>
1582- <button type="submit" class="act" data-palette-action="post">(label)</button>
1607+ <button type="submit" class=(primary.then_some("primary")) data-palette-action="post">(label)</button>
15831608 </form>
15841609 })
15851610 }
@@ -1712,8 +1737,16 @@ async fn runs_split(
17121737 names.get(&run.actor_id).cloned().unwrap_or_default()
17131738 };
17141739 RunRow {
1740+ tick: match run.state {
1741+ RunState::Failure | RunState::Error => "bad",
1742+ RunState::Running => "live",
1743+ RunState::Cancelled => "skip",
1744+ RunState::Queued | RunState::WaitingApproval => "wait",
1745+ _ => "done",
1746+ },
17151747 href: row_href(run.number),
1716- current: if selected.as_ref().is_some_and(|sel| sel.id == run.id) {
1748+ // The list page alone draws no run, so it marks none.
1749+ current: if number.is_some() && selected.as_ref().is_some_and(|sel| sel.id == run.id) {
17171750 "true"
17181751 } else {
17191752 "false"
@@ -1774,7 +1807,8 @@ async fn runs_split(
17741807 } else {
17751808 None
17761809 };
1777- let detail = match selected.as_ref() {
1810+ // The list page shows rows only; a run's detail is on its own page.
1811+ let detail = match number.and(selected.as_ref()) {
17781812 Some(run) => {
17791813 let actor = if run.trigger == "schedule" {
17801814 String::new()
@@ -1886,7 +1920,7 @@ async fn run_detail(
18861920 for job in jobs.iter_mut() {
18871921 let spans = steps_of
18881922 .get(&job.id)
1889- .map_or_else(Vec::new, |steps| step_spans(steps, job.state));
1923+ .map_or_else(Vec::new, |steps| step_spans(steps, job.state, job.finished));
18901924 job.steps = spans;
18911925 }
18921926 // A running step's expected time is judged from the samples of the run's branch.
@@ -1928,7 +1962,7 @@ async fn run_detail(
19281962 }
19291963 let tail = log_last_lines(&log_path(&state.config.data_dir, &job.id)).await;
19301964 let pick = format!("{}?job={}", run_href(title, run.number), job.id);
1931- let (steps, step_bar) = job_steps(
1965+ let steps = job_steps(
19321966 job,
19331967 steps_of.get(&job.id).map(Vec::as_slice).unwrap_or_default(),
19341968 &step_samples,
@@ -1960,7 +1994,6 @@ async fn run_detail(
19601994 id: job.id.clone(),
19611995 selected: picked == Some(index),
19621996 steps,
1963- step_bar,
19641997 pick,
19651998 expanded: !tail.is_empty() && starts_expanded(job.state, jobs.len()),
19661999 preview,
@@ -1971,6 +2004,12 @@ async fn run_detail(
19712004 href: job_href(title, &job.id),
19722005 name: variant.unwrap_or(job.name.as_str()).to_owned(),
19732006 dot: format!("ci-dot ci-{}", job.state.as_str()),
2007+ tick: match job.state {
2008+ JobState::Failure | JobState::Error => "bad",
2009+ JobState::Running => "live",
2010+ JobState::Success => "done",
2011+ _ => "",
2012+ },
19742013 detail: job.image.clone(),
19752014 rerun: (rerunnable && job.state.is_terminal())
19762015 .then(|| format!("{}/rerun", job_href(title, &job.id))),
@@ -2046,11 +2085,24 @@ async fn run_detail(
20462085 }
20472086 _ => None,
20482087 };
2088+ let (headline, headline_class) = run_headline(
2089+ lang,
2090+ run.state,
2091+ // The step that failed or runs says more than its job does.
2092+ picked.map_or("", |index| {
2093+ let job = &lines[index];
2094+ job.steps
2095+ .iter()
2096+ .find(|step| matches!(step.seg, "bad" | "live"))
2097+ .map_or(job.name.as_str(), |step| step.name.as_str())
2098+ }),
2099+ &duration_text(lang, Some(run.created_at.as_str()), run.finished_at.as_deref()),
2100+ );
20492101 Ok(RunDetail {
20502102 number: run.number,
20512103 title: header.title,
2052- state: state_text(lang, run.state.as_str()),
2053- state_class: format!("ci-state ci-{}", run.state.as_str()),
2104+ headline,
2105+ headline_class,
20542106 trigger: trigger_text(lang, &run.trigger),
20552107 branch: short_ref(&run.git_ref).to_owned(),
20562108 commit_href: header
@@ -2124,13 +2176,50 @@ fn query_value(cx: &Cx, key: &str) -> Option<String> {
21242176 .map(|(_, value)| value.into_owned())
21252177 }
21262178
2127-/// The runs list: its head with the Run workflow and badge menus, the rows and the pager. The list page
2128-/// and a run's page both keep it at the left, so moving between runs never loses it.
2179+/// The Run workflow and badge menus of the runs list. They sit in the list's head, beside its title.
21292180 #[component]
2130-async fn run_side(lang: Lang, list: ListView) -> Result<impl View> {
2181+async fn ci_menus(lang: Lang, list: &ListView) -> Result<impl View> {
2182+ let badge = &list.badge;
2183+ Ok(view! {
2184+ if let Some(form) = list.manual.as_ref() {
2185+ <details class="menu ci-tool">
2186+ <summary>(g::t(lang, K::RunWorkflow))</summary>
2187+ <div class="menu-list ci-pop">
2188+ <p class="muted small">(g::t(lang, K::RunWorkflowHelp))</p>
2189+ <form method="post" action=(form.action.as_str()) class="ci-manual-form">
2190+ <input type="hidden" name="csrf" value=(form.csrf.as_str())>
2191+ <label>
2192+ (g::t(lang, K::Branch)) " "
2193+ <select name="branch">
2194+ for branch in form.branches.iter() {
2195+ <option value=(branch.as_str())>(branch.as_str())</option>
2196+ }
2197+ </select>
2198+ </label>
2199+ <button type="submit" class="primary">(g::t(lang, K::RunWorkflow))</button>
2200+ </form>
2201+ </div>
2202+ </details>
2203+ }
2204+ <details class="menu ci-tool">
2205+ <summary>(g::t(lang, K::BadgeHeading))</summary>
2206+ <div class="menu-list ci-pop">
2207+ <p class="muted small">(g::t(lang, K::BadgeHelp))</p>
2208+ <p><img src=(badge.image.as_str()) alt="build"></p>
2209+ <label class="small">
2210+ (g::t(lang, K::BadgeSnippet))
2211+ <textarea readonly="readonly" rows="2" class="ci-badge-snippet">(badge.snippet.as_str())</textarea>
2212+ </label>
2213+ </div>
2214+ </details>
2215+ })
2216+}
2217+
2218+/// The runs list: one sheet with its tools row, one line per run (each opens the run's page) and the
2219+/// pager. The live list keeps its classes for the page script.
2220+#[component]
2221+async fn runs_sheet(lang: Lang, list: &ListView) -> Result<impl View> {
21312222 let ListView {
2132- manual,
2133- badge,
21342223 total,
21352224 scale,
21362225 rows,
@@ -2138,99 +2227,66 @@ async fn run_side(lang: Lang, list: ListView) -> Result<impl View> {
21382227 older_href,
21392228 page_label,
21402229 next_scheduled,
2230+ ..
21412231 } = list;
21422232 Ok(view! {
2143- <section class="ci-side">
2144- <div class="ci-side-head">
2145- <h2 class="ci-side-title">(g::t(lang, K::Runs)) <span class="ci-count">(total)</span></h2>
2146- <div class="ci-tools">
2147- if let Some(form) = manual {
2148- <details class="menu ci-tool">
2149- <summary>(g::t(lang, K::RunWorkflow))</summary>
2150- <div class="menu-list ci-pop">
2151- <p class="muted small">(g::t(lang, K::RunWorkflowHelp))</p>
2152- <form method="post" action=(form.action.as_str()) class="ci-manual-form">
2153- <input type="hidden" name="csrf" value=(form.csrf.as_str())>
2154- <label>
2155- (g::t(lang, K::Branch)) " "
2156- <select name="branch">
2157- for branch in form.branches.iter() {
2158- <option value=(branch.as_str())>(branch.as_str())</option>
2159- }
2160- </select>
2161- </label>
2162- <button type="submit" class="primary">(g::t(lang, K::RunWorkflow))</button>
2163- </form>
2164- </div>
2165- </details>
2166- }
2167- <details class="menu ci-tool">
2168- <summary>(g::t(lang, K::BadgeHeading))</summary>
2169- <div class="menu-list ci-pop">
2170- <p class="muted small">(g::t(lang, K::BadgeHelp))</p>
2171- <p><img src=(badge.image.as_str()) alt="build"></p>
2172- <label class="small">
2173- (g::t(lang, K::BadgeSnippet))
2174- <textarea readonly="readonly" rows="2" class="ci-badge-snippet">(badge.snippet.as_str())</textarea>
2175- </label>
2176- </div>
2177- </details>
2178- </div>
2179- </div>
2180- if let Some(next) = next_scheduled.as_ref() {
2181- <p class="ci-next muted small">(g::t(lang, K::NextScheduledRun)) ": " rel_time(lang: lang, stamp: next.as_str())</p>
2182- }
2183- if rows.is_empty() {
2184- empty_state(title: g::t(lang, K::NoRunsYet), hint: Some(g::t(lang, K::NoRunsHint)))
2185- } else {
2186- <p class="ci-scale">(scale.as_str())</p>
2187- <ul class="ci-run-list">
2188- for row in rows.iter() {
2189- <li data-kb-row="">
2190- <a class="ci-row" href=(row.href.as_str()) aria-current=(row.current)>
2191- <span class="ci-row-title">commit_line(subject: row.title.clone())</span>
2192- <span class="ci-row-line">
2193- <svg class="ci-bar" viewBox="0 0 1000 6" preserveAspectRatio="none" aria-hidden="true" data-origin=(row.origin.as_str()) data-scale=(row.scale.as_str())>
2194- for seg in row.bar.iter() {
2195- <rect class=(seg.class.as_str()) x=(seg.x.as_str()) y=(seg.y.as_str()) width=(seg.w.as_str()) height=(seg.h.as_str()) data-tick=(seg.tick.as_deref()) data-key=(seg.key.as_deref())/>
2196- }
2197- </svg>
2198- if let Some(est) = row.est.as_ref() {
2199- <progress class="ci-est" max="100" value=(est.pct.as_str()) data-est="true" data-since=(row.since.as_deref()) data-expected=(est.expected.as_str())></progress>
2200- <span class="ci-row-dur" data-since=(row.since.as_deref()) data-expected=(est.expected.as_str()) data-left=(est.left.as_str()) data-over=(est.over.as_str()) data-lm=(est.minutes.as_str())>(row.duration.as_str())</span>
2201- } else {
2202- <span class="ci-row-dur" data-since=(row.since.as_deref())>(row.duration.as_str())</span>
2203- }
2204- </span>
2205- <span class="ci-row-meta">(row.meta.head.as_str())<time datetime=(row.meta.at.as_str()) data-rel="true">(row.meta.age.as_str())</time>(row.meta.hint.as_str())</span>
2206- </a>
2207- if let Some((action, token)) = row.rerun.as_ref() {
2208- <form method="post" action=(action.as_str()) class="ci-row-rerun-form" data-kb-rerun="">
2209- <input type="hidden" name="csrf" value=(token.as_str())>
2210- <button type="submit" class="act ci-row-rerun">(g::t(lang, K::Rerun))</button>
2211- </form>
2233+ <div class="sheet ci-side">
2234+ <div class="sheet-tools">
2235+ <strong>(g::t(lang, K::Runs))</strong>
2236+ <span class="hint ci-count">(total)</span>
2237+ <span class="hint ci-scale">(scale.as_str())</span>
2238+ </div>
2239+ if let Some(next) = next_scheduled.as_ref() {
2240+ <p class="ci-next hint">(g::t(lang, K::NextScheduledRun)) ": " rel_time(lang: lang, stamp: next.as_str())</p>
2241+ }
2242+ if rows.is_empty() {
2243+ empty_state(title: g::t(lang, K::NoRunsYet), hint: Some(g::t(lang, K::NoRunsHint)))
2244+ } else {
2245+ <div class="ci-run-list">
2246+ for row in rows.iter() {
2247+ <div class="ci-run-item">
2248+ <a class="line ci-row" href=(row.href.as_str()) aria-current=(row.current) data-kb-row="">
2249+ <span class=(format!("tick {}", row.tick))></span>
2250+ <span class="name">commit_line(subject: row.title.clone())</span>
2251+ <svg class="ci-bar" viewBox="0 0 1000 6" preserveAspectRatio="none" aria-hidden="true" data-origin=(row.origin.as_str()) data-scale=(row.scale.as_str())>
2252+ for seg in row.bar.iter() {
2253+ <rect class=(seg.class.as_str()) x=(seg.x.as_str()) y=(seg.y.as_str()) width=(seg.w.as_str()) height=(seg.h.as_str()) data-tick=(seg.tick.as_deref()) data-key=(seg.key.as_deref())/>
2254+ }
2255+ </svg>
2256+ if let Some(est) = row.est.as_ref() {
2257+ <progress class="ci-est" max="100" value=(est.pct.as_str()) data-est="true" data-since=(row.since.as_deref()) data-expected=(est.expected.as_str())></progress>
2258+ <span class="val"><span class="ci-row-meta">(row.meta.head.as_str())<time datetime=(row.meta.at.as_str()) data-rel="true">(row.meta.age.as_str())</time>(row.meta.hint.as_str())</span> " · " <span class="ci-row-dur" data-since=(row.since.as_deref()) data-expected=(est.expected.as_str()) data-left=(est.left.as_str()) data-over=(est.over.as_str()) data-lm=(est.minutes.as_str())>(row.duration.as_str())</span></span>
2259+ } else {
2260+ <span class="val"><span class="ci-row-meta">(row.meta.head.as_str())<time datetime=(row.meta.at.as_str()) data-rel="true">(row.meta.age.as_str())</time>(row.meta.hint.as_str())</span> " · " <span class="ci-row-dur" data-since=(row.since.as_deref())>(row.duration.as_str())</span></span>
22122261 }
2213- </li>
2214- }
2215- </ul>
2216- }
2217- if newer_href.is_some() || older_href.is_some() {
2218- <nav class="pager">
2219- if let Some(href) = newer_href {
2220- <a href=(href.as_str())>(g::t(lang, K::Newer))</a>
2221- }
2222- <span class="muted small">(page_label.as_str())</span>
2223- if let Some(href) = older_href {
2224- <a href=(href.as_str())>(g::t(lang, K::Older))</a>
2225- }
2226- </nav>
2227- }
2228- </section>
2262+ </a>
2263+ if let Some((action, token)) = row.rerun.as_ref() {
2264+ <form method="post" action=(action.as_str()) class="act-form ci-row-rerun-form" data-kb-rerun="">
2265+ <input type="hidden" name="csrf" value=(token.as_str())>
2266+ <button type="submit" class="act ci-row-rerun">(g::t(lang, K::Rerun))</button>
2267+ </form>
2268+ }
2269+ </div>
2270+ }
2271+ </div>
2272+ }
2273+ if newer_href.is_some() || older_href.is_some() {
2274+ <nav class="pager">
2275+ if let Some(href) = newer_href {
2276+ <a href=(href.as_str())>(g::t(lang, K::Newer))</a>
2277+ }
2278+ <span class="muted small">(page_label.as_str())</span>
2279+ if let Some(href) = older_href {
2280+ <a href=(href.as_str())>(g::t(lang, K::Older))</a>
2281+ }
2282+ </nav>
2283+ }
2284+ </div>
22292285 })
22302286 }
22312287
2232-/// The runs page body. The header (the Run workflow and badge menus, the count) is the list's, and the
2233-/// split view sits in the live region. The selected run is marked in the list and drawn on the right.
2288+/// The runs page body: the repo head with the Run workflow and badge menus beside its title, then the
2289+/// runs sheet. The live region is the list's stream, so the list re-renders when a run changes.
22342290 #[component]
22352291 async fn runs_body(
22362292 head: RepoHead,
@@ -2238,11 +2294,10 @@ async fn runs_body(
22382294 notice: Option<(&'static str, bool)>,
22392295 live: Option<String>,
22402296 list: ListView,
2241- detail: Option<RunDetail>,
22422297 ) -> Result<impl View> {
22432298 let (fm, fs) = duration_templates(lang);
22442299 Ok(view! {
2245- repo_head(head: RepoHead { live: String::new(), ..head })
2300+ repo_head(head: RepoHead { live: String::new(), ..head }, ci_menus(lang: lang, list: &list))
22462301 if let Some((text, is_error)) = notice {
22472302 if is_error {
22482303 alert(message: text)
@@ -2250,7 +2305,7 @@ async fn runs_body(
22502305 <p class="state" role="status">(text)</p>
22512306 }
22522307 }
2253- <div data-live=(live.as_deref()) class="ci-split fit-pane" data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())>
2308+ <div data-live=(live.as_deref()) class="work ci-split" data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())>
22542309 <svg class="ci-defs" width="0" height="0" focusable="false" aria-hidden="true">
22552310 <defs>
22562311 <pattern id="ci-hatch" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
@@ -2258,18 +2313,7 @@ async fn runs_body(
22582313 </pattern>
22592314 </defs>
22602315 </svg>
2261- run_side(lang: lang, list: list)
2262- <section class="ci-detail">
2263- if let Some(run) = detail {
2264- run_head(lang: lang, run: &run, all_href: None)
2265- <div class="ci-tl-main">
2266- run_jobs(lang: lang, run: &run)
2267- run_log(lang: lang, run: &run, timeline: false)
2268- </div>
2269- } else {
2270- empty_state(title: g::t(lang, K::NoRunsYet), hint: Some(g::t(lang, K::NoRunsHint)))
2271- }
2272- </section>
2316+ runs_sheet(lang: lang, list: &list)
22732317 </div>
22742318 })
22752319 }
@@ -2380,191 +2424,190 @@ async fn run_timeline(lang: Lang, run: &RunDetail) -> Result<impl View> {
23802424 #[component]
23812425 async fn run_head(lang: Lang, run: &RunDetail, all_href: Option<String>) -> Result<impl View> {
23822426 let cancel_action = format!("{}/cancel", run.action_base);
2427+ let rerun_failed_shown = run.writer_csrf.is_some()
2428+ && run.can_rerun_failed
2429+ && !run.can_approve
2430+ && !run.can_cancel;
23832431 Ok(view! {
2384- <header class="ci-tl-head" data-run=(run.number)>
2385- <div class="ci-tl-headmain">
2386- <div class="ci-tl-line">
2387- <span class="ci-tl-no">(g::t(lang, K::RunNumber)) (run.number)</span>
2388- <h2 class="ci-tl-title">(headline(run.title.as_str()))</h2>
2389- <details class="ci-tl-more">
2390- <summary>(crate::i18n::code::t(lang, crate::i18n::code::K::ShowFullMessage))</summary>
2391- <p class="small">(run.title.as_str())</p>
2392- </details>
2393- if let Some(csrf) = run.writer_csrf.as_ref() {
2394- <div class="acts ci-tl-actions">
2395- if run.can_approve {
2396- action_button(action: format!("{}/approve", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::ApproveAndRun))
2397- }
2398- if run.can_cancel && run.stopping {
2399- <button type="button" class="ci-stopping" disabled="disabled">(g::t(lang, K::StoppingButton))</button>
2400- } else if run.can_cancel {
2401- confirm_post(lang: lang, csrf: csrf.as_str(), action: cancel_action.as_str(), label: g::t(lang, K::Cancel), message: crate::pages::passkeys::s(lang, "The run stops and its unfinished jobs are cancelled.", "Çalıştırma durur ve bitmemiş işleri iptal edilir.").to_owned(), confirm: crate::pages::passkeys::s(lang, "Yes, cancel", "Evet, iptal et"), danger: true, fields: vec![])
2402- }
2403- if run.can_rerun_failed && !run.can_approve && !run.can_cancel {
2404- action_button(action: format!("{}/rerun-failed", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::RerunFailed))
2405- }
2406- if !run.can_approve && run.reachable {
2407- action_button(action: format!("{}/rerun", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::Rerun))
2408- }
2409- </div>
2432+ <section class="head">
2433+ <div class="head-title">
2434+ <h1 class=(run.headline_class)>(run.headline.as_str())</h1>
2435+ if let Some(csrf) = run.writer_csrf.as_ref() {
2436+ if run.can_approve {
2437+ action_button(action: format!("{}/approve", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::ApproveAndRun), primary: true)
24102438 }
2411- </div>
2412- <div class="ci-tl-meta">
2413- <span class=(run.state_class.as_str())>(run.state.as_str())</span>
2414- <span class="muted">(run.trigger.as_str()) " \u{b7} " (run.branch.as_str())</span>
2415- if let Some(href) = run.commit_href.as_ref() {
2416- <a href=(href.as_str())><code>(run.commit.as_str())</code></a>
2417- } else {
2418- <code class="muted" title=(g::t(lang, K::CiCommitOverwritten))>(run.commit.as_str())</code>
2439+ if run.can_cancel && run.stopping {
2440+ <button type="button" class="ci-stopping" disabled="disabled">(g::t(lang, K::StoppingButton))</button>
2441+ } else if run.can_cancel {
2442+ confirm_post(lang: lang, csrf: csrf.as_str(), action: cancel_action.as_str(), label: g::t(lang, K::Cancel), message: crate::pages::passkeys::s(lang, "The run stops and its unfinished jobs are cancelled.", "Çalıştırma durur ve bitmemiş işleri iptal edilir.").to_owned(), confirm: crate::pages::passkeys::s(lang, "Yes, cancel", "Evet, iptal et"), fields: vec![])
24192443 }
2420- if !run.actor.is_empty() {
2421- <span class="muted">(run.actor.as_str())</span>
2444+ if rerun_failed_shown {
2445+ action_button(action: format!("{}/rerun-failed", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::RerunFailed), primary: true)
24222446 }
2423- if !run.duration.is_empty() {
2424- if let Some(est) = run.est.as_ref() {
2425- <span class="ci-tl-dur" data-since=(run.since.as_deref()) data-expected=(est.expected.as_str()) data-left=(est.left.as_str()) data-over=(est.over.as_str()) data-lm=(est.minutes.as_str())>(run.duration.as_str())</span>
2426- } else {
2427- <span class="ci-tl-dur" data-since=(run.since.as_deref())>(run.duration.as_str())</span>
2428- }
2429- }
2430- <time class="muted" datetime=(run.when_at.as_str()) data-rel="true">(run.when.as_str())</time>
2431- if let Some(href) = all_href {
2432- <a class="small ci-all-runs" href=(href.as_str())>(tl::t(lang, TK::AllRuns))</a>
2447+ if !run.can_approve && run.reachable {
2448+ action_button(action: format!("{}/rerun", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::Rerun), primary: !rerun_failed_shown)
24332449 }
2434- </div>
2435- if let Some(est) = run.est.as_ref() {
2436- <progress class="ci-est ci-est-run" max="100" value=(est.pct.as_str()) data-est="true" data-since=(run.since.as_deref()) data-expected=(est.expected.as_str())></progress>
24372450 }
24382451 </div>
2439- </header>
2452+ <p class="head-sub">
2453+ <span class="b" data-run=(run.number)>(run.title.as_str())</span>
2454+ <span class="sep" aria-hidden="true">"·"</span>
2455+ <span>(run.trigger.as_str()) " \u{b7} " (run.branch.as_str())</span>
2456+ <span class="sep" aria-hidden="true">"·"</span>
2457+ if let Some(href) = run.commit_href.as_ref() {
2458+ <a class="mono" href=(href.as_str())>(run.commit.as_str())</a>
2459+ } else {
2460+ <span class="mono" title=(g::t(lang, K::CiCommitOverwritten))>(run.commit.as_str())</span>
2461+ }
2462+ if !run.actor.is_empty() {
2463+ <span class="sep" aria-hidden="true">"·"</span>
2464+ <span>(run.actor.as_str())</span>
2465+ }
2466+ <span class="sep" aria-hidden="true">"·"</span>
2467+ <time datetime=(run.when_at.as_str()) data-rel="true">(run.when.as_str())</time>
2468+ if !run.duration.is_empty() {
2469+ <span class="sep" aria-hidden="true">"·"</span>
2470+ if let Some(est) = run.est.as_ref() {
2471+ <span class="ci-tl-dur" data-since=(run.since.as_deref()) data-expected=(est.expected.as_str()) data-left=(est.left.as_str()) data-over=(est.over.as_str()) data-lm=(est.minutes.as_str())>(run.duration.as_str())</span>
2472+ } else {
2473+ <span class="ci-tl-dur" data-since=(run.since.as_deref())>(run.duration.as_str())</span>
2474+ }
2475+ }
2476+ if let Some(href) = all_href {
2477+ <span class="sep" aria-hidden="true">"·"</span>
2478+ <a href=(href.as_str())>(tl::t(lang, TK::AllRuns))</a>
2479+ }
2480+ </p>
2481+ if let Some(est) = run.est.as_ref() {
2482+ <progress class="ci-est ci-est-run" max="100" value=(est.pct.as_str()) data-est="true" data-since=(run.since.as_deref()) data-expected=(est.expected.as_str())></progress>
2483+ }
2484+ </section>
24402485 })
24412486 }
24422487
2443-/// The class of a job's row: `ci-tl-sub` for a matrix combination, `ci-tl-hassteps` when its steps
2444-/// dropdown sits under the row.
2445-fn job_row_class(job: &JobLine) -> Option<&'static str> {
2446- match (job.sub, job.steps.is_empty()) {
2447- (true, false) => Some("ci-tl-sub ci-tl-hassteps"),
2448- (true, true) => Some("ci-tl-sub"),
2449- (false, false) => Some("ci-tl-hassteps"),
2450- (false, true) => None,
2451- }
2452-}
2453-
2454-/// The class of a step's row under its job: a matrix combination's steps sit one level in.
2455-fn step_class(sub: bool) -> &'static str {
2456- if sub {
2457- "ci-tl-step ci-tl-step-sub"
2458- } else {
2459- "ci-tl-step"
2460- }
2461-}
2462-
2463-/// The jobs pane (300 px): `Jobs`, one 36 px row per job with its dot, name, image and time at the right,
2464-/// then the run's artifacts. Each job's steps are a dropdown under its row, open for the selected job.
2488+/// The jobs of a run with more than one job: one `.job-row` each, its name, its tick and a mini strip
2489+/// of its steps. The selected job's row is marked; its steps are the strip under the head.
24652490 #[component]
24662491 async fn run_jobs(lang: Lang, run: &RunDetail) -> Result<impl View> {
2467- let steps_label = crate::pages::passkeys::s(lang, "Steps", "Adımlar");
24682492 Ok(view! {
2469- <section class="ci-pane ci-tl-jobs">
2470- <h2 class="ci-tl-label">(g::t(lang, K::Jobs))</h2>
2471- if run.jobs.is_empty() {
2472- <p class="muted small ci-tl-pad">(g::t(lang, K::NoJobs))</p>
2473- } else {
2474- <ul class="ci-tl-list">
2475- for job in run.jobs.iter() {
2476- if let Some(group) = job.group.as_ref() {
2477- <li class="ci-tl-group">(group.as_str())</li>
2493+ if run.jobs.len() > 1 {
2494+ <div class="jobs ci-tl-list">
2495+ for job in run.jobs.iter() {
2496+ if let Some(group) = job.group.as_ref() {
2497+ <p class="hint ci-tl-group">(group.as_str())</p>
2498+ }
2499+ <a class=(if job.selected { "job-row sel ci-tl-job" } else { "job-row ci-tl-job" }) href=(job.pick.as_str()) aria-current=(if job.selected { "true" } else { "false" }) data-kb-row="">
2500+ <span class=(format!("tick {}", job.tick))></span>
2501+ <span class="name">(job.name.as_str())</span>
2502+ if !job.detail.is_empty() {
2503+ <span class="hint">(job.detail.as_str())</span>
24782504 }
2479- <li class=(job_row_class(job)) data-kb-row="">
2480- <a class="ci-tl-job" href=(job.pick.as_str()) aria-current=(if job.selected { "true" } else { "false" })>
2481- <span class=(job.dot.as_str())></span>
2482- <span class="ci-tl-name">(job.name.as_str())</span>
2483- if !job.detail.is_empty() {
2484- <span class="ci-tl-tag">(job.detail.as_str())</span>
2485- }
2486- if job.stopping {
2487- <span class="muted small">(g::t(lang, K::StateStopping))</span>
2488- }
2489- if job.duration.is_empty() {
2490- <span class="ci-tl-dur muted">(g::t(lang, K::Waiting))</span>
2491- } else {
2492- <span class="ci-tl-dur" data-since=(job.since.as_deref())>(job.duration.as_str())</span>
2493- }
2494- if !job.step_bar.is_empty() {
2495- <svg class="ci-tl-stepbar" viewBox="0 0 1000 3" preserveAspectRatio="none" aria-hidden="true" focusable="false">
2496- for r in job.step_bar.iter() {
2497- <rect class=(r.class.as_str()) x=(r.x.as_str()) y=(r.y.as_str()) width=(r.w.as_str()) height=(r.h.as_str())/>
2498- }
2499- </svg>
2505+ if job.stopping {
2506+ <span class="hint">(g::t(lang, K::StateStopping))</span>
2507+ }
2508+ if job.duration.is_empty() {
2509+ <span class="hint ci-tl-dur">(g::t(lang, K::Waiting))</span>
2510+ } else {
2511+ <span class="ci-tl-dur" data-since=(job.since.as_deref())>(job.duration.as_str())</span>
2512+ }
2513+ if !job.steps.is_empty() {
2514+ <span class="strip">
2515+ for step in job.steps.iter() {
2516+ <span class=(format!("seg {} {}", step.seg, step.fr))><span class="bar"></span></span>
25002517 }
2518+ </span>
2519+ }
2520+ </a>
2521+ }
2522+ </div>
2523+ }
2524+ })
2525+}
2526+
2527+/// The steps of the selected job, one `.seg` each: a step's name, its time and its state. A step the
2528+/// URL picks is marked, and a step with its log opens that part of the log.
2529+#[component]
2530+async fn run_strip(run: &RunDetail) -> Result<impl View> {
2531+ let job = run.jobs.iter().find(|job| job.selected);
2532+ Ok(view! {
2533+ if let Some(job) = job {
2534+ if !job.steps.is_empty() {
2535+ <div class="strip">
2536+ for step in job.steps.iter() {
2537+ if let Some(href) = step.href.as_ref() {
2538+ <a class=(format!("seg {} {}{}", step.seg, step.fr, if step.selected { " sel" } else { "" })) href=(href.as_str()) aria-current=(if step.selected { "true" } else { "false" })>
2539+ <span class="bar">
2540+ if step.pct.is_some() || step.value.is_some() {
2541+ <progress class=(format!("ci-est ci-tl-stepprog {}", step.state_class)) max="100" value=(step.value.as_deref()) data-est=(step.pct.as_ref().map(|_| "true")) data-since=(step.pct.as_ref().and_then(|_| step.since.as_deref())) data-expected=(step.expected_secs.as_deref())></progress>
2542+ }
2543+ </span>
2544+ <span class="lab">(step.name.as_str())<em class="ci-tl-dur" data-since=(step.since.as_deref())>(step.duration.as_str())</em>
2545+ if let Some(expected) = step.expected.as_ref() {
2546+ <em class="ci-tl-stepexp">(expected.as_str())</em>
2547+ }
2548+ </span>
25012549 </a>
2502- if !job.steps.is_empty() {
2503- <details class="ci-tl-steps" data-steps-job=(job.id.as_str()) open=(job.selected)>
2504- <summary class="ci-tl-steptoggle" aria-label=(steps_label)><span class="ci-chev" aria-hidden="true"></span></summary>
2505- <ul class="ci-tl-steplist">
2506- for step in job.steps.iter() {
2507- <li>
2508- if let Some(href) = step.href.as_ref() {
2509- <a class=(step_class(job.sub)) href=(href.as_str()) aria-current=(if step.selected { "true" } else { "false" })>
2510- <span class=(format!("ci-tl-stepmark {}", step.mark))></span>
2511- <span class="ci-tl-stepname">(step.name.as_str())</span>
2512- <span class="ci-tl-dur" data-since=(step.since.as_deref())>(step.duration.as_str())</span>
2513- if let Some(expected) = step.expected.as_ref() {
2514- <span class="ci-tl-stepexp">(expected.as_str())</span>
2515- }
2516- <progress class=(format!("ci-est ci-tl-stepprog {}", step.state_class)) max="100" value=(step.value.as_deref()) data-est=(step.pct.as_ref().map(|_| "true")) data-since=(step.pct.as_ref().and_then(|_| step.since.as_deref())) data-expected=(step.expected_secs.as_deref())></progress>
2517- </a>
2518- } else {
2519- <div class=(step_class(job.sub))>
2520- <span class=(format!("ci-tl-stepmark {}", step.mark))></span>
2521- <span class="ci-tl-stepname">(step.name.as_str())</span>
2522- <span class="ci-tl-dur" data-since=(step.since.as_deref())>(step.duration.as_str())</span>
2523- if let Some(expected) = step.expected.as_ref() {
2524- <span class="ci-tl-stepexp">(expected.as_str())</span>
2525- }
2526- <progress class=(format!("ci-est ci-tl-stepprog {}", step.state_class)) max="100" value=(step.value.as_deref()) data-est=(step.pct.as_ref().map(|_| "true")) data-since=(step.pct.as_ref().and_then(|_| step.since.as_deref())) data-expected=(step.expected_secs.as_deref())></progress>
2527- </div>
2528- }
2529- </li>
2530- }
2531- </ul>
2532- </details>
2533- }
2534- </li>
2550+ } else {
2551+ <span class=(format!("seg {} {}", step.seg, step.fr))>
2552+ <span class="bar"></span>
2553+ <span class="lab">(step.name.as_str())<em class="ci-tl-dur" data-since=(step.since.as_deref())>(step.duration.as_str())</em></span>
2554+ </span>
2555+ }
25352556 }
2536- </ul>
2557+ </div>
25372558 }
2538- if !run.artifacts.is_empty() {
2539- <div class="ci-tl-artline">
2540- <h3 class="ci-tl-label">(g::t(lang, K::Artifacts))</h3>
2559+ }
2560+ })
2561+}
2562+
2563+/// The run's artifacts: the zip of all of them and one download line each.
2564+#[component]
2565+async fn run_artifacts(lang: Lang, run: &RunDetail) -> Result<impl View> {
2566+ Ok(view! {
2567+ if !run.artifacts.is_empty() {
2568+ <div class="sec">
2569+ <div class="acts">
2570+ <h2>(g::t(lang, K::Artifacts))</h2>
25412571 if let Some(href) = run.zip_href.as_ref() {
25422572 <a class="act" href=(href.as_str()) download="">(g::t(lang, K::DownloadAll))</a>
25432573 }
25442574 </div>
2545- <ul class="ci-art-list">
2546- for artifact in run.artifacts.iter() {
2547- <li>
2548- <span class="ci-art-name">(artifact.name.as_str())</span>
2549- <span class="muted small">(artifact.job.as_str()) " \u{b7} " (artifact.size.as_str())</span>
2550- <a class="ci-art-dl" href=(artifact.href.as_str()) download="">(g::t(lang, K::Download))</a>
2551- </li>
2552- }
2553- </ul>
2554- }
2555- </section>
2575+ for artifact in run.artifacts.iter() {
2576+ <div class="line">
2577+ <span class="name">(artifact.name.as_str())</span>
2578+ <span class="val">(artifact.job.as_str()) " \u{b7} " (artifact.size.as_str()) " " <a class="act" href=(artifact.href.as_str()) download="">(g::t(lang, K::Download))</a></span>
2579+ </div>
2580+ }
2581+ </div>
2582+ }
25562583 })
25572584 }
25582585
25592586 /// The log pane: a 48 px bar with the Log and Timeline tabs and the log's tools, then the selected job's
25602587 /// log on `--bg` (or the config errors and the fail-first block above it). The timeline is the other tab.
25612588 #[component]
2562-async fn run_log(lang: Lang, run: &RunDetail, timeline: bool) -> Result<impl View> {
2589+async fn run_log(
2590+ lang: Lang,
2591+ run: &RunDetail,
2592+ timeline: bool,
2593+ owner: String,
2594+ repo: String,
2595+ bars: Vec<StripBar>,
2596+) -> Result<impl View> {
2597+ let job_name = run
2598+ .jobs
2599+ .iter()
2600+ .find(|job| job.selected)
2601+ .map(|job| job.name.clone())
2602+ .unwrap_or_default();
25632603 Ok(view! {
2564- <section class="ci-pane ci-tl-log">
2604+ <section class="sheet ci-tl-log">
25652605 <input type="radio" name="ci-view" id="ci-view-log" class="ci-tl-radio" checked=(if timeline { None } else { Some("checked") })>
25662606 <input type="radio" name="ci-view" id="ci-view-timeline" class="ci-tl-radio" checked=(if timeline { Some("checked") } else { None })>
2567- <div class="ci-logbar ci-tl-logbar">
2607+ <div class="sheet-tools ci-logbar ci-tl-logbar">
2608+ if !job_name.is_empty() {
2609+ <strong>(job_name.as_str())</strong>
2610+ }
25682611 <div class="tabs ci-tl-tabs">
25692612 <label for="ci-view-log" class="ci-tl-tab ci-tl-tab-log">(g::t(lang, K::Log))</label>
25702613 <label for="ci-view-timeline" class="ci-tl-tab ci-tl-tab-timeline">(g::t(lang, K::Timeline))</label>
@@ -2597,7 +2640,7 @@ async fn run_log(lang: Lang, run: &RunDetail, timeline: bool) -> Result<impl Vie
25972640 if !run.warnings.is_empty() {
25982641 <section class="ci-warnings" role="status">
25992642 <p class="ci-warnings-title">(g::t(lang, K::ConfigWarnings))</p>
2600- <p class="muted small">(g::t(lang, K::ConfigWarningsHint))</p>
2643+ <p class="hint">(g::t(lang, K::ConfigWarningsHint))</p>
26012644 <ul>
26022645 for warning in run.warnings.iter() {
26032646 <li><code>(warning.as_str())</code></li>
@@ -2611,25 +2654,32 @@ async fn run_log(lang: Lang, run: &RunDetail, timeline: bool) -> Result<impl Vie
26112654 }
26122655 if let Some(log) = run.log.as_ref() {
26132656 if log.truncated {
2614- <p class="muted small ci-tl-pad">
2657+ <p class="hint">
26152658 (crate::pages::passkeys::s(lang, "Showing the end of this log.", "Günlüğün sonu gösteriliyor."))
26162659 " " <a href=(log.log_href.as_str())>(crate::pages::passkeys::s(lang, "Full log", "Tam günlük"))</a>
26172660 </p>
26182661 }
2619- <pre class="ci-log ci-tl-code" data-empty=(crate::pages::passkeys::s(lang, "No output yet.", "Henüz çıktı yok.")) data-live=(log.live.as_deref()) data-live-log="true" data-offset=(log.offset.as_str()) data-first=(log.first_line.as_str()) data-log-start=(log.at_step.then_some("true"))>(log.text.as_str())</pre>
2662+ <pre class="ci-log ci-tl-code" data-fail-at=(run.failing.as_ref().filter(|_| !log.at_step).and_then(FailFirst::line_no).map(|no| no.to_string())) data-empty=(crate::pages::passkeys::s(lang, "No output yet.", "Henüz çıktı yok.")) data-live=(log.live.as_deref()) data-live-log="true" data-offset=(log.offset.as_str()) data-first=(log.first_line.as_str()) data-log-start=(log.at_step.then_some("true"))>(log.text.as_str())</pre>
26202663 } else {
2621- <p class="muted ci-tl-pad">(g::t(lang, K::NoJobs))</p>
2664+ <p class="hint">(g::t(lang, K::NoJobs))</p>
26222665 }
26232666 </div>
26242667 <div class="ci-tl-panel ci-tl-panel-timeline">
26252668 run_timeline(lang: lang, run: run)
2669+ run_artifacts(lang: lang, run: run)
2670+ <div class="sec ci-dock">
2671+ <p class="hint">(crate::pages::passkeys::s(lang, "bar height is lines changed", "çubuk yüksekliği değişen satır sayısıdır"))</p>
2672+ <div class="dock-history">
2673+ history_strip(lang: lang, owner: owner, repo: repo, bars: bars)
2674+ </div>
2675+ </div>
26262676 </div>
26272677 </section>
26282678 })
26292679 }
2630-/// The run page body: a one-line header with the run's actions, the jobs (left) and the selected job's
2631-/// log (right), and the history dock under them. The page fits the window: the panes scroll inside.
2632-/// The live region is the run list's stream, so the page re-renders when a run or a job changes.
2680+/// The run page body, with no repo tabs: the run's head (its state as the title, its actions, its commit
2681+/// line), the jobs of the run, the strip of the selected job's steps and the sheet with its log and the
2682+/// history. The live region wraps all of it, so the page re-renders when a run or a job changes.
26332683 #[component]
26342684 async fn run_body(
26352685 head: RepoHead,
@@ -2642,11 +2692,13 @@ async fn run_body(
26422692 bars: Vec<StripBar>,
26432693 timeline: bool,
26442694 all_href: String,
2645- list: ListView,
26462695 ) -> Result<impl View> {
26472696 let (fm, fs) = duration_templates(lang);
2697+ let archived = head.archived;
26482698 Ok(view! {
2649- repo_head(head: RepoHead { live: String::new(), ..head })
2699+ if archived {
2700+ <p class="state" role="status">(crate::i18n::code::t(lang, crate::i18n::code::K::ArchivedNotice))</p>
2701+ }
26502702 if let Some((text, is_error)) = notice {
26512703 if is_error {
26522704 alert(message: text)
@@ -2654,7 +2706,7 @@ async fn run_body(
26542706 <p class="state" role="status">(text)</p>
26552707 }
26562708 }
2657- <div data-live=(live.as_deref()) class="ci-split fit-pane" data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())>
2709+ <div data-live=(live.as_deref()) class="ci-split ci-run" data-run=(run.number) data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())>
26582710 <svg class="ci-defs" width="0" height="0" focusable="false" aria-hidden="true">
26592711 <defs>
26602712 <pattern id="ci-hatch" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
@@ -2662,20 +2714,10 @@ async fn run_body(
26622714 </pattern>
26632715 </defs>
26642716 </svg>
2665- run_side(lang: lang, list: list)
2666- <div class="ci-run" data-run=(run.number)>
26672717 run_head(lang: lang, run: &run, all_href: Some(all_href))
2668- <div class="ci-tl-main">
2669- run_jobs(lang: lang, run: &run)
2670- run_log(lang: lang, run: &run, timeline: timeline)
2671- </div>
2672- <section class="ci-pane ci-dock">
2673- <p class="ci-dock-note">(crate::pages::passkeys::s(lang, "bar height is lines changed", "çubuk yüksekliği değişen satır sayısıdır"))</p>
2674- <div class="dock-history">
2675- history_strip(lang: lang, owner: owner, repo: repo, bars: bars)
2676- </div>
2677- </section>
2678- </div>
2718+ run_jobs(lang: lang, run: &run)
2719+ run_strip(run: &run)
2720+ run_log(lang: lang, run: &run, timeline: timeline, owner: owner, repo: repo, bars: bars)
26792721 </div>
26802722 })
26812723 }
@@ -2692,11 +2734,11 @@ async fn runs_list_page(cx: &Cx) -> Result<impl View> {
26922734 live,
26932735 page_title,
26942736 list,
2695- detail,
2737+ ..
26962738 } = runs_split(cx, None, None, None).await?;
26972739 Ok(view! {
26982740 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
2699- runs_body(head: head, lang: lang, notice: notice, live: live, list: list, detail: detail))
2741+ runs_body(head: head, lang: lang, notice: notice, live: live, list: list))
27002742 })
27012743 }
27022744
@@ -2714,8 +2756,8 @@ async fn run_page(cx: &Cx) -> Result<impl View> {
27142756 notice,
27152757 live,
27162758 page_title,
2717- list,
27182759 detail,
2760+ ..
27192761 } = runs_split(cx, Some(&number), wanted.as_deref(), wanted_step).await?;
27202762 let Some(run) = detail else {
27212763 return Err(not_found().into());
@@ -2728,7 +2770,7 @@ async fn run_page(cx: &Cx) -> Result<impl View> {
27282770 let all_href = ci_href(&title_of(&ctx));
27292771 Ok(view! {
27302772 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
2731- 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))
2773+ run_body(head: head, lang: lang, notice: notice, live: live, run: run, owner: owner, repo: repo, bars: bars, timeline: timeline, all_href: all_href))
27322774 })
27332775 }
27342776
crates/forge-web/src/pages/ci_tests.rsmodified+18 -14
@@ -549,8 +549,8 @@ fn current_href(html: &str) -> Option<&str> {
549549 link[at..].split('"').next()
550550 }
551551
552-/// `/ci` draws the newest run and `/ci/runs/n` draws run n. The drawn run is marked in the list. A run
553-/// that is not on the list page is still drawn, and no row of the list is marked for it.
552+/// `/ci` is the run list alone, each row opening its run; `/ci/runs/n` draws run n. A run that is not
553+/// on the list page is still drawn, and no row of the list is marked for it.
554554 #[tokio::test]
555555 async fn split_view_draws_the_newest_run_or_the_one_named() {
556556 let dir = tempfile::tempdir().expect("tempdir");
@@ -558,12 +558,12 @@ async fn split_view_draws_the_newest_run_or_the_one_named() {
558558 let first = run_with(&fx, &["build"], false).await;
559559 let second = run_with(&fx, &["build"], false).await;
560560 let tahinli = Some(cookie_for("tahinli-token"));
561- let newest = get(&fx.app, RUN_BASE, tahinli.as_deref()).await.text();
562- assert!(newest.contains(&format!("data-run=\"{}\"", second.number)));
563- assert_eq!(
564- current_href(&newest),
565- Some(format!("{RUN_BASE}/runs/{}", second.number).as_str())
566- );
561+ let list = get(&fx.app, RUN_BASE, tahinli.as_deref()).await.text();
562+ for run in [&first, &second] {
563+ assert!(list.contains(&format!("href=\"{RUN_BASE}/runs/{}\"", run.number)));
564+ }
565+ assert!(!list.contains("data-run="), "the list draws no run");
566+ assert_eq!(current_href(&list), None);
567567 let named = get(
568568 &fx.app,
569569 &format!("{RUN_BASE}/runs/{}", first.number),
@@ -572,13 +572,14 @@ async fn split_view_draws_the_newest_run_or_the_one_named() {
572572 .await
573573 .text();
574574 assert!(named.contains(&format!("data-run=\"{}\"", first.number)));
575- // The run page keeps the list beside it, so the run row and the selected job are both marked. On a
576- // phone the list gives way to the All runs link.
575+ // The run page is the run alone: the All runs link goes back to the list, and a one-job run has
576+ // no job list to mark.
577577 assert!(
578578 named.contains(&format!("href=\"{RUN_BASE}\"")),
579579 "All runs link"
580580 );
581- assert_eq!(named.matches("aria-current=\"true\"").count(), 2);
581+ assert!(!named.contains("ci-run-list"));
582+ assert_eq!(named.matches("aria-current=\"true\"").count(), 0);
582583
583584 // Thirty runs make two pages. Run 1 is on page 2, so page 1 marks no row and draws run 1.
584585 for _ in 0..28 {
@@ -592,9 +593,7 @@ async fn split_view_draws_the_newest_run_or_the_one_named() {
592593 .await
593594 .text();
594595 assert!(off_page.contains(&format!("data-run=\"{}\"", first.number)));
595- // The list shows the newest page, which does not hold this run: only its selected job is marked.
596- assert!(off_page.contains("ci-run-list"));
597- assert_eq!(off_page.matches("aria-current=\"true\"").count(), 1);
596+ // A run off the list's first page opens all the same.
598597 assert!(off_page.contains(&format!("data-live=\"{RUN_BASE}/events\"")));
599598 let rows = get(&fx.app, &format!("{RUN_BASE}?page=2"), tahinli.as_deref())
600599 .await
@@ -1482,6 +1481,11 @@ async fn running_runs_and_run_page_previews() {
14821481 html.contains("data-tick=\"rest\""),
14831482 "the hatched remainder follows the clock"
14841483 );
1484+ // The timeline is on the run's own page.
1485+ let html = get(&fx.app, &format!("{RUN_BASE}/runs/1"), Some(&cookie))
1486+ .await
1487+ .text()
1488+ .to_owned();
14851489 assert!(
14861490 html.contains("data-live-gantt=\"true\""),
14871491 "the timeline is live"
crates/forge-web/src/pages/code_search.rsmodified+48 -49
@@ -203,57 +203,57 @@ async fn search_page(cx: &Cx) -> Result<impl View> {
203203 let ref_label = ref_name.clone();
204204
205205 let mut header = ctx.head(state, "code").await?;
206- header.hide_search = true;
207206 // Results of a branch go stale when it moves: the header's stream follows that branch's head.
208207 header.live = branch_live_url(&owner_name, &repo_name, &ref_name);
209208 Ok(view! {
210209 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
211210 repo_head(head: header)
212- <div class="search-page">
213- <form method="get" action=(action.as_str()) class="search-form" role="search">
214- <div class="plain-search">
215- <input type="search" name="q" value=(q.as_str()) data-live-search="" autocomplete="off" placeholder=(g::t(lang, K::SearchCodePlaceholder)) aria-label=(g::t(lang, K::SearchCodePlaceholder))>
216- <button type="submit" class="sr-only">(g::t(lang, K::SearchButton))</button>
217- </div>
218- <div class="field-pair">
219- <div class="field">
220- <label for="search-ref">(g::t(lang, K::RefField))</label>
221- // Not live: a half-typed branch name is a 404 page. It searches on leaving the field.
222- <input id="search-ref" type="text" name="ref" value=(ref_value.as_str()) placeholder=(ctx.repo.default_branch.as_str()) data-autosubmit=(true)>
223- </div>
224- <div class="field">
225- <label for="search-path">(g::t(lang, K::PathField))</label>
226- <input id="search-path" type="text" name="path" value=(path_value.as_str()) placeholder="src/**/*.rs" data-live-search="">
211+ <form method="get" action=(action.as_str()) class="sheet search-form" role="search">
212+ <div class="sheet-tools">
213+ <div class="plain-search">
214+ <input type="search" name="q" value=(q.as_str()) data-live-search="" autocomplete="off" placeholder=(g::t(lang, K::SearchCodePlaceholder)) aria-label=(g::t(lang, K::SearchCodePlaceholder))>
215+ <button type="submit" class="sr-only">(g::t(lang, K::SearchButton))</button>
227216 </div>
228217 </div>
229- <label class="switch">
230- <input type="checkbox" name="case" value="1" checked=(match_case) data-autosubmit=(true)>
231- <span>(g::t(lang, K::MatchCase))</span>
232- </label>
233- <label class="switch">
234- <input type="checkbox" name="regex" value="1" checked=(regex) data-autosubmit=(true)>
235- <span>(g::t(lang, K::RegexOption))</span>
236- </label>
237- </form>
238- if empty_repo {
239- <p class="state">(empty_message.as_str())</p>
240- } else if no_query {
241- <p class="state">(g::t(lang, K::SearchFilesAt)) <code>(ref_label.as_str())</code> "."</p>
242- }
243- if let Some(msg) = notice {
244- <p class="state" role="alert">(msg.as_str())</p>
245- }
246- if !no_query && !empty_repo {
247- if has_results {
248- <p class="hint">(summary.as_str())
249- if truncated {
250- (g::t(lang, K::ShowingFirst)) (shown.as_str()) (g::t(lang, K::ShowingFirstEnd))
251- }
252- </p>
253- <section class="search-results">
218+ <section class="sec">
219+ <div class="fields">
220+ <div class="field">
221+ <label for="search-ref">(g::t(lang, K::RefField))</label>
222+ // Not live: a half-typed branch name is a 404 page. It searches on leaving the field.
223+ <input id="search-ref" type="text" name="ref" value=(ref_value.as_str()) placeholder=(ctx.repo.default_branch.as_str()) data-autosubmit=(true)>
224+ </div>
225+ <div class="field">
226+ <label for="search-path">(g::t(lang, K::PathField))</label>
227+ <input id="search-path" type="text" name="path" value=(path_value.as_str()) placeholder="src/**/*.rs" data-live-search="">
228+ </div>
229+ <label class="switch">
230+ <input type="checkbox" name="case" value="1" checked=(match_case) data-autosubmit=(true)>
231+ <span>(g::t(lang, K::MatchCase))</span>
232+ </label>
233+ <label class="switch">
234+ <input type="checkbox" name="regex" value="1" checked=(regex) data-autosubmit=(true)>
235+ <span>(g::t(lang, K::RegexOption))</span>
236+ </label>
237+ </div>
238+ </section>
239+ if empty_repo {
240+ <p class="state">(empty_message.as_str())</p>
241+ } else if no_query {
242+ <p class="state">(g::t(lang, K::SearchFilesAt)) <code>(ref_label.as_str())</code> "."</p>
243+ }
244+ if let Some(msg) = notice {
245+ <p class="state" role="alert">(msg.as_str())</p>
246+ }
247+ if !no_query && !empty_repo {
248+ if has_results {
249+ <p class="hint">(summary.as_str())
250+ if truncated {
251+ (g::t(lang, K::ShowingFirst)) (shown.as_str()) (g::t(lang, K::ShowingFirstEnd))
252+ }
253+ </p>
254254 for group in groups.iter() {
255- <div class="search-file">
256- <h3 class="search-file-name"><a href=(group.href.as_str())>(group.path.as_str())</a></h3>
255+ <section class="sec search-file">
256+ <h2><a href=(group.href.as_str())>(group.path.as_str())</a></h2>
257257 <ul class="search-hits">
258258 for line in group.lines.iter() {
259259 <li>
@@ -270,14 +270,13 @@ async fn search_page(cx: &Cx) -> Result<impl View> {
270270 </li>
271271 }
272272 </ul>
273- </div>
273+ </section>
274274 }
275- </section>
276- } else if searched {
277- empty_state(title: g::t(lang, K::NoMatches))
275+ } else if searched {
276+ empty_state(title: g::t(lang, K::NoMatches))
277+ }
278278 }
279- }
280- </div>
279+ </form>
281280 )
282281 })
283282 }
crates/forge-web/src/pages/commit.rsmodified+92 -87
@@ -172,7 +172,9 @@ async fn commit_page(cx: &Cx) -> Result<impl View> {
172172 .collect();
173173 let is_root = parents.is_empty();
174174 let body = trailers::strip_co_authors(&info.message);
175- let has_body = !body.trim().is_empty();
175+ // The first line is the head's title, so only what follows it is shown as the message.
176+ let body_rest = body.split_once('\n').map_or("", |(_, rest)| rest).trim();
177+ let has_body = !body_rest.is_empty();
176178 let mut coauthors: Vec<CoAuthorView> = Vec::new();
177179 for co in trailers::co_authors(&info.message) {
178180 if co.email.eq_ignore_ascii_case(&info.author_email) {
@@ -224,6 +226,7 @@ async fn commit_page(cx: &Cx) -> Result<impl View> {
224226 let show_full = g::t(lang, K::ShowFullMessage);
225227 let full_oid = info.oid.clone();
226228 let message = emojify(&body).into_owned();
229+ let rest_message = emojify(body_rest).into_owned();
227230 let statuses = state.store.statuses_for(&ctx.repo.id, &full_oid).await?;
228231 let checks = (!statuses.is_empty()).then(|| StatusSummary::from_rows(&statuses));
229232 let sig = signatures::badges(state, &ctx.repo, std::slice::from_ref(&full_oid))
@@ -257,98 +260,100 @@ async fn commit_page(cx: &Cx) -> Result<impl View> {
257260 header.live = ref_live::live_url(&owner_name, &repo_name);
258261 Ok(view! {
259262 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
260- repo_head(head: header)
261- <h1 class="h1 commit-summary-title">(heading.as_str())</h1>
262- <div class="hint commit-facts">
263- <button type="button" class="act quiet commit-hash" data-copy="commit-oid" data-copied=(copied) data-failed=(copy_failed) title=(full_oid.as_str())>(short.as_str())</button>
264- <code id="commit-oid" class="sr-only">(full_oid.as_str())</code>
265- if let Some(badge) = sig {
266- <span class=(badge.class) title=(badge.title.as_str())>(badge.label)</span>
267- }
268- <span class="commit-author-line" title=(who_title.as_str())>
269- <strong>(author.name.as_str())</strong>
270- if has_coauthors {
271- (g::t(lang, K::CoAuthorAnd))
272- for c in coauthors.iter() {
273- if c.sep { ", " }
274- if let Some(href) = c.href.as_ref() {
275- <a class="coauthor" href=(href.as_str())>
276- if let Some(src) = c.avatar.as_ref() {
277- <img class="avatar coauthor-avatar" src=(src.as_str()) alt="" width="16" height="16">
278- }
279- (c.name.as_str())
280- </a>
281- } else {
282- <span class="coauthor" title=(c.email.as_str())>(c.name.as_str())</span>
283- }
284- }
285- if folded {
286- ", "
287- <details class="coauthors-more">
288- <summary class="act">(others.as_str())</summary>
289- <ul class="coauthors-list" aria-label=(coauthors_label)>
290- for c in rest.iter() {
291- <li>
292- if let Some(href) = c.href.as_ref() {
293- <a class="coauthor" href=(href.as_str())>
294- if let Some(src) = c.avatar.as_ref() {
295- <img class="avatar coauthor-avatar" src=(src.as_str()) alt="" width="16" height="16">
296- }
297- (c.name.as_str())
298- </a>
299- } else {
300- <span class="coauthor" title=(c.email.as_str())>(c.name.as_str())</span>
301- }
302- </li>
303- }
304- </ul>
305- </details>
306- }
263+ repo_head(head: header, title: Some(heading.clone()),
264+ <a class="act" href=(tree_href.as_str())>(g::t(lang, K::BrowseFiles))</a>
265+ )
266+ <div class="sheet">
267+ <div class="sheet-tools">
268+ <button type="button" class="act commit-hash" data-copy="commit-oid" data-copied=(copied) data-failed=(copy_failed) title=(full_oid.as_str())>(short.as_str())</button>
269+ <code id="commit-oid" class="sr-only">(full_oid.as_str())</code>
270+ if let Some(badge) = sig {
271+ <span class=(badge.class) title=(badge.title.as_str())>(badge.label)</span>
307272 }
308- </span>
309- <time data-rel="true" datetime=(author.iso.as_str()) title=(author.absolute.as_str())>(author.relative.as_str())</time>
310- if is_root {
311- <span>(g::t(lang, K::RootCommit))</span>
312- } else {
313- <span>(g::t(lang, K::ParentLabel))
314- for p in parents.iter() {
315- <a class="mono" href=(p.href.as_str())>(p.short.as_str())</a>
273+ <span class="commit-author-line" title=(who_title.as_str())>
274+ <strong>(author.name.as_str())</strong>
275+ if has_coauthors {
276+ (g::t(lang, K::CoAuthorAnd))
277+ for c in coauthors.iter() {
278+ if c.sep { ", " }
279+ if let Some(href) = c.href.as_ref() {
280+ <a class="coauthor" href=(href.as_str())>
281+ if let Some(src) = c.avatar.as_ref() {
282+ <img class="avatar coauthor-avatar" src=(src.as_str()) alt="" width="16" height="16">
283+ }
284+ (c.name.as_str())
285+ </a>
286+ } else {
287+ <span class="coauthor" title=(c.email.as_str())>(c.name.as_str())</span>
288+ }
289+ }
290+ if folded {
291+ ", "
292+ <details class="coauthors-more">
293+ <summary class="act">(others.as_str())</summary>
294+ <ul class="coauthors-list" aria-label=(coauthors_label)>
295+ for c in rest.iter() {
296+ <li>
297+ if let Some(href) = c.href.as_ref() {
298+ <a class="coauthor" href=(href.as_str())>
299+ if let Some(src) = c.avatar.as_ref() {
300+ <img class="avatar coauthor-avatar" src=(src.as_str()) alt="" width="16" height="16">
301+ }
302+ (c.name.as_str())
303+ </a>
304+ } else {
305+ <span class="coauthor" title=(c.email.as_str())>(c.name.as_str())</span>
306+ }
307+ </li>
308+ }
309+ </ul>
310+ </details>
311+ }
316312 }
317313 </span>
314+ <time data-rel="true" datetime=(author.iso.as_str()) title=(author.absolute.as_str())>(author.relative.as_str())</time>
315+ if is_root {
316+ <span>(g::t(lang, K::RootCommit))</span>
317+ } else {
318+ <span>(g::t(lang, K::ParentLabel))
319+ for p in parents.iter() {
320+ <a class="mono" href=(p.href.as_str())>(p.short.as_str())</a>
321+ }
322+ </span>
323+ }
324+ if let Some(summary) = checks {
325+ checks_summary(summary: summary, lang: StatusLang(lang))
326+ }
327+ </div>
328+ if let Some(msg) = parsed.as_ref() {
329+ <section class="sec">
330+ <ul class="commit-groups" aria-label=(changes_label)>
331+ for group in msg.groups.iter() {
332+ <li class="commit-group">
333+ <span class="mono commit-kind">(group.kind.as_str())</span>
334+ <ul class="commit-clauses">
335+ for clause in group.clauses.iter() {
336+ <li>(clause.as_str())</li>
337+ }
338+ </ul>
339+ </li>
340+ }
341+ </ul>
342+ <details class="reveal commit-full-message">
343+ <summary class="act">(show_full)</summary>
344+ <div class="opened">
345+ <pre class="code commit-message"><code>(message.as_str())</code></pre>
346+ </div>
347+ </details>
348+ </section>
318349 }
319- if let Some(summary) = checks {
320- checks_summary(summary: summary, lang: StatusLang(lang))
350+ if parsed.is_none() && has_body {
351+ <section class="sec">
352+ <pre class="code commit-message"><code>(rest_message.as_str())</code></pre>
353+ </section>
321354 }
322355 </div>
323- <div class="acts">
324- <a class="act" href=(tree_href.as_str())>(g::t(lang, K::BrowseFiles))</a>
325- </div>
326- if let Some(msg) = parsed.as_ref() {
327- <ul class="commit-groups" aria-label=(changes_label)>
328- for group in msg.groups.iter() {
329- <li class="commit-group">
330- <span class="mono commit-kind">(group.kind.as_str())</span>
331- <ul class="commit-clauses">
332- for clause in group.clauses.iter() {
333- <li>(clause.as_str())</li>
334- }
335- </ul>
336- </li>
337- }
338- </ul>
339- <details class="reveal commit-full-message">
340- <summary class="act">(show_full)</summary>
341- <div class="opened">
342- <pre class="code commit-message"><code>(message.as_str())</code></pre>
343- </div>
344- </details>
345- }
346- if parsed.is_none() && has_body {
347- <pre class="code commit-message"><code>(message.as_str())</code></pre>
348- }
349- <div class="commit-diff">
350- diff_section(diff: &diff, owner: owner_name.as_str(), repo: repo_name.as_str(), oid: info.oid.as_str(), parent: parent.as_deref(), subject: g::t(lang, K::ThisCommit), lang: DiffLang(lang), opts: opts)
351- </div>
356+ diff_section(diff: &diff, owner: owner_name.as_str(), repo: repo_name.as_str(), oid: info.oid.as_str(), parent: parent.as_deref(), subject: g::t(lang, K::ThisCommit), lang: DiffLang(lang), opts: opts)
352357 )
353358 })
354359 }
crates/forge-web/src/pages/commits.rsmodified+62 -72
@@ -5,7 +5,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
55
66 use std::collections::HashMap;
77
8-use forge_core::store::commit_status::{CommitStatus, StatusState};
8+use forge_core::store::commit_status::CommitStatus;
99 use forge_core::tz::{format_in_tz, local_date};
1010 use forge_git::browse::{self, CommitInfo};
1111 use forge_git::history;
@@ -152,18 +152,6 @@ fn day_label(
152152 }
153153 }
154154
155-impl CommitRow {
156- /// The CI dot's class: none without statuses, ok, bad, or live while a status is pending.
157- pub(crate) fn dot(&self) -> &'static str {
158- match self.status.state {
159- None => "commits-dot none",
160- Some(StatusState::Success) => "commits-dot ok",
161- Some(StatusState::Failure | StatusState::Error) => "commits-dot bad",
162- Some(StatusState::Pending) => "commits-dot live",
163- }
164- }
165-}
166-
167155 /// A signature badge prepared for display: the CSS classes, the visible label and the title.
168156 #[derive(Clone)]
169157 pub(crate) struct SigBadgeView {
@@ -355,74 +343,76 @@ async fn commits_page(cx: &Cx) -> Result<impl View> {
355343 Ok(view! {
356344 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
357345 repo_head(head: header)
358- <p class="hint">(g::t(lang, K::CommitsOn)) <code>(ref_name.as_str())</code></p>
359- if has_filter {
360- <p class="sub">(g::t(lang, K::FilteredTo)) <code>(filter_text.as_str())</code> <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilter))</a></p>
361- }
362- if empty {
363- <p class="state">(g::t(lang, K::NoCommits))</p>
364- if has_filter {
365- <div class="acts"><a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilter))</a></div>
366- }
367- } else {
368- for group in groups.iter() {
369- <section class="sec">
370- <h2>(group.label.as_str())</h2>
371- <div class="commits-list">
372- for row in group.rows.iter() {
373- if let Some(body) = row.body.clone() {
374- <details class="row-open commits-d" data-kb-row="" data-arrive=(row.oid.as_str())>
375- <summary class="line commits-r">
376- <span class="commits-chev" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg></span>
377- <span class=(row.dot())></span>
346+ <div class="sheet">
347+ <div class="sheet-tools">
348+ <strong>(g::t(lang, K::CommitsOn))</strong> <code>(ref_name.as_str())</code>
349+ if has_filter {
350+ <span class="hint">(g::t(lang, K::FilteredTo)) <code>(filter_text.as_str())</code></span>
351+ <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilter))</a>
352+ }
353+ </div>
354+ if empty {
355+ <p class="state">(g::t(lang, K::NoCommits))</p>
356+ if has_filter {
357+ <div class="acts"><a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilter))</a></div>
358+ }
359+ } else {
360+ for group in groups.iter() {
361+ <section class="sec">
362+ <h2>(group.label.as_str())</h2>
363+ <div class="commits-list">
364+ for row in group.rows.iter() {
365+ if let Some(body) = row.body.clone() {
366+ <details class="row-open commits-d" data-kb-row="" data-arrive=(row.oid.as_str())>
367+ <summary class="line commits-r">
368+ <a class="name commit-summary" href=(row.commit_href.as_str())>commit_line(subject: row.summary.clone())</a>
369+ <span class="val"><span title=(row.email.as_str())>(row.author.as_str())</span> " · " <time class="commits-age" data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time></span>
370+ if let Some(badge) = row.sig.clone() {
371+ <span class=(badge.class) title=(badge.title.as_str())>(badge.label)</span>
372+ }
373+ <a class="sha commits-sha" href=(row.commit_href.as_str())>(row.short.as_str())</a>
374+ </summary>
375+ <div class="opened">
376+ <pre class="code commits-x">(body.as_str())</pre>
377+ if !row.status.items.is_empty() {
378+ <div class="commit-status">
379+ status_list(items: row.status.items.clone(), lang: lang)
380+ </div>
381+ }
382+ <div class="acts">
383+ <a class="act" href=(row.tree_href.as_str())>(g::t(lang, K::BrowseFilesShort))</a>
384+ </div>
385+ </div>
386+ </details>
387+ } else {
388+ <div class="line commits-r" data-kb-row="" data-arrive=(row.oid.as_str())>
378389 <a class="name commit-summary" href=(row.commit_href.as_str())>commit_line(subject: row.summary.clone())</a>
379390 <span class="val"><span title=(row.email.as_str())>(row.author.as_str())</span> " · " <time class="commits-age" data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time></span>
380391 if let Some(badge) = row.sig.clone() {
381392 <span class=(badge.class) title=(badge.title.as_str())>(badge.label)</span>
382393 }
383394 <a class="sha commits-sha" href=(row.commit_href.as_str())>(row.short.as_str())</a>
384- </summary>
385- <div class="opened">
386- <pre class="code commits-x">(body.as_str())</pre>
387- if !row.status.items.is_empty() {
388- <div class="commit-status">
389- status_list(items: row.status.items.clone(), lang: lang)
390- </div>
391- }
392- <div class="acts">
393- <a class="act quiet" href=(row.tree_href.as_str())>(g::t(lang, K::BrowseFilesShort))</a>
394- </div>
395+ commit_status(summary: row.status.clone(), lang: StatusLang(lang))
396+ <a class="act" href=(row.tree_href.as_str())>(g::t(lang, K::BrowseFilesShort))</a>
395397 </div>
396- </details>
397- } else {
398- <div class="line commits-r" data-kb-row="" data-arrive=(row.oid.as_str())>
399- <span class=(row.dot())></span>
400- <a class="name commit-summary" href=(row.commit_href.as_str())>commit_line(subject: row.summary.clone())</a>
401- <span class="val"><span title=(row.email.as_str())>(row.author.as_str())</span> " · " <time class="commits-age" data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time></span>
402- if let Some(badge) = row.sig.clone() {
403- <span class=(badge.class) title=(badge.title.as_str())>(badge.label)</span>
404- }
405- <a class="sha commits-sha" href=(row.commit_href.as_str())>(row.short.as_str())</a>
406- commit_status(summary: row.status.clone(), lang: StatusLang(lang))
407- <a class="act quiet" href=(row.tree_href.as_str())>(g::t(lang, K::BrowseFilesShort))</a>
408- </div>
398+ }
409399 }
410- }
411- </div>
412- </section>
413- }
414- }
415- if has_newer || has_older {
416- <nav class="sub">
417- if has_newer {
418- <a href=(newer_href.as_str())>(g::t(lang, K::NewerLink))</a>
419- }
420- <span>(page_label.as_str())</span>
421- if has_older {
422- <a href=(older_href.as_str())>(g::t(lang, K::OlderLink))</a>
400+ </div>
401+ </section>
423402 }
424- </nav>
425- }
403+ }
404+ if has_newer || has_older {
405+ <nav class="sub">
406+ if has_newer {
407+ <a href=(newer_href.as_str())>(g::t(lang, K::NewerLink))</a>
408+ }
409+ <span>(page_label.as_str())</span>
410+ if has_older {
411+ <a href=(older_href.as_str())>(g::t(lang, K::OlderLink))</a>
412+ }
413+ </nav>
414+ }
415+ </div>
426416 )
427417 })
428418 }
crates/forge-web/src/pages/compare.rsmodified+67 -66
@@ -324,81 +324,81 @@ async fn compare_view(
324324 let error_text = error.unwrap_or_default();
325325 let csrf = csrf_of(&ctx);
326326 let pulls_action = repo_href(&owner, &name, "pulls", "");
327- let heading_base = base.clone();
328- let heading_head = head.clone();
327+ let compare_title = format!("{}{base}...{head}", g::t(lang, K::ComparingPrefix));
329328
330329 let mut header = ctx.head(state, "commits").await?;
331330 header.live = ref_live::live_url(&ctx.repo.owner_name, &ctx.repo.name);
332331 let __cx = cx;
333332 Ok(view! {
334333 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
335- repo_head(head: header)
336- if has_commits {
337- <section class="sec">
338- <h2>(commits_label.as_str())</h2>
339- <div>
340- for row in rows.iter() {
341- <div class="line" data-kb-row="">
342- <a class="name commit-summary" href=(row.commit_href.as_str())>commit_line(subject: row.summary.clone())</a>
343- <span class="val">
344- (row.author.as_str())
345- if !row.email.is_empty() {
346- " · " (row.email.as_str())
347- }
348- if lang == i18n::Lang::Tr {
349- " · " <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time> " " (g::t(lang, K::Committed))
350- } else {
351- " · " (g::t(lang, K::Committed)) " " <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
352- }
353- </span>
354- <a class="sha commit-oid" href=(row.commit_href.as_str())>(row.short.as_str())</a>
355- <a class="act quiet" href=(row.tree_href.as_str())>(g::t(lang, K::BrowseFiles))</a>
334+ repo_head(head: header, title: Some(compare_title))
335+ <div class="sheet">
336+ if has_commits {
337+ <section class="sec">
338+ <h2>(commits_label.as_str())</h2>
339+ <div>
340+ for row in rows.iter() {
341+ <div class="line" data-kb-row="">
342+ <a class="name commit-summary" href=(row.commit_href.as_str())>commit_line(subject: row.summary.clone())</a>
343+ <span class="val">
344+ (row.author.as_str())
345+ if !row.email.is_empty() {
346+ " · " (row.email.as_str())
347+ }
348+ if lang == i18n::Lang::Tr {
349+ " · " <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time> " " (g::t(lang, K::Committed))
350+ } else {
351+ " · " (g::t(lang, K::Committed)) " " <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
352+ }
353+ </span>
354+ <a class="sha commit-oid" href=(row.commit_href.as_str())>(row.short.as_str())</a>
355+ <a class="act" href=(row.tree_href.as_str())>(g::t(lang, K::BrowseFiles))</a>
356+ </div>
357+ }
356358 </div>
359+ </section>
360+ }
361+ <section class="sec">
362+ if unrelated {
363+ <p class="state">(g::t(lang, K::Unrelated))</p>
357364 }
358- </div>
359- </section>
360- }
361- <section class="sec">
362- <h2>(g::t(lang, K::ComparingPrefix)) <code>(heading_base.as_str())</code> "..." <code>(heading_head.as_str())</code></h2>
363- if unrelated {
364- <p class="state">(g::t(lang, K::Unrelated))</p>
365- }
366- if nothing {
367- <p class="state">(g::t(lang, K::NothingToCompare))</p>
368- }
369- if show_form {
370- <div class="acts">
371- reveal(label: g::t(lang, K::OpenPullRequest), id: Some("open-pull"), open: has_error,
372- if has_error {
373- alert(message: error_text.as_str())
365+ if nothing {
366+ <p class="state">(g::t(lang, K::NothingToCompare))</p>
374367 }
375- <form method="post" action=(pulls_action.as_str()) class="fields">
376- <input type="hidden" name="csrf" value=(csrf.as_str())>
377- <input type="hidden" name="base" value=(base.as_str())>
378- <input type="hidden" name="head" value=(head_for_form.as_str())>
379- <div class="field">
380- <label for="pull-title">(g::t(lang, K::TitleLabel))</label>
381- <input id="pull-title" type="text" name="title" value=(form_title.as_str())>
382- </div>
383- <div class="field">
384- <label for="pull-body">(g::t(lang, K::DescriptionLabel))</label>
385- <textarea id="pull-body" name="body" rows="8">(form_body.as_str())</textarea>
386- </div>
368+ if show_form {
387369 <div class="acts">
388- <button type="submit" class="primary">(g::t(lang, K::CreatePullRequest))</button>
389- <button type="submit" class="act" name="draft" value="1">(g::t(lang, K::CreateDraftPullRequest))</button>
370+ reveal(label: g::t(lang, K::OpenPullRequest), id: Some("open-pull"), open: has_error,
371+ if has_error {
372+ alert(message: error_text.as_str())
373+ }
374+ <form method="post" action=(pulls_action.as_str()) class="fields">
375+ <input type="hidden" name="csrf" value=(csrf.as_str())>
376+ <input type="hidden" name="base" value=(base.as_str())>
377+ <input type="hidden" name="head" value=(head_for_form.as_str())>
378+ <div class="field">
379+ <label for="pull-title">(g::t(lang, K::TitleLabel))</label>
380+ <input id="pull-title" type="text" name="title" value=(form_title.as_str())>
381+ </div>
382+ <div class="field">
383+ <label for="pull-body">(g::t(lang, K::DescriptionLabel))</label>
384+ <textarea id="pull-body" name="body" rows="8">(form_body.as_str())</textarea>
385+ </div>
386+ <div class="acts">
387+ <button type="submit" class="primary">(g::t(lang, K::CreatePullRequest))</button>
388+ <button type="submit" class="act" name="draft" value="1">(g::t(lang, K::CreateDraftPullRequest))</button>
389+ </div>
390+ </form>
391+ )
390392 </div>
391- </form>
392- )
393- </div>
394- }
395- if has_existing {
396- <p class="state">(g::t(lang, K::AlreadyOpen)) <a class="act" href=(existing_href.as_str())>(g::t(lang, K::ViewIt))</a></p>
397- }
398- if archived_note {
399- <p class="state">(g::t(lang, K::ArchivedNoPulls))</p>
400- }
401- </section>
393+ }
394+ if has_existing {
395+ <p class="state">(g::t(lang, K::AlreadyOpen)) <a class="act" href=(existing_href.as_str())>(g::t(lang, K::ViewIt))</a></p>
396+ }
397+ if archived_note {
398+ <p class="state">(g::t(lang, K::ArchivedNoPulls))</p>
399+ }
400+ </section>
401+ </div>
402402 if show_diff {
403403 for d in diff.iter() {
404404 diff_section(diff: d, owner: owner.as_str(), repo: name.as_str(), oid: cmp.head_oid.as_str(), parent: parent.as_deref(), subject: g::t(lang, K::ThisComparison), lang: DiffLang(lang), opts: opts.clone())
@@ -426,9 +426,9 @@ async fn picker_view(cx: &Cx, ctx: RepoCtx, base: String, head: String) -> Resul
426426 let __cx = cx;
427427 Ok(view! {
428428 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
429- repo_head(head: header)
429+ repo_head(head: header, title: Some(g::t(lang, K::CompareBranches).to_owned()))
430+ <div class="sheet fit">
430431 <section class="sec">
431- <h2>(g::t(lang, K::CompareBranches))</h2>
432432 <form method="get" action=(action.as_str()) class="fields">
433433 <div class="field">
434434 <label for="compare-base">(g::t(lang, K::BasePrefix))</label>
@@ -446,6 +446,7 @@ async fn picker_view(cx: &Cx, ctx: RepoCtx, base: String, head: String) -> Resul
446446 <button type="submit" class="primary">(g::t(lang, K::Compare))</button>
447447 </form>
448448 </section>
449+ </div>
449450 )
450451 })
451452 }
crates/forge-web/src/pages/discussion_settings.rsmodified+2 -2
@@ -23,7 +23,7 @@ use crate::views::repo_href;
2323 path_param!(owner);
2424 path_param!(repo);
2525
26-/// The Discussions topic: a hint, then one switch. `enabled` is the current state. The switch submits
26+/// The Discussions topic: one switch, then its hint. `enabled` is the current state. The switch submits
2727 /// the form on change (`data-autosubmit`); an unchecked box sends no `enabled`, which the handler reads as off.
2828 #[component]
2929 pub(crate) async fn discussions_card(
@@ -40,13 +40,13 @@ pub(crate) async fn discussions_card(
4040 Ok(view! {
4141 <section class="sec" id="discussions">
4242 <h2>(g::t(lang, K::Discussions))</h2>
43- <p class="hint">(g::t(lang, K::DiscussionsDescription))</p>
4443 <form method="post" action=(action.as_str())>
4544 <input type="hidden" name="csrf" value=(csrf.as_str())>
4645 <label class="switch">
4746 <input type="checkbox" name="enabled" value="1" checked=(enabled) data-autosubmit="true">
4847 <span>(switch_label)</span>
4948 </label>
49+ <p class="hint">(g::t(lang, K::DiscussionsDescription))</p>
5050 </form>
5151 </section>
5252 })
crates/forge-web/src/pages/discussion_view.rsmodified+30 -30
@@ -25,7 +25,7 @@ use crate::pages::repo_ctx::{RepoCtx, load_repo};
2525 use crate::pages::tree::link_context;
2626 use crate::render::markdown::{LinkContext, render_markdown};
2727 use crate::state::AppState;
28-use crate::views::parts::{confirm_act, post_act, reveal};
28+use crate::views::parts::{SubPart, confirm_act, post_act, reveal};
2929 use crate::views::{avatar_url, display_name, now_unix, shell, user_href, user_link};
3030
3131 path_param!(owner);
@@ -184,9 +184,9 @@ async fn comment_article(item: CommentView) -> Result<impl View> {
184184 } = item;
185185 let profile = user_href(&login);
186186 let class = if accepted {
187- "sec discussion-accepted"
187+ "sec thread-entry discussion-accepted"
188188 } else {
189- "sec"
189+ "sec thread-entry"
190190 };
191191 let answer_fields = vec![
192192 ("comment_id".to_owned(), id.clone()),
@@ -198,18 +198,18 @@ async fn comment_article(item: CommentView) -> Result<impl View> {
198198 let edit_open = format!("edit-open-{id}");
199199 Ok(view! {
200200 <article class=(class) id=(anchor.as_str())>
201- <p class="state">
201+ <header class="thread-head">
202202 if deleted {
203203 (g::t(lang, K::CommentDeleted))
204204 } else {
205205 <a href=(profile.as_str()) aria-label=(login.as_str())><img class="avatar avatar-sm" src=(avatar.as_str()) alt="" width="24" height="24"></a>
206- " " user_link(shown: author.as_str(), login: login.as_str())
207- " " <time data-rel="true" datetime=(when.iso.as_str()) title=(when.absolute.as_str())>(when.relative.as_str())</time>
206+ <strong>user_link(shown: author.as_str(), login: login.as_str())</strong>
207+ <time data-rel="true" datetime=(when.iso.as_str()) title=(when.absolute.as_str())>(when.relative.as_str())</time>
208208 }
209209 if accepted {
210210 " · " (g::t(lang, K::Answer))
211211 }
212- </p>
212+ </header>
213213 if !deleted {
214214 <div class="markdown-body">(Unescaped::new_unchecked(html))</div>
215215 if let Some(bar) = reactions {
@@ -414,31 +414,29 @@ async fn discussion_page(
414414 let header = ctx.head(state, "discussions").await?;
415415
416416 let comments_label = g::comments_total(lang, discussion.comment_count);
417+ let mut sub = vec![SubPart::text(category)];
418+ if answered {
419+ sub.push(SubPart::text(g::t(lang, K::Answered)));
420+ }
421+ if locked {
422+ sub.push(SubPart::text(g::t(lang, K::Locked)));
423+ }
424+ sub.push(SubPart::link(author.clone(), author_profile.clone()));
425+ sub.push(SubPart::text(opened.relative.clone()));
426+ sub.push(SubPart::text(comments_label));
417427 Ok(view! { cx =>
418428 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
419- repo_head(head: header)
420- <section class="sec" data-live=(live_href.as_str()) data-live-now="">
421- <h1 class="h1">(discussion.title.as_str()) " " <span class="hint">(number_label.as_str())</span></h1>
422- <p class="hint">
423- (category)
424- if answered {
425- " " (g::t(lang, K::Answered))
426- }
427- if locked {
428- " " (g::t(lang, K::Locked))
429- }
430- " " user_link(shown: author.as_str(), login: author_login.as_str())
431- " " (g::t(lang, K::OpenedThis)) " "
432- <time data-rel="true" datetime=(opened.iso.as_str()) title=(opened.absolute.as_str())>(opened.relative.as_str())</time>
433- " " (g::t(lang, K::OpenedSeparator)) " "
434- (comments_label.as_str())
435- </p>
436- </section>
437- <article class="sec" id="discussion-body">
438- <p class="state">
429+ repo_head(head: header, title: Some(discussion.title.clone()), sub: sub,
430+ <span class="num">(number_label.as_str())</span>
431+ )
432+ <div class="work" data-live=(live_href.as_str()) data-live-now="">
433+ <div class="sheet">
434+ <article class="sec thread-entry" id="discussion-body">
435+ <header class="thread-head">
439436 <a href=(author_profile.as_str()) aria-label=(author.as_str())><img class="avatar avatar-sm" src=(author_avatar.as_str()) alt="" width="24" height="24"></a>
440- " " user_link(shown: author.as_str(), login: author_login.as_str())
441- </p>
437+ <strong>user_link(shown: author.as_str(), login: author_login.as_str())</strong>
438+ <time data-rel="true" datetime=(opened.iso.as_str()) title=(opened.absolute.as_str())>(opened.relative.as_str())</time>
439+ </header>
442440 <div class="markdown-body">(Unescaped::new_unchecked(body_html))</div>
443441 if let Some(bar) = body_bar {
444442 reaction_row(lang: lang, bar: bar)
@@ -487,13 +485,15 @@ async fn discussion_page(
487485 <p class="state">(g::t(lang, K::ArchivedDiscussions))</p>
488486 }
489487 if triage && !archived {
490- <section class="sec">
488+ <section class="sec meta">
491489 <h2>(g::t(lang, K::Conversation))</h2>
492490 <div class="acts">
493491 post_act(label: lock_label, action: lock_action.as_str(), csrf: csrf.as_str(), fields: vec![("locked".to_owned(), lock_value.to_owned())])
494492 </div>
495493 </section>
496494 }
495+ </div>
496+ </div>
497497 )
498498 })
499499 }
crates/forge-web/src/pages/discussions.rsmodified+65 -64
@@ -22,11 +22,12 @@ use crate::i18n::{self, Lang};
2222 use crate::pages::discussion_live::list_live_url;
2323 use crate::pages::issue_meta::{can_triage, form_field, form_pairs, refusal_message};
2424 use crate::pages::issue_parts::When;
25-use crate::pages::issues_list::{list_href, state_tab};
25+use crate::pages::issues_list::list_href;
2626 use crate::pages::repo::repo_head;
2727 use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo};
2828 use crate::render::markdown::mentioned_usernames;
2929 use crate::state::AppState;
30+use crate::views::parts::{RailItem, SubPart, rail};
3031 use crate::views::{alert, csrf_field, now_unix, repo_href, shell, user_link};
3132
3233 path_param!(owner);
@@ -262,18 +263,28 @@ async fn discussions_list_page(cx: &Cx) -> Result<impl View> {
262263 let selected = category.map_or("", |c| c.as_str());
263264 let all_on = category.is_none();
264265 let all_href = list_href(&base, &[]);
265- let all_label = g::t(lang, K::AllCategories);
266266 let nav_label = g::t(lang, K::CategoriesNav);
267- let tabs: Vec<(&'static str, String, bool)> = DISCUSSION_CATEGORIES
268- .iter()
269- .map(|c| {
270- (
271- g::category_label(lang, *c),
272- list_href(&base, &[("category", c.as_str())]),
273- category == Some(*c),
274- )
275- })
276- .collect();
267+ let list_title = match category {
268+ Some(c) => g::category_label(lang, c),
269+ None => g::t(lang, K::AllCategories),
270+ };
271+ let mut rail_items: Vec<RailItem> = vec![RailItem {
272+ name: g::t(lang, K::AllCategories).to_owned(),
273+ val: String::new(),
274+ href: all_href,
275+ current: all_on,
276+ }];
277+ rail_items.extend(DISCUSSION_CATEGORIES.iter().map(|c| RailItem {
278+ name: g::category_label(lang, *c).to_owned(),
279+ val: String::new(),
280+ href: list_href(&base, &[("category", c.as_str())]),
281+ current: category == Some(*c),
282+ }));
283+ let sub = vec![SubPart::text(match lang {
284+ Lang::En if total == 1 => "1 discussion".to_owned(),
285+ Lang::En => format!("{total} discussions"),
286+ Lang::Tr => format!("{total} tartışma"),
287+ })];
277288
278289 let last_page = total.div_ceil(u64::from(PER_PAGE)).max(1);
279290 let has_newer = page > 1;
@@ -302,62 +313,51 @@ async fn discussions_list_page(cx: &Cx) -> Result<impl View> {
302313 let header = ctx.head(state, "discussions").await?;
303314 Ok(view! {
304315 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
305- repo_head(head: header)
306- <div data-live=(live_href.as_str()) data-live-now="">
307- <h1 class="sr-only">(title.as_str())</h1>
308- <nav class="tabs" aria-label=(nav_label)>
309- state_tab(href: all_href.as_str(), text: all_label, current: all_on)
310- for tab in tabs.iter() {
311- state_tab(href: tab.1.as_str(), text: tab.0, current: tab.2)
312- }
313- </nav>
314- if can_start {
315- <div class="sub">
316- <a class="act" href=(new_href.as_str())>(new_label)</a>
317- </div>
318- }
319- if rows.is_empty() {
320- <p class="state">(empty_text)</p>
316+ repo_head(head: header, sub: sub,
321317 if can_start {
322- <div class="acts">
323- <a class="act" href=(new_href.as_str())>(new_label)</a>
324- </div>
318+ <a class="button primary" href=(new_href.as_str())>(new_label)</a>
325319 }
326- } else {
327- <div>
328- for row in rows.iter() {
329- <div class="line issue-row" data-kb-row="">
330- <div class="issue-main">
331- <div class="issue-title-line">
332- <a class="issue-title" href=(row.href.as_str())>(row.title.as_str())</a>
333- <span class="discussion-category">(row.category)</span>
334- </div>
335- <div class="issue-meta muted small">
336- <span>(by_before)</span>
337- <span>user_link(shown: row.author.as_str(), login: row.author.as_str())</span>
338- <span>(by_middle)</span>
320+ )
321+ <div class="work" data-live=(live_href.as_str()) data-live-now="">
322+ rail(label: nav_label, items: rail_items)
323+ <div class="sheet">
324+ <div class="sheet-tools">
325+ <strong>(list_title)</strong>
326+ </div>
327+ if rows.is_empty() {
328+ <p class="state">(empty_text)</p>
329+ if can_start {
330+ <div class="acts">
331+ <a class="act" href=(new_href.as_str())>(new_label)</a>
332+ </div>
333+ }
334+ } else {
335+ for row in rows.iter() {
336+ <div class="line" data-kb-row="">
337+ <a class="name" href=(row.href.as_str())>(row.title.as_str())</a>
338+ <span class="tag">(row.category)</span>
339+ <span class="val">
340+ (by_before) user_link(shown: row.author.as_str(), login: row.author.as_str()) (by_middle)
339341 <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
340- if !by_after.is_empty() {
341- <span>(by_after)</span>
342- }
343- <a class="small muted" href=(row.href.as_str())>(row.comments_text.as_str())</a>
344- </div>
342+ (by_after)
343+ " · "
344+ <a href=(row.href.as_str())>(row.comments_text.as_str())</a>
345+ </span>
345346 </div>
346- </div>
347- }
348- </div>
349- }
350- if has_newer || has_older {
351- <nav class="sub">
352- if has_newer {
353- <a href=(newer_href.as_str())>(newer_label)</a>
347+ }
354348 }
355- <span>(page_label.as_str())</span>
356- if has_older {
357- <a href=(older_href.as_str())>(older_label)</a>
349+ if has_newer || has_older {
350+ <nav class="sub">
351+ if has_newer {
352+ <a href=(newer_href.as_str())>(newer_label)</a>
353+ }
354+ <span>(page_label.as_str())</span>
355+ if has_older {
356+ <a href=(older_href.as_str())>(older_label)</a>
357+ }
358+ </nav>
358359 }
359- </nav>
360- }
360+ </div>
361361 </div>
362362 )
363363 })
@@ -382,8 +382,8 @@ async fn new_discussion_body(
382382 let action = discussions_href(&head.owner, &head.name, "new");
383383 let cancel = discussions_href(&head.owner, &head.name, "");
384384 Ok(view! {
385- repo_head(head: head)
386- <h1 class="sr-only">(g::t(lang, K::NewDiscussion))</h1>
385+ repo_head(head: head, title: Some(g::t(lang, K::NewDiscussion).to_owned()))
386+ <div class="sheet fit">
387387 if let Some(message) = draft.error {
388388 alert(message: message.as_str())
389389 }
@@ -411,6 +411,7 @@ async fn new_discussion_body(
411411 <a class="act quiet" href=(cancel.as_str())>(g::t(lang, K::Cancel))</a>
412412 </div>
413413 </form>
414+ </div>
414415 })
415416 }
416417
crates/forge-web/src/pages/edit_history.rsmodified+16 -15
@@ -23,6 +23,7 @@ use crate::pages::pull_live::pull_live_url;
2323 use crate::pages::repo::repo_head;
2424 use crate::pages::repo_ctx::{RepoCtx, load_repo};
2525 use crate::state::AppState;
26+use crate::views::parts::SubPart;
2627 use crate::views::{display_name, now_unix, repo_href, shell};
2728
2829 path_param!(owner);
@@ -228,6 +229,10 @@ async fn history_page(
228229 let heading = g::history_heading(lang, what);
229230 let back_label = g::back_to_item(lang, number);
230231 let count_label = g::earlier_versions(lang, entries.len());
232+ let sub = vec![
233+ SubPart::link(back_label, back),
234+ SubPart::text(count_label),
235+ ];
231236 // A history follows its item: a new edit adds a version to the list.
232237 let live = match kind_item {
233238 ItemKind::Issue => item_live_url(&owner, &name, number),
@@ -236,22 +241,18 @@ async fn history_page(
236241
237242 Ok(view! { cx =>
238243 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
239- repo_head(head: header)
240- <section class="sec" data-live=(live.as_str()) data-live-now="">
241- <h1 class="h1">(heading.as_str())</h1>
242- <p class="hint">
243- <a href=(back.as_str())>(back_label.as_str())</a>
244- " · "
245- (count_label.as_str())
246- </p>
247- </section>
248- <div class="issue-timeline">
244+ repo_head(head: header, title: Some(heading), sub: sub)
245+ <div class="work" data-live=(live.as_str()) data-live-now="">
246+ <div class="sheet">
249247 if entries.is_empty() {
250- <p class="hint">(g::t(lang, K::NoEarlierVersions))</p>
251- }
252- for entry in entries.into_iter() {
253- history_entry(lang: lang, entry: entry)
248+ <p class="state">(g::t(lang, K::NoEarlierVersions))</p>
254249 }
250+ <div class="issue-timeline">
251+ for entry in entries.into_iter() {
252+ history_entry(lang: lang, entry: entry)
253+ }
254+ </div>
255+ </div>
255256 </div>
256257 )
257258 })
@@ -270,7 +271,7 @@ async fn history_entry(lang: Lang, entry: HistoryEntry) -> Result<impl View> {
270271 } = entry;
271272 let title_text = title_change.map(|(from, to)| g::title_change(lang, &from, &to));
272273 Ok(view! {
273- <article class="thread-entry">
274+ <article class="sec thread-entry">
274275 <header class="thread-head">
275276 <strong>(editor.as_str())</strong>
276277 (g::t(lang, K::EditedBy))
crates/forge-web/src/pages/explore.rsmodified+15 -17
@@ -15,6 +15,7 @@ use crate::i18n::orgs::{self as g, K};
1515 use crate::i18n::{self, Lang};
1616 use crate::live::{Topic, stream_changes};
1717 use crate::state::AppState;
18+use crate::views::parts::{SubPart, head};
1819 use crate::views::repo_list::{
1920 PageLink, RepoRow, SortLink, pager, pager_links, repo_rows, sort_chips,
2021 };
@@ -199,18 +200,17 @@ async fn explore_body(
199200 let (links, prev, next) = nav;
200201 let clear_href = explore_href("", sort, 1);
201202 Ok(view! {
202- <h1 class="sr-only">(g::t(lang, K::Explore))</h1>
203- <section class="explore" data-live=(live.as_str())>
204- <p class="hint">(g::t(lang, K::PublicReposIntro))</p>
205- <form method="get" action="/explore" class="plain-search" role="search">
206- <input type="search" name="q" value=(q.as_str()) data-live-search=""
207- placeholder=(g::t(lang, K::SearchPublicRepos)) aria-label=(g::t(lang, K::SearchPublicRepos))>
208- <input type="hidden" name="sort" value=(sort)>
209- <button type="submit" class="act">(g::t(lang, K::Search))</button>
210- </form>
211- <div class="sub">
203+ head(title: g::t(lang, K::Explore), sub: vec![SubPart::text(g::t(lang, K::PublicReposIntro))])
204+ <div class="sheet" data-live=(live.as_str())>
205+ <div class="sheet-tools">
206+ <strong>(g::repo_count(lang, total))</strong>
207+ <form method="get" action="/explore" class="plain-search" role="search">
208+ <input type="search" name="q" value=(q.as_str()) data-live-search=""
209+ placeholder=(g::t(lang, K::SearchPublicRepos)) aria-label=(g::t(lang, K::SearchPublicRepos))>
210+ <input type="hidden" name="sort" value=(sort)>
211+ <button type="submit" class="act">(g::t(lang, K::Search))</button>
212+ </form>
212213 sort_chips(links: sort_links, lang: lang)
213- <span>(g::repo_count(lang, total))</span>
214214 </div>
215215 if empty {
216216 <p class="state">(g::t(lang, K::NoPublicReposMatch))</p>
@@ -226,14 +226,12 @@ async fn explore_body(
226226 if has_orgs {
227227 <section class="sec">
228228 <h2>(g::t(lang, K::Organizations))</h2>
229- <div>
230- for org in orgs.iter() {
231- <a class="line" href=(format!("/{}", org.as_str()))><span class="name">(org.as_str())</span></a>
232- }
233- </div>
229+ for org in orgs.iter() {
230+ <a class="line" href=(format!("/{}", org.as_str()))><span class="name">(org.as_str())</span></a>
231+ }
234232 </section>
235233 }
236- </section>
234+ </div>
237235 })
238236 }
239237
crates/forge-web/src/pages/forgot.rsmodified+15 -11
@@ -22,6 +22,7 @@ use crate::mail::account;
2222 use crate::pages::register::check_new_password;
2323 use crate::state::AppState;
2424 use crate::throttle;
25+use crate::views::parts::{SubPart, head};
2526 use crate::views::{alert, shell};
2627
2728 /// Reset requests allowed per client IP inside the throttle window.
@@ -58,9 +59,8 @@ enum ResetMode {
5859 #[component]
5960 async fn forgot_form(lang: Lang, precsrf: &str) -> Result<impl View> {
6061 Ok(view! {
61- <section>
62- <h1>(t(lang, Key::ForgotTitle))</h1>
63- <p class="hint">(t(lang, Key::ForgotSub))</p>
62+ head(title: t(lang, Key::ForgotTitle), sub: vec![SubPart::text(t(lang, Key::ForgotSub))])
63+ <div class="sheet fit">
6464 <form data-hard="true" method="post" action="/forgot" class="fields">
6565 <input type="hidden" name="precsrf" value=(precsrf)>
6666 <div class="field">
@@ -69,17 +69,17 @@ async fn forgot_form(lang: Lang, precsrf: &str) -> Result<impl View> {
6969 </div>
7070 <button type="submit" class="primary">(t(lang, Key::ForgotSubmit))</button>
7171 </form>
72- </section>
72+ </div>
7373 })
7474 }
7575
7676 #[component]
7777 async fn forgot_sent(lang: Lang) -> Result<impl View> {
7878 Ok(view! {
79- <section>
80- <h1>(t(lang, Key::ForgotTitle))</h1>
79+ head(title: t(lang, Key::ForgotTitle))
80+ <div class="sheet fit">
8181 <p class="state" role="status">(t(lang, Key::ForgotSent))</p>
82- </section>
82+ </div>
8383 })
8484 }
8585
@@ -149,11 +149,15 @@ async fn reset_body(
149149 mode: ResetMode,
150150 error: Option<String>,
151151 ) -> Result<impl View> {
152+ let sub = if mode == ResetMode::Form {
153+ vec![SubPart::text(t(lang, Key::ResetSub))]
154+ } else {
155+ Vec::new()
156+ };
152157 Ok(view! {
153- <section>
154- <h1>(t(lang, Key::ResetTitle))</h1>
158+ head(title: t(lang, Key::ResetTitle), sub: sub)
159+ <div class="sheet fit">
155160 if mode == ResetMode::Form {
156- <p class="hint">(t(lang, Key::ResetSub))</p>
157161 <form data-hard="true" method="post" action=(format!("/reset/{token}")) class="fields">
158162 if let Some(message) = error {
159163 alert(message: message.as_str())
@@ -183,7 +187,7 @@ async fn reset_body(
183187 <a class="act" href="/login">(t(lang, Key::LogIn))</a>
184188 </div>
185189 }
186- </section>
190+ </div>
187191 })
188192 }
189193
crates/forge-web/src/pages/home.rsmodified+7 -10
@@ -11,6 +11,7 @@ use crate::i18n::orgs::{self as g, K};
1111 use crate::i18n::{self, Lang};
1212 use crate::pages::repo_settings::{notice_banner_for, take_notice};
1313 use crate::state::AppState;
14+use crate::views::parts::{SubPart, head};
1415 use crate::views::{enc, shell};
1516
1617 #[page("/")]
@@ -33,15 +34,11 @@ async fn home(cx: &Cx) -> Result<impl View> {
3334 #[component]
3435 async fn landing(has_users: bool, lang: Lang) -> Result<impl View> {
3536 Ok(view! {
36- <section class="sec">
37- <h1 class="sr-only">"forge"</h1>
38- <p class="state">(g::t(lang, K::LandingTagline))</p>
39- <div class="acts">
40- <a class="act" href="/login">(g::t(lang, K::LogIn))</a>
41- if !has_users {
42- <a class="act" href="/setup">(g::t(lang, K::SetUpForge))</a>
43- }
44- </div>
45- </section>
37+ head(title: "forge", sub: vec![SubPart::text(g::t(lang, K::LandingTagline))],
38+ <a class="button primary" href="/login">(g::t(lang, K::LogIn))</a>
39+ if !has_users {
40+ <a class="button" href="/setup">(g::t(lang, K::SetUpForge))</a>
41+ }
42+ )
4643 })
4744 }
crates/forge-web/src/pages/import.rsmodified+213 -207
@@ -31,6 +31,7 @@ use crate::pages::ci_runs::{changed_event, events_response};
3131 use crate::pages::new_repo::{owner_choices, repo_owner};
3232 use crate::pages::repo_ctx::still_readable;
3333 use crate::state::AppState;
34+use crate::views::parts::{SubPart, head};
3435 use crate::views::{alert, csrf_field, rel_time, shell, user_facing_message};
3536
3637 path_param!(job_id);
@@ -179,7 +180,7 @@ async fn source_tabs(lang: Lang, base: &str, active: Source) -> Result<impl View
179180 let gitlab = format!("{base}?source=gitlab");
180181 let forgejo = format!("{base}?source=forgejo");
181182 Ok(view! {
182- <nav class="sub" aria-label=(g::t(lang, K::TabImport))>
183+ <nav class="tabs" aria-label=(g::t(lang, K::TabImport))>
183184 <a href=(git.as_str()) aria-current=((active == Source::Git).then_some("page"))>(g::t(lang, K::SrcGit))</a>
184185 <a href=(github.as_str()) aria-current=((active == Source::GitHub).then_some("page"))>(g::t(lang, K::SrcGitHub))</a>
185186 <a href=(gitlab.as_str()) aria-current=((active == Source::GitLab).then_some("page"))>(g::t(lang, K::SrcGitLab))</a>
@@ -192,33 +193,30 @@ async fn source_tabs(lang: Lang, base: &str, active: Source) -> Result<impl View
192193 #[component]
193194 pub(crate) async fn visibility_pick(lang: Lang, private: bool) -> Result<impl View> {
194195 Ok(view! {
195- <fieldset class="rule-group">
196- <legend>(crate::i18n::misc::t(lang, crate::i18n::misc::K::VisibilityLegend))</legend>
197- <label class="switch">
198- <input type="radio" name="visibility" value="private" checked=(private)>
199- <span>(crate::i18n::community::t(lang, crate::i18n::community::K::VisibilityPrivate))</span>
200- </label>
201- <p class="hint">(crate::i18n::misc::t(lang, crate::i18n::misc::K::PrivateHelp))</p>
202- <label class="switch">
203- <input type="radio" name="visibility" value="public" checked=(!private)>
204- <span>(crate::i18n::community::t(lang, crate::i18n::community::K::VisibilityPublic))</span>
205- </label>
206- <p class="hint">(crate::i18n::misc::t(lang, crate::i18n::misc::K::PublicHelp))</p>
207- </fieldset>
196+ <div class="field">
197+ <span class="field-label">(crate::i18n::misc::t(lang, crate::i18n::misc::K::VisibilityLegend))</span>
198+ <div class="choice" role="radiogroup" aria-label=(crate::i18n::misc::t(lang, crate::i18n::misc::K::VisibilityLegend))>
199+ <label><input type="radio" name="visibility" value="private" checked=(private)><span>(crate::i18n::community::t(lang, crate::i18n::community::K::VisibilityPrivate))</span></label>
200+ <label><input type="radio" name="visibility" value="public" checked=(!private)><span>(crate::i18n::community::t(lang, crate::i18n::community::K::VisibilityPublic))</span></label>
201+ </div>
202+ <p class="hint">(crate::i18n::misc::t(lang, crate::i18n::misc::K::PrivateHelp)) ". " (crate::i18n::misc::t(lang, crate::i18n::misc::K::PublicHelp)) "."</p>
203+ </div>
208204 })
209205 }
210206
211207 #[component]
212208 async fn option_boxes(lang: Lang, opts: ImportOptions) -> Result<impl View> {
213209 Ok(view! {
214- <fieldset class="rule-group">
215- <legend>(g::t(lang, K::WhatToImport))</legend>
216- <label class="switch"><input type="checkbox" name="opt_labels" value="on" checked=(opts.labels)><span>(g::t(lang, K::OptLabels))</span></label>
217- <label class="switch"><input type="checkbox" name="opt_issues" value="on" checked=(opts.issues)><span>(g::t(lang, K::OptIssues))</span></label>
218- <label class="switch"><input type="checkbox" name="opt_pulls" value="on" checked=(opts.pulls)><span>(g::t(lang, K::OptPulls))</span></label>
219- <label class="switch"><input type="checkbox" name="opt_releases" value="on" checked=(opts.releases)><span>(g::t(lang, K::OptReleases))</span></label>
210+ <div class="field" role="group" aria-labelledby="import-what">
211+ <span class="field-label" id="import-what">(g::t(lang, K::WhatToImport))</span>
212+ <div class="checks">
213+ <label class="switch"><input type="checkbox" name="opt_labels" value="on" checked=(opts.labels)><span>(g::t(lang, K::OptLabels))</span></label>
214+ <label class="switch"><input type="checkbox" name="opt_issues" value="on" checked=(opts.issues)><span>(g::t(lang, K::OptIssues))</span></label>
215+ <label class="switch"><input type="checkbox" name="opt_pulls" value="on" checked=(opts.pulls)><span>(g::t(lang, K::OptPulls))</span></label>
216+ <label class="switch"><input type="checkbox" name="opt_releases" value="on" checked=(opts.releases)><span>(g::t(lang, K::OptReleases))</span></label>
217+ </div>
220218 <p class="hint">(g::t(lang, K::OptionsNote))</p>
221- </fieldset>
219+ </div>
222220 })
223221 }
224222
@@ -318,69 +316,70 @@ async fn import_form(
318316 let private = draft.private;
319317 let opts = draft.opts;
320318 Ok(view! {
321- <h1 class="sr-only">(g::t(lang, K::ImportTitle))</h1>
319+ head(title: g::t(lang, K::ImportTitle), sub: vec![SubPart::text(g::t(lang, K::ImportIntro))])
322320 newrepo_tabs(lang: lang, active: "import")
323321 source_tabs(lang: lang, base: "/new/import", active: source)
324- if !is_git {
325- <section class="sec">
326- <h2>(g::t(lang, K::BulkLink))</h2>
327- <p class="hint">(g::t(lang, K::BulkIntro))</p>
328- <div class="acts">
329- <a class="act" href=(bulk_href.as_str())>(g::t(lang, K::BulkLinkButton))</a>
330- </div>
331- </section>
332- }
333- <form method="post" action="/new/import" class="fields">
334- if let Some(message) = error {
335- alert(message: message.as_str())
322+ <div class="sheet fit">
323+ if !is_git {
324+ <section class="sec">
325+ <h2>(g::t(lang, K::BulkLink))</h2>
326+ <p class="hint">(g::t(lang, K::BulkIntro))</p>
327+ <div class="acts">
328+ <a class="act" href=(bulk_href.as_str())>(g::t(lang, K::BulkLinkButton))</a>
329+ </div>
330+ </section>
336331 }
337- csrf_field(token: csrf)
338- <input type="hidden" name="source" value=(source_value)>
339- <p class="hint">(g::t(lang, K::ImportIntro))</p>
340- if has_instance {
332+ <form method="post" action="/new/import" class="fields">
333+ if let Some(message) = error {
334+ alert(message: message.as_str())
335+ }
336+ csrf_field(token: csrf)
337+ <input type="hidden" name="source" value=(source_value)>
338+ if has_instance {
339+ <div class="field">
340+ <label for="import-instance">(instance_label)</label>
341+ <input id="import-instance" type="url" name="instance" value=(draft.instance.as_str()) autocomplete="off" spellcheck="false" maxlength="2048">
342+ </div>
343+ }
341344 <div class="field">
342- <label for="import-instance">(instance_label)</label>
343- <input id="import-instance" type="url" name="instance" value=(draft.instance.as_str()) autocomplete="off" spellcheck="false" maxlength="2048">
345+ <label for="import-remote">(remote_label)</label>
346+ <input id="import-remote" type="text" name="remote" value=(draft.remote.as_str()) placeholder=(remote_placeholder) required=(true) autocomplete="off" spellcheck="false" maxlength="2048">
344347 </div>
345- }
346- <div class="field">
347- <label for="import-remote">(remote_label)</label>
348- <input id="import-remote" type="text" name="remote" value=(draft.remote.as_str()) placeholder=(remote_placeholder) required=(true) autocomplete="off" spellcheck="false" maxlength="2048">
349- </div>
350- if is_git {
348+ if is_git {
349+ <div class="field">
350+ <label for="import-git-user">(g::t(lang, K::GitUser))</label>
351+ <input id="import-git-user" type="text" name="git_user" value=(draft.git_user.as_str()) autocomplete="off" maxlength="255">
352+ </div>
353+ }
351354 <div class="field">
352- <label for="import-git-user">(g::t(lang, K::GitUser))</label>
353- <input id="import-git-user" type="text" name="git_user" value=(draft.git_user.as_str()) autocomplete="off" maxlength="255">
355+ <label for="import-token">(token_label)</label>
356+ <input id="import-token" type="password" name="token" autocomplete="new-password" maxlength="1024">
357+ <p class="hint">(g::t(lang, K::TokenHelp))</p>
354358 </div>
355- }
356- <div class="field">
357- <label for="import-token">(token_label)</label>
358- <input id="import-token" type="password" name="token" autocomplete="new-password" maxlength="1024">
359- <p class="hint">(g::t(lang, K::TokenHelp))</p>
360- </div>
361- if !is_git {
362- option_boxes(lang: lang, opts: opts)
363- }
364- <div class="field">
365- <label for="import-owner">(g::t(lang, K::TargetOwner))</label>
366- <select id="import-owner" name="owner">
367- for name in owners.iter() {
368- <option value=(name.as_str()) selected=(*name == selected_owner)>(name.as_str())</option>
369- }
370- </select>
371- </div>
372- <div class="field">
373- <label for="import-name">(g::t(lang, K::TargetName))</label>
374- <input id="import-name" type="text" name="name" value=(draft.name.as_str()) maxlength="64" autocomplete="off">
375- <p class="hint">(g::t(lang, K::TargetNameHelp))</p>
376- </div>
377- <div class="field">
378- <label for="import-description">(g::t(lang, K::Description))</label>
379- <textarea id="import-description" name="description" rows="2" maxlength="350">(draft.description.as_str())</textarea>
380- </div>
381- visibility_pick(lang: lang, private: private)
382- <button type="submit" class="primary">(g::t(lang, K::StartImport))</button>
383- </form>
359+ if !is_git {
360+ option_boxes(lang: lang, opts: opts)
361+ }
362+ <div class="field">
363+ <label for="import-owner">(g::t(lang, K::TargetOwner))</label>
364+ <select id="import-owner" name="owner">
365+ for name in owners.iter() {
366+ <option value=(name.as_str()) selected=(*name == selected_owner)>(name.as_str())</option>
367+ }
368+ </select>
369+ </div>
370+ <div class="field">
371+ <label for="import-name">(g::t(lang, K::TargetName))</label>
372+ <input id="import-name" type="text" name="name" value=(draft.name.as_str()) maxlength="64" autocomplete="off">
373+ <p class="hint">(g::t(lang, K::TargetNameHelp))</p>
374+ </div>
375+ <div class="field">
376+ <label for="import-description">(g::t(lang, K::Description))</label>
377+ <textarea id="import-description" name="description" rows="2" maxlength="350">(draft.description.as_str())</textarea>
378+ </div>
379+ visibility_pick(lang: lang, private: private)
380+ <button type="submit" class="primary">(g::t(lang, K::StartImport))</button>
381+ </form>
382+ </div>
384383 })
385384 }
386385
@@ -611,35 +610,36 @@ async fn bulk_form(
611610 // A Forgejo token can list its own repositories, so the owner may stay empty.
612611 let owner_required = source != Source::Forgejo;
613612 Ok(view! {
614- <h1 class="sr-only">(g::t(lang, K::BulkTitle))</h1>
613+ head(title: g::t(lang, K::BulkTitle), sub: vec![SubPart::text(g::t(lang, K::BulkIntro))])
615614 newrepo_tabs(lang: lang, active: "import")
616615 source_tabs(lang: lang, base: "/new/import/bulk", active: source)
617- <form method="post" action="/new/import/bulk" class="fields">
618- if let Some(message) = error {
619- alert(message: message.as_str())
620- }
621- csrf_field(token: csrf)
622- <input type="hidden" name="source" value=(source_value)>
623- <input type="hidden" name="stage" value="list">
624- <p class="hint">(g::t(lang, K::BulkIntro))</p>
625- if has_instance {
616+ <div class="sheet fit">
617+ <form method="post" action="/new/import/bulk" class="fields">
618+ if let Some(message) = error {
619+ alert(message: message.as_str())
620+ }
621+ csrf_field(token: csrf)
622+ <input type="hidden" name="source" value=(source_value)>
623+ <input type="hidden" name="stage" value="list">
624+ if has_instance {
625+ <div class="field">
626+ <label for="bulk-instance">(instance_label)</label>
627+ <input id="bulk-instance" type="url" name="instance" value=(instance) autocomplete="off" spellcheck="false" maxlength="2048">
628+ </div>
629+ }
626630 <div class="field">
627- <label for="bulk-instance">(instance_label)</label>
628- <input id="bulk-instance" type="url" name="instance" value=(instance) autocomplete="off" spellcheck="false" maxlength="2048">
631+ <label for="bulk-from">(owner_label)</label>
632+ <input id="bulk-from" type="text" name="from" required=(owner_required) autocomplete="off" spellcheck="false" maxlength="100">
629633 </div>
630- }
631- <div class="field">
632- <label for="bulk-from">(owner_label)</label>
633- <input id="bulk-from" type="text" name="from" required=(owner_required) autocomplete="off" spellcheck="false" maxlength="100">
634- </div>
635- <div class="field">
636- <label for="bulk-token">(g::t(lang, K::TokenOptional))</label>
637- <input id="bulk-token" type="password" name="token" autocomplete="new-password" maxlength="1024">
638- <p class="hint">(g::t(lang, K::TokenHelp))</p>
639- </div>
640- <input type="hidden" name="owner" value=(owners.first().map(String::as_str).unwrap_or(""))>
641- <button type="submit" class="primary">(g::t(lang, K::BulkListButton))</button>
642- </form>
634+ <div class="field">
635+ <label for="bulk-token">(g::t(lang, K::TokenOptional))</label>
636+ <input id="bulk-token" type="password" name="token" autocomplete="new-password" maxlength="1024">
637+ <p class="hint">(g::t(lang, K::TokenHelp))</p>
638+ </div>
639+ <input type="hidden" name="owner" value=(owners.first().map(String::as_str).unwrap_or(""))>
640+ <button type="submit" class="primary">(g::t(lang, K::BulkListButton))</button>
641+ </form>
642+ </div>
643643 })
644644 }
645645
@@ -670,59 +670,61 @@ async fn bulk_select(
670670 form.owner.clone()
671671 };
672672 Ok(view! {
673- <h1 class="sr-only">(g::t(lang, K::BulkSelectHeading))</h1>
673+ head(title: g::t(lang, K::BulkSelectHeading))
674674 newrepo_tabs(lang: lang, active: "import")
675- <form method="post" action="/new/import/bulk" class="fields">
676- csrf_field(token: csrf)
677- <input type="hidden" name="stage" value="run">
678- <input type="hidden" name="source" value=(form.source.as_str())>
679- <input type="hidden" name="instance" value=(form.instance.as_str())>
680- <input type="hidden" name="token" value=(form.token.as_str())>
681- <input type="hidden" name="from" value=(form.from.as_str())>
682- if empty {
683- <p class="state">(g::t(lang, K::BulkNone))</p>
684- } else {
685- <div class="field">
686- <label for="bulk-owner">(g::t(lang, K::TargetOwner))</label>
687- <select id="bulk-owner" name="owner">
688- for name in owners.iter() {
689- <option value=(name.as_str()) selected=(*name == selected_owner)>(name.as_str())</option>
675+ <div class="sheet">
676+ <form method="post" action="/new/import/bulk" class="fields">
677+ csrf_field(token: csrf)
678+ <input type="hidden" name="stage" value="run">
679+ <input type="hidden" name="source" value=(form.source.as_str())>
680+ <input type="hidden" name="instance" value=(form.instance.as_str())>
681+ <input type="hidden" name="token" value=(form.token.as_str())>
682+ <input type="hidden" name="from" value=(form.from.as_str())>
683+ if empty {
684+ <p class="state">(g::t(lang, K::BulkNone))</p>
685+ } else {
686+ <div class="field">
687+ <label for="bulk-owner">(g::t(lang, K::TargetOwner))</label>
688+ <select id="bulk-owner" name="owner">
689+ for name in owners.iter() {
690+ <option value=(name.as_str()) selected=(*name == selected_owner)>(name.as_str())</option>
691+ }
692+ </select>
693+ <p class="hint">(g::t(lang, K::BulkOwnerHelp))</p>
694+ </div>
695+ visibility_pick(lang: lang, private: private)
696+ if form.source != "git" {
697+ option_boxes(lang: lang, opts: opts)
698+ }
699+ <label class="line" data-kb-row="">
700+ <input type="checkbox" data-select-all=".import-pick-list">
701+ <span class="name">(g::t(lang, K::BulkSelectAll))</span>
702+ <span class="val">(count)</span>
703+ </label>
704+ <div class="import-pick-list">
705+ for (i, repo) in repos.iter().enumerate() {
706+ <label class="line" data-kb-row="">
707+ <input type="checkbox" name=(format!("sel_{i}")) value=(repo.full_name.as_str())>
708+ <span class="name">(repo.name.as_str())</span>
709+ <span class="val">
710+ if repo.private {
711+ <span class="badge private">(g::t(lang, K::BulkPrivate))</span>
712+ }
713+ if repo.fork {
714+ <span class="badge">(g::t(lang, K::BulkFork))</span>
715+ }
716+ if repo.archived {
717+ <span class="badge">(g::t(lang, K::BulkArchived))</span>
718+ }
719+ (repo.description.as_str())
720+ </span>
721+ </label>
690722 }
691- </select>
692- <p class="hint">(g::t(lang, K::BulkOwnerHelp))</p>
693- </div>
694- visibility_pick(lang: lang, private: private)
695- if form.source != "git" {
696- option_boxes(lang: lang, opts: opts)
723+ </div>
724+ <button type="submit" class="primary">(g::t(lang, K::BulkImportSelected))</button>
697725 }
698- <label class="line" data-kb-row="">
699- <input type="checkbox" data-select-all=".import-pick-list">
700- <span class="name">(g::t(lang, K::BulkSelectAll))</span>
701- <span class="val">(count)</span>
702- </label>
703- <div class="import-pick-list">
704- for (i, repo) in repos.iter().enumerate() {
705- <label class="line" data-kb-row="">
706- <input type="checkbox" name=(format!("sel_{i}")) value=(repo.full_name.as_str())>
707- <span class="name">(repo.name.as_str())</span>
708- <span class="val">
709- if repo.private {
710- <span class="badge private">(g::t(lang, K::BulkPrivate))</span>
711- }
712- if repo.fork {
713- <span class="badge">(g::t(lang, K::BulkFork))</span>
714- }
715- if repo.archived {
716- <span class="badge">(g::t(lang, K::BulkArchived))</span>
717- }
718- (repo.description.as_str())
719- </span>
720- </label>
721- }
722- </div>
723- <button type="submit" class="primary">(g::t(lang, K::BulkImportSelected))</button>
724- }
725- </form>
726+ </form>
727+ </div>
726728 })
727729 }
728730
@@ -1054,20 +1056,18 @@ async fn recent_imports(
10541056 let retry = jobs.iter().any(|(job, _)| job.state == ImportState::Failed);
10551057 Ok(view! {
10561058 if !empty {
1057- <section class="sec">
1058- <h2>(g::t(lang, K::RecentImports))</h2>
1059+ <div class="sheet">
1060+ <div class="sheet-tools">
1061+ <strong>(g::t(lang, K::RecentImports))</strong>
1062+ if more {
1063+ <a class="act" href="/import">(g::t(lang, K::ViewAll))</a>
1064+ }
1065+ if retry {
1066+ <a class="act" href="/import/retry">(g::t(lang, K::RetryFailedTitle))</a>
1067+ }
1068+ </div>
10591069 job_rows(lang: lang, jobs: jobs)
1060- if more || retry {
1061- <div class="acts">
1062- if more {
1063- <a class="act quiet" href="/import">(g::t(lang, K::ViewAll))</a>
1064- }
1065- if retry {
1066- <a class="act" href="/import/retry">(g::t(lang, K::RetryFailedTitle))</a>
1067- }
1068- </div>
1069- }
1070- </section>
1070+ </div>
10711071 }
10721072 })
10731073 }
@@ -1081,10 +1081,10 @@ async fn jobs_list(
10811081 let empty = jobs.is_empty();
10821082 let retry = jobs.iter().any(|(job, _)| job.state == ImportState::Failed);
10831083 Ok(view! {
1084- <section data-live="/import/events">
1085- <h1 class="sr-only">(g::t(lang, K::JobsTitle))</h1>
1084+ head(title: g::t(lang, K::JobsTitle), live: Some("/import/events"))
1085+ <div class="sheet">
10861086 if retry {
1087- <div class="acts">
1087+ <div class="sheet-tools">
10881088 <a class="act" href="/import/retry">(g::t(lang, K::RetryFailedTitle))</a>
10891089 </div>
10901090 }
@@ -1099,7 +1099,7 @@ async fn jobs_list(
10991099 } else {
11001100 job_rows(lang: lang, jobs: jobs)
11011101 }
1102- </section>
1102+ </div>
11031103 })
11041104 }
11051105
@@ -1187,10 +1187,14 @@ async fn job_view(
11871187 let error = job.error.clone();
11881188 let state_word = job.state.as_str();
11891189 let empty_log = log.is_empty();
1190+ let sub = vec![SubPart {
1191+ text: badge_text.to_owned(),
1192+ class: badge_class,
1193+ ..SubPart::default()
1194+ }];
11901195 Ok(view! {
1191- <section class="import-job" data-live=(live.as_deref()) data-live-state=(state_word)>
1192- <h1 class="h1">(job.source_ref.as_str())</h1>
1193- <p class="state"><span class=(badge_class)>(badge_text)</span></p>
1196+ head(title: job.source_ref.as_str(), sub: sub, live: live.as_deref())
1197+ <div class="sheet import-job" data-live-state=(state_word)>
11941198 <section class="sec">
11951199 if !stage.is_empty() {
11961200 <p class="state">
@@ -1241,7 +1245,7 @@ async fn job_view(
12411245 </ol>
12421246 }
12431247 </section>
1244- </section>
1248+ </div>
12451249 })
12461250 }
12471251
@@ -1409,40 +1413,42 @@ async fn retry_list(lang: Lang, csrf: &str, rows: Vec<(ImportJob, Repo)>) -> Res
14091413 let count = rows.len();
14101414 let empty = rows.is_empty();
14111415 Ok(view! {
1412- <h1 class="sr-only">(g::t(lang, K::RetryFailedTitle))</h1>
1413- <form method="post" action="/import/retry" class="fields">
1414- csrf_field(token: csrf)
1415- if empty {
1416- <p class="state">(g::t(lang, K::RetryNone))</p>
1417- } else {
1418- <div class="field">
1419- <label for="retry-token">(g::t(lang, K::TokenOptional))</label>
1420- <input id="retry-token" type="password" name="token" autocomplete="new-password" maxlength="1024">
1421- <p class="hint">(g::t(lang, K::RetryTokenHelp))</p>
1422- </div>
1423- <label class="line" data-kb-row="">
1424- <input type="checkbox" data-select-all=".import-pick-list">
1425- <span class="name">(g::t(lang, K::BulkSelectAll))</span>
1426- <span class="val">(count)</span>
1427- </label>
1428- <div class="import-pick-list">
1429- for (i, (job, repo)) in rows.iter().enumerate() {
1430- <label class="line" data-kb-row="">
1431- <input type="checkbox" name=(format!("sel_{i}")) value=(job.id.as_str())>
1432- <span class="name">(format!("{}/{}", repo.owner_name, repo.name))</span>
1433- <span class="val">
1434- <span class="badge">(source_label(&job.source))</span>
1435- " " (job.source_ref.as_str())
1436- if let Some(message) = job.error.as_ref() {
1437- " · " (message.as_str())
1438- }
1439- </span>
1440- </label>
1441- }
1442- </div>
1443- <button type="submit" class="primary">(g::t(lang, K::RetrySelected))</button>
1444- }
1445- </form>
1416+ head(title: g::t(lang, K::RetryFailedTitle))
1417+ <div class="sheet">
1418+ <form method="post" action="/import/retry" class="fields">
1419+ csrf_field(token: csrf)
1420+ if empty {
1421+ <p class="state">(g::t(lang, K::RetryNone))</p>
1422+ } else {
1423+ <div class="field">
1424+ <label for="retry-token">(g::t(lang, K::TokenOptional))</label>
1425+ <input id="retry-token" type="password" name="token" autocomplete="new-password" maxlength="1024">
1426+ <p class="hint">(g::t(lang, K::RetryTokenHelp))</p>
1427+ </div>
1428+ <label class="line" data-kb-row="">
1429+ <input type="checkbox" data-select-all=".import-pick-list">
1430+ <span class="name">(g::t(lang, K::BulkSelectAll))</span>
1431+ <span class="val">(count)</span>
1432+ </label>
1433+ <div class="import-pick-list">
1434+ for (i, (job, repo)) in rows.iter().enumerate() {
1435+ <label class="line" data-kb-row="">
1436+ <input type="checkbox" name=(format!("sel_{i}")) value=(job.id.as_str())>
1437+ <span class="name">(format!("{}/{}", repo.owner_name, repo.name))</span>
1438+ <span class="val">
1439+ <span class="badge">(source_label(&job.source))</span>
1440+ " " (job.source_ref.as_str())
1441+ if let Some(message) = job.error.as_ref() {
1442+ " · " (message.as_str())
1443+ }
1444+ </span>
1445+ </label>
1446+ }
1447+ </div>
1448+ <button type="submit" class="primary">(g::t(lang, K::RetrySelected))</button>
1449+ }
1450+ </form>
1451+ </div>
14461452 })
14471453 }
14481454
crates/forge-web/src/pages/invites.rsmodified+20 -26
@@ -16,9 +16,8 @@ use crate::auth::check_csrf;
1616 use crate::i18n::{self, Key, Lang, t};
1717 use crate::mail::account;
1818 use crate::pages::admin_users::admin_only;
19-use crate::pages::passkeys::s;
2019 use crate::state::AppState;
21-use crate::views::parts::reveal;
20+use crate::views::parts::{SubPart, head};
2221 use crate::views::{alert, shell, user_facing_message};
2322
2423 #[derive(Deserialize)]
@@ -36,31 +35,26 @@ async fn invite_body(
3635 notice: Option<&'static str>,
3736 error: Option<String>,
3837 ) -> Result<impl View> {
39- let open = error.is_some();
4038 Ok(view! {
41- <h1 class="sr-only">(t(lang, Key::InvitesTitle))</h1>
42- <section class="sec">
43- <h2>(s(lang, "Invite by email", "E-posta ile davet et"))</h2>
44- <p class="hint">(t(lang, Key::InvitesSub))</p>
45- if let Some(message) = notice {
46- <p class="state" role="status">(message)</p>
47- }
48- <div class="acts">
49- reveal(label: t(lang, Key::InvitesSubmit), id: Some("invite-email"), open: open,
50- if let Some(message) = error {
51- alert(message: message.as_str())
52- }
53- <form method="post" action="/admin/invites" class="fields">
54- <input type="hidden" name="csrf" value=(csrf)>
55- <div class="field">
56- <label for="invite-email">(t(lang, Key::Email))</label>
57- <input id="invite-email" type="email" name="email" autocomplete="off" maxlength="254" required=(true)>
58- </div>
59- <button type="submit" class="primary">(t(lang, Key::InvitesSubmit))</button>
60- </form>
61- )
62- </div>
63- </section>
39+ head(title: t(lang, Key::InvitesTitle), sub: vec![SubPart::text(t(lang, Key::InvitesSub))])
40+ <div class="sheet">
41+ <section class="sec">
42+ if let Some(message) = error {
43+ alert(message: message.as_str())
44+ }
45+ <form method="post" action="/admin/invites" class="fields">
46+ <input type="hidden" name="csrf" value=(csrf)>
47+ <div class="field">
48+ <label for="invite-email">(t(lang, Key::Email))</label>
49+ <input id="invite-email" type="email" name="email" autocomplete="off" maxlength="254" required=(true)>
50+ </div>
51+ <button type="submit" class="primary">(t(lang, Key::InvitesSubmit))</button>
52+ </form>
53+ </section>
54+ </div>
55+ if let Some(message) = notice {
56+ <p class="state" role="status">(message)</p>
57+ }
6458 })
6559 }
6660
crates/forge-web/src/pages/issue_meta.rsmodified+7 -6
@@ -22,6 +22,7 @@ use crate::notify;
2222 use crate::pages::issue_parts::{ItemKind, bump_live};
2323 use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo};
2424 use crate::state::AppState;
25+use crate::views::parts::head;
2526 use crate::views::{alert, shell, user_facing_message};
2627 use crate::webhooks::emit::{
2728 Sender, emit_assignee_changes, emit_item_action, emit_label_changes, emit_milestone_change,
@@ -58,13 +59,13 @@ impl RepoFrame {
5859 .as_ref()
5960 .map(|(_, session)| session.csrf_token.clone())
6061 .unwrap_or_default();
61- let head = ctx.head(state, active).await?;
62+ let repo_head = ctx.head(state, active).await?;
6263 Ok(Self {
6364 title: format!("{}/{}", ctx.repo.owner_name, ctx.repo.name),
6465 csrf,
6566 archived: ctx.repo.archived,
6667 can_triage: can_triage(ctx),
67- head,
68+ head: repo_head,
6869 })
6970 }
7071 }
@@ -94,7 +95,7 @@ pub(crate) async fn issue_subnav(lang: Lang, title: String, active: String) -> R
9495 let on_labels = active == "labels";
9596 let on_milestones = active == "milestones";
9697 Ok(view! {
97- <nav class="sub" aria-label=(g::t(lang, K::IssuePages)) data-live=(live.as_str()) data-live-now="">
98+ <nav class="tabs" aria-label=(g::t(lang, K::IssuePages)) data-live=(live.as_str()) data-live-now="">
9899 if on_issues {
99100 <a href=(issues.as_str()) aria-current="page">(g::t(lang, K::Issues))</a>
100101 } else {
@@ -201,13 +202,13 @@ pub(crate) async fn action_error_at(
201202 back: String,
202203 ) -> Result<impl View> {
203204 Ok(view! {
204- <section class="sec">
205- <h1 class="sr-only">(g::t(lang, K::CouldNotSave))</h1>
205+ head(title: g::t(lang, K::CouldNotSave))
206+ <div class="sheet fit">
206207 alert(message: message.as_str())
207208 <div class="acts">
208209 <a class="act" href=(back.as_str())>(g::t(lang, K::GoBack))</a>
209210 </div>
210- </section>
211+ </div>
211212 })
212213 }
213214
crates/forge-web/src/pages/issue_parts.rsmodified+82 -74
@@ -437,7 +437,7 @@ pub(crate) async fn comment_item(lang: Lang, item: CommentView) -> Result<impl V
437437 let profile = user_href(&login);
438438 let has_acts = edit_href.is_some() || delete_href.is_some();
439439 Ok(view! {
440- <article class="thread-entry" id=(anchor.as_str())>
440+ <article class="sec thread-entry" id=(anchor.as_str())>
441441 <header class="thread-head">
442442 <a href=(profile.as_str()) aria-label=(login.as_str())><img class="avatar avatar-sm" src=(avatar.as_str()) alt="" width="24" height="24"></a>
443443 <strong>user_link(shown: author.as_str(), login: login.as_str())</strong>
@@ -609,7 +609,7 @@ pub(crate) async fn review_item(lang: Lang, review: ReviewView) -> Result<impl V
609609 "review-verb"
610610 };
611611 Ok(view! {
612- <article class="thread-entry review-item" id=(anchor.as_str())>
612+ <article class="sec thread-entry review-item" id=(anchor.as_str())>
613613 <header class="thread-head">
614614 <a href=(profile.as_str()) aria-label=(login.as_str())><img class="avatar avatar-sm" src=(avatar.as_str()) alt="" width="24" height="24"></a>
615615 <strong>user_link(shown: author.as_str(), login: login.as_str())</strong>
@@ -1083,9 +1083,9 @@ pub(crate) async fn labels_box(
10831083 ) -> Result<impl View> {
10841084 let any_attached = labels.iter().any(|row| row.attached);
10851085 Ok(view! {
1086- <div class="acts">
1087- <span class="state">
1088- (g::t(lang, K::Labels)) ": "
1086+ <section class="sec meta">
1087+ <h2>(g::t(lang, K::Labels))</h2>
1088+ <p class="hint">
10891089 if !any_attached {
10901090 (g::t(lang, K::NoneYet))
10911091 }
@@ -1094,25 +1094,27 @@ pub(crate) async fn labels_box(
10941094 <span class=(row.chip.as_str())>(row.name.as_str())</span>
10951095 }
10961096 }
1097- </span>
1097+ </p>
10981098 if write {
1099- reveal(label: g::t(lang, K::Edit),
1100- <form method="post" action=(action.as_str()) class="fields" data-apply="true">
1101- <input type="hidden" name="csrf" value=(csrf.as_str())>
1102- if labels.is_empty() {
1103- <p class="hint">(g::t(lang, K::NoRepoLabels))</p>
1104- }
1105- for row in labels.iter() {
1106- <label class="switch">
1107- <input type="checkbox" name="label" value=(row.id.as_str()) checked=(row.attached)>
1108- <span class=(row.chip.as_str())>(row.name.as_str())</span>
1109- </label>
1110- }
1111- <noscript><div><button type="submit" class="primary">(g::t(lang, K::SaveLabels))</button></div></noscript>
1112- </form>
1113- )
1099+ <div class="acts">
1100+ reveal(label: g::t(lang, K::Edit),
1101+ <form method="post" action=(action.as_str()) class="fields" data-apply="true">
1102+ <input type="hidden" name="csrf" value=(csrf.as_str())>
1103+ if labels.is_empty() {
1104+ <p class="hint">(g::t(lang, K::NoRepoLabels))</p>
1105+ }
1106+ for row in labels.iter() {
1107+ <label class="switch">
1108+ <input type="checkbox" name="label" value=(row.id.as_str()) checked=(row.attached)>
1109+ <span class=(row.chip.as_str())>(row.name.as_str())</span>
1110+ </label>
1111+ }
1112+ <noscript><div><button type="submit" class="primary">(g::t(lang, K::SaveLabels))</button></div></noscript>
1113+ </form>
1114+ )
1115+ </div>
11141116 }
1115- </div>
1117+ </section>
11161118 })
11171119 }
11181120
@@ -1127,16 +1129,17 @@ pub(crate) async fn assignees_box(
11271129 ) -> Result<impl View> {
11281130 let text = names.join(", ");
11291131 Ok(view! {
1130- <div class="acts">
1131- <span class="state">
1132- (g::t(lang, K::Assignees)) ": "
1132+ <section class="sec meta">
1133+ <h2>(g::t(lang, K::Assignees))</h2>
1134+ <p class="hint">
11331135 if names.is_empty() {
11341136 (g::t(lang, K::NoOneAssigned))
11351137 } else {
11361138 (text.as_str())
11371139 }
1138- </span>
1140+ </p>
11391141 if write {
1142+ <div class="acts">
11401143 reveal(label: g::t(lang, K::Edit),
11411144 if let Some(next) = assign_next {
11421145 <form method="post" action=(action.as_str()) class="act-form">
@@ -1155,8 +1158,9 @@ pub(crate) async fn assignees_box(
11551158 <noscript><div><button type="submit" class="primary">(g::t(lang, K::SaveAssignees))</button></div></noscript>
11561159 </form>
11571160 )
1161+ </div>
11581162 }
1159- </div>
1163+ </section>
11601164 })
11611165 }
11621166
@@ -1171,33 +1175,35 @@ pub(crate) async fn milestone_box(
11711175 none_selected: bool,
11721176 ) -> Result<impl View> {
11731177 Ok(view! {
1174- <div class="acts">
1175- <span class="state">
1176- (g::t(lang, K::MilestoneBox)) ": "
1178+ <section class="sec meta">
1179+ <h2>(g::t(lang, K::MilestoneBox))</h2>
1180+ <p class="hint">
11771181 if current.is_empty() {
11781182 (g::t(lang, K::NoMilestone))
11791183 } else {
11801184 (current.as_str())
11811185 }
1182- </span>
1186+ </p>
11831187 if write {
1184- reveal(label: g::t(lang, K::Edit),
1185- <form method="post" action=(action.as_str()) class="fields" data-apply="true">
1186- <input type="hidden" name="csrf" value=(csrf.as_str())>
1187- <div class="field">
1188- <label for="issue-milestone">(g::t(lang, K::MilestoneBox))</label>
1189- <select id="issue-milestone" name="milestone_id">
1190- <option value="" selected=(none_selected)>(g::t(lang, K::NoneOption))</option>
1191- for row in options.iter() {
1192- <option value=(row.id.as_str()) selected=(row.selected)>(row.title.as_str())</option>
1193- }
1194- </select>
1195- </div>
1196- <noscript><div><button type="submit" class="primary">(g::t(lang, K::SaveMilestone))</button></div></noscript>
1197- </form>
1198- )
1188+ <div class="acts">
1189+ reveal(label: g::t(lang, K::Edit),
1190+ <form method="post" action=(action.as_str()) class="fields" data-apply="true">
1191+ <input type="hidden" name="csrf" value=(csrf.as_str())>
1192+ <div class="field">
1193+ <label for="issue-milestone">(g::t(lang, K::MilestoneBox))</label>
1194+ <select id="issue-milestone" name="milestone_id">
1195+ <option value="" selected=(none_selected)>(g::t(lang, K::NoneOption))</option>
1196+ for row in options.iter() {
1197+ <option value=(row.id.as_str()) selected=(row.selected)>(row.title.as_str())</option>
1198+ }
1199+ </select>
1200+ </div>
1201+ <noscript><div><button type="submit" class="primary">(g::t(lang, K::SaveMilestone))</button></div></noscript>
1202+ </form>
1203+ )
1204+ </div>
11991205 }
1200- </div>
1206+ </section>
12011207 })
12021208 }
12031209
@@ -1219,9 +1225,9 @@ pub(crate) async fn lock_box(
12191225 .to_owned();
12201226 let none = reason.is_none();
12211227 Ok(view! {
1222- <div class="acts">
1223- <span class="state">
1224- (g::t(lang, K::ConversationBox)) ": "
1228+ <section class="sec meta">
1229+ <h2>(g::t(lang, K::ConversationBox))</h2>
1230+ <p class="hint">
12251231 if locked {
12261232 (g::t(lang, K::LockedToCollaborators))
12271233 if !none {
@@ -1230,32 +1236,34 @@ pub(crate) async fn lock_box(
12301236 } else {
12311237 (g::t(lang, K::OpenToEveryone))
12321238 }
1233- </span>
1239+ </p>
12341240 if write {
1235- reveal(label: g::t(lang, K::Edit),
1236- <form method="post" action=(action.as_str()) class="fields">
1237- <input type="hidden" name="csrf" value=(csrf.as_str())>
1238- if locked {
1239- <input type="hidden" name="locked" value="0">
1240- <button type="submit" class="primary">(g::t(lang, K::UnlockConversation))</button>
1241- } else {
1242- <div class="field">
1243- <label for="issue-lock-reason">(g::t(lang, K::Reason))</label>
1244- <select id="issue-lock-reason" name="reason">
1245- <option value="" selected=(true)>(g::t(lang, K::NoReason))</option>
1246- <option value="off_topic">(g::t(lang, K::OptOffTopic))</option>
1247- <option value="too_heated">(g::t(lang, K::OptTooHeated))</option>
1248- <option value="resolved">(g::t(lang, K::OptResolved))</option>
1249- <option value="spam">(g::t(lang, K::OptSpam))</option>
1250- </select>
1251- </div>
1252- <input type="hidden" name="locked" value="1">
1253- <button type="submit" class="primary">(g::t(lang, K::LockConversation))</button>
1254- }
1255- </form>
1256- )
1241+ <div class="acts">
1242+ reveal(label: g::t(lang, K::Edit),
1243+ <form method="post" action=(action.as_str()) class="fields">
1244+ <input type="hidden" name="csrf" value=(csrf.as_str())>
1245+ if locked {
1246+ <input type="hidden" name="locked" value="0">
1247+ <button type="submit" class="primary">(g::t(lang, K::UnlockConversation))</button>
1248+ } else {
1249+ <div class="field">
1250+ <label for="issue-lock-reason">(g::t(lang, K::Reason))</label>
1251+ <select id="issue-lock-reason" name="reason">
1252+ <option value="" selected=(true)>(g::t(lang, K::NoReason))</option>
1253+ <option value="off_topic">(g::t(lang, K::OptOffTopic))</option>
1254+ <option value="too_heated">(g::t(lang, K::OptTooHeated))</option>
1255+ <option value="resolved">(g::t(lang, K::OptResolved))</option>
1256+ <option value="spam">(g::t(lang, K::OptSpam))</option>
1257+ </select>
1258+ </div>
1259+ <input type="hidden" name="locked" value="1">
1260+ <button type="submit" class="primary">(g::t(lang, K::LockConversation))</button>
1261+ }
1262+ </form>
1263+ )
1264+ </div>
12571265 }
1258- </div>
1266+ </section>
12591267 })
12601268 }
12611269
crates/forge-web/src/pages/issue_pin.rsmodified+8 -6
@@ -92,18 +92,20 @@ pub(crate) async fn pin_box(
9292 g::t(lang, K::PinIssue)
9393 };
9494 Ok(view! {
95- <div class="acts">
96- <span class="state">
97- (g::t(lang, K::Pinned)) ": "
95+ <section class="sec meta">
96+ <h2>(g::t(lang, K::Pinned))</h2>
97+ <p class="hint">
9898 if pinned {
9999 (g::t(lang, K::PinnedTopNote))
100100 } else {
101101 (g::t(lang, K::NotPinned))
102102 }
103- </span>
103+ </p>
104104 if write {
105- post_act(label: label, action: action.as_str(), csrf: csrf.as_str(), fields: vec![("pinned".to_owned(), next.to_owned())])
105+ <div class="acts">
106+ post_act(label: label, action: action.as_str(), csrf: csrf.as_str(), fields: vec![("pinned".to_owned(), next.to_owned())])
107+ </div>
106108 }
107- </div>
109+ </section>
108110 })
109111 }
crates/forge-web/src/pages/issue_view.rsmodified+46 -49
@@ -30,7 +30,8 @@ use crate::pages::notifications::notify_box_for;
3030 use crate::pages::repo::repo_head;
3131 use crate::pages::repo_ctx::{RepoCtx, load_repo};
3232 use crate::state::AppState;
33-use crate::views::{alert, repo_href, shell, user_facing_message, user_link};
33+use crate::views::parts::SubPart;
34+use crate::views::{alert, repo_href, shell, user_facing_message, user_href};
3435 use crate::webhooks::emit::{Sender, emit_comment, emit_item_action};
3536
3637 path_param!(owner);
@@ -83,6 +84,16 @@ async fn issue_page(
8384 (IssueState::Closed, _) => ("issue-badge issue-badge-completed", g::t(lang, K::Closed)),
8485 };
8586 let comments_label = g::comment_count(lang, issue.comment_count);
87+ let sub = vec![
88+ SubPart {
89+ text: state_text.to_owned(),
90+ href: None,
91+ class: state_class,
92+ },
93+ SubPart::link(author.clone(), user_href(&author_login)),
94+ SubPart::text(opened.relative.clone()),
95+ SubPart::text(comments_label),
96+ ];
8697 let page_title = format!("{} #{number} \u{b7} {owner}/{name}", issue.title);
8798 let number_label = format!("#{number}");
8899 let login_href = "/login".to_owned();
@@ -93,40 +104,28 @@ async fn issue_page(
93104 let header = ctx.head(state, "issues").await?;
94105 Ok(view! { cx =>
95106 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(), extra_stylesheet: Some(labels_href.as_str()),
96- repo_head(head: header)
97- <section class="sec" data-live=(live_href.as_str()) data-live-now="">
98- <h1 class="h1">(issue.title.as_str()) " " <span class="hint">(number_label.as_str())</span></h1>
99- <p class="hint">
100- <span class=(state_class)>(state_text)</span>
101- " · "
102- <strong>user_link(shown: author.as_str(), login: author_login.as_str())</strong>
103- " "
104- (g::t(lang, K::OpenedThis))
105- " "
106- <time data-rel="true" datetime=(opened.iso.as_str()) title=(opened.absolute.as_str())>(opened.relative.as_str())</time>
107- " "
108- (g::opened_after(lang))
109- " · "
110- (comments_label.as_str())
111- </p>
112- </section>
113- <section class="sec">
107+ repo_head(head: header, title: Some(issue.title.clone()), sub: sub,
108+ <span class="num">(number_label.as_str())</span>
109+ )
110+ <div class="work" data-live=(live_href.as_str()) data-live-now="">
111+ <div class="sheet">
112+ discussion_timeline(lang: lang, discussion: discussion)
113+ if can_comment {
114+ comment_form(lang: lang, action: comment_action.clone(), state_action: comment_action.clone(),
115+ csrf: csrf.clone(), draft: draft, error: error, can_close: editable_issue, open: open)
116+ }
117+ if archived {
118+ <p class="state">(g::t(lang, K::ArchivedIssuesReadOnly))</p>
119+ }
120+ if locked_for_viewer {
121+ <p class="state">(lock_notice.as_str())</p>
122+ } else if !signed_in {
123+ <p class="state">(g::comment_login_lead(lang))<a href=(login_href.as_str())>(g::t(lang, K::LogInLink))</a>(g::t(lang, K::ToComment))</p>
124+ }
114125 pin_box(lang: lang, write: write_meta, pinned: pinned, action: pin_action.clone(), csrf: csrf.clone())
115126 item_sidebar(lang: lang, write: write_meta, base: issue_href.clone(), csrf: csrf.clone(), viewer: viewer_login, sidebar: sidebar, notify: notify)
116- </section>
117- discussion_timeline(lang: lang, discussion: discussion)
118- if can_comment {
119- comment_form(lang: lang, action: comment_action.clone(), state_action: comment_action.clone(),
120- csrf: csrf.clone(), draft: draft, error: error, can_close: editable_issue, open: open)
121- }
122- if archived {
123- <p class="hint">(g::t(lang, K::ArchivedIssuesReadOnly))</p>
124- }
125- if locked_for_viewer {
126- <p class="hint">(lock_notice.as_str())</p>
127- } else if !signed_in {
128- <p class="hint">(g::comment_login_lead(lang))<a href=(login_href.as_str())>(g::t(lang, K::LogInLink))</a>(g::t(lang, K::ToComment))</p>
129- }
127+ </div>
128+ </div>
130129 )
131130 })
132131 }
@@ -216,9 +215,8 @@ async fn edit_item_page(
216215 let header = ctx.head(state, kind_tab(kind)).await?;
217216 Ok(view! { cx =>
218217 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
219- repo_head(head: header)
220- <section class="sec">
221- <h1 class="h1">(heading.as_str())</h1>
218+ repo_head(head: header, title: Some(heading))
219+ <div class="sheet fit">
222220 if let Some(message) = error {
223221 alert(message: message.as_str())
224222 }
@@ -232,12 +230,12 @@ async fn edit_item_page(
232230 <label for="item-body">(g::t(lang, K::Description))</label>
233231 <textarea id="item-body" name="body" rows="12">(body.as_str())</textarea>
234232 </div>
235- <button type="submit" class="primary">(g::t(lang, K::SaveChanges))</button>
233+ <div class="acts">
234+ <button type="submit" class="primary">(g::t(lang, K::SaveChanges))</button>
235+ <a class="act" href=(back.as_str())>(g::t(lang, K::Cancel))</a>
236+ </div>
236237 </form>
237- <div class="acts">
238- <a class="act quiet" href=(back.as_str())>(g::t(lang, K::Cancel))</a>
239- </div>
240- </section>
238+ </div>
241239 )
242240 })
243241 }
@@ -332,9 +330,8 @@ async fn edit_comment_page(
332330 let header = ctx.head(state, kind_tab(kind)).await?;
333331 Ok(view! { cx =>
334332 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
335- repo_head(head: header)
336- <section class="sec">
337- <h1 class="h1">(g::t(lang, K::EditComment))</h1>
333+ repo_head(head: header, title: Some(g::t(lang, K::EditComment).to_owned()))
334+ <div class="sheet fit">
338335 if let Some(message) = error {
339336 alert(message: message.as_str())
340337 }
@@ -344,12 +341,12 @@ async fn edit_comment_page(
344341 <label for="comment-body">(g::t(lang, K::Comment))</label>
345342 <textarea id="comment-body" name="body" rows="10">(body.as_str())</textarea>
346343 </div>
347- <button type="submit" class="primary">(g::t(lang, K::SaveComment))</button>
344+ <div class="acts">
345+ <button type="submit" class="primary">(g::t(lang, K::SaveComment))</button>
346+ <a class="act" href=(back.as_str())>(g::t(lang, K::Cancel))</a>
347+ </div>
348348 </form>
349- <div class="acts">
350- <a class="act quiet" href=(back.as_str())>(g::t(lang, K::Cancel))</a>
351- </div>
352- </section>
349+ </div>
353350 )
354351 })
355352 }
crates/forge-web/src/pages/issues_list.rsmodified+189 -137
@@ -21,10 +21,12 @@ use crate::i18n::{self, Lang};
2121 use crate::notify::{self, Activity};
2222 use crate::pages::issue_meta::{can_triage, form_all, form_field, form_pairs};
2323 use crate::pages::issues_live::list_live_url;
24+use crate::pages::passkeys::s;
2425 use crate::pages::repo::repo_head;
2526 use crate::pages::repo_ctx::{RepoHead, load_repo};
2627 use crate::state::AppState;
2728 use crate::templates::{self, Template};
29+use crate::views::parts::{RailItem, SubPart, rail};
2830 use crate::views::{
2931 alert, avatar_url, csrf_field, enc, iso_time, now_unix, relative_time, repo_href,
3032 shell, user_facing_message, user_link,
@@ -242,18 +244,6 @@ pub(crate) fn stamp_unix(stamp: &str) -> i64 {
242244 .map_or(0, |t| t.unix_timestamp())
243245 }
244246
245-/// One link of a tab row. The current tab carries `aria-current`.
246-#[component]
247-pub(crate) async fn state_tab(href: &str, text: &str, current: bool) -> Result<impl View> {
248- Ok(view! {
249- if current {
250- <a aria-current="page" href=(href)>(text)</a>
251- } else {
252- <a href=(href)>(text)</a>
253- }
254- })
255-}
256-
257247 pub(crate) struct AssigneeView {
258248 pub(crate) name: String,
259249 pub(crate) avatar: String,
@@ -275,7 +265,8 @@ pub(crate) struct MilestoneView {
275265 struct RowView {
276266 /// The number, the `data-arrive` value that marks a row new after a live update.
277267 arrive: String,
278- state_class: &'static str,
268+ /// `tick`, with `done` for a closed issue.
269+ tick_class: &'static str,
279270 state_label: &'static str,
280271 number_text: String,
281272 href: String,
@@ -323,11 +314,7 @@ fn row_view(row: RowCtx<'_>, item: &IssueListItem) -> RowView {
323314 let comments = issue.comment_count.max(0);
324315 RowView {
325316 arrive: issue.number.to_string(),
326- state_class: if open {
327- "issue-state issue-state-open"
328- } else {
329- "issue-state issue-state-closed"
330- },
317+ tick_class: if open { "tick" } else { "tick done" },
331318 state_label: if open {
332319 g::t(lang, K::OpenIssue)
333320 } else {
@@ -340,7 +327,7 @@ fn row_view(row: RowCtx<'_>, item: &IssueListItem) -> RowView {
340327 .labels
341328 .iter()
342329 .map(|label| LabelView {
343- class: format!("label-chip label-{}", label.id),
330+ class: format!("tag label-chip label-{}", label.id),
344331 name: label.name.clone(),
345332 href: list_href(&base, &[("state", state), ("label", label.name.as_str())]),
346333 })
@@ -379,7 +366,7 @@ pub(crate) fn tasks_text(lang: Lang, body: &str) -> Option<String> {
379366
380367 /// One pinned issue card, with the strings the template shows already built.
381368 struct PinnedCard {
382- state_class: &'static str,
369+ tick_class: &'static str,
383370 state_label: &'static str,
384371 number_text: String,
385372 href: String,
@@ -391,11 +378,7 @@ fn pinned_card(lang: Lang, owner: &str, repo: &str, issue: &forge_core::Issue) -
391378 let open = matches!(issue.state, IssueState::Open);
392379 let comments = issue.comment_count.max(0);
393380 PinnedCard {
394- state_class: if open {
395- "issue-state issue-state-open"
396- } else {
397- "issue-state issue-state-closed"
398- },
381+ tick_class: if open { "tick" } else { "tick done" },
399382 state_label: if open {
400383 g::t(lang, K::OpenIssue)
401384 } else {
@@ -415,6 +398,45 @@ pub(crate) struct SortOption {
415398 pub(crate) selected: bool,
416399 }
417400
401+/// How many open issues match one assignee or author, from the list's total with one row asked for.
402+async fn open_matching(
403+ state: &AppState,
404+ repo_id: &str,
405+ assignee: Option<String>,
406+ author: Option<String>,
407+) -> forge_core::Result<u64> {
408+ let filter = IssueFilter {
409+ state: Some(IssueState::Open),
410+ label: None,
411+ milestone: None,
412+ author,
413+ assignee,
414+ review_requested: None,
415+ query: None,
416+ draft: None,
417+ sort: IssueSort::Newest,
418+ page: 1,
419+ per_page: 1,
420+ };
421+ Ok(state.store.list_issues(repo_id, &filter).await?.1)
422+}
423+
424+/// The list's sub line: the open and closed counts, then the viewer's assigned count when signed in.
425+fn list_sub(lang: Lang, open: u64, closed: u64, assigned: Option<u64>) -> Vec<SubPart> {
426+ let (open_text, closed_text) = match lang {
427+ Lang::En => (format!("{open} open"), format!("{closed} closed")),
428+ Lang::Tr => (format!("{open} açık"), format!("{closed} kapalı")),
429+ };
430+ let mut parts = vec![SubPart::text(open_text), SubPart::text(closed_text)];
431+ if let Some(n) = assigned {
432+ parts.push(SubPart::text(match lang {
433+ Lang::En => format!("{n} assigned to you"),
434+ Lang::Tr => format!("{n} sana atanmış"),
435+ }));
436+ }
437+ parts
438+}
439+
418440 #[page("/{owner}/{repo}/issues")]
419441 async fn issues_list_page(cx: &Cx) -> Result<impl View> {
420442 let owner = path_param::<Owner>(cx);
@@ -469,9 +491,15 @@ async fn issues_list_page(cx: &Cx) -> Result<impl View> {
469491 let open_href = sel.href(&base, "open", 1);
470492 let closed_href = sel.href(&base, "closed", 1);
471493 let all_href = sel.href(&base, "all", 1);
472- let open_text = g::tab_open(lang, open_count);
473- let closed_text = g::tab_closed(lang, closed_count);
474- let all_text = g::tab_all(lang, open_count + closed_count);
494+ let me = ctx.viewer.as_ref().map(|(u, _)| u.username.clone());
495+ let (assigned_count, created_count) = match &me {
496+ Some(name) => (
497+ open_matching(state, &ctx.repo.id, Some(name.clone()), None).await?,
498+ open_matching(state, &ctx.repo.id, None, Some(name.clone())).await?,
499+ ),
500+ None => (0, 0),
501+ };
502+ let sub = list_sub(lang, open_count, closed_count, me.as_ref().map(|_| assigned_count));
475503 let clear_href = list_href(&base, &[("state", sel.state)]);
476504 let has_filters = sel.has_filters();
477505
@@ -506,92 +534,115 @@ async fn issues_list_page(cx: &Cx) -> Result<impl View> {
506534
507535 let live_href = list_live_url(&owner_name, &repo_name);
508536 let header = ctx.head(state, "issues").await?;
537+ let tools_title = match sel.state {
538+ "closed" => s(lang, "Closed issues", "Kapalı sorunlar"),
539+ "all" => s(lang, "All issues", "Tüm sorunlar"),
540+ _ => s(lang, "Open issues", "Açık sorunlar"),
541+ };
542+ let person_filter = sel.assignee.is_empty() && sel.author.is_empty();
543+ let mut rail_items = vec![
544+ RailItem {
545+ name: g::t(lang, K::Open).to_owned(),
546+ val: open_count.to_string(),
547+ href: open_href,
548+ current: open_on && person_filter,
549+ },
550+ RailItem {
551+ name: g::t(lang, K::Closed).to_owned(),
552+ val: closed_count.to_string(),
553+ href: closed_href,
554+ current: closed_on && person_filter,
555+ },
556+ RailItem {
557+ name: s(lang, "All", "Tümü").to_owned(),
558+ val: (open_count + closed_count).to_string(),
559+ href: all_href,
560+ current: all_on && person_filter,
561+ },
562+ ];
563+ if let Some(name) = &me {
564+ rail_items.push(RailItem {
565+ name: s(lang, "Assigned to you", "Sana atanmış").to_owned(),
566+ val: assigned_count.to_string(),
567+ href: list_href(&base, &[("state", "open"), ("assignee", name.as_str())]),
568+ current: sel.state == "open" && sel.assignee == *name,
569+ });
570+ rail_items.push(RailItem {
571+ name: s(lang, "Created by you", "Sana ait").to_owned(),
572+ val: created_count.to_string(),
573+ href: list_href(&base, &[("state", "open"), ("author", name.as_str())]),
574+ current: sel.state == "open" && sel.author == *name,
575+ });
576+ }
509577 Ok(view! {
510578 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), extra_stylesheet: Some(labels_href.as_str()),
511- repo_head(head: header)
512- <div data-live=(live_href.as_str()) data-live-now="">
513- <h1 class="sr-only">(title.as_str())</h1>
514- <nav class="tabs" aria-label=(g::t(lang, K::IssuesByState))>
515- state_tab(href: open_href.as_str(), text: open_text.as_str(), current: open_on)
516- state_tab(href: closed_href.as_str(), text: closed_text.as_str(), current: closed_on)
517- state_tab(href: all_href.as_str(), text: all_text.as_str(), current: all_on)
518- </nav>
519- <form method="get" action=(base.as_str())>
520- <input type="hidden" name="state" value=(sel.state)>
521- <input type="hidden" name="label" value=(sel.label.as_str())>
522- <input type="hidden" name="milestone" value=(sel.milestone.as_str())>
523- <input type="hidden" name="author" value=(sel.author.as_str())>
524- <input type="hidden" name="assignee" value=(sel.assignee.as_str())>
525- <div class="plain-search">
526- <input type="search" name="q" value=(search_value.as_str()) data-live-search="" autocomplete="off" placeholder=(g::t(lang, K::SearchTitles)) aria-label=(g::t(lang, K::SearchTitles)) maxlength="256">
527- <button type="submit" class="sr-only">(g::t(lang, K::Search))</button>
528- </div>
529- <div class="sub">
530- <select name="sort" aria-label=(g::t(lang, K::Sort)) data-autosubmit=(true)>
531- for option in sort_options.iter() {
532- <option value=(option.value) selected=(option.selected)>(option.label)</option>
533- }
534- </select>
535- <a href=(labels_page_href.as_str())>(g::t(lang, K::Labels))</a>
536- <a href=(milestones_href.as_str())>(g::t(lang, K::Milestones))</a>
537- if can_create {
538- <a class="act" href=(new_href.as_str()) data-palette-action="go">(g::t(lang, K::NewIssue))</a>
579+ repo_head(head: header, sub: sub,
580+ if can_create {
581+ <a class="button primary" href=(new_href.as_str()) data-palette-action="go">(g::t(lang, K::NewIssue))</a>
582+ }
583+ )
584+ <div class="work" data-live=(live_href.as_str()) data-live-now="">
585+ rail(label: s(lang, "Filters", "Filtreler"), items: rail_items)
586+ <div class="sheet">
587+ <form method="get" action=(base.as_str()) class="sheet-tools">
588+ <input type="hidden" name="state" value=(sel.state)>
589+ <input type="hidden" name="label" value=(sel.label.as_str())>
590+ <input type="hidden" name="milestone" value=(sel.milestone.as_str())>
591+ <input type="hidden" name="author" value=(sel.author.as_str())>
592+ <input type="hidden" name="assignee" value=(sel.assignee.as_str())>
593+ <strong>(tools_title)</strong>
594+ <div class="plain-search">
595+ <input type="search" name="q" value=(search_value.as_str()) data-live-search="" autocomplete="off" placeholder=(g::t(lang, K::SearchTitles)) aria-label=(g::t(lang, K::SearchTitles)) maxlength="256">
596+ <button type="submit" class="sr-only">(g::t(lang, K::Search))</button>
597+ </div>
598+ <select name="sort" aria-label=(g::t(lang, K::Sort)) data-autosubmit=(true)>
599+ for option in sort_options.iter() {
600+ <option value=(option.value) selected=(option.selected)>(option.label)</option>
601+ }
602+ </select>
603+ <a class="act" href=(labels_page_href.as_str())>(g::t(lang, K::Labels))</a>
604+ <a class="act" href=(milestones_href.as_str())>(g::t(lang, K::Milestones))</a>
605+ </form>
606+ if has_filters {
607+ <p class="hint">(g::t(lang, K::FiltersApplied)) " " <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a></p>
539608 }
540- </div>
541- </form>
542- if has_filters {
543- <p class="hint">(g::t(lang, K::FiltersApplied)) " " <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a></p>
544- }
545- if !pinned.is_empty() {
546- <section class="sec" aria-label=(g::t(lang, K::PinnedIssues))>
547- <h2>(g::t(lang, K::Pinned))</h2>
548- for card in pinned.iter() {
549- <a class="line" href=(card.href.as_str())>
550- <span class=(card.state_class) role="img" aria-label=(card.state_label)></span>
551- <span class="name">(card.title.as_str())</span>
552- <span class="val">(card.number_text.as_str()) " · " (card.comments_text.as_str())</span>
553- </a>
609+ if !pinned.is_empty() {
610+ <section class="sec" aria-label=(g::t(lang, K::PinnedIssues))>
611+ <h2>(g::t(lang, K::Pinned))</h2>
612+ for card in pinned.iter() {
613+ <a class="line" href=(card.href.as_str())>
614+ <span class=(card.tick_class) role="img" aria-label=(card.state_label)></span>
615+ <span class="name">(card.title.as_str())</span>
616+ <span class="val">(card.number_text.as_str()) " · " (card.comments_text.as_str())</span>
617+ </a>
618+ }
619+ </section>
554620 }
555- </section>
556- }
557- if rows.is_empty() {
558- <p class="state">(empty_text)</p>
559- if has_filters {
560- <div class="acts">
561- <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a>
562- </div>
563- } else if can_create {
564- <div class="acts">
565- <a class="act" href=(new_href.as_str()) data-palette-action="go">(g::t(lang, K::NewIssue))</a>
566- </div>
567- }
568- } else {
569- <div>
570- for row in rows.iter() {
571- <div class="line issue-row" data-kb-row="" data-arrive=(row.arrive.as_str())>
572- <span class=(row.state_class) role="img" aria-label=(row.state_label)></span>
573- <div class="issue-main">
574- <div class="issue-title-line">
575- <a class="issue-title" href=(row.href.as_str())>(row.title.as_str())</a>
576- for chip in row.labels.iter() {
577- <a class=(chip.class.as_str()) href=(chip.href.as_str())>(chip.name.as_str())</a>
578- }
579- </div>
580- <div class="issue-meta muted small">
581- <span>(row.number_text.as_str())</span>
582- if lang == Lang::Tr {
583- <span>user_link(shown: row.author.as_str(), login: row.author.as_str())</span>
584- <span>(g::t(lang, K::By))</span>
585- <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
586- <span>(g::t(lang, K::Opened))</span>
587- } else {
588- <span>(g::t(lang, K::Opened))</span>
589- <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
590- <span>(g::t(lang, K::By))</span>
591- <span>user_link(shown: row.author.as_str(), login: row.author.as_str())</span>
592- }
621+ if rows.is_empty() {
622+ <p class="state">(empty_text)</p>
623+ if has_filters {
624+ <div class="acts">
625+ <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a>
626+ </div>
627+ } else if can_create {
628+ <div class="acts">
629+ <a class="act" href=(new_href.as_str()) data-palette-action="go">(g::t(lang, K::NewIssue))</a>
630+ </div>
631+ }
632+ } else {
633+ for row in rows.iter() {
634+ <div class="line issue-row" data-kb-row="" data-arrive=(row.arrive.as_str())>
635+ <span class=(row.tick_class) role="img" aria-label=(row.state_label)></span>
636+ <a class="name" href=(row.href.as_str())>(row.title.as_str())</a>
637+ for chip in row.labels.iter() {
638+ <a class=(chip.class.as_str()) href=(chip.href.as_str())>(chip.name.as_str())</a>
639+ }
640+ <span class="val">
641+ (row.number_text.as_str()) " · "
642+ user_link(shown: row.author.as_str(), login: row.author.as_str()) " · "
643+ <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
593644 if let Some(milestone) = row.milestone.clone() {
594- <a href=(milestone.href.as_str())>(milestone.title.as_str())</a>
645+ " · " <a href=(milestone.href.as_str())>(milestone.title.as_str())</a>
595646 }
596647 if let Some(tasks) = row.tasks_text.clone() {
597648 <span class="task-progress">(tasks.as_str())</span>
@@ -600,25 +651,24 @@ async fn issues_list_page(cx: &Cx) -> Result<impl View> {
600651 <img class="avatar avatar-sm" src=(assignee.avatar.as_str()) alt=(assignee.name.as_str()) title=(assignee.name.as_str()) width="20" height="20">
601652 }
602653 if row.has_comments {
603- <a class="small muted" href=(row.href.as_str())>(row.comments_text.as_str())</a>
654+ " · " <a href=(row.href.as_str())>(row.comments_text.as_str())</a>
604655 }
605- </div>
656+ </span>
606657 </div>
607- </div>
608- }
609- </div>
610- }
611- if has_newer || has_older {
612- <nav class="sub">
613- if has_newer {
614- <a href=(newer_href.as_str())>(g::t(lang, K::Newer))</a>
658+ }
615659 }
616- <span>(page_label.as_str())</span>
617- if has_older {
618- <a href=(older_href.as_str())>(g::t(lang, K::Older))</a>
660+ if has_newer || has_older {
661+ <nav class="sub">
662+ if has_newer {
663+ <a href=(newer_href.as_str())>(g::t(lang, K::Newer))</a>
664+ }
665+ <span>(page_label.as_str())</span>
666+ if has_older {
667+ <a href=(older_href.as_str())>(g::t(lang, K::Older))</a>
668+ }
669+ </nav>
619670 }
620- </nav>
621- }
671+ </div>
622672 </div>
623673 )
624674 })
@@ -709,8 +759,8 @@ async fn new_issue_body(
709759 let rows = chooser.unwrap_or_default();
710760 let has_labels = !labels.is_empty();
711761 Ok(view! {
712- repo_head(head: head)
713- <h1 class="sr-only">(g::t(lang, K::NewIssue))</h1>
762+ repo_head(head: head, title: Some(g::t(lang, K::NewIssue).to_owned()))
763+ <div class="sheet fit">
714764 if chooser_mode {
715765 <p class="state">(g::t(lang, K::ChooseTemplate))</p>
716766 <div>
@@ -741,15 +791,17 @@ async fn new_issue_body(
741791 <p class="hint">(g::t(lang, K::MarkdownSupported))</p>
742792 </div>
743793 if has_labels {
744- <fieldset class="field">
745- <legend>(g::t(lang, K::Labels))</legend>
746- for label in labels.iter() {
747- <label class="switch">
748- <input type="checkbox" name="label" value=(label.id.as_str()) checked=(label.checked)>
749- <span>(label.name.as_str())</span>
750- </label>
751- }
752- </fieldset>
794+ <div class="field">
795+ <span class="field-label">(g::t(lang, K::Labels))</span>
796+ <div class="checks">
797+ for label in labels.iter() {
798+ <label class="switch">
799+ <input type="checkbox" name="label" value=(label.id.as_str()) checked=(label.checked)>
800+ <span>(label.name.as_str())</span>
801+ </label>
802+ }
803+ </div>
804+ </div>
753805 }
754806 <div class="acts">
755807 <button type="submit" class="primary">(g::t(lang, K::SubmitNewIssue))</button>
@@ -757,6 +809,7 @@ async fn new_issue_body(
757809 </div>
758810 </form>
759811 }
812+ </div>
760813 })
761814 }
762815
@@ -1139,7 +1192,6 @@ mod tests {
11391192 .await
11401193 .text();
11411194 assert!(html.contains("az önce"), "{html}");
1142- assert!(html.contains("açıldı"), "{html}");
11431195 assert!(!html.contains("just now"), "{html}");
11441196
11451197 // [archived] last, because it changes the repo: creates and the form are 403.
@@ -1227,7 +1279,7 @@ mod tests {
12271279 .text();
12281280 assert!(default.contains("still open"));
12291281 assert!(!default.contains("already done"));
1230- assert!(default.contains("Closed 1"), "{default}");
1282+ assert!(default.contains(">Closed</span>"), "{default}");
12311283 let closed = send(
12321284 &fx.router,
12331285 "GET",
crates/forge-web/src/pages/labels_page.rsmodified+6 -7
@@ -97,13 +97,12 @@ async fn labels_body(
9797 let csrf = frame.csrf.clone();
9898 let header = frame.head.clone();
9999 Ok(view! {
100- repo_head(head: header)
101- if archived {
102- <p class="state" role="status">(g::t(lang, K::LabelsArchived))</p>
103- }
100+ repo_head(head: header, title: Some(g::t(lang, K::Labels).to_owned()))
104101 issue_subnav(lang: lang, title: frame.title.clone(), active: "labels".to_owned())
105- <div class="lang-list" data-live=(live.as_str()) data-live-now="">
106- <h2 class="sr-only">(g::t(lang, K::Labels))</h2>
102+ <div class="sheet" data-live=(live.as_str()) data-live-now="">
103+ if archived {
104+ <p class="state" role="status">(g::t(lang, K::LabelsArchived))</p>
105+ }
107106 if can_triage {
108107 <section class="sec">
109108 <h2>(g::t(lang, K::NewLabel))</h2>
@@ -149,7 +148,7 @@ async fn labels_body(
149148 </span>
150149 </summary>
151150 <div class="opened">
152- <p class="state"><a class="label-open" href=(row.issues_href.as_str())>(row.open_text.as_str())</a></p>
151+ <p class="hint"><a class="label-open" href=(row.issues_href.as_str())>(row.open_text.as_str())</a></p>
153152 if can_triage {
154153 <div class="acts">
155154 reveal(label: g::t(lang, K::Edit),
crates/forge-web/src/pages/login.rsmodified+19 -10
@@ -22,9 +22,10 @@ use crate::auth::{
2222 };
2323 use crate::client_ip::client_ip;
2424 use crate::i18n::{self, Key, Lang, t};
25-use crate::pages::passkeys::{available as passkeys_available, login_passkey};
25+use crate::pages::passkeys::{available as passkeys_available, login_passkey, s};
2626 use crate::state::AppState;
2727 use crate::throttle::{self, LOGIN_IP_LIMIT, LOGIN_USER_LIMIT, TWO_FACTOR_USER_LIMIT};
28+use crate::views::parts::{SubPart, head};
2829 use crate::views::{alert, shell};
2930
3031 /// Hash checked when the username is unknown, so both paths spend one argon2 verify.
@@ -76,10 +77,11 @@ async fn login_form(
7677 precsrf: &str,
7778 error: Option<String>,
7879 passkeys: bool,
80+ can_register: bool,
7981 ) -> Result<impl View> {
8082 Ok(view! {
81- <section>
82- <h1>(t(lang, Key::LogIn))</h1>
83+ head(title: t(lang, Key::LogIn))
84+ <div class="sheet fit">
8385 <form data-hard="true" method="post" action="/login" class="fields">
8486 if let Some(message) = error {
8587 alert(message: message.as_str())
@@ -95,11 +97,17 @@ async fn login_form(
9597 <input id="login-password" type="password" name="password" autocomplete="current-password" required=(true)>
9698 </div>
9799 <button type="submit" class="primary">(t(lang, Key::LogIn))</button>
100+ <p class="acts">
101+ <a class="act" href="/forgot">(s(lang, "Forgot password", "Parolamı unuttum"))</a>
102+ if can_register {
103+ <a class="act" href="/register">(s(lang, "Create an account", "Hesap oluştur"))</a>
104+ }
105+ </p>
98106 </form>
99107 if passkeys {
100108 login_passkey(lang: lang)
101109 }
102- </section>
110+ </div>
103111 })
104112 }
105113
@@ -113,8 +121,9 @@ async fn login_page(cx: &Cx) -> Result<impl View> {
113121 let precsrf = pre_csrf_token(cx);
114122 let lang = i18n::lang(cx, None);
115123 let passkeys = passkeys_available(app_context::<AppState>(cx));
124+ let can_register = app_context::<AppState>(cx).live().registration == forge_core::Registration::Open;
116125 Ok(view! {
117- shell(title: t(lang, Key::LogIn), viewer: None, login_form(lang: lang, next: next.as_str(), username: "", precsrf: precsrf.as_str(), error: None, passkeys: passkeys))
126+ shell(title: t(lang, Key::LogIn), viewer: None, login_form(lang: lang, next: next.as_str(), username: "", precsrf: precsrf.as_str(), error: None, passkeys: passkeys, can_register: can_register))
118127 })
119128 }
120129
@@ -258,20 +267,20 @@ async fn login_submit(cx: &Cx, Form(form): Form<LoginForm>) -> Result<impl View>
258267 let username = form.username.clone();
259268 let precsrf = form.precsrf.clone();
260269 let passkeys = passkeys_available(state);
270+ let can_register = state.live().registration == forge_core::Registration::Open;
261271 // The status and headers are view parts, so they apply to this page's response.
262272 Ok(view! {
263273 (status)
264274 (headers)
265- shell(title: t(lang, Key::LogIn), viewer: None, login_form(lang: lang, next: next.as_str(), username: username.as_str(), precsrf: precsrf.as_str(), error: Some(message), passkeys: passkeys))
275+ shell(title: t(lang, Key::LogIn), viewer: None, login_form(lang: lang, next: next.as_str(), username: username.as_str(), precsrf: precsrf.as_str(), error: Some(message), passkeys: passkeys, can_register: can_register))
266276 })
267277 }
268278
269279 #[component]
270280 async fn two_factor_form(lang: Lang, precsrf: &str, error: Option<String>) -> Result<impl View> {
271281 Ok(view! {
272- <section>
273- <h1>(t(lang, Key::TwoFactorCheck))</h1>
274- <p class="hint">(t(lang, Key::TwoFactorCheckSub))</p>
282+ head(title: t(lang, Key::TwoFactorCheck), sub: vec![SubPart::text(t(lang, Key::TwoFactorCheckSub))])
283+ <div class="sheet fit">
275284 <form data-hard="true" method="post" action="/login/2fa" class="fields">
276285 if let Some(message) = error {
277286 alert(message: message.as_str())
@@ -283,7 +292,7 @@ async fn two_factor_form(lang: Lang, precsrf: &str, error: Option<String>) -> Re
283292 </div>
284293 <button type="submit" class="primary">(t(lang, Key::Verify))</button>
285294 </form>
286- </section>
295+ </div>
287296 })
288297 }
289298
crates/forge-web/src/pages/merge_queue.rsmodified+49 -45
@@ -359,7 +359,7 @@ async fn queue_body(
359359 csrf: String,
360360 ) -> Result<impl View> {
361361 let remove_label = g::t(lang, K::RemoveFromQueue);
362- let hint = g::t(lang, K::MergeQueueHint);
362+ let hint = g::t(lang, K::RequireMergeQueueHint);
363363 let remove_note = crate::pages::passkeys::s(
364364 lang,
365365 "The pull request leaves the queue. It can join again later.",
@@ -367,49 +367,24 @@ async fn queue_body(
367367 )
368368 .to_owned();
369369 Ok(view! {
370- repo_head(head: head)
371- if !protected {
372- <p class="state" role="status">(g::t(lang, K::QueueNoBranch))</p>
373- }
374- <div data-live=(live.as_str())>
375- <nav class="tabs" aria-label=(g::t(lang, K::MergeQueueNav))>
376- <a aria-current=(current_tab(!history)) href=(waiting_href.as_str())>(g::t(lang, K::QueueWaiting))</a>
377- <a aria-current=(current_tab(history)) href=(history_href.as_str())>(g::t(lang, K::QueueHistory))</a>
378- </nav>
370+ repo_head(head: head, title: Some(g::t(lang, K::MergeQueueTitle).to_owned()))
371+ <nav class="tabs" aria-label=(g::t(lang, K::MergeQueueNav))>
372+ <a aria-current=(current_tab(!history)) href=(waiting_href.as_str())>(g::t(lang, K::QueueWaiting))</a>
373+ <a aria-current=(current_tab(history)) href=(history_href.as_str())>(g::t(lang, K::QueueHistory))</a>
374+ </nav>
375+ <div class="sheet" data-live=(live.as_str())>
376+ if !protected {
377+ <p class="state" role="status">(g::t(lang, K::QueueNoBranch))</p>
378+ }
379379 if empty {
380- <p class="state">(g::t(lang, K::QueueEmpty))</p>
380+ if protected {
381+ <p class="state">(g::t(lang, K::QueueEmpty))</p>
382+ }
381383 } else {
382- <div>
383- for row in rows.iter() {
384- if row.remove {
385- <details class="row-open">
386- <summary class="line" data-kb-row="">
387- <span class="name"><a href=(row.pull_href.as_str())>"#"(row.pull_number)" "(row.pull_title.as_str())</a></span>
388- <span class="val">
389- if !row.position.is_empty() {
390- (g::t(lang, K::QueueColPosition)) " " (row.position.as_str()) " · "
391- }
392- <span class=(row.state_class)>(row.state)</span>
393- " · " <code>(row.branch.as_str())</code>
394- " · " (row.by.as_str())
395- " · " rel_time(lang: lang, stamp: row.queued_at.as_str())
396- " · "
397- if let Some(href) = row.run_href.as_ref() {
398- <a href=(href.as_str())>(row.run_label.as_str())</a>
399- } else {
400- <span>(row.run_label.as_str())</span>
401- }
402- if !row.reason.is_empty() {
403- " · " (row.reason.as_str())
404- }
405- </span>
406- </summary>
407- <div class="opened">
408- confirm_act(lang: lang, label: remove_label, action: row.remove_action.as_str(), csrf: csrf.as_str(), note: Some(remove_note.clone()))
409- </div>
410- </details>
411- } else {
412- <div class="line" data-kb-row="">
384+ for row in rows.iter() {
385+ if row.remove {
386+ <details class="row-open">
387+ <summary class="line" data-kb-row="">
413388 <span class="name"><a href=(row.pull_href.as_str())>"#"(row.pull_number)" "(row.pull_title.as_str())</a></span>
414389 <span class="val">
415390 if !row.position.is_empty() {
@@ -429,12 +404,41 @@ async fn queue_body(
429404 " · " (row.reason.as_str())
430405 }
431406 </span>
407+ </summary>
408+ <div class="opened">
409+ confirm_act(lang: lang, label: remove_label, action: row.remove_action.as_str(), csrf: csrf.as_str(), note: Some(remove_note.clone()))
432410 </div>
433- }
411+ </details>
412+ } else {
413+ <div class="line" data-kb-row="">
414+ <span class="name"><a href=(row.pull_href.as_str())>"#"(row.pull_number)" "(row.pull_title.as_str())</a></span>
415+ <span class="val">
416+ if !row.position.is_empty() {
417+ (g::t(lang, K::QueueColPosition)) " " (row.position.as_str()) " · "
418+ }
419+ <span class=(row.state_class)>(row.state)</span>
420+ " · " <code>(row.branch.as_str())</code>
421+ " · " (row.by.as_str())
422+ " · " rel_time(lang: lang, stamp: row.queued_at.as_str())
423+ " · "
424+ if let Some(href) = row.run_href.as_ref() {
425+ <a href=(href.as_str())>(row.run_label.as_str())</a>
426+ } else {
427+ <span>(row.run_label.as_str())</span>
428+ }
429+ if !row.reason.is_empty() {
430+ " · " (row.reason.as_str())
431+ }
432+ </span>
433+ </div>
434434 }
435- </div>
435+ }
436+ }
437+ if protected {
438+ <section class="sec">
439+ <p class="hint">(hint)</p>
440+ </section>
436441 }
437- <p class="hint">(hint)</p>
438442 </div>
439443 })
440444 }
crates/forge-web/src/pages/milestones_page.rsmodified+23 -21
@@ -98,19 +98,19 @@ fn due_on_field(raw: &str) -> Option<&str> {
9898 (!trimmed.is_empty()).then_some(trimmed)
9999 }
100100
101-/// The Open and Closed filter links, with the current one marked.
101+/// The Open and Closed filter as the sheet's tools row: the shown state in bold, the other a link.
102102 #[component]
103103 async fn state_tabs(lang: Lang, title: String, closed: bool) -> Result<impl View> {
104104 let open_href = format!("{}?state=open", milestones_href(&title));
105105 let closed_href = format!("{}?state=closed", milestones_href(&title));
106106 Ok(view! {
107- <nav class="sub" aria-label=(g::t(lang, K::MilestoneState))>
107+ <nav class="sheet-tools" aria-label=(g::t(lang, K::MilestoneState))>
108108 if closed {
109- <a href=(open_href.as_str())>(g::t(lang, K::Open))</a>
110- <a href=(closed_href.as_str()) aria-current="page">(g::t(lang, K::Closed))</a>
109+ <strong aria-current="page">(g::t(lang, K::Closed))</strong>
110+ <a class="act" href=(open_href.as_str())>(g::t(lang, K::Open))</a>
111111 } else {
112- <a href=(open_href.as_str()) aria-current="page">(g::t(lang, K::Open))</a>
113- <a href=(closed_href.as_str())>(g::t(lang, K::Closed))</a>
112+ <strong aria-current="page">(g::t(lang, K::Open))</strong>
113+ <a class="act" href=(closed_href.as_str())>(g::t(lang, K::Closed))</a>
114114 }
115115 </nav>
116116 })
@@ -136,7 +136,7 @@ async fn milestone_row(
136136 <span class="val">(open_text.as_str()) " \u{b7} " (closed_text.as_str())</span>
137137 </summary>
138138 <div class="opened">
139- <p class="state">
139+ <p class="hint">
140140 if let Some(due) = row.due.as_deref() {
141141 (g::due_text(lang, due))
142142 if row.overdue {
@@ -147,9 +147,9 @@ async fn milestone_row(
147147 }
148148 </p>
149149 <progress value=(row.closed) max=(max)></progress>
150- <div class="sub">
151- <a href=(row.open_href.as_str())>(open_text.as_str())</a>
152- <a href=(row.closed_href.as_str())>(closed_text.as_str())</a>
150+ <div class="acts">
151+ <a class="act" href=(row.open_href.as_str())>(open_text.as_str())</a>
152+ <a class="act" href=(row.closed_href.as_str())>(closed_text.as_str())</a>
153153 </div>
154154 if !row.description_html.is_empty() {
155155 <div class="markdown-body">(Unescaped::new_unchecked(row.description_html.clone()))</div>
@@ -263,13 +263,13 @@ async fn milestones_body(
263263 g::t(lang, K::NoOpenMilestones)
264264 };
265265 Ok(view! {
266- repo_head(head: header)
267- if frame.archived {
268- <p class="state" role="status">(g::t(lang, K::MilestonesArchived))</p>
269- }
266+ repo_head(head: header, title: Some(g::t(lang, K::Milestones).to_owned()))
270267 issue_subnav(lang: lang, title: title.clone(), active: "milestones".to_owned())
271- state_tabs(lang: lang, title: title.clone(), closed: closed)
272- <div class="lang-list" data-live=(live.as_str()) data-live-now="">
268+ <div class="sheet" data-live=(live.as_str()) data-live-now="">
269+ state_tabs(lang: lang, title: title.clone(), closed: closed)
270+ if frame.archived {
271+ <p class="state" role="status">(g::t(lang, K::MilestonesArchived))</p>
272+ }
273273 if can_create {
274274 <section class="sec">
275275 <h2>(g::t(lang, K::NewMilestone))</h2>
@@ -391,11 +391,13 @@ async fn milestone_edit_body(
391391 let csrf = frame.csrf.clone();
392392 let header = frame.head.clone();
393393 Ok(view! {
394- repo_head(head: header)
394+ repo_head(head: header, title: Some(g::t(lang, K::EditMilestone).to_owned()))
395395 issue_subnav(lang: lang, title: frame.title.clone(), active: "milestones".to_owned())
396- <section class="sec">
397- <h2>(g::t(lang, K::EditMilestone))</h2>
398- <p class="sub"><a href=(back.as_str())>(g::t(lang, K::BackToMilestones))</a></p>
396+ <div class="sheet fit">
397+ <div class="sheet-tools">
398+ <strong>(title_value.as_str())</strong>
399+ <a class="act" href=(back.as_str())>(g::t(lang, K::BackToMilestones))</a>
400+ </div>
399401 <form method="post" action=(action.as_str()) class="fields">
400402 <input type="hidden" name="csrf" value=(csrf.as_str())>
401403 <div class="field">
@@ -419,7 +421,7 @@ async fn milestone_edit_body(
419421 </div>
420422 <button type="submit" class="primary">(g::t(lang, K::SaveMilestone))</button>
421423 </form>
422- </section>
424+ </div>
423425 })
424426 }
425427
crates/forge-web/src/pages/needs_you.rsmodified+26 -33
@@ -20,7 +20,9 @@ use crate::i18n::needs::{self as ni, K};
2020 use crate::i18n::{self, Lang};
2121 use crate::live::{Topic, stream_wakes};
2222 use crate::pages::ci_runs::run_href;
23+use crate::pages::passkeys::s;
2324 use crate::state::AppState;
25+use crate::views::parts::{SubPart, head};
2426 use crate::views::repo_list::{PageLink, pager, pager_links};
2527 use crate::views::{rel_time, repo_href, shell};
2628
@@ -360,18 +362,16 @@ pub(crate) async fn need_section(lang: Lang, section: NeedSection) -> Result<imp
360362 Ok(view! {
361363 <section class="sec">
362364 <h2>(heading)</h2>
363- <div class="plain-rows">
364- for row in rows.iter() {
365- <a class="line" href=(row.href.as_str()) data-kb-row="">
366- <span class="name">(row.title.as_str())</span>
367- if let Some(badge) = row.badge {
368- <span class="badge">(badge)</span>
369- }
370- <span class="val">(row.detail.as_str())</span>
371- <span class="val">rel_time(lang: lang, stamp: row.stamp.as_str())</span>
372- </a>
373- }
374- </div>
365+ for row in rows.iter() {
366+ <a class="line" href=(row.href.as_str()) data-kb-row="">
367+ <span class="name">(row.title.as_str())</span>
368+ if let Some(badge) = row.badge {
369+ <span class="badge">(badge)</span>
370+ }
371+ <span class="val">(row.detail.as_str())</span>
372+ <span class="val">rel_time(lang: lang, stamp: row.stamp.as_str())</span>
373+ </a>
374+ }
375375 if let Some((href, text)) = more {
376376 <div class="acts">
377377 <a class="act" href=(href)>(text)</a>
@@ -407,35 +407,28 @@ async fn needs_you(cx: &Cx) -> Result<impl View> {
407407 ),
408408 _ => "/needs-you/events".to_owned(),
409409 };
410- let grid = full.is_none() && !sections.is_empty();
411410 let empty = full.is_none() && sections.is_empty();
412411 let back = full.as_ref().map(|_| ni::t(lang, K::BackToNeedsYou));
413412 let heading = ni::t(lang, K::NeedsYou);
413+ let sub = vec![SubPart::text(s(lang, "Waiting on you", "Senden beklenenler"))];
414414 Ok(view! {
415415 shell(title: heading, viewer: Some(&viewer),
416- <section data-live=(live.as_str())>
417- <h1 class="sr-only">(heading)</h1>
416+ head(title: heading, sub: sub, live: Some(live.as_str()),
418417 if let Some(back) = back {
419- <div class="acts">
420- <a class="act" href="/needs-you">(back)</a>
421- </div>
418+ <a class="act" href="/needs-you">(back)</a>
422419 }
423- </section>
424- if empty {
425- <p class="state">(ni::t(lang, K::AllClear))</p>
426- }
427- if grid {
428- <div class="needs-page">
429- for section in sections.into_iter() {
430- need_section(lang: lang, section: section)
431- }
432- </div>
433- }
434- if let Some(section) = full {
435- <div class="needs-page">
420+ )
421+ <div class="sheet">
422+ if empty {
423+ <p class="state">(ni::t(lang, K::AllClear))</p>
424+ }
425+ for section in sections.into_iter() {
436426 need_section(lang: lang, section: section)
437- </div>
438- }
427+ }
428+ if let Some(section) = full {
429+ need_section(lang: lang, section: section)
430+ }
431+ </div>
439432 )
440433 })
441434 }
crates/forge-web/src/pages/new_repo.rsmodified+62 -60
@@ -23,7 +23,7 @@ use crate::i18n::{self, Key, Lang};
2323 use crate::pages::org_ctx::may_create_repo_in;
2424 use crate::pages::repo_mirrors::{Checked, check_form_in, redacted_url};
2525 use crate::state::AppState;
26-use crate::views::parts::reveal;
26+use crate::views::parts::{head, reveal};
2727 use crate::views::{alert, csrf_field, shell, user_facing_message};
2828
2929 const MAX_DESCRIPTION_CHARS: usize = 350;
@@ -234,74 +234,76 @@ async fn new_repo_form(
234234 let draft_mirror_username = draft.mirror_username;
235235 let draft_mirror_interval = draft.mirror_interval;
236236 Ok(view! {
237- <h1 class="sr-only">(i18n::t(lang, Key::NewRepository))</h1>
237+ head(title: i18n::t(lang, Key::NewRepository))
238238 crate::pages::import::newrepo_tabs(lang: lang, active: "create")
239- <form method="post" action="/new" class="fields">
240- if let Some(message) = error {
241- alert(message: message.as_str())
242- }
243- csrf_field(token: csrf)
244- <div class="field">
245- <label for="new-owner">(g::t(lang, K::NewOwner))</label>
246- <select id="new-owner" name="owner">
247- for name in owners.iter() {
248- <option value=(name.as_str()) selected=(*name == selected_owner)>(name.as_str())</option>
249- }
250- </select>
251- </div>
252- <div class="field">
253- <label for="new-name">(g::t(lang, K::RepoName))</label>
254- <input id="new-name" type="text" name="name" value=(draft.name) required=(true) maxlength="64" autocomplete="off" spellcheck="false">
255- </div>
256- <div class="field">
257- <label for="new-description">(g::t(lang, K::DescriptionOptional))</label>
258- <textarea id="new-description" name="description" rows="3" maxlength="350">(draft.description)</textarea>
259- </div>
260- <div class="field">
261- <label for="new-branch">(g::t(lang, K::DefaultBranch))</label>
262- <input id="new-branch" type="text" name="default_branch" value=(branch) maxlength="255" autocomplete="off" spellcheck="false">
263- </div>
264- <label class="switch">
265- <input type="checkbox" name="default_labels" value="on" checked=(default_labels)>
266- <span>(g::t(lang, K::AddDefaultLabels))</span>
267- </label>
268- crate::pages::import::visibility_pick(lang: lang, private: private)
269- <label class="switch">
270- <input type="checkbox" name="add_readme" value="on" checked=(add_readme)>
271- <span>(g::t(lang, K::ReadmeLabel))</span>
272- </label>
273- <p class="hint">(g::t(lang, K::ReadmeHelp))</p>
274- <div class="field">
275- <label for="new-license">(g::t(lang, K::LicenseLabel))</label>
276- <select id="new-license" name="license">
277- <option value="" selected=(draft_license.is_empty())>(g::t(lang, K::LicenseNone))</option>
278- for (id, label, _) in LICENSES.iter() {
279- <option value=(*id) selected=(*id == draft_license.as_str())>(*label)</option>
280- }
281- </select>
282- <p class="hint">(g::t(lang, K::LicenseHelp))</p>
283- </div>
284- reveal(label: g::t(lang, K::MirrorLegend), id: Some("new-mirror"), open: mirror_open,
285- <p class="hint">(g::t(lang, K::MirrorIntro))</p>
239+ <div class="sheet fit">
240+ <form method="post" action="/new" class="fields">
241+ if let Some(message) = error {
242+ alert(message: message.as_str())
243+ }
244+ csrf_field(token: csrf)
286245 <div class="field">
287- <label for="new-mirror-url">(g::t(lang, K::SourceUrl))</label>
288- <input id="new-mirror-url" type="url" name="mirror_url" value=(draft_mirror_url.as_str()) autocomplete="off" spellcheck="false" maxlength="2048">
246+ <label for="new-owner">(g::t(lang, K::NewOwner))</label>
247+ <select id="new-owner" name="owner">
248+ for name in owners.iter() {
249+ <option value=(name.as_str()) selected=(*name == selected_owner)>(name.as_str())</option>
250+ }
251+ </select>
289252 </div>
290253 <div class="field">
291- <label for="new-mirror-username">(g::t(lang, K::UsernameOptional))</label>
292- <input id="new-mirror-username" type="text" name="mirror_username" value=(draft_mirror_username.as_str()) autocomplete="off" maxlength="255">
254+ <label for="new-name">(g::t(lang, K::RepoName))</label>
255+ <input id="new-name" type="text" name="name" value=(draft.name) required=(true) maxlength="64" autocomplete="off" spellcheck="false">
293256 </div>
294257 <div class="field">
295- <label for="new-mirror-secret">(g::t(lang, K::PasswordOrToken))</label>
296- <input id="new-mirror-secret" type="password" name="mirror_secret" autocomplete="new-password" maxlength="1024">
258+ <label for="new-description">(g::t(lang, K::DescriptionOptional))</label>
259+ <textarea id="new-description" name="description" rows="3" maxlength="350">(draft.description)</textarea>
297260 </div>
298261 <div class="field">
299- <label for="new-mirror-interval">(g::t(lang, K::SyncInterval))</label>
300- <input id="new-mirror-interval" type="number" name="mirror_interval" value=(draft_mirror_interval.as_str()) min="0" max="525600" step="1">
262+ <label for="new-branch">(g::t(lang, K::DefaultBranch))</label>
263+ <input id="new-branch" type="text" name="default_branch" value=(branch) maxlength="255" autocomplete="off" spellcheck="false">
301264 </div>
302- )
303- <button type="submit" class="primary">(g::t(lang, K::CreateRepository))</button>
304- </form>
265+ <label class="switch">
266+ <input type="checkbox" name="default_labels" value="on" checked=(default_labels)>
267+ <span>(g::t(lang, K::AddDefaultLabels))</span>
268+ </label>
269+ crate::pages::import::visibility_pick(lang: lang, private: private)
270+ <label class="switch">
271+ <input type="checkbox" name="add_readme" value="on" checked=(add_readme)>
272+ <span>(g::t(lang, K::ReadmeLabel))</span>
273+ </label>
274+ <p class="hint">(g::t(lang, K::ReadmeHelp))</p>
275+ <div class="field">
276+ <label for="new-license">(g::t(lang, K::LicenseLabel))</label>
277+ <select id="new-license" name="license">
278+ <option value="" selected=(draft_license.is_empty())>(g::t(lang, K::LicenseNone))</option>
279+ for (id, label, _) in LICENSES.iter() {
280+ <option value=(*id) selected=(*id == draft_license.as_str())>(*label)</option>
281+ }
282+ </select>
283+ <p class="hint">(g::t(lang, K::LicenseHelp))</p>
284+ </div>
285+ reveal(label: g::t(lang, K::MirrorLegend), id: Some("new-mirror"), open: mirror_open,
286+ <p class="hint">(g::t(lang, K::MirrorIntro))</p>
287+ <div class="field">
288+ <label for="new-mirror-url">(g::t(lang, K::SourceUrl))</label>
289+ <input id="new-mirror-url" type="url" name="mirror_url" value=(draft_mirror_url.as_str()) autocomplete="off" spellcheck="false" maxlength="2048">
290+ </div>
291+ <div class="field">
292+ <label for="new-mirror-username">(g::t(lang, K::UsernameOptional))</label>
293+ <input id="new-mirror-username" type="text" name="mirror_username" value=(draft_mirror_username.as_str()) autocomplete="off" maxlength="255">
294+ </div>
295+ <div class="field">
296+ <label for="new-mirror-secret">(g::t(lang, K::PasswordOrToken))</label>
297+ <input id="new-mirror-secret" type="password" name="mirror_secret" autocomplete="new-password" maxlength="1024">
298+ </div>
299+ <div class="field">
300+ <label for="new-mirror-interval">(g::t(lang, K::SyncInterval))</label>
301+ <input id="new-mirror-interval" type="number" name="mirror_interval" value=(draft_mirror_interval.as_str()) min="0" max="525600" step="1">
302+ </div>
303+ )
304+ <button type="submit" class="primary">(g::t(lang, K::CreateRepository))</button>
305+ </form>
306+ </div>
305307 })
306308 }
307309
crates/forge-web/src/pages/not_found_page.rsmodified+72 -13
@@ -1,18 +1,21 @@
1-//! The styled 404 page. Topcoat answers a `not_found()` error with a bare text body, so this layer
2-//! swaps that body for the regular shell plus a short message, for browser requests only.
1+//! The styled 404 and 403 pages. Topcoat answers `not_found()` and `forbidden()` with a bare text
2+//! body, so this layer swaps that body for the regular shell plus a short message, for browser
3+//! requests only. A signed-out visitor refused a page is sent to log in first, as every page that
4+//! needs an account does.
35
46 use http::header::ACCEPT;
57 use topcoat::Result;
68 use topcoat::context::Cx;
7-use topcoat::router::error::{NotFoundError, rewrite};
9+use topcoat::router::error::{ForbiddenError, NotFoundError, rewrite};
810 use topcoat::router::page;
911 use topcoat::router::request::headers;
1012 use topcoat::router::response::Response;
1113 use topcoat::router::{Body, Layer, LayerFuture, Method, Next, Path, StatusCode};
1214 use topcoat::view::{View, component, view};
1315
14-use crate::auth::current_user;
16+use crate::auth::{current_user, percent_encode};
1517 use crate::i18n::{self, Lang};
18+use crate::views::parts::{SubPart, head};
1619 use crate::views::shell;
1720
1821 pub struct NotFoundLayer;
@@ -46,30 +49,86 @@ fn texts(lang: Lang) -> (&'static str, &'static str, &'static str) {
4649 async fn not_found_body(lang: Lang) -> Result<impl View> {
4750 let (title, hint, back) = texts(lang);
4851 Ok(view! {
49- <section class="not-found">
50- <p class="not-found-code">"404"</p>
51- <h1>(title)</h1>
52- <p class="state">(hint)</p>
53- <div class="acts">
54- <a class="act" href="/">(back)</a>
55- </div>
56- </section>
52+ head(title: title, sub: vec![SubPart::mono("404")])
53+ <p class="state">(hint) " " <a class="act" href="/">(back)</a></p>
5754 })
5855 }
5956
6057 async fn styled_not_found(cx: &Cx, body: Body, next: Next<'_>) -> Result<Response> {
58+ let is_get = *topcoat::router::request::method(cx) == Method::GET;
6159 let result = next.run(cx, body).await;
6260 let is_not_found = matches!(&result, Err(e) if e.downcast_ref::<NotFoundError>().is_some());
61+ let is_forbidden = matches!(&result, Err(e) if e.downcast_ref::<ForbiddenError>().is_some());
6362 let wants_html = headers(cx)
6463 .get(ACCEPT)
6564 .and_then(|v| v.to_str().ok())
6665 .is_some_and(|v| v.contains("text/html"));
67- if !is_not_found || !wants_html {
66+ if !wants_html || !(is_not_found || is_forbidden) {
6867 return result;
6968 }
69+ if is_forbidden {
70+ // The cookies are not readable out here, so the page itself decides whether the visitor
71+ // must log in first; a refused GET hands it the address to come back to.
72+ let target = if is_get {
73+ let path = topcoat::router::request::uri(cx)
74+ .path_and_query()
75+ .map_or("/", |p| p.as_str());
76+ format!("{FORBIDDEN_PATH}?next={}", percent_encode(path))
77+ } else {
78+ FORBIDDEN_PATH.to_owned()
79+ };
80+ return Err(rewrite(target, Body::empty()).method(Method::GET).into());
81+ }
7082 Err(rewrite(PATH, Body::empty()).method(Method::GET).into())
7183 }
7284
85+/// Where the layer sends a browser's 403. The page answers with status 403 itself.
86+const FORBIDDEN_PATH: &str = "/-/forbidden";
87+
88+fn forbidden_texts(lang: Lang) -> (&'static str, &'static str, &'static str) {
89+ match lang {
90+ Lang::En => (
91+ "Not allowed",
92+ "Your account cannot do this here. Ask an owner for access, or go back to the start.",
93+ "Back to the start",
94+ ),
95+ Lang::Tr => (
96+ "İzin yok",
97+ "Hesabınız burada bunu yapamaz. Bir sahibinden erişim isteyin ya da başa dönün.",
98+ "Başa dön",
99+ ),
100+ }
101+}
102+
103+#[component]
104+async fn forbidden_body(lang: Lang) -> Result<impl View> {
105+ let (title, hint, back) = forbidden_texts(lang);
106+ Ok(view! {
107+ head(title: title, sub: vec![SubPart::mono("403")])
108+ <p class="state">(hint) " " <a class="act" href="/">(back)</a></p>
109+ })
110+}
111+
112+#[page("/-/forbidden")]
113+async fn forbidden_page(cx: &Cx) -> Result<impl View> {
114+ let viewer = current_user(cx).await?;
115+ if viewer.is_none() {
116+ let next = topcoat::router::request::uri(cx)
117+ .query()
118+ .and_then(|q| q.split('&').find_map(|pair| pair.strip_prefix("next=")))
119+ .filter(|next| next.starts_with('/') && !next.starts_with("//"));
120+ if let Some(next) = next {
121+ return Err(topcoat::router::error::see_other(format!("/login?next={next}")).into());
122+ }
123+ }
124+ let lang = i18n::lang(cx, viewer.as_ref().map(|(user, _)| user));
125+ let title = forbidden_texts(lang).0;
126+ Ok(view! {
127+ (StatusCode::FORBIDDEN)
128+ shell(title: title, viewer: viewer.as_ref(), forbidden_body(lang: lang))
129+ })
130+}
131+
73132 /// Where the layer sends a browser's 404. The page answers with status 404 itself.
74133 const PATH: &str = "/-/not-found";
75134
crates/forge-web/src/pages/notifications.rsmodified+62 -39
@@ -35,7 +35,7 @@ use crate::pages::repo_ctx::{RepoCtx, load_repo};
3535 use crate::pages::repo_transfer::transfer_list_for;
3636 use crate::pages::star::return_path;
3737 use crate::state::AppState;
38-use crate::views::parts::post_act;
38+use crate::views::parts::{RailItem, head, post_act, rail};
3939 use crate::views::{csrf_field, display_name, iso_time, now_unix, relative_time, repo_href, shell};
4040
4141 /// Rows per inbox page. Older rows come behind the older link, so one page stays short.
@@ -1099,7 +1099,8 @@ fn back(cx: &Cx) -> String {
10991099 return_path(cx).unwrap_or_else(|| "/notifications".to_owned())
11001100 }
11011101
1102-/// The inbox body: heading, mark-all button, tabs, the repo groups and the older-rows link.
1102+/// The inbox page: the head with Mark all read, the filter rail (Unread, All, Reviews), then one
1103+/// sheet holding the transfers, the repo groups and the older-rows link.
11031104 #[component]
11041105 async fn inbox_list(
11051106 lang: Lang,
@@ -1117,40 +1118,54 @@ async fn inbox_list(
11171118 } else {
11181119 g::t(lang, K::NoUnreadNotifications)
11191120 };
1120- let unread_current = if all { None } else { Some("page") };
1121- let all_current = if all { Some("page") } else { None };
1122- let unread_text = format!("{} ({unread_count})", g::t(lang, K::Unread));
1121+ let filters = vec![
1122+ RailItem {
1123+ name: g::t(lang, K::Unread).to_owned(),
1124+ val: unread_count.to_string(),
1125+ href: "/notifications".to_owned(),
1126+ current: !all,
1127+ },
1128+ RailItem {
1129+ name: g::t(lang, K::AllTab).to_owned(),
1130+ val: String::new(),
1131+ href: "/notifications?all=1".to_owned(),
1132+ current: all,
1133+ },
1134+ RailItem {
1135+ name: crate::i18n::authoring::t(lang, crate::i18n::authoring::K::ReviewRequestsTab)
1136+ .to_owned(),
1137+ val: String::new(),
1138+ href: "/review-requests".to_owned(),
1139+ current: false,
1140+ },
1141+ ];
11231142 Ok(view! {
1124- <div data-live=(live.as_str())>
1125- <h1 class="sr-only">(i18n::t(lang, Key::Notifications))</h1>
1126- <nav class="tabs" aria-label=(g::t(lang, K::NotificationFilter))>
1127- <a href="/notifications" aria-current=(unread_current)>(unread_text.as_str())</a>
1128- <a href="/notifications?all=1" aria-current=(all_current)>(g::t(lang, K::AllTab))</a>
1129- <a href="/review-requests">(crate::i18n::authoring::t(lang, crate::i18n::authoring::K::ReviewRequestsTab))</a>
1130- </nav>
1143+ head(title: i18n::t(lang, Key::Notifications),
11311144 if !empty {
1132- <div class="acts">
1133- post_act(label: g::t(lang, K::MarkAllAsRead), action: "/notifications/mark_all_read", csrf: csrf.as_str())
1134- </div>
1145+ <form method="post" action="/notifications/mark_all_read" class="act-form">
1146+ <input type="hidden" name="csrf" value=(csrf.as_str())>
1147+ <button type="submit" class="button">(g::t(lang, K::MarkAllAsRead))</button>
1148+ </form>
11351149 }
1136- transfer_list_for(lang: lang, transfers: transfers, csrf: csrf.clone())
1137- if empty {
1138- <section class="sec">
1150+ )
1151+ <div class="work">
1152+ rail(label: g::t(lang, K::NotificationFilter), items: filters)
1153+ <div class="sheet" data-live=(live.as_str())>
1154+ transfer_list_for(lang: lang, transfers: transfers, csrf: csrf.clone())
1155+ if empty {
11391156 <p class="state">(empty_text)</p>
11401157 if !all {
11411158 <div class="acts">
11421159 <a class="act" href="/notifications?all=1">(g::t(lang, K::ViewAllNotifications))</a>
11431160 </div>
11441161 }
1145- </section>
1146- }
1147- for group in groups.into_iter() {
1148- <section class="sec">
1149- <h2><a href=(group.href.as_str())>(group.heading.as_str())</a></h2>
1150- <div class="acts">
1151- post_act(label: g::t(lang, K::MarkAllRead), action: group.mark_action.as_str(), csrf: csrf.as_str())
1152- </div>
1153- <div class="notif-rows">
1162+ }
1163+ for group in groups.into_iter() {
1164+ <section class="sec">
1165+ <h2><a href=(group.href.as_str())>(group.heading.as_str())</a></h2>
1166+ <div class="acts">
1167+ post_act(label: g::t(lang, K::MarkAllRead), action: group.mark_action.as_str(), csrf: csrf.as_str())
1168+ </div>
11541169 for row in group.rows.into_iter() {
11551170 <div class=(row.item_class) data-kb-row="">
11561171 <a class="line" href=(row.open_href.as_str())>
@@ -1166,14 +1181,14 @@ async fn inbox_list(
11661181 }
11671182 </div>
11681183 }
1169- </div>
1170- </section>
1171- }
1172- if let Some(href) = more {
1173- <div class="acts">
1174- <a class="act" href=(href.as_str())>(g::t(lang, K::Older))</a>
1175- </div>
1176- }
1184+ </section>
1185+ }
1186+ if let Some(href) = more {
1187+ <p class="state">
1188+ <a class="act" href=(href.as_str())>(g::t(lang, K::Older))</a>
1189+ </p>
1190+ }
1191+ </div>
11771192 </div>
11781193 })
11791194 }
@@ -1194,9 +1209,9 @@ pub(crate) async fn notify_box(
11941209 (g::t(lang, K::Subscribe), "subscribe")
11951210 };
11961211 Ok(view! {
1197- <section class="sec">
1212+ <section class="sec meta">
11981213 <h2>(i18n::t(lang, Key::Notifications))</h2>
1199- <p class="state">(reason.as_str())</p>
1214+ <p class="hint">(reason.as_str())</p>
12001215 <div class="acts">
12011216 post_act(label: label, action: action.as_str(), csrf: csrf.as_str(), fields: vec![("action".to_owned(), value_text.to_owned())])
12021217 </div>
@@ -1270,7 +1285,7 @@ pub(crate) async fn watch_form(
12701285 </li>
12711286 </ul>
12721287 </details>
1273- <span class="muted small">(count.as_str())</span>
1288+ <span class="hint">(count.as_str())</span>
12741289 </div>
12751290 })
12761291 }
@@ -1289,6 +1304,7 @@ mod tests {
12891304 struct Site {
12901305 router: Router,
12911306 store: Store,
1307+ git: std::sync::Arc<forge_git::GitEnv>,
12921308 _dir: tempfile::TempDir,
12931309 }
12941310
@@ -1302,10 +1318,12 @@ mod tests {
13021318 let dir = tempfile::tempdir().expect("tempdir");
13031319 let state = crate::test_support::test_state(dir.path()).await;
13041320 let store = state.store.clone();
1321+ let git = state.git.clone();
13051322 let router = crate::test_support::app_router(state);
13061323 Site {
13071324 router,
13081325 store,
1326+ git,
13091327 _dir: dir,
13101328 }
13111329 }
@@ -1632,7 +1650,12 @@ mod tests {
16321650 WatchLevel::Watching
16331651 );
16341652
1635- let header = get(&site, "/tahinli/demo/issues/1", Some(&cookie)).await;
1653+ // The watch menu sits in the repo head on the code tab, which reads the repository.
1654+ let bare = forge_git::repo::repo_path(&site.git.data_dir, &w.repo.id).expect("repo path");
1655+ forge_git::repo::init_bare(&site.git, &bare, "main")
1656+ .await
1657+ .expect("init bare");
1658+ let header = get(&site, "/tahinli/demo", Some(&cookie)).await;
16361659 assert!(header.body.contains("action=\"/tahinli/demo/watch\""));
16371660 assert!(header.body.contains("<details class=\"menu watch-menu\">"));
16381661 assert!(!header.body.contains("<select"));
crates/forge-web/src/pages/org_members.rsmodified+74 -73
@@ -19,12 +19,12 @@ use crate::audit::{self, Actor, Target};
1919 use crate::i18n::orgs::{self as g, K};
2020 use crate::i18n::{self, Lang};
2121 use crate::pages::org_ctx::{
22- load_org, member_role_word, notice_href, org_head, org_notice, org_tab_counts, org_tabs,
22+ load_org, member_role_word, notice_href, org_notice, org_tab_counts, org_tabs,
2323 parse_member_role, require_form_csrf, require_member, require_owner, take_notice,
2424 };
2525 use crate::pages::passkeys;
2626 use crate::state::AppState;
27-use crate::views::parts::{confirm_act, reveal};
27+use crate::views::parts::{SubPart, confirm_act, head, reveal};
2828 use crate::views::{avatar_url, display_name, shell};
2929
3030 path_param!(org);
@@ -86,81 +86,82 @@ async fn members_body(
8686 let role_action = format!("{base}/members/role");
8787 let remove_action = format!("{base}/members/remove");
8888 let add_action = format!("{base}/members/add");
89+ let sub = if description.is_empty() {
90+ Vec::new()
91+ } else {
92+ vec![SubPart::text(description)]
93+ };
8994 Ok(view! {
90- <div data-live=(live.as_str())>
91- org_tabs(lang: lang, name: name.clone(), current: "members".to_owned(), owner: owner, repo_count: repo_count, package_count: package_count)
92- org_head(name: name, description: description)
93- org_notice(notice: notice)
94- <section class="sec">
95- <h2>(g::t(lang, K::Members))</h2>
95+ head(title: name.as_str(), sub: sub, live: Some(live.as_str()))
96+ org_tabs(lang: lang, name: name.clone(), current: "members".to_owned(), owner: owner, repo_count: repo_count, package_count: package_count)
97+ org_notice(notice: notice)
98+ <div class="sheet">
99+ <div class="sheet-tools">
100+ <strong>(g::t(lang, K::Members))</strong>
96101 if owner {
97- <p class="hint">(g::t(lang, K::OwnersHelp))</p>
98- <div class="acts">
99- reveal(label: g::t(lang, K::AddMemberButton), id: Some("add-member"),
100- <form method="post" action=(add_action.as_str()) class="fields">
101- <input type="hidden" name="csrf" value=(csrf.as_str())>
102- <div class="field">
103- <label for="add-member-username">(g::t(lang, K::Username))</label>
104- <input id="add-member-username" type="text" name="username" autocomplete="off" spellcheck="false" required=(true)>
105- </div>
106- <div class="field">
107- <label for="add-member-role">(g::t(lang, K::Role))</label>
108- <select id="add-member-role" name="role">
109- <option value="member" selected=(true)>(g::t(lang, K::RoleMember))</option>
110- <option value="owner">(g::t(lang, K::RoleOwner))</option>
111- </select>
112- </div>
113- <button type="submit" class="primary">(g::t(lang, K::AddMemberButton))</button>
114- </form>
115- )
116- </div>
102+ reveal(label: g::t(lang, K::AddMemberButton), id: Some("add-member"),
103+ <form method="post" action=(add_action.as_str()) class="fields">
104+ <input type="hidden" name="csrf" value=(csrf.as_str())>
105+ <div class="field">
106+ <label for="add-member-username">(g::t(lang, K::Username))</label>
107+ <input id="add-member-username" type="text" name="username" autocomplete="off" spellcheck="false" required=(true)>
108+ </div>
109+ <div class="field">
110+ <label for="add-member-role">(g::t(lang, K::Role))</label>
111+ <select id="add-member-role" name="role">
112+ <option value="member" selected=(true)>(g::t(lang, K::RoleMember))</option>
113+ <option value="owner">(g::t(lang, K::RoleOwner))</option>
114+ </select>
115+ </div>
116+ <button type="submit" class="primary">(g::t(lang, K::AddMemberButton))</button>
117+ </form>
118+ )
117119 }
118- <div>
119- for row in rows.iter() {
120- if owner || row.is_self {
121- <details class="row-open">
122- <summary class="line" data-kb-row="">
123- <span class="name org-who">
124- <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24">
125- <span>(row.label.as_str())</span>
126- </span>
127- <span class="val">(if row.is_owner { g::t(lang, K::RoleOwner) } else { g::t(lang, K::RoleMember) })</span>
128- </summary>
129- <div class="opened">
130- if owner {
131- <form method="post" action=(role_action.as_str()) class="fields">
132- <input type="hidden" name="csrf" value=(csrf.as_str())>
133- <input type="hidden" name="user_id" value=(row.user_id.as_str())>
134- <div class="field">
135- <label for=(format!("role-{}", row.user_id))>(g::t(lang, K::Role))</label>
136- <select id=(format!("role-{}", row.user_id)) name="role">
137- <option value="owner" selected=(row.is_owner)>(g::t(lang, K::RoleOwner))</option>
138- <option value="member" selected=(!row.is_owner)>(g::t(lang, K::RoleMember))</option>
139- </select>
140- </div>
141- <div class="acts">
142- <button type="submit" class="act">(g::t(lang, K::Save))</button>
143- </div>
144- </form>
145- }
146- <a class="act quiet" href=(format!("/{}", row.username.as_str()))>(passkeys::s(lang, "Open profile", "Profili aç"))</a>
147- <div class="acts">
148- confirm_act(lang: lang, label: g::t(lang, if row.is_self { K::Leave } else { K::Remove }), action: remove_action.as_str(), csrf: csrf.as_str(), fields: vec![("user_id".to_owned(), row.user_id.clone())])
120+ </div>
121+ if owner {
122+ <p class="hint">(g::t(lang, K::OwnersHelp))</p>
123+ }
124+ for row in rows.iter() {
125+ if owner || row.is_self {
126+ <details class="row-open">
127+ <summary class="line" data-kb-row="">
128+ <span class="name org-who">
129+ <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24">
130+ <span>(row.label.as_str())</span>
131+ </span>
132+ <span class="val">(if row.is_owner { g::t(lang, K::RoleOwner) } else { g::t(lang, K::RoleMember) })</span>
133+ </summary>
134+ <div class="opened">
135+ if owner {
136+ <form method="post" action=(role_action.as_str()) class="fields">
137+ <input type="hidden" name="csrf" value=(csrf.as_str())>
138+ <input type="hidden" name="user_id" value=(row.user_id.as_str())>
139+ <div class="field">
140+ <label for=(format!("role-{}", row.user_id))>(g::t(lang, K::Role))</label>
141+ <select id=(format!("role-{}", row.user_id)) name="role">
142+ <option value="owner" selected=(row.is_owner)>(g::t(lang, K::RoleOwner))</option>
143+ <option value="member" selected=(!row.is_owner)>(g::t(lang, K::RoleMember))</option>
144+ </select>
149145 </div>
150- </div>
151- </details>
152- } else {
153- <a class="line" href=(format!("/{}", row.username.as_str())) data-kb-row="">
154- <span class="name org-who">
155- <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24">
156- <span>(row.label.as_str())</span>
157- </span>
158- <span class="val">(if row.is_owner { g::t(lang, K::RoleOwner) } else { g::t(lang, K::RoleMember) })</span>
159- </a>
160- }
161- }
162- </div>
163- </section>
146+ <button type="submit" class="primary small">(g::t(lang, K::Save))</button>
147+ </form>
148+ }
149+ <div class="acts">
150+ <a class="act" href=(format!("/{}", row.username.as_str()))>(passkeys::s(lang, "Open profile", "Profili aç"))</a>
151+ confirm_act(lang: lang, label: g::t(lang, if row.is_self { K::Leave } else { K::Remove }), action: remove_action.as_str(), csrf: csrf.as_str(), fields: vec![("user_id".to_owned(), row.user_id.clone())])
152+ </div>
153+ </div>
154+ </details>
155+ } else {
156+ <a class="line" href=(format!("/{}", row.username.as_str())) data-kb-row="">
157+ <span class="name org-who">
158+ <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24">
159+ <span>(row.label.as_str())</span>
160+ </span>
161+ <span class="val">(if row.is_owner { g::t(lang, K::RoleOwner) } else { g::t(lang, K::RoleMember) })</span>
162+ </a>
163+ }
164+ }
164165 </div>
165166 })
166167 }
crates/forge-web/src/pages/org_new.rsmodified+19 -17
@@ -18,6 +18,7 @@ use crate::i18n::orgs::{self as g, K};
1818 use crate::i18n::{self, Lang};
1919 use crate::live::Topic;
2020 use crate::state::AppState;
21+use crate::views::parts::{SubPart, head};
2122 use crate::views::{alert, csrf_field, shell, user_facing_message};
2223
2324 const MAX_DESCRIPTION_CHARS: usize = 2000;
@@ -49,23 +50,24 @@ async fn new_org_form(
4950 lang: Lang,
5051 ) -> Result<impl View> {
5152 Ok(view! {
52- <h1 class="sr-only">(g::t(lang, K::NewOrganization))</h1>
53- <p class="hint">(g::t(lang, K::NewOrgIntro))</p>
54- if let Some(message) = error {
55- alert(message: message.as_str())
56- }
57- <form method="post" action="/org/new" class="fields">
58- csrf_field(token: csrf.as_str())
59- <div class="field">
60- <label for="org-new-name">(g::t(lang, K::OrgName))</label>
61- <input id="org-new-name" type="text" name="name" value=(name.as_str()) required=(true) maxlength="64" autocomplete="off">
62- </div>
63- <div class="field">
64- <label for="org-new-description">(g::t(lang, K::DescriptionOptional))</label>
65- <textarea id="org-new-description" name="description" rows="3" maxlength="2000">(description.as_str())</textarea>
66- </div>
67- <button type="submit" class="primary">(g::t(lang, K::CreateOrg))</button>
68- </form>
53+ head(title: g::t(lang, K::NewOrganization), sub: vec![SubPart::text(g::t(lang, K::NewOrgIntro))])
54+ <div class="sheet fit">
55+ if let Some(message) = error {
56+ alert(message: message.as_str())
57+ }
58+ <form method="post" action="/org/new" class="fields">
59+ csrf_field(token: csrf.as_str())
60+ <div class="field">
61+ <label for="org-new-name">(g::t(lang, K::OrgName))</label>
62+ <input id="org-new-name" type="text" name="name" value=(name.as_str()) required=(true) maxlength="64" autocomplete="off">
63+ </div>
64+ <div class="field">
65+ <label for="org-new-description">(g::t(lang, K::DescriptionOptional))</label>
66+ <textarea id="org-new-description" name="description" rows="3" maxlength="2000">(description.as_str())</textarea>
67+ </div>
68+ <button type="submit" class="primary">(g::t(lang, K::CreateOrg))</button>
69+ </form>
70+ </div>
6971 })
7072 }
7173
crates/forge-web/src/pages/org_settings.rsmodified+8 -8
@@ -27,7 +27,7 @@ use crate::pages::org_ctx::{
2727 };
2828 use crate::pages::settings_profile::store_avatar;
2929 use crate::state::AppState;
30-use crate::views::parts::{confirm_act, reveal};
30+use crate::views::parts::{confirm_act, head, reveal};
3131 use crate::views::{avatar_url, shell, user_facing_message};
3232
3333 path_param!(org);
@@ -88,10 +88,10 @@ async fn settings_body(
8888 let delete_action = format!("{base}/settings/delete");
8989 let confirm_label = g::type_to_confirm(lang, &name);
9090 Ok(view! {
91- <div data-live=(live.as_str())>
92- org_tabs(lang: lang, name: name.clone(), current: "settings".to_owned(), owner: true, repo_count: repo_count, package_count: package_count)
93- <h1 class="sr-only">(name.as_str())</h1>
94- org_notice(notice: notice)
91+ head(title: name.as_str(), live: Some(live.as_str()))
92+ org_tabs(lang: lang, name: name.clone(), current: "settings".to_owned(), owner: true, repo_count: repo_count, package_count: package_count)
93+ org_notice(notice: notice)
94+ <div class="sheet">
9595 <form id="org-settings-form" method="post" action=(save_action.as_str())>
9696 <input type="hidden" name="csrf" value=(csrf.as_str())>
9797 <section class="sec">
@@ -157,9 +157,9 @@ async fn settings_body(
157157 <label for="org-delete-confirm">(confirm_label.as_str())</label>
158158 <input id="org-delete-confirm" type="text" name="confirm" autocomplete="off" spellcheck="false" required=(true)>
159159 </div>
160- <div class="acts">
161- <button type="submit" class="act danger">(g::t(lang, K::DeleteOrg))</button>
162- <button type="button" class="act quiet" data-close-details="">(crate::pages::passkeys::s(lang, "Cancel", "Vazgeç"))</button>
160+ <div class="acts asks">
161+ <button type="submit" class="danger small">(g::t(lang, K::DeleteOrg))</button>
162+ <button type="button" class="act" data-close-details="">(crate::pages::passkeys::s(lang, "Cancel", "Vazgeç"))</button>
163163 </div>
164164 </form>
165165 </details>
crates/forge-web/src/pages/org_teams.rsmodified+128 -133
@@ -19,12 +19,12 @@ use crate::audit::{self, Actor, Target};
1919 use crate::i18n::orgs::{self as g, K};
2020 use crate::i18n::{self, Lang};
2121 use crate::pages::org_ctx::{
22- OrgCtx, TEAM_ROLES, load_org, notice_href, org_head, org_notice, org_tab_counts, org_tabs,
22+ OrgCtx, TEAM_ROLES, load_org, notice_href, org_notice, org_tab_counts, org_tabs,
2323 require_form_csrf, require_member, require_owner, take_notice,
2424 };
2525 use crate::pages::passkeys;
2626 use crate::state::AppState;
27-use crate::views::parts::{confirm_act, reveal};
27+use crate::views::parts::{SubPart, confirm_act, head, reveal};
2828 use crate::views::{avatar_url, display_name, repo_href, shell};
2929
3030 path_param!(org);
@@ -196,61 +196,62 @@ async fn teams_body(
196196 package_count: usize,
197197 ) -> Result<impl View> {
198198 let create_action = format!("{base}/teams/new");
199+ let sub = if description.is_empty() {
200+ Vec::new()
201+ } else {
202+ vec![SubPart::text(description)]
203+ };
199204 Ok(view! {
200- <div data-live=(live.as_str())>
201- org_tabs(lang: lang, name: name.clone(), current: "teams".to_owned(), owner: owner, repo_count: repo_count, package_count: package_count)
202- org_head(name: name, description: description)
203- org_notice(notice: notice)
204- <section class="sec">
205- <h2>(g::t(lang, K::Teams))</h2>
206- <p class="hint">(g::t(lang, K::TeamsIntro))</p>
205+ head(title: name.as_str(), sub: sub, live: Some(live.as_str()))
206+ org_tabs(lang: lang, name: name.clone(), current: "teams".to_owned(), owner: owner, repo_count: repo_count, package_count: package_count)
207+ org_notice(notice: notice)
208+ <div class="sheet">
209+ <div class="sheet-tools">
210+ <strong>(g::t(lang, K::Teams))</strong>
207211 if owner {
208- <div class="acts">
209- reveal(label: g::t(lang, K::CreateTeam), id: Some("new-team"),
210- <form method="post" action=(create_action.as_str()) class="fields">
211- <input type="hidden" name="csrf" value=(csrf.as_str())>
212- <div class="field">
213- <label for="new-team-name">(g::t(lang, K::Name))</label>
214- <input id="new-team-name" type="text" name="name" autocomplete="off" required=(true) maxlength="64">
215- </div>
216- <div class="field">
217- <label for="new-team-description">(g::t(lang, K::DescriptionOptional))</label>
218- <textarea id="new-team-description" name="description" rows="2" maxlength="350"></textarea>
219- </div>
220- <div class="field">
221- <label for="new-team-role">(g::t(lang, K::Role))</label>
222- <select id="new-team-role" name="role">
223- for role in TEAM_ROLES.iter() {
224- <option value=(role.as_str()) selected=(*role == Role::Read)>(g::role_name(lang, role.as_str()))</option>
225- }
226- </select>
227- </div>
228- <label class="switch">
229- <input type="checkbox" name="all_repos" value="on">
230- <span>(g::t(lang, K::CoversAllRepos))</span>
231- </label>
232- <button type="submit" class="primary">(g::t(lang, K::CreateTeam))</button>
233- </form>
234- )
235- </div>
212+ reveal(label: g::t(lang, K::CreateTeam), id: Some("new-team"),
213+ <form method="post" action=(create_action.as_str()) class="fields">
214+ <input type="hidden" name="csrf" value=(csrf.as_str())>
215+ <div class="field">
216+ <label for="new-team-name">(g::t(lang, K::Name))</label>
217+ <input id="new-team-name" type="text" name="name" autocomplete="off" required=(true) maxlength="64">
218+ </div>
219+ <div class="field">
220+ <label for="new-team-description">(g::t(lang, K::DescriptionOptional))</label>
221+ <textarea id="new-team-description" name="description" rows="2" maxlength="350"></textarea>
222+ </div>
223+ <div class="field">
224+ <label for="new-team-role">(g::t(lang, K::Role))</label>
225+ <select id="new-team-role" name="role">
226+ for role in TEAM_ROLES.iter() {
227+ <option value=(role.as_str()) selected=(*role == Role::Read)>(g::role_name(lang, role.as_str()))</option>
228+ }
229+ </select>
230+ </div>
231+ <label class="switch">
232+ <input type="checkbox" name="all_repos" value="on">
233+ <span>(g::t(lang, K::CoversAllRepos))</span>
234+ </label>
235+ <button type="submit" class="primary">(g::t(lang, K::CreateTeam))</button>
236+ </form>
237+ )
236238 }
237- if rows.is_empty() {
238- <p class="state">(g::t(lang, K::NoTeamsYet))</p>
239- }
240- <div>
241- for row in rows.iter() {
242- <a class="line" href=(row.href.as_str()) data-kb-row="">
243- <span class="name">(row.name.as_str())</span>
244- <span class="val">
245- (g::coverage_text(lang, row.role, row.all_repos))
246- if !row.description.is_empty() {
247- " · " (row.description.as_str())
248- }
249- </span>
250- </a>
251- }
252- </div>
253- </section>
239+ </div>
240+ <p class="hint">(g::t(lang, K::TeamsIntro))</p>
241+ if rows.is_empty() {
242+ <p class="state">(g::t(lang, K::NoTeamsYet))</p>
243+ }
244+ for row in rows.iter() {
245+ <a class="line" href=(row.href.as_str()) data-kb-row="">
246+ <span class="name">(row.name.as_str())</span>
247+ <span class="val">
248+ (g::coverage_text(lang, row.role, row.all_repos))
249+ if !row.description.is_empty() {
250+ " · " (row.description.as_str())
251+ }
252+ </span>
253+ </a>
254+ }
254255 </div>
255256 })
256257 }
@@ -307,108 +308,102 @@ async fn team_body(
307308 let owner = data.owner;
308309 let has_choices = !data.choices.is_empty();
309310 let has_description = !data.team_description.is_empty();
311+ let mut sub = vec![SubPart::text(g::coverage_text(
312+ lang,
313+ data.team_role,
314+ data.team_all_repos,
315+ ))];
316+ if has_description {
317+ sub.push(SubPart::text(data.team_description.clone()));
318+ }
310319 Ok(view! {
311- <div data-live=(data.live.as_str())>
312- org_tabs(lang: lang, name: data.org_name.clone(), current: "teams".to_owned(), owner: owner, repo_count: data.repo_count, package_count: data.package_count)
313- org_notice(notice: notice)
314- <h1 class="h1">(data.team_name.as_str())</h1>
315- <p class="hint">
316- (g::coverage_text(lang, data.team_role, data.team_all_repos))
317- if has_description {
318- " · " (data.team_description.as_str())
319- }
320- </p>
320+ head(title: data.team_name.as_str(), sub: sub, live: Some(data.live.as_str()))
321+ org_tabs(lang: lang, name: data.org_name.clone(), current: "teams".to_owned(), owner: owner, repo_count: data.repo_count, package_count: data.package_count)
322+ org_notice(notice: notice)
323+ <div class="sheet">
321324 <section class="sec">
322325 <h2>(g::t(lang, K::Members))</h2>
323326 if owner {
324- <div class="acts">
325- reveal(label: g::t(lang, K::AddToTeam), id: Some("add-member"),
326- <form method="post" action=(add_member_action.as_str()) class="fields">
327- <input type="hidden" name="csrf" value=(csrf.as_str())>
328- <div class="field">
329- <label for="team-member-username">(g::t(lang, K::Username))</label>
330- <input id="team-member-username" type="text" name="username" autocomplete="off" spellcheck="false" required=(true)>
331- </div>
332- <button type="submit" class="primary">(g::t(lang, K::AddToTeam))</button>
333- </form>
334- )
335- </div>
327+ reveal(label: g::t(lang, K::AddToTeam), id: Some("add-member"),
328+ <form method="post" action=(add_member_action.as_str()) class="fields">
329+ <input type="hidden" name="csrf" value=(csrf.as_str())>
330+ <div class="field">
331+ <label for="team-member-username">(g::t(lang, K::Username))</label>
332+ <input id="team-member-username" type="text" name="username" autocomplete="off" spellcheck="false" required=(true)>
333+ </div>
334+ <button type="submit" class="primary">(g::t(lang, K::AddToTeam))</button>
335+ </form>
336+ )
336337 }
337338 if data.members.is_empty() {
338339 <p class="state">(g::t(lang, K::NoTeamMembers))</p>
339340 }
340- <div>
341- for member in data.members.iter() {
342- if owner {
343- <details class="row-open">
344- <summary class="line" data-kb-row="">
345- <span class="name org-who">
346- <img class="avatar avatar-sm" src=(member.avatar.as_str()) alt="" width="24" height="24">
347- <span>(member.label.as_str())</span>
348- </span>
349- </summary>
350- <div class="opened">
351- <a class="act quiet" href=(format!("/{}", member.username.as_str()))>(passkeys::s(lang, "Open profile", "Profili aç"))</a>
352- <div class="acts">
353- confirm_act(lang: lang, label: g::t(lang, K::Remove), action: remove_member_action.as_str(), csrf: csrf.as_str(), fields: vec![("user_id".to_owned(), member.user_id.clone())])
354- </div>
355- </div>
356- </details>
357- } else {
358- <a class="line" href=(format!("/{}", member.username.as_str())) data-kb-row="">
341+ for member in data.members.iter() {
342+ if owner {
343+ <details class="row-open">
344+ <summary class="line" data-kb-row="">
359345 <span class="name org-who">
360346 <img class="avatar avatar-sm" src=(member.avatar.as_str()) alt="" width="24" height="24">
361347 <span>(member.label.as_str())</span>
362348 </span>
363- </a>
364- }
349+ </summary>
350+ <div class="opened">
351+ <div class="acts">
352+ <a class="act" href=(format!("/{}", member.username.as_str()))>(passkeys::s(lang, "Open profile", "Profili aç"))</a>
353+ confirm_act(lang: lang, label: g::t(lang, K::Remove), action: remove_member_action.as_str(), csrf: csrf.as_str(), fields: vec![("user_id".to_owned(), member.user_id.clone())])
354+ </div>
355+ </div>
356+ </details>
357+ } else {
358+ <a class="line" href=(format!("/{}", member.username.as_str())) data-kb-row="">
359+ <span class="name org-who">
360+ <img class="avatar avatar-sm" src=(member.avatar.as_str()) alt="" width="24" height="24">
361+ <span>(member.label.as_str())</span>
362+ </span>
363+ </a>
365364 }
366- </div>
365+ }
367366 </section>
368367 <section class="sec">
369368 <h2>(g::t(lang, K::Repositories))</h2>
370369 if owner && has_choices {
371- <div class="acts">
372- reveal(label: g::t(lang, K::LinkRepository), id: Some("link-repository"),
373- <form method="post" action=(add_repo_action.as_str()) class="fields">
374- <input type="hidden" name="csrf" value=(csrf.as_str())>
375- <div class="field">
376- <label for="team-repo-id">(g::t(lang, K::Repository))</label>
377- <select id="team-repo-id" name="repo_id">
378- for choice in data.choices.iter() {
379- <option value=(choice.id.as_str())>(choice.title.as_str())</option>
380- }
381- </select>
382- </div>
383- <button type="submit" class="primary">(g::t(lang, K::LinkRepository))</button>
384- </form>
385- )
386- </div>
370+ reveal(label: g::t(lang, K::LinkRepository), id: Some("link-repository"),
371+ <form method="post" action=(add_repo_action.as_str()) class="fields">
372+ <input type="hidden" name="csrf" value=(csrf.as_str())>
373+ <div class="field">
374+ <label for="team-repo-id">(g::t(lang, K::Repository))</label>
375+ <select id="team-repo-id" name="repo_id">
376+ for choice in data.choices.iter() {
377+ <option value=(choice.id.as_str())>(choice.title.as_str())</option>
378+ }
379+ </select>
380+ </div>
381+ <button type="submit" class="primary">(g::t(lang, K::LinkRepository))</button>
382+ </form>
383+ )
387384 }
388385 if data.repos.is_empty() {
389386 <p class="state">(g::t(lang, K::NoTeamRepos))</p>
390387 }
391- <div>
392- for repo in data.repos.iter() {
393- if owner {
394- <details class="row-open">
395- <summary class="line" data-kb-row="">
396- <span class="name">(repo.title.as_str())</span>
397- </summary>
398- <div class="opened">
399- <a class="act quiet" href=(repo.href.as_str())>(passkeys::s(lang, "Open repository", "Depoyu aç"))</a>
400- <div class="acts">
401- confirm_act(lang: lang, label: g::t(lang, K::Unlink), action: remove_repo_action.as_str(), csrf: csrf.as_str(), fields: vec![("repo_id".to_owned(), repo.repo_id.clone())])
402- </div>
403- </div>
404- </details>
405- } else {
406- <a class="line" href=(repo.href.as_str()) data-kb-row="">
388+ for repo in data.repos.iter() {
389+ if owner {
390+ <details class="row-open">
391+ <summary class="line" data-kb-row="">
407392 <span class="name">(repo.title.as_str())</span>
408- </a>
409- }
393+ </summary>
394+ <div class="opened">
395+ <div class="acts">
396+ <a class="act" href=(repo.href.as_str())>(passkeys::s(lang, "Open repository", "Depoyu aç"))</a>
397+ confirm_act(lang: lang, label: g::t(lang, K::Unlink), action: remove_repo_action.as_str(), csrf: csrf.as_str(), fields: vec![("repo_id".to_owned(), repo.repo_id.clone())])
398+ </div>
399+ </div>
400+ </details>
401+ } else {
402+ <a class="line" href=(repo.href.as_str()) data-kb-row="">
403+ <span class="name">(repo.title.as_str())</span>
404+ </a>
410405 }
411- </div>
406+ }
412407 </section>
413408 if owner {
414409 <section class="sec">
crates/forge-web/src/pages/packages.rsmodified+47 -38
@@ -26,6 +26,7 @@ use crate::pages::ci_runs::{changed_event, events_response};
2626 use crate::pages::packages_oci::{self, oci_package_view};
2727 use crate::render::markdown::render_markdown;
2828 use crate::state::AppState;
29+use crate::views::parts::{SubPart, head};
2930 use crate::views::{empty_state, enc, rel_time, shell};
3031
3132 path_param!(owner);
@@ -304,67 +305,75 @@ async fn package_view(page: PackagePage) -> Result<impl View> {
304305 let readme_label = pk::t(lang, K::Readme);
305306 let versions_label = pk::t(lang, K::PackageVersions);
306307 let no_readme = pk::t(lang, K::NoReadme);
308+ // The sub line: the owner, the private mark and the linked repo.
309+ let mut sub = vec![
310+ SubPart::text(owner_name.as_str()),
311+ SubPart::text(pk::t(lang, K::TabPackages)),
312+ ];
313+ if private {
314+ sub.push(SubPart::text(pk::t(lang, K::PackagePrivate)));
315+ }
316+ if has_repo {
317+ sub.push(SubPart::link(
318+ format!("{}: {}", pk::t(lang, K::PackageRepoLink), repo_text),
319+ repo_href.as_str(),
320+ ));
321+ }
322+ let heading = format!("{} {}", package.name, latest_text)
323+ .trim_end()
324+ .to_owned();
307325 Ok(view! {
308- <div data-live=(events.as_str())>
309- <h1 class="h1">(package.name.as_str()) " " <span class="muted">(latest_text.as_str())</span></h1>
310- <p class="hint">(owner_name.as_str()) " / " (pk::t(lang, K::TabPackages))</p>
311- if !description.is_empty() {
312- <p class="state">(description.as_str())</p>
313- }
314- if private {
315- <p class="hint"><span class="badge">(pk::t(lang, K::PackagePrivate))</span></p>
316- }
317- if has_repo {
318- <p class="hint">(pk::t(lang, K::PackageRepoLink)) ": " <a href=(repo_href.as_str())>(repo_text.as_str())</a></p>
319- }
326+ head(title: heading.as_str(), sub: sub)
327+ <nav class="tabs" aria-label=(package.name.as_str())>
328+ <a href=(readme_href.as_str()) aria-current=(readme_current)>(readme_label)</a>
329+ <a href=(versions_href.as_str()) aria-current=(versions_current)>(versions_label)</a>
330+ </nav>
331+ <div class="sheet" data-live=(events.as_str())>
320332 <section class="sec">
333+ if !description.is_empty() {
334+ <p>(description.as_str())</p>
335+ }
321336 <h2>(install)</h2>
322337 <p class="hint">(pk::t(lang, K::InstallHelp))</p>
323- <p class="state">(pk::t(lang, K::InstallRegistryConfig))</p>
338+ <p class="hint">(pk::t(lang, K::InstallRegistryConfig))</p>
324339 <div class="copy-box">
325340 <code id="pkg-config">(config_block.as_str())</code>
326341 <button type="button" data-copy="pkg-config">(copy_label)</button>
327342 </div>
328- <p class="state">(pk::t(lang, K::InstallAdd))</p>
343+ <p class="hint">(pk::t(lang, K::InstallAdd))</p>
329344 <div class="copy-box">
330345 <code id="pkg-add">(add_cmd.as_str())</code>
331346 <button type="button" data-copy="pkg-add">(copy_label)</button>
332347 </div>
333- <p class="state">(pk::t(lang, K::InstallPublish))</p>
348+ <p class="hint">(pk::t(lang, K::InstallPublish))</p>
334349 <div class="copy-box">
335350 <code id="pkg-publish">(publish_cmd.as_str())</code>
336351 <button type="button" data-copy="pkg-publish">(copy_label)</button>
337352 </div>
338- <p class="state">(pk::t(lang, K::InstallLogin))</p>
353+ <p class="hint">(pk::t(lang, K::InstallLogin))</p>
339354 <div class="copy-box">
340355 <code id="pkg-login">(login_cmd.as_str())</code>
341356 <button type="button" data-copy="pkg-login">(copy_label)</button>
342357 </div>
343358 </section>
344- <nav class="tabs" aria-label=(package.name.as_str())>
345- <a href=(readme_href.as_str()) aria-current=(readme_current)>(readme_label)</a>
346- <a href=(versions_href.as_str()) aria-current=(versions_current)>(versions_label)</a>
347- </nav>
348359 if versions_tab {
349360 if has_versions {
350- <div>
351- for (version, date, yanked, checksum) in version_rows.iter() {
352- <details class="row-open" data-kb-row="">
353- <summary class="line">
354- <span class="name">
355- (version.as_str())
356- if *yanked {
357- " " <span class="badge">(pk::t(lang, K::VersionYanked))</span>
358- }
359- </span>
360- <span class="val">rel_time(lang: lang, stamp: date.as_str())</span>
361- </summary>
362- <div class="opened">
363- <code class="hint">(checksum.as_str())</code>
364- </div>
365- </details>
366- }
367- </div>
361+ for (version, date, yanked, checksum) in version_rows.iter() {
362+ <details class="row-open" data-kb-row="">
363+ <summary class="line">
364+ <span class="name">
365+ (version.as_str())
366+ if *yanked {
367+ " " <span class="badge">(pk::t(lang, K::VersionYanked))</span>
368+ }
369+ </span>
370+ <span class="val">rel_time(lang: lang, stamp: date.as_str())</span>
371+ </summary>
372+ <div class="opened">
373+ <code class="hint">(checksum.as_str())</code>
374+ </div>
375+ </details>
376+ }
368377 } else {
369378 empty_state(title: pk::t(lang, K::NoVersions))
370379 }
crates/forge-web/src/pages/packages_oci.rsmodified+15 -7
@@ -11,7 +11,7 @@ use crate::i18n::Lang;
1111 use crate::i18n::packages::{self as pk, K};
1212 use crate::package_ops;
1313 use crate::state::AppState;
14-use crate::views::parts::confirm_act;
14+use crate::views::parts::{SubPart, confirm_act, head};
1515 use crate::views::{empty_state, enc, human_size, rel_time};
1616
1717 /// What the container package page shows, prepared by the handler.
@@ -110,13 +110,21 @@ pub async fn oci_package_view(page: OciPage) -> Result<impl View> {
110110 )
111111 })
112112 .collect();
113+ // The head holds the name, the owner, the newest tag and the private note; the install and tag
114+ // topics sit in one sheet below it.
115+ let mut sub = vec![SubPart::text(format!(
116+ "{owner_name} / {}",
117+ pk::t(lang, K::ContainerKind)
118+ ))];
119+ if !newest_tag.is_empty() {
120+ sub.push(SubPart::mono(newest_tag.clone()));
121+ }
122+ if private {
123+ sub.push(SubPart::strong(pk::t(lang, K::PackagePrivate)));
124+ }
113125 Ok(view! {
114- <div data-live=(events.as_str())>
115- <h1 class="h1">(package.name.as_str()) " " <span class="muted">(newest_tag.as_str())</span></h1>
116- <p class="hint">(owner_name.as_str()) " / " (pk::t(lang, K::ContainerKind))</p>
117- if private {
118- <p class="hint"><span class="badge">(pk::t(lang, K::PackagePrivate))</span></p>
119- }
126+ head(title: package.name.as_str(), sub: sub, live: Some(events.as_str()))
127+ <div class="sheet">
120128 <section class="sec">
121129 <h2>(pk::t(lang, K::Install))</h2>
122130 <p class="hint">(pk::t(lang, K::ContainerInstallHelp))</p>
crates/forge-web/src/pages/passkeys.rsmodified+22 -26
@@ -678,32 +678,28 @@ pub async fn passkeys_panel(lang: Lang, csrf: &str, panel: PasskeyPanel) -> Resu
678678 } else {
679679 <p class="hint">(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."))</p>
680680 }
681- if !empty {
682- <div>
683- for (item, rename_action, delete_action, field) in rows.into_iter() {
684- <details class="row-open">
685- <summary class="line">
686- <span class="name">(item.name.as_str())</span>
687- <span class="val">added_status(lang: lang, added: Some(item.created_at.as_str()), used: item.last_used_at.as_deref())</span>
688- </summary>
689- <div class="opened">
690- <div class="acts">
691- reveal(label: s(lang, "Rename", "Yeniden adlandır"),
692- <form method="post" action=(rename_action.as_str()) class="fields">
693- <input type="hidden" name="csrf" value=(csrf)>
694- <div class="field">
695- <label for=(field.as_str())>(s(lang, "Name", "Ad"))</label>
696- <input id=(field.as_str()) type="text" name="name" value=(item.name.as_str()) maxlength="40" autocomplete="off" required=(true)>
697- </div>
698- <button type="submit" class="primary">(t(lang, Key::Save))</button>
699- </form>
700- )
701- confirm_act(lang: lang, label: t(lang, Key::Delete), action: delete_action.as_str(), csrf: csrf, note: Some(s(lang, "Delete this passkey? You can no longer sign in with it.", "Bu geçiş anahtarı silinsin mi? Artık onunla giriş yapamazsınız.").to_owned()))
702- </div>
703- </div>
704- </details>
705- }
706- </div>
681+ for (item, rename_action, delete_action, field) in rows.into_iter() {
682+ <details class="row-open">
683+ <summary class="line">
684+ <span class="name">(item.name.as_str())</span>
685+ <span class="val">added_status(lang: lang, added: Some(item.created_at.as_str()), used: item.last_used_at.as_deref())</span>
686+ </summary>
687+ <div class="opened">
688+ <div class="acts">
689+ reveal(label: s(lang, "Rename", "Yeniden adlandır"),
690+ <form method="post" action=(rename_action.as_str()) class="fields">
691+ <input type="hidden" name="csrf" value=(csrf)>
692+ <div class="field">
693+ <label for=(field.as_str())>(s(lang, "Name", "Ad"))</label>
694+ <input id=(field.as_str()) type="text" name="name" value=(item.name.as_str()) maxlength="40" autocomplete="off" required=(true)>
695+ </div>
696+ <button type="submit" class="primary">(t(lang, Key::Save))</button>
697+ </form>
698+ )
699+ confirm_act(lang: lang, label: t(lang, Key::Delete), action: delete_action.as_str(), csrf: csrf, note: Some(s(lang, "Delete this passkey? You can no longer sign in with it.", "Bu geçiş anahtarı silinsin mi? Artık onunla giriş yapamazsınız.").to_owned()))
700+ </div>
701+ </div>
702+ </details>
707703 }
708704 if usable {
709705 <div class="acts">
crates/forge-web/src/pages/profile.rsmodified+88 -91
@@ -36,6 +36,7 @@ use crate::pages::snippets::{ListRow, list_row, snippet_rows};
3636 use crate::render::markdown::render_markdown;
3737 use crate::state::AppState;
3838 use crate::views::heatmap::{Calendar, DayDetail, contribution_calendar};
39+use crate::views::parts::{SubPart, head};
3940 use crate::views::repo_list::{
4041 PageLink, RepoRow, SortLink, badge_class, pager, pager_links, repo_rows, sort_chips,
4142 };
@@ -646,56 +647,54 @@ async fn profile_card(
646647 let new_repo_href = format!("/new?owner={}", enc(&user.username));
647648 let settings_href = format!("/org/{}/settings", enc(&user.username));
648649 let members_href = format!("/org/{}/members", enc(&user.username));
649- let has_acts = edit_profile || (is_org && (org_owner || org_can_create));
650650 let members_more = org
651651 .as_ref()
652652 .is_some_and(|summary| org_member && summary.total > summary.members.len());
653+ // The sub line: the username under a display name, then whether this is an organization or the
654+ // person's local time.
655+ let mut sub = Vec::new();
656+ if has_name {
657+ sub.push(SubPart::text(user.username.as_str()));
658+ }
659+ if is_org {
660+ sub.push(SubPart::text(g::t(lang, K::Organization)));
661+ } else {
662+ sub.push(SubPart::text(format!(
663+ "{} {}",
664+ g::t(lang, K::LocalTime),
665+ local_time
666+ )));
667+ }
653668 Ok(view! {
654- <article class="profile-page" data-live=(format!("/users/{}/events", user.username))>
655- <header class="profile-head">
656- <img class=(avatar_class) src=(src) alt="" width=(avatar_px) height=(avatar_px)>
657- <div class="profile-id">
658- <h1 class="h1">(heading)</h1>
659- if has_name {
660- <p class="hint">(user.username.as_str())</p>
661- }
662- if is_org {
663- <p class="hint">(g::t(lang, K::Organization))</p>
664- }
665- if !is_org {
666- <p class="hint">(g::t(lang, K::LocalTime)) (local_time.as_str())</p>
667- }
668- if has_acts {
669- <div class="acts">
670- if edit_profile {
671- <a class="act" href="/settings/profile">(edit_label)</a>
672- }
673- if org_owner {
674- <a class="act" href=(settings_href.as_str())>(org_edit_label)</a>
675- }
676- if org_can_create {
677- <a class="act" href=(new_repo_href.as_str())>(g::t(lang, K::NewRepository))</a>
678- }
679- </div>
680- }
681- </div>
682- if has_about {
683- <section class="profile-about markdown-body">(Unescaped::new_unchecked(about_html))</section>
684- }
685- </header>
686- profile_tabs(username: user.username.clone(), items: tab_items, current: tab.clone(), counts: tab_counts)
669+ head(title: heading.as_str(), sub: sub,
670+ <img class=(avatar_class) src=(src) alt="" width=(avatar_px) height=(avatar_px)>
671+ if edit_profile {
672+ <a class="button" href="/settings/profile">(edit_label)</a>
673+ }
674+ if org_owner {
675+ <a class="button" href=(settings_href.as_str())>(org_edit_label)</a>
676+ }
677+ if org_can_create {
678+ <a class="button primary" href=(new_repo_href.as_str())>(g::t(lang, K::NewRepository))</a>
679+ }
680+ )
681+ profile_tabs(username: user.username.clone(), items: tab_items, current: tab.clone(), counts: tab_counts)
682+ <div class="sheet" data-live=(format!("/users/{}/events", user.username))>
683+ if has_about {
684+ <section class="sec profile-about markdown-body">(Unescaped::new_unchecked(about_html))</section>
685+ }
687686 if overview_on {
688687 if let Some((calendar, selected)) = heat {
689- contribution_calendar(calendar: calendar, selected: selected, lang: lang, base: base.clone(),
690- live: Some(format!("/users/{}/events", user.username)))
688+ <section class="sec">
689+ contribution_calendar(calendar: calendar, selected: selected, lang: lang, base: base.clone(),
690+ live: Some(format!("/users/{}/events", user.username)))
691+ </section>
691692 }
692693 <section class="sec profile-pinned">
693- <div class="topic-head">
694- <h2>(pinned_heading)</h2>
695- if let Some(menu) = pins_menu_data {
696- pins_menu(lang: lang, action: menu.action, csrf: menu.csrf, options: menu.options)
697- }
698- </div>
694+ <h2>(pinned_heading)</h2>
695+ if let Some(menu) = pins_menu_data {
696+ pins_menu(lang: lang, action: menu.action, csrf: menu.csrf, options: menu.options)
697+ }
699698 if pins_error {
700699 <p class="alert" role="alert">(g::t(lang, K::PinsTooMany))</p>
701700 }
@@ -743,16 +742,18 @@ async fn profile_card(
743742 }
744743 }
745744 if list_on {
746- <section class="repo-listing">
747- <form method="get" action=(base.as_str()) class="plain-search" role="search">
748- <input type="hidden" name="tab" value=(tab.as_str())>
749- <input type="hidden" name="sort" value=(sort)>
750- <input type="search" name="q" value=(q.as_str()) data-live-search=""
751- placeholder=(filter_label) aria-label=(filter_label)>
752- <button type="submit" class="act">(g::t(lang, K::Search))</button>
753- </form>
754- sort_chips(links: sort_links, lang: lang)
755- <p class="hint repo-count">(count_text.as_str())</p>
745+ <section class="sec">
746+ <div class="sheet-tools">
747+ <strong>(count_text.as_str())</strong>
748+ <form method="get" action=(base.as_str()) class="plain-search" role="search">
749+ <input type="hidden" name="tab" value=(tab.as_str())>
750+ <input type="hidden" name="sort" value=(sort)>
751+ <input type="search" name="q" value=(q.as_str()) data-live-search=""
752+ placeholder=(filter_label) aria-label=(filter_label)>
753+ <button type="submit" class="act">(g::t(lang, K::Search))</button>
754+ </form>
755+ sort_chips(links: sort_links, lang: lang)
756+ </div>
756757 if has_rows {
757758 repo_rows(rows: rows, lang: lang)
758759 } else {
@@ -771,24 +772,22 @@ async fn profile_card(
771772 <h2>(pk::t(lang, PK::PackagesHeading))</h2>
772773 <p class="hint">(pk::t(lang, PK::PackagesHelp))</p>
773774 if has_packages {
774- <div class="plain-rows">
775- for row in package_rows.into_iter() {
776- <div class="line" data-kb-row="">
777- <a class="name" href=(row.href.as_str())>(row.name.as_str())</a>
778- if row.container {
779- <span class="badge">(pk::t(lang, PK::ContainerKind))</span>
780- }
781- <span class="val">(row.latest.as_str())</span>
782- <span class="val">(row.versions.to_string()) " " (pk::t(lang, match (row.container, row.versions == 1) { (true, true) => PK::PackageTagCountOne, (true, false) => PK::PackageTagCount, (false, true) => PK::PackageVersionCountOne, (false, false) => PK::PackageVersionCount }))</span>
783- if row.private {
784- <span class="badge">(pk::t(lang, PK::PackagePrivate))</span>
785- }
786- if !row.description.is_empty() {
787- <span class="val">(row.description.as_str())</span>
788- }
789- </div>
790- }
791- </div>
775+ for row in package_rows.into_iter() {
776+ <div class="line" data-kb-row="">
777+ <a class="name" href=(row.href.as_str())>(row.name.as_str())</a>
778+ if row.container {
779+ <span class="badge">(pk::t(lang, PK::ContainerKind))</span>
780+ }
781+ <span class="val">(row.latest.as_str())</span>
782+ <span class="val">(row.versions.to_string()) " " (pk::t(lang, match (row.container, row.versions == 1) { (true, true) => PK::PackageTagCountOne, (true, false) => PK::PackageTagCount, (false, true) => PK::PackageVersionCountOne, (false, false) => PK::PackageVersionCount }))</span>
783+ if row.private {
784+ <span class="badge">(pk::t(lang, PK::PackagePrivate))</span>
785+ }
786+ if !row.description.is_empty() {
787+ <span class="val">(row.description.as_str())</span>
788+ }
789+ </div>
790+ }
792791 } else {
793792 <p class="state">(pk::t(lang, PK::NoPackages))</p>
794793 }
@@ -818,24 +817,22 @@ async fn profile_card(
818817 </div>
819818 }
820819 if has_orgs {
821- <div class="plain-rows">
822- for org in orgs.into_iter() {
823- <div class="line" data-kb-row="">
824- <img class="avatar avatar-sm" src=(org.avatar.as_str()) alt="" width="24" height="24">
825- <a class="name" href=(org.href.as_str())>(org.name.as_str())</a>
826- if !org.display_name.is_empty() {
827- <span class="val">(org.display_name.as_str())</span>
828- }
829- <span class="badge">(org.role)</span>
830- </div>
831- }
832- </div>
820+ for org in orgs.into_iter() {
821+ <div class="line" data-kb-row="">
822+ <img class="avatar avatar-sm" src=(org.avatar.as_str()) alt="" width="24" height="24">
823+ <a class="name" href=(org.href.as_str())>(org.name.as_str())</a>
824+ if !org.display_name.is_empty() {
825+ <span class="val">(org.display_name.as_str())</span>
826+ }
827+ <span class="badge">(org.role)</span>
828+ </div>
829+ }
833830 } else {
834831 <p class="state">(g::t(lang, K::NoOrganizations))</p>
835832 }
836833 </section>
837834 }
838- </article>
835+ </div>
839836 })
840837 }
841838
@@ -1045,7 +1042,7 @@ mod tests {
10451042 assert!(owner.contains("tahinli/secret-repo"), "owner: private repo");
10461043 assert!(owner.contains("tahinli/shared-repo"), "owner: shared repo");
10471044 assert!(
1048- owner.contains("class=\"act\" href=\"/settings/profile\""),
1045+ owner.contains("class=\"button\" href=\"/settings/profile\""),
10491046 "owner: edit button"
10501047 );
10511048
@@ -1084,7 +1081,7 @@ mod tests {
10841081 ] {
10851082 let (_, body) = get(&site.router, uri, None).await;
10861083 assert!(
1087- !body.contains("<article class=\"profile-page\""),
1084+ !body.contains("<div class=\"sheet\" data-live=\"/users/"),
10881085 "{uri} was served by the profile page"
10891086 );
10901087 }
@@ -1096,7 +1093,7 @@ mod tests {
10961093 let (status, body) = get(&site.router, "/tahinli/missing", None).await;
10971094 assert_eq!(status, 404, "missing repo");
10981095 assert!(
1099- !body.contains("<article class=\"profile-page\""),
1096+ !body.contains("<div class=\"sheet\" data-live=\"/users/"),
11001097 "missing repo"
11011098 );
11021099 }
@@ -1212,7 +1209,7 @@ mod tests {
12121209 "org pins: anonymous has no edit link"
12131210 );
12141211 assert!(
1215- owner.contains("class=\"act\" href=\"/org/acme/settings\"")
1212+ owner.contains("class=\"button\" href=\"/org/acme/settings\"")
12161213 && owner.contains("/new?owner=acme"),
12171214 "org profile: owner sees Edit organization and New repository"
12181215 );
@@ -1296,22 +1293,22 @@ mod tests {
12961293 let (status, body) = get(&site.router, "/tahinli", None).await;
12971294 assert_eq!(status, 200, "display name: page");
12981295 assert!(
1299- body.contains("<h1 class=\"h1\">Ahmet Kaan Gümüş</h1>"),
1296+ body.contains("<h1>Ahmet Kaan Gümüş</h1>"),
13001297 "display name: heading {body}"
13011298 );
13021299 assert!(
1303- body.contains("<p class=\"hint\">tahinli</p>"),
1300+ body.contains("<p class=\"head-sub\"><span class=\"\">tahinli</span>"),
13041301 "display name: username below {body}"
13051302 );
13061303
13071304 site.store.set_display_name(&tahinli, " ").await.unwrap();
13081305 let (_, body) = get(&site.router, "/tahinli", None).await;
13091306 assert!(
1310- body.contains("<h1 class=\"h1\">tahinli</h1>"),
1307+ body.contains("<h1>tahinli</h1>"),
13111308 "blank name: heading {body}"
13121309 );
13131310 assert!(
1314- !body.contains("<p class=\"hint\">tahinli</p>"),
1311+ !body.contains("<p class=\"head-sub\"><span class=\"\">tahinli</span>"),
13151312 "blank name: no username line {body}"
13161313 );
13171314 }
crates/forge-web/src/pages/profile_pins.rsmodified+2 -2
@@ -66,9 +66,9 @@ pub(crate) async fn pins_menu(
6666 options: Vec<PinOption>,
6767 ) -> Result<impl View> {
6868 Ok(view! {
69- <details class="pop pins-menu">
69+ <details class="menu pins-menu">
7070 <summary class="act">(g::t(lang, K::CustomizePins))</summary>
71- <form method="post" action=(action.as_str()) class="pop-panel">
71+ <form method="post" action=(action.as_str()) class="menu-list">
7272 <input type="hidden" name="csrf" value=(csrf.as_str())>
7373 <p class="hint">(g::t(lang, K::PinsIntro))</p>
7474 <ul class="pin-options">
crates/forge-web/src/pages/pull_branch.rsmodified+6 -6
@@ -370,8 +370,8 @@ pub(crate) fn branch_error_from(cx: &Cx, lang: Lang) -> Option<String> {
370370 branch_error_text(lang, &code).map(str::to_owned)
371371 }
372372
373-/// The branch box on a finished pull request: an error line and, when the viewer may act, the
374-/// delete or restore form.
373+/// The branch topic of a finished pull request, for the pull request's sheet: an error line and,
374+/// when the viewer may act, the delete or restore tool.
375375 #[component]
376376 pub(crate) async fn branch_box(
377377 lang: Lang,
@@ -380,19 +380,19 @@ pub(crate) async fn branch_box(
380380 ) -> Result<impl View> {
381381 let heading = crate::pages::passkeys::s(lang, "Branch", "Dal");
382382 Ok(view! {
383- <section class="sec merge-box merge-muted">
383+ <section class="sec">
384384 <h2>(heading)</h2>
385385 if let Some(text) = error {
386- <p class="alert merge-error" role="alert">(text.as_str())</p>
386+ <p class="alert" role="alert">(text.as_str())</p>
387387 }
388388 if let Some(a) = action {
389389 if a.restore {
390- <p class="state merge-headline">(g::t(lang, K::BranchPrefix)) <code>(a.branch.as_str())</code> (g::t(lang, K::BranchWasDeleted))</p>
390+ <p>(g::t(lang, K::BranchPrefix)) " " <code>(a.branch.as_str())</code> " " (g::t(lang, K::BranchWasDeleted))</p>
391391 <div class="acts">
392392 post_act(label: g::t(lang, K::RestoreBranch), action: a.action.as_str(), csrf: a.csrf.as_str())
393393 </div>
394394 } else {
395- <p class="state merge-headline">(g::t(lang, K::BranchPrefix)) <code>(a.branch.as_str())</code> (g::t(lang, K::BranchStillHere))</p>
395+ <p>(g::t(lang, K::BranchPrefix)) " " <code>(a.branch.as_str())</code> " " (g::t(lang, K::BranchStillHere))</p>
396396 <div class="acts">
397397 confirm_act(lang: lang, label: g::t(lang, K::DeleteBranch), action: a.action.as_str(), csrf: a.csrf.as_str(),
398398 note: Some(crate::pages::passkeys::s(lang, "The branch is removed from the repo. Its commits stay in the pull request.", "Dal depodan kaldırılır. Commit'leri çekme isteğinde kalır.").to_owned()))
crates/forge-web/src/pages/pull_files.rsmodified+271 -163
@@ -1,13 +1,12 @@
11 //! The Files changed tab of a pull request, `/{owner}/{repo}/pulls/{n}/files`. Each diff line has
22 //! an anchor and a "+" link (`?comment=<file>:<old|new>:<line>`), which opens an inline comment
33 //! form under that line. Existing review threads render under their lines. Signed-in viewers see
4-//! the review bar at the top. The header and tabs come from `pull_view`. The review POST routes
5-//! are in `pull_reviews`.
4+//! the decision pill under the diff. The header and tabs come from `pull_view`. The review POST
5+//! routes are in `pull_reviews`.
66
7-use std::collections::HashMap;
7+use std::collections::{HashMap, HashSet};
88 use std::sync::Arc;
99
10-use forge_core::store::commit_status::StatusState;
1110 use forge_core::{Action, IssueState, PullRequest, Side, Thread, authorize};
1211 use forge_git::command::ObjectSource;
1312 use forge_git::history::{CommitDiff, DiffStatus, FileDiff};
@@ -23,23 +22,23 @@ use topcoat::view::{View, component, view};
2322
2423 use crate::auth::require_user;
2524 use crate::i18n::browse as b;
25+use crate::i18n::pulls as review_strings;
2626 use crate::i18n::pulls::{self as g, K};
2727 use crate::i18n::{self, Lang};
2828 use crate::pages::edit_history::thread_edit_counts;
2929 use crate::pages::issue_parts::{
30- When, check_write, csrf_of, may_converse, parse_number, triage, viewer,
30+ check_write, csrf_of, may_converse, parse_number, triage, viewer,
3131 };
3232 use crate::pages::passkeys;
3333 use crate::pages::pull_reviews::{error_text_in, pull_diff, suggest_states};
34-use crate::pages::pull_view::{commits_of, frame_in, is_merged, pull_header, pull_subnav_in};
35-use crate::pages::repo::repo_head;
34+use crate::pages::pull_view::{commits_of, frame_in, is_merged, pull_header};
3635 use crate::pages::repo_ctx::{RepoCtx, load_repo};
3736 use crate::pages::tree::link_context;
3837 use crate::state::AppState;
3938 use crate::views::diff::{DiffLang, DiffOpts, LIMITS, LineComments, diff_section};
40-use crate::views::parts::confirm_act;
39+use crate::views::parts::{confirm_act, seg_fr};
4140 use crate::views::review_thread::ThreadCtx;
42-use crate::views::{alert, now_unix, repo_href, shell};
41+use crate::views::{alert, repo_href, shell};
4342
4443 path_param!(owner);
4544 path_param!(repo);
@@ -131,13 +130,14 @@ struct FileRow {
131130 deletions: u32,
132131 /// The file's index in the diff the page shows, when that diff lists it.
133132 index: Option<usize>,
133+ /// A thread on this file is still open.
134+ commented: bool,
134135 }
135136
136137 /// Where the viewed checkboxes post, for a signed-in viewer.
137138 struct ViewedControls {
138139 pr_href: String,
139140 csrf: String,
140- archived: bool,
141141 }
142142
143143 /// One row per file of the full diff. A mark counts only while its blob is the file's blob at the
@@ -176,128 +176,78 @@ async fn file_rows(
176176 additions: file.additions,
177177 deletions: file.deletions,
178178 index: file_index(shown, path),
179+ commented: false,
179180 });
180181 }
181182 Ok(rows)
182183 }
183184
184-/// What one Files pane row shows, with its classes and link worked out.
185-struct FileItem {
186- path: String,
185+/// One segment of the strip above the diff: one file, its size among the files, and its state.
186+struct SegView {
187+ class: String,
188+ href: String,
187189 label: String,
188- class: &'static str,
190+}
191+
192+/// One row of the Files rail, with its tick and counts worked out.
193+struct RailFile {
194+ class: String,
195+ tick: String,
189196 href: Option<String>,
197+ path: String,
198+ label: String,
190199 state: MarkState,
191- additions: String,
192- deletions: String,
200+ checked: bool,
201+ counts: String,
193202 }
194203
195-/// The Files pane: `Files` with the viewer's `N of M viewed`, then one 36px row per file with its
196-/// icon, its path, its counts and, for a signed-in viewer, the Viewed checkbox. A row links to its
197-/// file in the diff pane. The checkbox posts to the pull's `viewed` route from nav.js and shows the
198-/// new state only after the server answered; a changed file says so.
204+/// The Files rail: one row per file of the full diff, with its viewed tick, its name and its
205+/// counts. A row links to its file in the diff. For a signed-in viewer the tick is the Viewed
206+/// toggle, and a changed file says so.
199207 #[component]
200-async fn files_pane(
208+async fn files_rail(
201209 lang: Lang,
202- rows: Vec<FileRow>,
203- selected: Option<usize>,
204- controls: Option<ViewedControls>,
210+ rows: Vec<RailFile>,
211+ done_text: String,
212+ signed_in: bool,
213+ archived: bool,
205214 ) -> Result<impl View> {
206- let signed_in = controls.is_some();
207- let total = rows.len();
208- let done = rows
209- .iter()
210- .filter(|row| row.state == MarkState::Viewed)
211- .count();
212- let count = if signed_in {
213- g::viewed_count(lang, done, total)
214- } else {
215- String::new()
216- };
217- let (action, csrf, archived) = match controls {
218- Some(c) => (format!("{}/viewed", c.pr_href), c.csrf, c.archived),
219- None => (String::new(), String::new(), false),
220- };
221- let items: Vec<FileItem> = rows
222- .into_iter()
223- .map(|row| {
224- let current = row.index.is_some() && row.index == selected;
225- FileItem {
226- href: row.index.map(|i| format!("?file={i}#file-{}", i + 1)),
227- class: if current {
228- "line pull-file current"
229- } else {
230- "line pull-file"
231- },
232- additions: format!("+{}", row.additions),
233- deletions: format!("\u{2212}{}", row.deletions),
234- path: row.path,
235- label: row.label,
236- state: row.state,
237- }
238- })
239- .collect();
240215 let mark = g::t(lang, K::ViewedMark);
241216 let changed = g::t(lang, K::ChangedSinceViewed);
242- let heading = passkeys::s(lang, "Files", "Dosyalar");
243217 let hint = g::t(lang, K::ViewedHint);
244218 let viewed_files = g::t(lang, K::ViewedFiles);
219+ let heading = passkeys::s(lang, "Files", "Dosyalar");
245220 Ok(view! {
246- <section class="sec pull-files" data-viewed-panel="" data-action=(action.as_str()) data-csrf=(csrf.as_str()) aria-label=(viewed_files)>
247- <h2>(heading)</h2>
248- if signed_in {
249- <p class="hint" title=(hint)>(count.as_str())</p>
250- }
251- <div>
252- for item in items.into_iter() {
253- <div class=(item.class) data-viewed-row="" data-state=(item.state.name()) data-label=(item.label.as_str())>
254- if let Some(href) = item.href {
255- <a class="name pull-file-link" href=(href.as_str())><span class="mono clip">(item.path.as_str())</span></a>
221+ <nav class="rail" aria-label=(viewed_files)>
222+ <h2>(heading) " " <span title=(hint)>(done_text.as_str())</span></h2>
223+ <div class="rail-list">
224+ for file in rows.into_iter() {
225+ <div class=(file.class.as_str()) data-viewed-row="" data-state=(file.state.name()) data-label=(file.label.as_str())>
226+ if signed_in && !archived {
227+ <label class="tick-toggle" title=(mark)>
228+ if file.checked {
229+ <input class="sr-only" type="checkbox" checked="" data-viewed-toggle="" data-path=(file.path.as_str())>
230+ } else {
231+ <input class="sr-only" type="checkbox" data-viewed-toggle="" data-path=(file.path.as_str())>
232+ }
233+ <i class=(file.tick.as_str())></i>
234+ </label>
256235 } else {
257- <span class="name pull-file-link"><span class="mono clip">(item.path.as_str())</span></span>
236+ <i class=(file.tick.as_str())></i>
258237 }
259- <span class="val pull-counts"><span class="ok">(item.additions.as_str())</span> <span class="bad">(item.deletions.as_str())</span></span>
260- if item.state == MarkState::Changed {
261- <span class="viewed-note">(changed)</span>
238+ if let Some(href) = file.href {
239+ <a class="nm" href=(href.as_str())>(file.path.as_str())</a>
240+ } else {
241+ <span class="nm">(file.path.as_str())</span>
262242 }
263- if signed_in && !archived {
264- if item.state == MarkState::Viewed {
265- <label class="switch"><input type="checkbox" checked="" data-viewed-toggle="" data-path=(item.path.as_str())><span>(mark)</span></label>
266- } else {
267- <label class="switch"><input type="checkbox" data-viewed-toggle="" data-path=(item.path.as_str())><span>(mark)</span></label>
268- }
243+ <span class="val">(file.counts.as_str())</span>
244+ if file.state == MarkState::Changed {
245+ <span class="hint">(changed)</span>
269246 }
270247 </div>
271248 }
272249 </div>
273- </section>
274- })
275-}
276-
277-/// One status context in the Checks pane: its dot, its name and how long ago it last reported.
278-struct CheckItem {
279- context: String,
280- dot: &'static str,
281- when: String,
282-}
283-
284-/// The Checks pane: the head commit's contexts with a dot, the name and the time of the last report.
285-#[component]
286-async fn checks_pane(lang: Lang, items: Vec<CheckItem>) -> Result<impl View> {
287- let heading = passkeys::s(lang, "Checks", "Kontroller");
288- Ok(view! {
289- <section class="sec pull-checks">
290- <h2>(heading)</h2>
291- <div>
292- for item in items.into_iter() {
293- <div class="line">
294- <span class=(item.dot)></span>
295- <span class="name clip">(item.context.as_str())</span>
296- <span class="val"><time class="pull-time">(item.when.as_str())</time></span>
297- </div>
298- }
299- </div>
300- </section>
250+ </nav>
301251 })
302252 }
303253
@@ -380,41 +330,85 @@ async fn viewed_post(cx: &Cx, Form(form): Form<ViewedForm>) -> Result<SeeOther>
380330 Ok(see_other(files))
381331 }
382332
383-/// The review compose box at the foot of the diff pane. It shows one line, the summary, and the
384-/// Comment button. Focusing the line opens the rest: the pending count and Discard. Approve and
385-/// Request changes are in the pull's head and submit this same form.
333+/// The decision pill under the diff: the viewed count, the open threads, the next unviewed file and
334+/// Finish review. Finish review opens the review form in a panel above the pill. Approve and
335+/// Request changes in the pull's head submit the same form.
386336 #[component]
387337 async fn review_bar(
388338 lang: Lang,
389339 pr_href: String,
390340 csrf: String,
391341 pending: usize,
342+ viewed_text: String,
343+ open_threads: usize,
344+ next: Option<String>,
345+ is_author: bool,
392346 ) -> Result<impl View> {
393347 let reviews_action = format!("{pr_href}/reviews");
394348 let discard_action = format!("{pr_href}/reviews/discard");
395- let pending_text = g::pending_comments(lang, pending);
349+ let pending_text = match (lang, pending) {
350+ (_, 0) => String::new(),
351+ (Lang::En, 1) => "1 comment included".to_owned(),
352+ (Lang::En, n) => format!("{n} comments included"),
353+ (Lang::Tr, n) => format!("{n} yorum dahil"),
354+ };
396355 let finish = g::t(lang, K::FinishReview);
397356 let discard = g::t(lang, K::DiscardPending);
398357 let summary = g::t(lang, K::ReviewSummary);
399358 let submit = g::t(lang, K::SubmitReview);
400359 let comment = g::t(lang, K::CommentChoice).trim();
401- let placeholder = passkeys::s(lang, "Leave a comment", "Yorum bırakın");
360+ let approve = review_strings::t(lang, review_strings::K::ApproveChoice).trim();
361+ let changes = review_strings::t(lang, review_strings::K::RequestChangesChoice).trim();
362+ let placeholder = passkeys::s(lang, "Optional", "İsteğe bağlı");
363+ let next_text = passkeys::s(lang, "Next file", "Sonraki dosya");
364+ let approve_hint = passkeys::s(lang, "Ready to merge", "Birleştirmeye hazır");
365+ let changes_hint = passkeys::s(
366+ lang,
367+ "Blocks the merge until you approve",
368+ "Siz onaylayana kadar birleştirmeyi engeller",
369+ );
370+ let comment_hint = passkeys::s(lang, "No decision", "Karar yok");
371+ let threads_text = match lang {
372+ Lang::Tr => format!("{open_threads} açık konu"),
373+ Lang::En if open_threads == 1 => "1 open thread".to_owned(),
374+ Lang::En => format!("{open_threads} open threads"),
375+ };
402376 Ok(view! {
403- <section class="sec pull-compose">
404- <h2>(finish)</h2>
405- <p class="hint">(pending_text.as_str())</p>
406- <form id="review-form" method="post" action=(reviews_action.as_str()) class="fields" aria-label=(submit)>
407- <input type="hidden" name="csrf" value=(csrf.as_str())>
408- <div class="field">
409- <label for="review-body">(summary)</label>
410- <input id="review-body" class="pull-input" type="text" name="body" placeholder=(placeholder)>
377+ <div class="decide">
378+ <span class="stat">(viewed_text.as_str())</span>
379+ <span class="stat">(threads_text.as_str())</span>
380+ if let Some(href) = next {
381+ <a class="button small" href=(href.as_str())>(next_text)</a>
382+ }
383+ <details class="decide-open">
384+ <summary class="button primary">(finish)</summary>
385+ <div class="decide-panel">
386+ <h3>(finish)</h3>
387+ <form id="review-form" method="post" action=(reviews_action.as_str()) class="fields" aria-label=(submit)>
388+ <input type="hidden" name="csrf" value=(csrf.as_str())>
389+ <div class="field">
390+ <label for="review-body">(summary)</label>
391+ <textarea id="review-body" name="body" rows="3" placeholder=(placeholder)></textarea>
392+ </div>
393+ // An author cannot approve or block their own pull, so they only comment.
394+ if !is_author {
395+ <label class="opt"><input type="radio" name="state" value="approve"><span>(approve)<small>(approve_hint)</small></span></label>
396+ <label class="opt"><input type="radio" name="state" value="request_changes"><span>(changes)<small>(changes_hint)</small></span></label>
397+ }
398+ <label class="opt"><input type="radio" name="state" value="comment" checked=(true)><span>(comment)<small>(comment_hint)</small></span></label>
399+ <div class="acts decide-send">
400+ <button type="submit" class="primary">(submit)</button>
401+ <span class="hint">(pending_text.as_str())</span>
402+ </div>
403+ </form>
404+ if pending > 0 {
405+ <div class="acts">
406+ confirm_act(lang: lang, label: discard, action: discard_action.as_str(), csrf: csrf.as_str())
407+ </div>
408+ }
411409 </div>
412- <button type="submit" class="primary" name="state" value="comment">(comment)</button>
413- </form>
414- <div class="acts">
415- confirm_act(lang: lang, label: discard, action: discard_action.as_str(), csrf: csrf.as_str())
416- </div>
417- </section>
410+ </details>
411+ </div>
418412 })
419413 }
420414
@@ -459,7 +453,6 @@ async fn pull_files(cx: &Cx) -> Result<impl View> {
459453 let controls = viewer_user.as_ref().map(|_| ViewedControls {
460454 pr_href: frame.href.clone(),
461455 csrf: csrf_of(&ctx),
462- archived: ctx.repo.archived,
463456 });
464457 // With whitespace ignored the file list can shrink, so file indexes differ from the comment
465458 // routes' view. Existing threads still show; new inline comments wait for the full diff.
@@ -480,21 +473,10 @@ async fn pull_files(cx: &Cx) -> Result<impl View> {
480473 None
481474 };
482475 let diff: &CommitDiff = shown_ws.as_ref().unwrap_or(&full_diff);
483- let rows = file_rows(state, &ctx, &pr, &full_diff, diff, marks.as_ref()).await?;
484- let selected = file_param(cx).or((!diff.files.is_empty()).then_some(0));
485- let statuses = state.store.statuses_for(&ctx.repo.id, &pr.head_oid).await?;
486- let checks: Vec<CheckItem> = statuses
487- .iter()
488- .map(|status| CheckItem {
489- context: status.context.clone(),
490- dot: match status.state {
491- StatusState::Success => "dot ok",
492- StatusState::Failure | StatusState::Error => "dot bad",
493- StatusState::Pending => "dot live",
494- },
495- when: When::new(lang, &status.updated_at, ctx.viewer_tz(), now_unix()).relative,
496- })
497- .collect();
476+ let mut rows = file_rows(state, &ctx, &pr, &full_diff, diff, marks.as_ref()).await?;
477+ let selected = file_param(cx)
478+ .or(comment_target(cx).map(|(index, ..)| index))
479+ .or((!diff.files.is_empty()).then_some(0));
498480
499481 let viewer_id = viewer_user.as_ref().map(|user| user.id.clone());
500482 let signed_in = viewer_id.is_some();
@@ -514,7 +496,6 @@ async fn pull_files(cx: &Cx) -> Result<impl View> {
514496 // Comments and replies stay open on a closed pull request; new reviews do not.
515497 let can_review = can_comment && open;
516498 // Approve and request changes are offered to every viewer who may review but did not open it.
517- frame.head_review = can_review && !is_author;
518499 let href = frame.href.clone();
519500 let csrf = csrf_of(&ctx);
520501
@@ -525,6 +506,18 @@ async fn pull_files(cx: &Cx) -> Result<impl View> {
525506 .review_threads(&pr.issue.id, viewer_id.as_deref())
526507 .await?;
527508 let pending = threads.iter().filter(|t| t.root.pending).count();
509+ let open_threads = threads
510+ .iter()
511+ .filter(|t| !t.root.outdated && !t.root.resolved)
512+ .count();
513+ let commented: HashSet<String> = threads
514+ .iter()
515+ .filter(|t| !t.root.outdated)
516+ .map(|t| t.root.path.clone())
517+ .collect();
518+ for row in rows.iter_mut() {
519+ row.commented = commented.contains(&row.path);
520+ }
528521 let edits = thread_edit_counts(state, &threads).await?;
529522 let suggest = suggest_states(state, &ctx, &pr, viewer(&ctx), &threads).await?;
530523 let mut by_line: HashMap<(usize, Side, u32), Vec<Thread>> = HashMap::new();
@@ -566,6 +559,7 @@ async fn pull_files(cx: &Cx) -> Result<impl View> {
566559 // The diff pane has its own top row, so the section's toolbar is left off.
567560 let mut section_opts = opts.clone();
568561 section_opts.enabled = false;
562+ section_opts.only = selected;
569563 let unified_href = opts.href(false, opts.ignore_ws);
570564 let split_href = opts.href(true, opts.ignore_ws);
571565 let ws_href = opts.href(opts.split, !opts.ignore_ws);
@@ -579,28 +573,141 @@ async fn pull_files(cx: &Cx) -> Result<impl View> {
579573 let name = ctx.repo.name.clone();
580574 let parent = pr.merge_base.clone();
581575 let page_title = frame.page_title.clone();
582- let header = ctx.head(state, "pulls").await?;
576+ let panel_action = controls
577+ .as_ref()
578+ .map(|c| format!("{}/viewed", c.pr_href))
579+ .unwrap_or_default();
580+ let panel_csrf = controls.as_ref().map(|c| c.csrf.clone()).unwrap_or_default();
581+
582+ let done = rows
583+ .iter()
584+ .filter(|row| row.state == MarkState::Viewed)
585+ .count();
586+ let total = rows.len();
587+ let viewed_text = g::viewed_count(lang, done, total);
588+ let mark_text = g::t(lang, K::ViewedMark);
589+ let total_changed: u64 = rows
590+ .iter()
591+ .map(|row| u64::from(row.additions) + u64::from(row.deletions))
592+ .sum();
593+ let current = rows
594+ .iter()
595+ .find(|row| row.index.is_some() && row.index == selected);
596+ let current_head = current.map(|row| {
597+ (
598+ row.path.clone(),
599+ format!("+{} \u{2212}{}", row.additions, row.deletions),
600+ )
601+ });
602+ let current_path = current.map(|row| row.path.clone()).unwrap_or_default();
603+ let current_viewed = current.is_some_and(|row| row.state == MarkState::Viewed);
604+ let mark_shown = signed_in && !archived && current.is_some();
605+ // The next file after the current one that is not viewed, wrapping round.
606+ let next = {
607+ let start = rows
608+ .iter()
609+ .position(|row| row.index.is_some() && row.index == selected)
610+ .map_or(0, |p| p + 1);
611+ rows.iter()
612+ .cycle()
613+ .skip(start)
614+ .take(total)
615+ .find(|row| {
616+ row.index.is_some() && row.index != selected && row.state != MarkState::Viewed
617+ })
618+ .and_then(|row| row.index)
619+ .map(|i| format!("?file={i}#file-{}", i + 1))
620+ };
621+ // The strip above the diff: one segment per file, sized by its changed lines.
622+ let segs: Vec<SegView> = rows
623+ .iter()
624+ .map(|row| {
625+ let is_current = row.index.is_some() && row.index == selected;
626+ let fr = seg_fr(
627+ u64::from(row.additions) + u64::from(row.deletions),
628+ total_changed,
629+ );
630+ let state = if is_current {
631+ "sel"
632+ } else if row.state == MarkState::Viewed {
633+ ""
634+ } else {
635+ "wait"
636+ };
637+ SegView {
638+ class: format!("seg {fr} {state}").trim_end().to_owned(),
639+ href: row
640+ .index
641+ .map_or_else(|| "#".to_owned(), |i| format!("?file={i}#file-{}", i + 1)),
642+ label: row.path.clone(),
643+ }
644+ })
645+ .collect();
646+ let rail: Vec<RailFile> = rows
647+ .into_iter()
648+ .map(|row| {
649+ let is_current = row.index.is_some() && row.index == selected;
650+ let mut tick = String::from("tick");
651+ if row.state == MarkState::Viewed {
652+ tick.push_str(" on");
653+ }
654+ if row.commented {
655+ tick.push_str(" cm");
656+ }
657+ RailFile {
658+ class: if is_current {
659+ "rail-item file sel"
660+ } else {
661+ "rail-item file"
662+ }
663+ .to_owned(),
664+ tick,
665+ href: row
666+ .index
667+ .map(|i| format!("?file={i}#file-{}", i + 1)),
668+ path: row.path,
669+ label: row.label,
670+ state: row.state,
671+ checked: row.state == MarkState::Viewed,
672+ counts: format!("+{} \u{2212}{}", row.additions, row.deletions),
673+ }
674+ })
675+ .collect();
676+
583677 Ok(view! {
584678 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
585- repo_head(head: header)
586- pull_header(frame: frame.clone())
587- pull_subnav_in(lang: lang, href: href.clone(), active: "files".to_owned(),
588- commits: frame.commit_count, files: frame.file_count)
679+ pull_header(frame: frame.clone(), active: "files".to_owned())
680+ <div class="strip files">
681+ for seg in segs.into_iter() {
682+ <a class=(seg.class.as_str()) href=(seg.href.as_str()) aria-label=(seg.label.as_str())><span class="bar"></span></a>
683+ }
684+ </div>
589685 if let Some(message) = error {
590686 alert(message: message.as_str())
591687 }
592- <div class="pull-page" data-live=(live.as_str())>
593- files_pane(lang: lang, rows: rows, selected: selected, controls: controls)
594- checks_pane(lang: lang, items: checks)
595- diff_top(lang: lang, unified: unified_href, split: split_href, ws: ws_href, split_on: split_on, ws_on: ws_on)
596- <div class="pull-diff">
597- diff_section(diff: &diff, owner: owner.as_str(), repo: name.as_str(),
598- oid: pr.head_oid.as_str(), parent: parent.as_deref(),
599- subject: g::t(lang, K::ThisPullRequest), lang: DiffLang(lang), comments: comments, opts: section_opts)
688+ <div class="work" data-live=(live.as_str()) data-viewed-panel="" data-action=(panel_action.as_str()) data-csrf=(panel_csrf.as_str())>
689+ files_rail(lang: lang, rows: rail, done_text: viewed_text.clone(), signed_in: signed_in, archived: archived)
690+ <div class="work-main">
691+ <div class="sheet">
692+ <div class="sheet-tools">
693+ if let Some((path, counts)) = current_head {
694+ <strong>(path.as_str())</strong>
695+ <span class="mono">(counts.as_str())</span>
696+ }
697+ if mark_shown {
698+ <label class="switch"><input type="checkbox" checked=(current_viewed) data-viewed-toggle="" data-path=(current_path.as_str())><span>(mark_text)</span></label>
699+ }
700+ diff_top(lang: lang, unified: unified_href, split: split_href, ws: ws_href, split_on: split_on, ws_on: ws_on)
701+ </div>
702+ diff_section(diff: &diff, owner: owner.as_str(), repo: name.as_str(),
703+ oid: pr.head_oid.as_str(), parent: parent.as_deref(),
704+ subject: g::t(lang, K::ThisPullRequest), lang: DiffLang(lang), comments: comments, opts: section_opts)
705+ </div>
706+ if can_review {
707+ review_bar(lang: lang, pr_href: href.clone(), csrf: csrf.clone(), pending: pending,
708+ viewed_text: viewed_text, open_threads: open_threads, next: next, is_author: is_author)
709+ }
600710 </div>
601- if can_review {
602- review_bar(lang: lang, pr_href: href.clone(), csrf: csrf.clone(), pending: pending)
603- }
604711 </div>
605712 )
606713 })
@@ -757,8 +864,9 @@ mod tests {
757864 let bytes = to_bytes(res.into_body(), usize::MAX).await.unwrap();
758865 let body = String::from_utf8_lossy(&bytes).into_owned();
759866 assert!(body.contains("İncelemeyi tamamla"), "turkish bar: {body}");
867+ // With nothing pending there is nothing to discard.
760868 assert!(
761- body.contains("Bekleyen yorumları sil"),
869+ !body.contains("Bekleyen yorumları sil"),
762870 "turkish bar: {body}"
763871 );
764872
@@ -883,7 +991,7 @@ mod tests {
883991 assert_eq!(status, 200, "outdated");
884992 assert!(!body.contains("Stale remark"), "outdated: {body}");
885993 assert!(
886- !body.contains("class=\"review-thread\""),
994+ !body.contains("class=\"row-open review-thread\""),
887995 "outdated: {body}"
888996 );
889997
@@ -910,7 +1018,7 @@ mod tests {
9101018 assert!(author.contains("Draft secret"), "pending author: {author}");
9111019 assert!(author.contains("Pending"), "pending author: {author}");
9121020 assert!(
913- author.contains("1 pending comment."),
1021+ author.contains("1 comment included"),
9141022 "pending author: {author}"
9151023 );
9161024
@@ -933,7 +1041,7 @@ mod tests {
9331041 assert_eq!(status, 200, "thread");
9341042 assert!(body.contains("Looks good"), "thread: {body}");
9351043 let line = body.find("id=\"L-0-new-1\"").unwrap();
936- let thread = body.find("class=\"review-thread\"").unwrap();
1044+ let thread = body.find("class=\"row-open review-thread\"").unwrap();
9371045 assert!(thread > line, "the thread sits after its line");
9381046 }
9391047
crates/forge-web/src/pages/pull_reviews.rsmodified+11 -12
@@ -483,24 +483,23 @@ async fn edit_page(
483483 let header = ctx.head(state, "pulls").await?;
484484 Ok(view! { cx =>
485485 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
486- repo_head(head: header)
487- <section class="sec">
488- <h2>(heading)</h2>
486+ repo_head(head: header, title: Some(heading.to_owned()))
487+ <div class="sheet fit">
489488 if let Some(message) = error {
490489 alert(message: message)
491490 }
492491 <form method="post" action=(action.as_str()) class="fields">
493492 <input type="hidden" name="csrf" value=(csrf.as_str())>
494- <label class="field">
495- <span>(comment_label)</span>
496- <textarea name="body" rows="10">(comment.body.as_str())</textarea>
497- </label>
498- <button type="submit" class="primary">(save_label)</button>
493+ <div class="field">
494+ <label for="review-body">(comment_label)</label>
495+ <textarea id="review-body" name="body" rows="10">(comment.body.as_str())</textarea>
496+ </div>
497+ <div class="acts">
498+ <button type="submit" class="primary">(save_label)</button>
499+ <a class="act" href=(back.as_str())>(cancel_label)</a>
500+ </div>
499501 </form>
500- <div class="acts">
501- <a class="act quiet" href=(back.as_str())>(cancel_label)</a>
502- </div>
503- </section>
502+ </div>
504503 )
505504 })
506505 }
crates/forge-web/src/pages/pull_view.rsmodified+68 -104
@@ -20,7 +20,6 @@ use topcoat::router::{page, path_param};
2020 use topcoat::view::{View, component, view};
2121
2222 use crate::auth::require_user;
23-use crate::i18n::pulls as review_strings;
2423 use crate::i18n::pulls_review::{self as g, K};
2524 use crate::i18n::{self, Lang};
2625 use crate::pages::commits::{CommitRow, now_secs};
@@ -40,7 +39,6 @@ use crate::pages::pulls_merge::{
4039 ERR_NOT_UP_TO_DATE, ERR_QUEUE_ALREADY, ERR_QUEUE_REQUIRED, ERR_REBASE_CONFLICT, ERR_UP_TO_DATE,
4140 merge_gate,
4241 };
43-use crate::pages::repo::repo_head;
4442 use crate::pages::repo_ctx::{RepoCtx, load_repo};
4543 use crate::pages::review_requests::{load_reviewers, reviewers_box};
4644 use crate::state::AppState;
@@ -120,11 +118,10 @@ pub(crate) struct Frame {
120118 pub(crate) file_count: usize,
121119 base_branch: String,
122120 head_label: String,
123- state_class: &'static str,
124121 state_text: &'static str,
122+ /// The state badge's classes: the same colours an issue's state uses.
123+ state_class: &'static str,
125124 lang: Lang,
126- /// The Files tab's review buttons: they submit the review form on that tab.
127- pub(crate) head_review: bool,
128125 /// Lines added and removed across the whole diff, shown on the Files tab.
129126 pub(crate) totals: Option<(u32, u32)>,
130127 }
@@ -162,14 +159,14 @@ pub(crate) async fn frame_in(
162159 },
163160 };
164161
165- let (state_class, state_text) = if is_merged(pr) {
166- ("issue-badge issue-badge-merged", g::t(lang, K::StateMerged))
162+ let (state_text, state_class) = if is_merged(pr) {
163+ (g::t(lang, K::StateMerged), "issue-badge issue-badge-merged")
167164 } else if matches!(pr.issue.state, IssueState::Open) && pr.draft {
168- ("issue-badge issue-badge-draft", g::t(lang, K::DraftBadge))
165+ (g::t(lang, K::DraftBadge), "issue-badge")
169166 } else if matches!(pr.issue.state, IssueState::Open) {
170- ("issue-badge issue-badge-open", g::t(lang, K::StateOpen))
167+ (g::t(lang, K::StateOpen), "issue-badge issue-badge-open")
171168 } else {
172- ("issue-badge issue-badge-closed", g::t(lang, K::StateClosed))
169+ (g::t(lang, K::StateClosed), "issue-badge issue-badge-closed")
173170 };
174171
175172 Ok(Frame {
@@ -185,21 +182,22 @@ pub(crate) async fn frame_in(
185182 file_count,
186183 base_branch: pr.base_branch.clone(),
187184 head_label,
188- state_class,
189185 state_text,
190- head_review: false,
186+ state_class,
191187 totals: None,
192188 })
193189 }
194190
191+/// The head of every pull request tab: the title with the review buttons beside it, the byline,
192+/// then the pull request's tabs. `active` names the tab that is open.
195193 #[component]
196-pub(crate) async fn pull_header(frame: Frame) -> Result<impl View> {
194+pub(crate) async fn pull_header(frame: Frame, active: String) -> Result<impl View> {
197195 let Frame {
198196 title,
199197 number,
200198 href,
201- state_class,
202199 state_text,
200+ state_class,
203201 author,
204202 author_known,
205203 opened,
@@ -208,22 +206,25 @@ pub(crate) async fn pull_header(frame: Frame) -> Result<impl View> {
208206 base_branch,
209207 head_label,
210208 lang,
211- head_review,
212209 totals,
213210 ..
214211 } = frame;
215212 let number_label = format!("#{number}");
216213 // The header is on every pull tab, so each tab follows the pull's stream.
217214 let live_url = format!("{href}/events");
215+ let commits_href = format!("{href}/commits");
216+ let files_href = format!("{href}/files");
218217 let commits_text = g::commit_count_line(lang, commit_count);
218+ let commits_label = g::commits_tab(lang, commit_count);
219+ let files_label = g::files_tab(lang, file_count);
220+ let conversation = g::t(lang, K::TabConversation);
221+ let aria = g::t(lang, K::PullPages);
219222 let wants = g::t(lang, K::ByWantsToMerge);
220223 let into = g::t(lang, K::ByInto);
221224 let from = g::t(lang, K::ByFrom);
222225 let byline_end = g::t(lang, K::BylineEnd);
223226 // Turkish puts the source branch first and the commit count before the verb.
224227 let turkish = matches!(lang, Lang::Tr);
225- let changes_label = review_strings::t(lang, review_strings::K::RequestChangesChoice).trim();
226- let approve_label = review_strings::t(lang, review_strings::K::ApproveChoice).trim();
227228 let totals_text = totals.map(|(add, del)| {
228229 format!(
229230 "{} \u{b7} +{add} \u{2212}{del}",
@@ -231,18 +232,18 @@ pub(crate) async fn pull_header(frame: Frame) -> Result<impl View> {
231232 )
232233 });
233234 Ok(view! {
234- <section class="pull-head" data-live=(live_url.as_str())>
235- <h1 class="h1">(title.as_str()) " " <span class="issue-number">(number_label.as_str())</span></h1>
236- <p class="hint">
235+ <section class="head" data-live=(live_url.as_str())>
236+ <div class="head-title">
237+ <h1>(title.as_str()) " " <span class="num">(number_label.as_str())</span></h1>
238+ </div>
239+ <p class="head-sub">
237240 <span class=(state_class)>(state_text)</span>
238241 " "
239- <strong>
240- if author_known {
241- user_link(shown: author.as_str(), login: author.as_str())
242- } else {
243- (author.as_str())
244- }
245- </strong>
242+ if author_known {
243+ user_link(shown: author.as_str(), login: author.as_str())
244+ } else {
245+ (author.as_str())
246+ }
246247 " "
247248 if turkish {
248249 (wants) <code>(head_label.as_str())</code>
@@ -256,16 +257,15 @@ pub(crate) async fn pull_header(frame: Frame) -> Result<impl View> {
256257 " "
257258 <time data-rel="true" datetime=(opened.iso.as_str()) title=(opened.absolute.as_str())>(opened.relative.as_str())</time>
258259 if let Some(text) = totals_text {
259- " "
260- <span class="pull-totals">(text.as_str())</span>
260+ " · "
261+ <span class="mono">(text.as_str())</span>
261262 }
262263 </p>
263- if head_review {
264- <div class="acts" role="group" aria-label=(review_strings::t(lang, review_strings::K::ReviewType))>
265- <button type="submit" class="act" form="review-form" name="state" value="request_changes">(changes_label)</button>
266- <button type="submit" class="act" form="review-form" name="state" value="approve">(approve_label)</button>
267- </div>
268- }
264+ <nav class="tabs" aria-label=(aria)>
265+ <a aria-current=(current_tab(&active, "conversation")) href=(href.as_str())>(conversation)</a>
266+ <a aria-current=(current_tab(&active, "commits")) href=(commits_href.as_str())>(commits_label.as_str())</a>
267+ <a aria-current=(current_tab(&active, "files")) href=(files_href.as_str())>(files_label.as_str())</a>
268+ </nav>
269269 </section>
270270 })
271271 }
@@ -275,30 +275,6 @@ fn current_tab(active: &str, tab: &str) -> Option<&'static str> {
275275 (active == tab).then_some("page")
276276 }
277277
278-/// The pull request's sub-tabs, with their labels in `lang`.
279-#[component]
280-pub(crate) async fn pull_subnav_in(
281- lang: Lang,
282- href: String,
283- active: String,
284- commits: usize,
285- files: usize,
286-) -> Result<impl View> {
287- let commits_href = format!("{href}/commits");
288- let files_href = format!("{href}/files");
289- let commits_label = g::commits_tab(lang, commits);
290- let files_label = g::files_tab(lang, files);
291- let conversation = g::t(lang, K::TabConversation);
292- let aria = g::t(lang, K::PullPages);
293- Ok(view! {
294- <nav class="tabs" aria-label=(aria)>
295- <a aria-current=(current_tab(&active, "conversation")) href=(href.as_str())>(conversation)</a>
296- <a aria-current=(current_tab(&active, "commits")) href=(commits_href.as_str())>(commits_label.as_str())</a>
297- <a aria-current=(current_tab(&active, "files")) href=(files_href.as_str())>(files_label.as_str())</a>
298- </nav>
299- })
300-}
301-
302278 // Merge box
303279
304280 /// Where the merge form posts, and whether fast-forward is offered.
@@ -349,7 +325,7 @@ async fn merge_box(
349325 flow: FlowView,
350326 lang: Lang,
351327 ) -> Result<impl View> {
352- let class = format!("sec merge-box merge-{tone}");
328+ let class = format!("sec merge-{tone}");
353329 let heading = crate::pages::passkeys::s(lang, "Merge", "Birleştirme");
354330 let required_heading = g::t(lang, K::RequiredChecksHeading);
355331 let style_rebase = g::t(lang, K::StyleRebase);
@@ -389,13 +365,11 @@ async fn merge_box(
389365 checks_summary(summary: summary, lang: StatusLang(lang))
390366 }
391367 if !required.is_empty() {
392- <div class="required-checks">
368+ <div>
393369 <p class="hint">(required_heading)</p>
394- <ul class="required-check-list">
395- for row in required.iter() {
396- <li class=(row.class)><code>(row.context.as_str())</code><span>(row.label)</span></li>
397- }
398- </ul>
370+ for row in required.iter() {
371+ <div class=(format!("line {}", row.class))><span class="name"><code>(row.context.as_str())</code></span><span class="val">(row.label)</span></div>
372+ }
399373 </div>
400374 }
401375 if let Some(text) = approvals {
@@ -405,11 +379,11 @@ async fn merge_box(
405379 <p class="hint merge-blocked">(text.as_str())</p>
406380 }
407381 if !conflicts.is_empty() {
408- <ul class="merge-files">
382+ <div>
409383 for file in conflicts.iter() {
410- <li><code>(file.as_str())</code></li>
384+ <div class="line"><span class="name"><code>(file.as_str())</code></span></div>
411385 }
412- </ul>
386+ </div>
413387 }
414388 if let Some(href) = reload {
415389 <div class="acts">
@@ -420,14 +394,16 @@ async fn merge_box(
420394 <form method="post" action=(f.action.as_str()) class="fields merge-form">
421395 <input type="hidden" name="csrf" value=(f.csrf.as_str())>
422396 <input type="hidden" name="head" value=(f.head.as_str())>
423- <fieldset class="merge-styles">
397+ <fieldset>
424398 <legend>(style_legend)</legend>
425- <label class="switch"><input type="radio" name="style" value="merge" checked=(true)><span>(style_merge)</span></label>
426- <label class="switch"><input type="radio" name="style" value="squash"><span>(style_squash)</span></label>
427- <label class="switch"><input type="radio" name="style" value="rebase"><span>(style_rebase)</span></label>
428- if f.ff {
429- <label class="switch"><input type="radio" name="style" value="ff"><span>(style_ff)</span></label>
430- }
399+ <div class="choice">
400+ <label><input type="radio" name="style" value="merge" checked=(true)><span>(style_merge)</span></label>
401+ <label><input type="radio" name="style" value="squash"><span>(style_squash)</span></label>
402+ <label><input type="radio" name="style" value="rebase"><span>(style_rebase)</span></label>
403+ if f.ff {
404+ <label><input type="radio" name="style" value="ff"><span>(style_ff)</span></label>
405+ }
406+ </div>
431407 </fieldset>
432408 <div class="field">
433409 <label for="merge-message">(message_label)</label>
@@ -502,7 +478,7 @@ async fn merged_notice(
502478 let as_sep = g::t(lang, K::MergedAsSep);
503479 let heading = g::t(lang, K::StateMerged);
504480 Ok(view! {
505- <section class="sec merge-box merge-merged">
481+ <section class="sec merge-merged">
506482 <h2>(heading)</h2>
507483 <p class="state merge-headline">
508484 (prefix) <strong>user_link(shown: who.as_str(), login: who.as_str())</strong> (middle)
@@ -542,7 +518,7 @@ async fn review_box(
542518 let dismiss_text = g::t(lang, K::DismissButton);
543519 let heading = crate::pages::passkeys::s(lang, "Reviews", "İncelemeler");
544520 Ok(view! {
545- <section class="sec review-box">
521+ <section class="sec">
546522 <h2>(heading)</h2>
547523 if let Some(text) = approved {
548524 <p class="state">(text.as_str())</p>
@@ -557,10 +533,9 @@ async fn review_box(
557533 reveal(label: dismiss_text,
558534 <form method="post" action=(row.action.as_str()) class="fields review-dismiss">
559535 <input type="hidden" name="csrf" value=(csrf.as_str())>
560- <label class="field">
561- <span>(row.label.as_str())</span>
562- <input type="text" name="reason" required=(true)>
563- </label>
536+ <div class="field">
537+ <label><span>(row.label.as_str())</span><input type="text" name="reason" required=(true)></label>
538+ </div>
564539 <button type="submit" class="primary">(dismiss_text)</button>
565540 </form>
566541 )
@@ -934,24 +909,16 @@ async fn pull_conversation(
934909 let branch_shown = !open && (branch.is_some() || branch_error.is_some());
935910
936911 let page_title = frame.page_title.clone();
937- let header = ctx.head(state, "pulls").await?;
938912 let labels_href = repo_href(&owner, &name, "labels.css", "");
939913 // The conversation follows the pull request's event stream: a change re-renders it.
940914 let live = format!("{href}/events");
941915 Ok(view! { cx =>
942916 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(), extra_stylesheet: Some(labels_href.as_str()),
943- repo_head(head: header)
944- pull_header(frame: frame.clone())
945- pull_subnav_in(lang: lang, href: href.clone(), active: "conversation".to_owned(),
946- commits: commit_count, files: file_count)
917+ pull_header(frame: frame.clone(), active: "conversation".to_owned())
947918 if let Some(message) = review_error {
948919 alert(message: message)
949920 }
950- <div data-live=(live.as_str())>
951- <div class="pull-topics">
952- item_sidebar(lang: lang, write: write_meta, base: href.clone(), csrf: csrf.clone(), viewer: viewer_login, sidebar: sidebar, notify: notify)
953- reviewers_box(lang: lang, reviewers: reviewers)
954- </div>
921+ <div class="sheet" data-live=(live.as_str())>
955922 discussion_timeline(lang: lang, discussion: discussion)
956923 if review_box_shown {
957924 review_box(approved: approved, approved_before: approved_before, changes: changes, dismiss: dismiss,
@@ -974,6 +941,9 @@ async fn pull_conversation(
974941 comment_form(lang: lang, action: comment_action, state_action: state_action,
975942 csrf: csrf.clone(), draft: draft, error: error, can_close: can_close, open: open)
976943 }
944+ // What the pull request is filed under comes after the conversation, as on an issue.
945+ reviewers_box(lang: lang, reviewers: reviewers)
946+ item_sidebar(lang: lang, write: write_meta, base: href.clone(), csrf: csrf.clone(), viewer: viewer_login, sidebar: sidebar, notify: notify)
977947 if archived {
978948 <p class="hint">(archived_text)</p>
979949 }
@@ -1070,15 +1040,12 @@ async fn pull_commits(cx: &Cx) -> Result<impl View> {
10701040 .collect();
10711041
10721042 let page_title = frame.page_title.clone();
1073- let href = frame.href.clone();
1074- let header = ctx.head(state, "pulls").await?;
10751043 Ok(view! {
10761044 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
1077- repo_head(head: header)
1078- pull_header(frame: frame.clone())
1079- pull_subnav_in(lang: lang, href: href, active: "commits".to_owned(),
1080- commits: frame.commit_count, files: frame.file_count)
1081- commit_list(rows: rows, lang: lang)
1045+ pull_header(frame: frame.clone(), active: "commits".to_owned())
1046+ <div class="sheet">
1047+ commit_list(rows: rows, lang: lang)
1048+ </div>
10821049 )
10831050 })
10841051 }
@@ -1345,10 +1312,7 @@ mod tests {
13451312 let (status, _, body) = send(&fx.router, "GET", &uri, Some("tahinli"), None).await;
13461313 assert_eq!(status, 200, "clean");
13471314 assert!(body.contains("Add feature"), "clean: {body}");
1348- assert!(
1349- body.contains("issue-badge issue-badge-open"),
1350- "clean: {body}"
1351- );
1315+ assert!(body.contains("issue-badge-open\">Open<"), "clean: {body}");
13521316 assert!(
13531317 body.contains("This branch has no conflicts with the base branch"),
13541318 "clean: {body}"
@@ -1771,7 +1735,7 @@ mod tests {
17711735 assert!(body.contains("Please rename this"), "approval: {body}");
17721736 assert!(body.contains("feat.txt:1"), "approval: {body}");
17731737 assert!(body.contains("@@ -0,0 +1 @@"), "approval: {body}");
1774- assert!(body.contains("review-badge-outdated"), "approval: {body}");
1738+ assert!(body.contains("<span class=\"badge\">Outdated</span>"), "approval: {body}");
17751739 assert!(body.contains("Approved by bob"), "approval: {body}");
17761740
17771741 fx.store
crates/forge-web/src/pages/pulls_list.rsmodified+141 -128
@@ -17,11 +17,13 @@ use crate::i18n::pulls::{self as g, K};
1717 use crate::i18n::{self, Lang};
1818 use crate::pages::issues_list::{
1919 AssigneeView, LabelView, ListQuery, MilestoneView, Selection, SortOption, list_href,
20- stamp_unix, state_tab,
20+ stamp_unix,
2121 };
2222 use crate::pages::repo::repo_head;
2323 use crate::pages::repo_ctx::load_repo;
2424 use crate::state::AppState;
25+use crate::pages::passkeys::s;
26+use crate::views::parts::{RailItem, SubPart, rail};
2527 use crate::views::{
2628 avatar_url, iso_time, now_unix, relative_time, repo_href, shell, user_link,
2729 };
@@ -36,9 +38,8 @@ const PER_PAGE: u32 = 25;
3638 struct PullRowView {
3739 /// The number, the `data-arrive` value that marks a row new after a live update.
3840 arrive: String,
39- state_class: &'static str,
41+ open: bool,
4042 state_label: &'static str,
41- badge_class: &'static str,
4243 badge_label: &'static str,
4344 number_text: String,
4445 href: String,
@@ -58,33 +59,14 @@ struct PullRowView {
5859 reviewers_text: Option<String>,
5960 }
6061
61-/// The row's icon and badge: green for open, purple for merged, red for closed without a merge.
62-fn state_parts(
63- lang: Lang,
64- open: bool,
65- merged: bool,
66-) -> (&'static str, &'static str, &'static str, &'static str) {
62+/// The row's icon label and badge: open, merged (purple) or closed without a merge.
63+fn state_parts(lang: Lang, open: bool, merged: bool) -> (&'static str, &'static str) {
6764 if open {
68- (
69- "issue-state issue-state-open",
70- g::t(lang, K::PrStateOpenLabel),
71- "issue-badge issue-badge-open",
72- g::t(lang, K::StateOpen),
73- )
65+ (g::t(lang, K::PrStateOpenLabel), g::t(lang, K::StateOpen))
7466 } else if merged {
75- (
76- "issue-state pull-state-merged",
77- g::t(lang, K::PrStateMergedLabel),
78- "issue-badge issue-badge-merged",
79- g::t(lang, K::StateMerged),
80- )
67+ (g::t(lang, K::PrStateMergedLabel), g::t(lang, K::StateMerged))
8168 } else {
82- (
83- "issue-state pull-state-closed",
84- g::t(lang, K::PrStateClosedLabel),
85- "issue-badge issue-badge-closed",
86- g::t(lang, K::StateClosed),
87- )
69+ (g::t(lang, K::PrStateClosedLabel), g::t(lang, K::StateClosed))
8870 }
8971 }
9072
@@ -119,11 +101,10 @@ fn row_view(
119101 let unix = stamp_unix(&issue.created_at);
120102 let open = matches!(issue.state, IssueState::Open);
121103 let comments = issue.comment_count.max(0);
122- let (state_class, state_label, badge_class, badge_label) = state_parts(lang, open, merged);
104+ let (state_label, badge_label) = state_parts(lang, open, merged);
123105 PullRowView {
124- state_class,
106+ open,
125107 state_label,
126- badge_class,
127108 badge_label,
128109 arrive: issue.number.to_string(),
129110 number_text: format!("#{}", issue.number),
@@ -233,7 +214,6 @@ async fn pulls_list_page(cx: &Cx) -> Result<impl View> {
233214 let all_href = sel.href(&base, "all", 1);
234215 let open_text = g::tab_open(lang, open_count);
235216 let closed_text = g::tab_closed(lang, closed_count);
236- let all_text = g::tab_all(lang, open_count + closed_count);
237217 let clear_href = list_href(&base, &[("state", sel.state)]);
238218 let has_filters = sel.has_filters();
239219
@@ -270,88 +250,122 @@ async fn pulls_list_page(cx: &Cx) -> Result<impl View> {
270250
271251 let header = ctx.head(state, "pulls").await?;
272252 let live_url = format!("/{owner}/{name}/pulls/events");
253+ let open_label = g::t(lang, K::StateOpen);
254+ let closed_label = g::t(lang, K::StateClosed);
255+ let total_count = (open_count + closed_count).to_string();
256+ let mut items = vec![
257+ RailItem {
258+ name: open_label.to_owned(),
259+ val: open_count.to_string(),
260+ href: open_href,
261+ current: open_on,
262+ },
263+ RailItem {
264+ name: closed_label.to_owned(),
265+ val: closed_count.to_string(),
266+ href: closed_href,
267+ current: closed_on,
268+ },
269+ RailItem {
270+ name: s(lang, "All", "Tümü").to_owned(),
271+ val: total_count,
272+ href: all_href,
273+ current: all_on,
274+ },
275+ ];
276+ if let Some(me) = ctx.viewer.as_ref().map(|(user, _)| user.username.as_str()) {
277+ items.push(RailItem {
278+ name: s(lang, "Assigned to you", "Size atanan").to_owned(),
279+ val: String::new(),
280+ href: list_href(&base, &[("state", "open"), ("assignee", me)]),
281+ current: sel.assignee == me,
282+ });
283+ items.push(RailItem {
284+ name: s(lang, "Created by you", "Sizin açtıklarınız").to_owned(),
285+ val: String::new(),
286+ href: list_href(&base, &[("state", "open"), ("author", me)]),
287+ current: sel.author == me,
288+ });
289+ items.push(RailItem {
290+ name: s(lang, "Review requests", "İnceleme istekleri").to_owned(),
291+ val: String::new(),
292+ href: list_href(&base, &[("state", "open"), ("review_requested", "@me")]),
293+ current: sel.review_requested == me,
294+ });
295+ }
296+ let shown_name = items
297+ .iter()
298+ .find(|item| item.current)
299+ .map_or_else(String::new, |item| item.name.clone());
273300 Ok(view! {
274301 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), extra_stylesheet: Some(labels_href.as_str()),
275- repo_head(head: header)
276- <div data-live=(live_url.as_str())>
277- <h1 class="sr-only">(title.as_str())</h1>
278- <nav class="tabs" aria-label=(g::t(lang, K::ListStateNavLabel))>
279- state_tab(href: open_href.as_str(), text: open_text.as_str(), current: open_on)
280- state_tab(href: closed_href.as_str(), text: closed_text.as_str(), current: closed_on)
281- state_tab(href: all_href.as_str(), text: all_text.as_str(), current: all_on)
282- </nav>
283- <form method="get" action=(base.as_str())>
284- <input type="hidden" name="state" value=(sel.state)>
285- <input type="hidden" name="label" value=(sel.label.as_str())>
286- <input type="hidden" name="milestone" value=(sel.milestone.as_str())>
287- <input type="hidden" name="author" value=(sel.author.as_str())>
288- <input type="hidden" name="assignee" value=(sel.assignee.as_str())>
289- <div class="plain-search">
290- <input type="search" name="q" value=(search_value.as_str()) data-live-search="" autocomplete="off" placeholder=(g::t(lang, K::SearchTitles)) aria-label=(g::t(lang, K::SearchTitles)) maxlength="256">
291- <button type="submit" class="sr-only">(g::t(lang, K::Search))</button>
292- </div>
293- <div class="sub">
294- <select name="draft" aria-label=(g::t(lang, K::DraftFilterLabel)) data-autosubmit=(true)>
295- <option value="" selected=(draft_sel.is_empty())>(g::t(lang, K::DraftAny))</option>
296- <option value="true" selected=(draft_sel == "true")>(g::t(lang, K::DraftOnly))</option>
297- <option value="false" selected=(draft_sel == "false")>(g::t(lang, K::DraftReadyOnly))</option>
298- </select>
299- <select name="sort" aria-label=(g::t(lang, K::SortLabel)) data-autosubmit=(true)>
300- for option in sort_options.iter() {
301- <option value=(option.value) selected=(option.selected)>(option.label)</option>
302- }
303- </select>
304- <a href=(queue_href.as_str())>(mq::t(lang, mq::K::MergeQueueTitle))</a>
305- if can_create {
306- <a class="act" href=(compare_href.as_str()) data-palette-action="go">(g::t(lang, K::NewPullRequest))</a>
307- }
308- </div>
309- </form>
310- if has_filters {
311- <p class="hint">(g::t(lang, K::FiltersApplied)) " " <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a></p>
312- }
313- if rows.is_empty() {
314- <p class="state">(empty_text)</p>
315- if has_filters {
316- <div class="acts">
317- <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a>
318- </div>
319- } else if no_pulls_yet && can_create {
320- <div class="acts">
321- <a class="act" href=(compare_href.as_str()) data-palette-action="go">(g::t(lang, K::NewPullRequest))</a>
322- </div>
302+ repo_head(head: header, sub: vec![SubPart::text(open_text), SubPart::text(closed_text)],
303+ if can_create {
304+ <a class="button primary" href=(compare_href.as_str()) data-palette-action="go">(g::t(lang, K::NewPullRequest))</a>
323305 }
324- } else {
325- <div>
326- for row in rows.iter() {
327- <div class="line issue-row" data-kb-row="" data-arrive=(row.arrive.as_str())>
328- <span class=(row.state_class) role="img" aria-label=(row.state_label)></span>
329- <div class="issue-main">
330- <div class="issue-title-line">
331- <a class="issue-title" href=(row.href.as_str())>(row.title.as_str())</a>
332- <span class=(row.badge_class)>(row.badge_label)</span>
333- if row.draft {
334- <span class="issue-badge issue-badge-draft">(draft_label)</span>
335- }
336- for chip in row.labels.iter() {
337- <a class=(chip.class.as_str()) href=(chip.href.as_str())>(chip.name.as_str())</a>
306+ )
307+ <div class="work" data-live=(live_url.as_str())>
308+ rail(label: title.as_str(), items: items)
309+ <div class="sheet">
310+ <form method="get" action=(base.as_str())>
311+ <input type="hidden" name="state" value=(sel.state)>
312+ <input type="hidden" name="label" value=(sel.label.as_str())>
313+ <input type="hidden" name="milestone" value=(sel.milestone.as_str())>
314+ <input type="hidden" name="author" value=(sel.author.as_str())>
315+ <input type="hidden" name="assignee" value=(sel.assignee.as_str())>
316+ <div class="sheet-tools">
317+ <strong>(shown_name.as_str())</strong>
318+ <div class="plain-search">
319+ <input type="search" name="q" value=(search_value.as_str()) data-live-search="" autocomplete="off" placeholder=(g::t(lang, K::SearchTitles)) aria-label=(g::t(lang, K::SearchTitles)) maxlength="256">
320+ <button type="submit" class="sr-only">(g::t(lang, K::Search))</button>
321+ </div>
322+ <select name="draft" aria-label=(g::t(lang, K::DraftFilterLabel)) data-autosubmit=(true)>
323+ <option value="" selected=(draft_sel.is_empty())>(g::t(lang, K::DraftAny))</option>
324+ <option value="true" selected=(draft_sel == "true")>(g::t(lang, K::DraftOnly))</option>
325+ <option value="false" selected=(draft_sel == "false")>(g::t(lang, K::DraftReadyOnly))</option>
326+ </select>
327+ <select name="sort" aria-label=(g::t(lang, K::SortLabel)) data-autosubmit=(true)>
328+ for option in sort_options.iter() {
329+ <option value=(option.value) selected=(option.selected)>(option.label)</option>
330+ }
331+ </select>
332+ <a class="act" href=(queue_href.as_str())>(mq::t(lang, mq::K::MergeQueueTitle))</a>
333+ </div>
334+ </form>
335+ if has_filters {
336+ <p class="hint">(g::t(lang, K::FiltersApplied)) " " <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a></p>
337+ }
338+ if rows.is_empty() {
339+ <p class="state">(empty_text)</p>
340+ if has_filters {
341+ <div class="acts">
342+ <a class="act" href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a>
343+ </div>
344+ } else if no_pulls_yet && can_create {
345+ <div class="acts">
346+ <a class="act" href=(compare_href.as_str()) data-palette-action="go">(g::t(lang, K::NewPullRequest))</a>
347+ </div>
348+ }
349+ } else {
350+ for row in rows.iter() {
351+ <div class="line issue-row" data-kb-row="" data-arrive=(row.arrive.as_str())>
352+ <span class=(if row.open { "tick" } else { "tick done" }) role="img" aria-label=(row.state_label)></span>
353+ <a class="name" href=(row.href.as_str())>(row.title.as_str())</a>
354+ for chip in row.labels.iter() {
355+ <a class=(chip.class.as_str()) href=(chip.href.as_str())>(chip.name.as_str())</a>
356+ }
357+ <span class="val">
358+ (row.number_text.as_str()) " · "
359+ if !row.open {
360+ (row.badge_label) " · "
338361 }
339- </div>
340- <div class="issue-meta muted small">
341- <span>(row.number_text.as_str())</span>
342- if lang == Lang::Tr {
343- <span>(g::t(lang, K::MetaBeforeTime))</span>
344- <span>user_link(shown: row.author.as_str(), login: row.author.as_str())</span>
345- <span>(g::t(lang, K::MetaAfterTime))</span>
346- <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
347- } else {
348- <span>(g::t(lang, K::MetaBeforeTime))</span>
349- <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
350- <span>(g::t(lang, K::MetaAfterTime))</span>
351- <span>user_link(shown: row.author.as_str(), login: row.author.as_str())</span>
362+ if row.draft {
363+ (draft_label) " · "
352364 }
365+ user_link(shown: row.author.as_str(), login: row.author.as_str()) " · "
366+ <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
353367 if let Some(milestone) = row.milestone.clone() {
354- <a href=(milestone.href.as_str())>(milestone.title.as_str())</a>
368+ " · " <a href=(milestone.href.as_str())>(milestone.title.as_str())</a>
355369 }
356370 if let Some(tasks) = row.tasks_text.clone() {
357371 <span class="task-progress">(tasks.as_str())</span>
@@ -363,25 +377,24 @@ async fn pulls_list_page(cx: &Cx) -> Result<impl View> {
363377 <img class="avatar avatar-sm" src=(assignee.avatar.as_str()) alt=(assignee.name.as_str()) title=(assignee.name.as_str()) width="20" height="20">
364378 }
365379 if row.has_comments {
366- <a class="small muted" href=(row.href.as_str())>(row.comments_text.as_str())</a>
380+ " · " <a href=(row.href.as_str())>(row.comments_text.as_str())</a>
367381 }
368- </div>
382+ </span>
369383 </div>
370- </div>
371- }
372- </div>
373- }
374- if has_newer || has_older {
375- <nav class="sub">
376- if has_newer {
377- <a href=(newer_href.as_str())>(g::t(lang, K::Newer))</a>
384+ }
378385 }
379- <span>(page_label.as_str())</span>
380- if has_older {
381- <a href=(older_href.as_str())>(g::t(lang, K::Older))</a>
386+ if has_newer || has_older {
387+ <nav class="sub">
388+ if has_newer {
389+ <a href=(newer_href.as_str())>(g::t(lang, K::Newer))</a>
390+ }
391+ <span>(page_label.as_str())</span>
392+ if has_older {
393+ <a href=(older_href.as_str())>(g::t(lang, K::Older))</a>
394+ }
395+ </nav>
382396 }
383- </nav>
384- }
397+ </div>
385398 </div>
386399 )
387400 })
@@ -398,7 +411,7 @@ mod tests {
398411 }
399412
400413 fn rows(html: &str) -> usize {
401- html.matches("class=\"line issue-row\"").count()
414+ html.matches("class=\"line issue-row\" data-kb-row=\"\"").count()
402415 }
403416
404417 const HEAD_OID: &str = "1111111111111111111111111111111111111111";
@@ -448,7 +461,7 @@ mod tests {
448461 html.contains(&format!("href=\"/{OWNER}/{REPO}/pulls/2\"")),
449462 "{html}"
450463 );
451- assert!(html.contains("issue-badge-open\">Open<"));
464+ assert!(!html.contains("badge\">Open<"), "open rows carry no badge");
452465 assert!(html.contains(&format!("href=\"/{OWNER}/{REPO}/compare\"")));
453466 assert!(html.contains("New pull request"), "case signed in");
454467 let anon = send(&fx.router, "GET", &base(), false, None, &[])
@@ -547,16 +560,16 @@ mod tests {
547560 assert!(closed.contains("merged pull"), "{closed}");
548561 assert!(closed.contains("dropped pull"), "{closed}");
549562 assert!(!closed.contains("still open pull"), "{closed}");
550- assert!(closed.contains("issue-badge-merged\">Merged<"), "{closed}");
551- assert!(closed.contains("issue-badge-closed\">Closed<"), "{closed}");
552- assert_eq!(closed.matches("issue-badge-merged\">Merged<").count(), 1);
563+ assert!(closed.contains("· Merged ·"), "{closed}");
564+ assert!(closed.contains("· Closed ·"), "{closed}");
565+ assert_eq!(closed.matches("· Merged ·").count(), 1);
553566
554567 let open = send(&fx.router, "GET", &base(), true, None, &[])
555568 .await
556569 .text();
557570 assert!(open.contains("still open pull"));
558571 assert!(!open.contains("merged pull"));
559- assert!(!open.contains("issue-badge-merged"));
572+ assert!(!open.contains("badge\">Merged<"));
560573 }
561574
562575 #[tokio::test]
crates/forge-web/src/pages/refs.rsmodified+4 -4
@@ -111,26 +111,26 @@ async fn refs_table(rows: Vec<RefRow>, lang: Lang) -> Result<impl View> {
111111 if empty {
112112 <p class="state">(g::t(lang, K::NothingHere))</p>
113113 } else {
114- <div>
114+ <div class="sheet">
115115 for row in rows.into_iter() {
116116 if let Some(last) = row.last {
117117 <details class="row-open" data-kb-row="">
118118 <summary class="line">
119119 <a class="name" href=(row.href)>(row.name)</a>
120120 if row.is_default {
121- <span class="badge public">(g::t(lang, K::DefaultBadge))</span>
121+ <span class="hint">(g::t(lang, K::DefaultBadge))</span>
122122 }
123123 <span class="val"><time datetime=(last.iso.clone()) title=(last.absolute)>(last.age)</time></span>
124124 </summary>
125125 <div class="opened">
126- <p class="state"><a href=(last.href)>commit_line(subject: last.summary.clone())</a></p>
126+ <p><a href=(last.href)>commit_line(subject: last.summary.clone())</a></p>
127127 </div>
128128 </details>
129129 } else {
130130 <div class="line" data-kb-row="">
131131 <a class="name" href=(row.href)>(row.name)</a>
132132 if row.is_default {
133- <span class="badge public">(g::t(lang, K::DefaultBadge))</span>
133+ <span class="hint">(g::t(lang, K::DefaultBadge))</span>
134134 }
135135 </div>
136136 }
crates/forge-web/src/pages/register.rsmodified+18 -14
@@ -25,6 +25,7 @@ use crate::i18n::{self, Key, Lang, password_too_long, password_too_short, t};
2525 use crate::mail::account;
2626 use crate::state::AppState;
2727 use crate::throttle;
28+use crate::views::parts::{SubPart, head};
2829 use crate::views::{alert, shell, user_facing_message};
2930
3031 const MIN_PASSWORD_CHARS: usize = 12;
@@ -127,9 +128,14 @@ async fn register_form(
127128 precsrf: &str,
128129 error: Option<String>,
129130 ) -> Result<impl View> {
131+ let sub = match (gate, invited) {
132+ (Gate::Form, true) => vec![SubPart::text(t(lang, Key::RegisterInviteSub))],
133+ (Gate::Form, false) => vec![SubPart::text(t(lang, Key::RegisterSub))],
134+ _ => Vec::new(),
135+ };
130136 Ok(view! {
131- <section>
132- <h1>(t(lang, Key::RegisterTitle))</h1>
137+ head(title: t(lang, Key::RegisterTitle), sub: sub)
138+ <div class="sheet fit">
133139 if gate == Gate::NeedsInvite {
134140 <p class="state">(t(lang, Key::RegisterNeedsInvite))</p>
135141 }
@@ -137,12 +143,6 @@ async fn register_form(
137143 <p class="state">(t(lang, Key::RegisterInvalidInvite))</p>
138144 }
139145 if gate == Gate::Form {
140- if invited {
141- <p class="hint">(t(lang, Key::RegisterInviteSub))</p>
142- }
143- if !invited {
144- <p class="hint">(t(lang, Key::RegisterSub))</p>
145- }
146146 <form data-hard="true" method="post" action="/register" class="fields">
147147 if let Some(message) = error {
148148 alert(message: message.as_str())
@@ -177,7 +177,7 @@ async fn register_form(
177177 <button type="submit" class="primary">(t(lang, Key::RegisterSubmit))</button>
178178 </form>
179179 }
180- </section>
180+ </div>
181181 })
182182 }
183183
@@ -352,12 +352,16 @@ async fn verify_body(
352352 precsrf: &str,
353353 mode: VerifyMode,
354354 ) -> Result<impl View> {
355+ let sub = if mode == VerifyMode::Confirm {
356+ vec![SubPart::text(t(lang, Key::VerifyConfirmSub))]
357+ } else {
358+ Vec::new()
359+ };
355360 Ok(view! {
356- <section>
357- <h1>(t(lang, Key::VerifyTitle))</h1>
361+ head(title: t(lang, Key::VerifyTitle), sub: sub)
362+ <div class="sheet fit">
358363 if mode == VerifyMode::Confirm {
359- <p class="hint">(t(lang, Key::VerifyConfirmSub))</p>
360- <form data-hard="true" method="post" action=(format!("/verify/{token}")) class="fields">
364+ <form data-hard="true" method="post" action=(format!("/verify/{token}")) class="sec">
361365 <input type="hidden" name="precsrf" value=(precsrf)>
362366 <button type="submit" class="primary">(t(lang, Key::VerifyConfirm))</button>
363367 </form>
@@ -368,7 +372,7 @@ async fn verify_body(
368372 if mode == VerifyMode::Invalid {
369373 <p class="state">(t(lang, Key::VerifyInvalid))</p>
370374 }
371- </section>
375+ </div>
372376 })
373377 }
374378
crates/forge-web/src/pages/releases.rsmodified+143 -156
@@ -203,10 +203,8 @@ pub struct ReleaseCard {
203203
204204 /// The "latest release" summary shown on the repo home page.
205205 pub struct LatestRelease {
206- pub title: String,
207206 pub tag: String,
208207 pub href: String,
209- pub(crate) when: When,
210208 pub assets: Vec<AssetLink>,
211209 }
212210
@@ -249,15 +247,9 @@ pub async fn latest_release_for_home(
249247 };
250248 let title = title_of(ctx);
251249 let assets = state.store.list_release_assets(&release.id).await?;
252- let when = release
253- .published_at
254- .as_deref()
255- .unwrap_or(&release.created_at);
256250 Ok(Some(LatestRelease {
257- title: release.title.clone(),
258251 tag: release.tag.clone(),
259252 href: tag_href(&title, &release.tag),
260- when: When::new(ctx.lang, when, ctx.viewer_tz(), now_unix()),
261253 assets: assets
262254 .iter()
263255 .map(|asset| asset_link(&title, &release.tag, asset))
@@ -370,22 +362,20 @@ async fn release_form(
370362 }
371363 <input type="hidden" name="csrf" value=(csrf.as_str())>
372364 if is_new {
373- // The tag and the target branch are short, so they share a row.
374- <div class="field-pair">
375- <div class="field">
376- <label for="release-tag">(g::t(lang, K::Tag))</label>
377- <input id="release-tag" type="text" name="tag" value=(draft.tag.as_str()) required="required" maxlength="100" autocomplete="off" spellcheck="false">
378- </div>
379- <div class="field">
380- <label for="release-target">(g::t(lang, K::TargetBranch))</label>
381- <select id="release-target" name="target">
382- for branch in branches.iter() {
383- <option value=(branch.as_str()) selected=(branch.as_str() == draft.target.as_str())>(branch.as_str())</option>
384- }
385- </select>
386- </div>
365+ <div class="field">
366+ <label for="release-tag">(g::t(lang, K::Tag))</label>
367+ <input id="release-tag" type="text" name="tag" value=(draft.tag.as_str()) required="required" maxlength="100" autocomplete="off" spellcheck="false">
368+ <p class="hint">(tag_hint)</p>
369+ </div>
370+ <div class="field">
371+ <label for="release-target">(g::t(lang, K::TargetBranch))</label>
372+ <select id="release-target" name="target">
373+ for branch in branches.iter() {
374+ <option value=(branch.as_str()) selected=(branch.as_str() == draft.target.as_str())>(branch.as_str())</option>
375+ }
376+ </select>
377+ <p class="hint">(crate::pages::passkeys::s(lang, "Used only when the tag is created.", "Yalnızca etiket oluşturulurken kullanılır."))</p>
387378 </div>
388- <p class="hint">(tag_hint)</p>
389379 } else {
390380 <div class="field">
391381 <label for="release-tag">(g::t(lang, K::Tag))</label>
@@ -494,7 +484,11 @@ async fn list_body(
494484 ) -> Result<impl View> {
495485 let (links, prev, next) = nav;
496486 Ok(view! {
497- repo_head(head: head)
487+ repo_head(head: head,
488+ if let Some(href) = &new_href {
489+ <a class="button primary" href=(href.as_str())>(g::t(lang, K::NewRelease))</a>
490+ }
491+ )
498492 if let Some((text, is_error)) = notice {
499493 if is_error {
500494 alert(message: text)
@@ -502,56 +496,48 @@ async fn list_body(
502496 <p class="state" role="status">(text)</p>
503497 }
504498 }
505- <div data-live=(live.as_str())>
506- <section class="sec">
507- <h2>(g::t(lang, K::Releases))</h2>
508- if let Some(href) = &new_href {
509- <div class="acts">
510- <a class="act" href=(href.as_str())>(g::t(lang, K::NewRelease))</a>
511- </div>
499+ <div class="sheet" data-live=(live.as_str())>
500+ if cards.is_empty() {
501+ empty_state(title: g::t(lang, K::NoReleasesYet))
512502 }
513- </section>
514- if cards.is_empty() {
515- empty_state(title: g::t(lang, K::NoReleasesYet))
516- }
517- for card in cards.iter() {
518- <details class="row-open" data-kb-row="" title=(card.body.as_str())>
519- <summary class="line">
520- <span class="name">
521- (card.title.as_str())
522- if card.latest {
523- " " <span class="badge latest">(g::t(lang, K::Latest))</span>
524- }
525- if card.prerelease {
526- " " <span class="badge">(g::t(lang, K::PreRelease))</span>
503+ for card in cards.iter() {
504+ <details class="row-open" data-kb-row="" title=(card.body.as_str())>
505+ <summary class="line">
506+ <span class="name">
507+ (card.title.as_str())
508+ if card.latest {
509+ " " <span class="hint">(g::t(lang, K::Latest))</span>
510+ }
511+ if card.prerelease {
512+ " " <span class="hint">(g::t(lang, K::PreRelease))</span>
513+ }
514+ if card.draft {
515+ " " <span class="hint">(g::t(lang, K::Draft))</span>
516+ }
517+ </span>
518+ <span class="val">
519+ <code>(card.tag.as_str())</code> " · " <time data-rel="true" datetime=(card.when.iso.as_str()) title=(card.when.absolute.as_str())>(card.when.relative.as_str())</time>
520+ </span>
521+ </summary>
522+ <div class="opened">
523+ if !card.author.is_empty() {
524+ <p class="hint">user_link(shown: card.author.as_str(), login: card.author.as_str())</p>
527525 }
528- if card.draft {
529- " " <span class="badge draft">(g::t(lang, K::Draft))</span>
526+ if !card.assets.is_empty() {
527+ <div class="sub">
528+ for asset in card.assets.iter() {
529+ <a href=(asset.href.as_str())>(asset.name.as_str()) " (" (asset.size.as_str()) ", " (g::download_count(lang, asset.downloads)) ")"</a>
530+ }
531+ </div>
530532 }
531- </span>
532- <span class="val">
533- <code>(card.tag.as_str())</code> " · " <time data-rel="true" datetime=(card.when.iso.as_str()) title=(card.when.absolute.as_str())>(card.when.relative.as_str())</time>
534- </span>
535- </summary>
536- <div class="opened">
537- if !card.author.is_empty() {
538- <p class="hint">user_link(shown: card.author.as_str(), login: card.author.as_str())</p>
539- }
540- if !card.assets.is_empty() {
541- <div class="sub">
542- for asset in card.assets.iter() {
543- <a href=(asset.href.as_str())>(asset.name.as_str()) " (" (asset.size.as_str()) ", " (g::download_count(lang, asset.downloads)) ")"</a>
544- }
533+ <div class="acts">
534+ <a class="act" href=(card.href.as_str())>(card.tag.as_str())</a>
535+ <a class="act" href=(card.edit_href.as_str())>(g::t(lang, K::Edit))</a>
545536 </div>
546- }
547- <div class="acts">
548- <a class="act" href=(card.href.as_str())>(card.tag.as_str())</a>
549- <a class="act" href=(card.edit_href.as_str())>(g::t(lang, K::Edit))</a>
550537 </div>
551- </div>
552- </details>
553- }
554- pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
538+ </details>
539+ }
540+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
555541 </div>
556542 })
557543 }
@@ -636,10 +622,12 @@ async fn new_form_body(
636622 ) -> Result<impl View> {
637623 Ok(view! {
638624 repo_head(head: head)
639- <section class="sec">
640- <h2>(g::t(lang, K::NewRelease))</h2>
641- release_form(action: action, csrf: csrf, lang: lang, is_new: true, move_target: true, draft: draft, branches: branches, submit: g::t(lang, K::SaveRelease))
642- </section>
625+ <div class="sheet fit">
626+ <section class="sec">
627+ <h2>(g::t(lang, K::NewRelease))</h2>
628+ release_form(action: action, csrf: csrf, lang: lang, is_new: true, move_target: true, draft: draft, branches: branches, submit: g::t(lang, K::SaveRelease))
629+ </section>
630+ </div>
643631 })
644632 }
645633
@@ -806,7 +794,11 @@ async fn release_tag_page(cx: &Cx) -> Result<impl View> {
806794 };
807795 Ok(view! {
808796 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
809- repo_head(head: head)
797+ repo_head(head: head, title: Some(card.title.clone()),
798+ if writer {
799+ <a class="act" href=(edit_href.as_str())>(g::t(lang, K::Edit))</a>
800+ }
801+ )
810802 if let Some((text, is_error)) = notice {
811803 if is_error {
812804 alert(message: text)
@@ -814,68 +806,62 @@ async fn release_tag_page(cx: &Cx) -> Result<impl View> {
814806 <p class="state" role="status">(text)</p>
815807 }
816808 }
817- <div data-live=(live.as_str())>
818- <nav class="sub">
819- <a href=(all_href.as_str())>(g::t(lang, K::AllReleases))</a>
820- </nav>
821- <h1 class="h1">
822- (card.title.as_str())
823- if card.prerelease {
824- " " <span class="badge">(g::t(lang, K::PreRelease))</span>
825- }
826- if card.draft {
827- " " <span class="badge draft">(g::t(lang, K::Draft))</span>
828- }
829- </h1>
830- <p class="hint">
831- <code>(card.tag.as_str())</code>
832- " \u{b7} " <time data-rel="true" datetime=(card.when.iso.as_str()) title=(card.when.absolute.as_str())>(card.when.relative.as_str())</time>
833- if !card.author.is_empty() {
834- " \u{b7} " user_link(shown: card.author.as_str(), login: card.author.as_str())
835- }
836- </p>
837- if !body_html.is_empty() {
809+ <div class="sheet" data-live=(live.as_str())>
810+ <div class="sheet-tools">
811+ <strong>(card.tag.as_str())</strong>
812+ if card.prerelease {
813+ <span class="hint">(g::t(lang, K::PreRelease))</span>
814+ }
815+ if card.draft {
816+ <span class="hint">(g::t(lang, K::Draft))</span>
817+ }
818+ <a class="act" href=(all_href.as_str())>(g::t(lang, K::AllReleases))</a>
819+ </div>
838820 <section class="sec">
839- <div class="markdown-body release-body">(Unescaped::new_unchecked(body_html))</div>
821+ <p class="hint">
822+ <time data-rel="true" datetime=(card.when.iso.as_str()) title=(card.when.absolute.as_str())>(card.when.relative.as_str())</time>
823+ if !card.author.is_empty() {
824+ " \u{b7} " user_link(shown: card.author.as_str(), login: card.author.as_str())
825+ }
826+ </p>
827+ if !body_html.is_empty() {
828+ <div class="markdown-body release-body">(Unescaped::new_unchecked(body_html))</div>
829+ }
840830 </section>
841- }
842- <section class="sec">
843- <h2>(g::t(lang, K::Assets))</h2>
844- if card.assets.is_empty() {
845- <p class="state">(g::t(lang, K::NoAssets))</p>
846- } else {
847- for asset in card.assets.iter() {
848- <details class="row-open" data-kb-row="">
849- <summary class="line">
850- <span class="name">(asset.name.as_str())</span>
851- <span class="val">(asset.size.as_str()) " · " (g::download_count(lang, asset.downloads))</span>
852- </summary>
853- <div class="opened">
854- <code class="hint">(asset.sha256.as_str())</code>
855- <div class="acts">
856- <a class="act" href=(asset.href.as_str())>(g::t(lang, K::Download))</a>
831+ <section class="sec">
832+ <h2>(g::t(lang, K::Assets))</h2>
833+ if card.assets.is_empty() {
834+ <p class="state">(g::t(lang, K::NoAssets))</p>
835+ } else {
836+ for asset in card.assets.iter() {
837+ <details class="row-open" data-kb-row="">
838+ <summary class="line">
839+ <span class="name">(asset.name.as_str())</span>
840+ <span class="val">(asset.size.as_str()) " · " (g::download_count(lang, asset.downloads))</span>
841+ </summary>
842+ <div class="opened">
843+ <code class="hint">(asset.sha256.as_str())</code>
844+ <div class="acts">
845+ <a class="act" href=(asset.href.as_str())>(g::t(lang, K::Download))</a>
846+ </div>
857847 </div>
858- </div>
859- </details>
848+ </details>
849+ }
860850 }
861- }
862- </section>
863- <section class="sec">
864- <h2>(g::t(lang, K::SourceCode))</h2>
865- <div class="acts">
866- <a class="act" href=(archive_tar.as_str())>"tar.gz"</a>
867- <a class="act" href=(archive_zip.as_str())>"zip"</a>
868- </div>
869- </section>
870- if writer {
851+ </section>
871852 <section class="sec">
853+ <h2>(g::t(lang, K::SourceCode))</h2>
872854 <div class="acts">
873- <a class="act" href=(edit_href.as_str())>(g::t(lang, K::Edit))</a>
874- confirm_act(lang: lang, label: g::t(lang, K::DeleteRelease), action: delete_href.as_str(), csrf: csrf.as_str(),
875- fields: vec![("confirm".to_owned(), "on".to_owned())], note: Some(g::t(lang, K::DeleteReleaseHelp).to_owned()))
855+ <a class="act" href=(archive_tar.as_str())>"tar.gz"</a>
856+ <a class="act" href=(archive_zip.as_str())>"zip"</a>
876857 </div>
877858 </section>
878- }
859+ if writer {
860+ <section class="sec">
861+ confirm_act(lang: lang, label: g::t(lang, K::DeleteRelease), action: delete_href.as_str(), csrf: csrf.as_str(),
862+ fields: vec![("confirm".to_owned(), "on".to_owned())], note: Some(g::t(lang, K::DeleteReleaseHelp).to_owned()))
863+ </section>
864+ }
879865 </div>
880866 )
881867 })
@@ -902,7 +888,9 @@ async fn edit_body(
902888 delete_href: String,
903889 ) -> Result<impl View> {
904890 Ok(view! {
905- repo_head(head: head)
891+ repo_head(head: head,
892+ <a class="act" href=(view_tag.as_str())>(g::t(lang, K::BackToRelease))</a>
893+ )
906894 if let Some((text, is_error)) = notice {
907895 if is_error {
908896 alert(message: text)
@@ -910,34 +898,33 @@ async fn edit_body(
910898 <p class="state" role="status">(text)</p>
911899 }
912900 }
913- <nav class="sub">
914- <a href=(view_tag.as_str())>(g::t(lang, K::BackToRelease))</a>
915- </nav>
916- <section class="sec">
917- <h2>(g::t(lang, K::EditRelease))</h2>
918- release_form(action: action, csrf: csrf.clone(), lang: lang, is_new: false, move_target: move_target, draft: draft, branches: branches, submit: g::t(lang, K::SaveRelease))
919- </section>
920- <section class="sec">
921- <h2>(g::t(lang, K::Assets))</h2>
922- <p class="hint">(upload_hint.as_str())</p>
923- asset_rows(assets: assets, delete_actions: delete_actions, upload_action: upload_action.clone(), csrf: csrf.clone(), lang: lang)
924- <form method="post" action=(upload_action.as_str()) enctype="multipart/form-data" class="fields">
925- <input type="hidden" name="csrf" value=(csrf.as_str())>
926- <div class="field">
927- <label for="upload-file">(g::t(lang, K::File))</label>
928- <input id="upload-file" type="file" name="file" required="required">
901+ <div class="sheet">
902+ <section class="sec">
903+ <h2>(g::t(lang, K::EditRelease))</h2>
904+ release_form(action: action, csrf: csrf.clone(), lang: lang, is_new: false, move_target: move_target, draft: draft, branches: branches, submit: g::t(lang, K::SaveRelease))
905+ </section>
906+ <section class="sec">
907+ <h2>(g::t(lang, K::Assets))</h2>
908+ <p class="hint">(upload_hint.as_str())</p>
909+ asset_rows(assets: assets, delete_actions: delete_actions, upload_action: upload_action.clone(), csrf: csrf.clone(), lang: lang)
910+ <form method="post" action=(upload_action.as_str()) enctype="multipart/form-data" class="fields">
911+ <input type="hidden" name="csrf" value=(csrf.as_str())>
912+ <div class="field">
913+ <label for="upload-file">(g::t(lang, K::File))</label>
914+ <input id="upload-file" type="file" name="file" required="required">
915+ </div>
916+ <button type="submit" class="primary">(g::t(lang, K::UploadAsset))</button>
917+ </form>
918+ </section>
919+ <section class="sec">
920+ <h2>(g::t(lang, K::DeleteRelease))</h2>
921+ <p class="hint">(g::t(lang, K::DeleteReleaseHelp))</p>
922+ <div class="acts">
923+ confirm_act(lang: lang, label: g::t(lang, K::DeleteRelease), action: delete_href.as_str(), csrf: csrf.as_str(),
924+ fields: vec![("confirm".to_owned(), "on".to_owned())])
929925 </div>
930- <button type="submit" class="primary">(g::t(lang, K::UploadAsset))</button>
931- </form>
932- </section>
933- <section class="sec">
934- <h2>(g::t(lang, K::DeleteRelease))</h2>
935- <p class="hint">(g::t(lang, K::DeleteReleaseHelp))</p>
936- <div class="acts">
937- confirm_act(lang: lang, label: g::t(lang, K::DeleteRelease), action: delete_href.as_str(), csrf: csrf.as_str(),
938- fields: vec![("confirm".to_owned(), "on".to_owned())])
939- </div>
940- </section>
926+ </section>
927+ </div>
941928 })
942929 }
943930
crates/forge-web/src/pages/releases_tests.rsmodified+2 -2
@@ -384,12 +384,12 @@ async fn drafts_and_permissions_share_one_repo() {
384384 assert!(fx.store.release(&rel.id).await.expect("read").is_some());
385385 }
386386
387- // The repo home shows the latest release card and links to the releases tab.
387+ // The repo home's head names the latest release and links to it and to the releases tab.
388388 {
389389 fx.release("v0.9-beta", false).await;
390390 let home = send(&fx.app, "GET", "/tahinli/proj", None, None, Vec::new()).await;
391391 assert_eq!(home.status, 200);
392- assert!(home.text().contains("Latest release"));
392+ assert!(home.text().contains("/tahinli/proj/releases/tag/v0.9-beta"));
393393 assert!(
394394 home.text().contains("/tahinli/proj/releases"),
395395 "the tabs link to releases"
crates/forge-web/src/pages/repo.rsmodified+125 -174
@@ -1,6 +1,5 @@
1-//! Page: repository home at `/{owner}/{repo}`. Shows the default branch's root tree, a Clone
2-//! popover and the README, with a branch aside. An empty repo shows the clone popover and push
3-//! instructions instead.
1+//! Page: repository home at `/{owner}/{repo}`. Shows the default branch's root folder in the rail
2+//! and the README in the sheet. An empty repo shows push instructions instead.
43
54 use std::collections::{HashMap, HashSet};
65 use std::path::PathBuf;
@@ -16,7 +15,7 @@ use topcoat::Result;
1615 use topcoat::context::{Cx, app_context};
1716 use topcoat::router::error::not_found;
1817 use topcoat::router::{page, path_param, route};
19-use topcoat::view::{View, component, view};
18+use topcoat::view::{Child, View, ViewExt, component, view};
2019
2120 use crate::i18n::code::{self as g, K};
2221 use crate::i18n::{self, Lang};
@@ -28,17 +27,15 @@ use crate::pages::packages;
2827 use crate::pages::passkeys::s;
2928 use crate::pages::refs::{load_refs, ref_links};
3029 use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo};
31-use crate::pages::repo_side::{
32- StripFacts, TreeFacts, commit_strip, readme_meta, repo_dock, repo_strip, run_rows, run_states,
33- strip_bars, tree_facts,
34-};
30+use crate::pages::repo_side::{StripFacts, code_sub, commit_strip, run_pips, run_rows, tree_facts};
3531 use crate::pages::tree::{
36- entry_rows, last_commits, latest_bar, load_readme, read_dir, readme_card, tree_table,
32+ entry_rows, last_commits, latest_bar, load_readme, read_dir, readme_sheet, tree_table,
3733 };
3834 use crate::state::AppState;
35+use crate::views::parts::{SubPart, head_sub};
3936 use crate::views::repo_list::badge_class;
4037 use crate::views::{
41- empty_state, now_unix, ref_selector, rel_time, relative_time, repo_href, repo_tabs, shell,
38+ now_unix, ref_selector, relative_time, repo_href, repo_tabs, shell,
4239 };
4340
4441 path_param!(owner);
@@ -65,11 +62,37 @@ pub fn ssh_clone_url(config: &Config, owner: &str, name: &str) -> String {
6562 }
6663 }
6764
68-/// Header shared by the repo pages: title, visibility, the fork line, the fork and star controls,
69-/// the archived notice, description and the header tabs. Built by `RepoCtx::head`; every repo page
70-/// passes one.
65+/// The title a repo page shows when it gives none: the tab it is on.
66+fn tab_title(lang: Lang, active: &str, repo: &str) -> String {
67+ match active {
68+ "issues" => g::t(lang, K::TabIssues).to_owned(),
69+ "pulls" => g::t(lang, K::TabPulls).to_owned(),
70+ "ci" => g::t(lang, K::TabCi).to_owned(),
71+ "commits" => g::t(lang, K::TabCommits).to_owned(),
72+ "branches" => g::t(lang, K::BranchesTitle).to_owned(),
73+ "tags" => g::t(lang, K::TagsTitle).to_owned(),
74+ "releases" => g::t(lang, K::TabReleases).to_owned(),
75+ "discussions" => g::t(lang, K::TabDiscussions).to_owned(),
76+ "wiki" => g::t(lang, K::TabWiki).to_owned(),
77+ "security" => i18n::t(lang, i18n::Key::Security).to_owned(),
78+ "settings" => g::t(lang, K::TabSettings).to_owned(),
79+ _ => repo.to_owned(),
80+ }
81+}
82+
83+/// Head of every repo page: the title with its actions right beside it, the sub line and the tabs.
84+/// The Code tab's head is the repo itself: its name, Clone, Star, Fork and the rest in a menu. Any
85+/// other tab's head is that tab (or `title`), and `child` holds the page's own actions. `sub` is
86+/// added to the sub line; the Code tab starts it with the description and the visibility. Built by
87+/// `RepoCtx::head`; every repo page passes one.
7188 #[component]
72-pub async fn repo_head(head: RepoHead) -> Result<impl View> {
89+pub async fn repo_head(
90+ head: RepoHead,
91+ #[default] title: Option<String>,
92+ #[default] sub: Vec<SubPart>,
93+ #[default] pips: Vec<(String, String, &'static str)>,
94+ #[default] child: Child<'_>,
95+) -> Result<impl View> {
7396 let RepoHead {
7497 owner,
7598 name,
@@ -78,9 +101,7 @@ pub async fn repo_head(head: RepoHead) -> Result<impl View> {
78101 description,
79102 archived,
80103 active,
81- hide_search,
82104 can_admin,
83- can_delete: _,
84105 open_issues,
85106 open_pulls,
86107 forked_from,
@@ -96,23 +117,20 @@ pub async fn repo_head(head: RepoHead) -> Result<impl View> {
96117 wiki,
97118 security,
98119 lang,
120+ clone,
99121 ..
100122 } = head;
123+ let is_code = active == "code";
101124 let badge = badge_class(visibility);
102125 let private = matches!(visibility, forge_core::Visibility::Private);
103126 let vis = i18n::visibility_label(lang, visibility);
127+ let shown_title = title.unwrap_or_else(|| tab_title(lang, active, &name));
104128 let active = active.to_owned();
105129 // The fork button posts with the same session CSRF token as the star form.
106130 let fork_control = match (can_fork, star.as_ref()) {
107131 (true, Some(star)) => Some((repo_href(&owner, &name, "fork", ""), star.csrf.clone())),
108132 _ => None,
109133 };
110- let fork_line = forked_from.map(|(source_owner, source_name)| {
111- (
112- repo_href(&source_owner, &source_name, "", ""),
113- format!("{source_owner}/{source_name}"),
114- )
115- });
116134 // Signed-in viewers get a button that stars or unstars; anonymous viewers see the count only.
117135 let star_control = match star {
118136 Some(star) => {
@@ -137,96 +155,82 @@ pub async fn repo_head(head: RepoHead) -> Result<impl View> {
137155 });
138156 let watch_count = g::watching_count(lang, watchers);
139157 let fork_count = g::forks_count(lang, forks);
140- let mirror_line = mirror.as_ref().map(|source| source.url.clone());
141- // A stamp is shown as a live relative time between the two words; without one, the status is plain text.
142- let (mirror_before, mirror_after, mirror_at, mirror_status) = match mirror {
143- Some(source) => match (source.last_sync, source.last_ok) {
144- (Some(at), Some(true)) => {
145- let (before, after) = g::mirror_synced(lang);
146- (before, after, Some(at), String::new())
147- }
148- (Some(at), _) => {
149- let (before, after) = g::mirror_sync_failed(lang);
150- (before, after, Some(at), String::new())
151- }
152- (None, _) => ("", "", None, g::t(lang, K::NotSyncedYet).to_owned()),
153- },
154- None => ("", "", None, String::new()),
155- };
158+ // The sub line: on the Code tab what the repo is, then what the page adds.
159+ let mut parts: Vec<SubPart> = Vec::new();
160+ if is_code {
161+ if !description.is_empty() {
162+ parts.push(SubPart::text(description.as_str()));
163+ }
164+ parts.push(SubPart::text(vis));
165+ if let Some((source_owner, source_name)) = forked_from {
166+ parts.push(SubPart::link(
167+ format!("{} {source_owner}/{source_name}", g::t(lang, K::ForkedFrom)),
168+ repo_href(&source_owner, &source_name, "", ""),
169+ ));
170+ }
171+ if let Some(source) = mirror {
172+ let status = match (source.last_sync, source.last_ok) {
173+ (Some(_), Some(true)) => g::mirror_synced(lang).0,
174+ (Some(_), _) => g::mirror_sync_failed(lang).0,
175+ (None, _) => g::t(lang, K::NotSyncedYet),
176+ };
177+ parts.push(SubPart::text(format!(
178+ "{} {}, {}",
179+ g::t(lang, K::MirrorOf),
180+ source.url,
181+ status.trim()
182+ )));
183+ }
184+ }
185+ parts.extend(sub);
156186 let live_attr = (!live.is_empty()).then(|| live.clone());
157- // The head: the path bar names the repo; the actions sit as text links under it, then the tabs,
158- // then the code search entry.
159- let has_origin = fork_line.is_some() || mirror_line.is_some();
160- let search_action = repo_href(&owner, &name, "search", "");
161- let search_label = g::t(lang, K::SearchCodePlaceholder);
162187 Ok(view! {
163- <section class="repo-head" data-live=(live_attr.as_deref())>
164- <h1 class="sr-only">(owner.as_str()) "/" (name.as_str())</h1>
165- if has_origin {
166- <div>
167- if let Some((href, label)) = fork_line {
168- <p class="hint">(g::t(lang, K::ForkedFrom)) <a href=(href.as_str())>(label.as_str())</a></p>
169- }
170- if let Some(source) = mirror_line {
171- <p class="hint mirror-line">(g::t(lang, K::MirrorOf)) <code>(source.as_str())</code> ", "
172- if let Some(at) = mirror_at.as_deref() {
173- (mirror_before) rel_time(lang: lang, stamp: at) (mirror_after)
188+ <section class="head repo-head" data-live=(live_attr.as_deref())>
189+ <div class="head-title">
190+ <h1>(shown_title.as_str())</h1>
191+ if is_code {
192+ clone_popover(https: clone.https, ssh: clone.ssh, downloads: clone.downloads, lang: lang)
193+ if let Some((action, label, csrf)) = star_control {
194+ <form method="post" action=(action.as_str()) class="act-form">
195+ <input type="hidden" name="csrf" value=(csrf.as_str())>
196+ <button type="submit" data-palette-action="post">(label.as_str())</button>
197+ </form>
174198 } else {
175- (mirror_status.as_str())
199+ <span class="hint" aria-label=(g::t(lang, K::StarsAria))>(anon_count.as_str())</span>
176200 }
177- </p>
178- }
179- </div>
180- }
181- <div class="acts">
182- // A private repo says so beside the star; public needs no mark outside the menu.
183- if private {
201+ if let Some((action, csrf)) = fork_control {
202+ <form method="post" action=(action.as_str()) class="act-form">
203+ <input type="hidden" name="csrf" value=(csrf.as_str())>
204+ <button type="submit">(g::t(lang, K::ForkButton))</button>
205+ </form>
206+ }
207+ <details class="menu head-more">
208+ <summary class="button" aria-label=(s(lang, "Repository actions", "Depo işlemleri"))>
209+ <span aria-hidden="true">"…"</span>
210+ </summary>
211+ <div class="menu-list head-more-list">
212+ if let Some((action, csrf, level)) = watch_control {
213+ watch_form(lang: lang, action: action, csrf: csrf, level: level, watchers: watchers)
214+ } else {
215+ <span class="hint">(watch_count.as_str())</span>
216+ }
217+ <span class="hint">(fork_count.as_str())</span>
218+ </div>
219+ </details>
220+ } else if private {
184221 <span class=(badge)>(vis)</span>
185222 }
186- if let Some((action, label, csrf)) = star_control {
187- <form method="post" action=(action.as_str()) class="act-form">
188- <input type="hidden" name="csrf" value=(csrf.as_str())>
189- <button type="submit" class="act" data-palette-action="post">(label.as_str())</button>
190- </form>
191- } else {
192- <span class="hint" aria-label=(g::t(lang, K::StarsAria))>(anon_count.as_str())</span>
193- }
194- <details class="menu head-more">
195- <summary class="act" aria-label=(s(lang, "Repository actions", "Depo işlemleri"))>
196- <span aria-hidden="true">"…"</span>
197- </summary>
198- <div class="menu-list head-more-list">
199- <span class=(badge)>(vis)</span>
200- if let Some((action, csrf)) = fork_control {
201- <form method="post" action=(action.as_str()) class="act-form">
202- <input type="hidden" name="csrf" value=(csrf.as_str())>
203- <button type="submit" class="act">(g::t(lang, K::ForkButton))</button>
204- </form>
205- }
206- if let Some((action, csrf, level)) = watch_control {
207- watch_form(lang: lang, action: action, csrf: csrf, level: level, watchers: watchers)
208- } else {
209- <span class="hint">(watch_count.as_str())</span>
210- }
211- <span class="hint">(fork_count.as_str())</span>
212- </div>
213- </details>
223+ (child)
214224 </div>
225+ head_sub(parts: parts, pips: pips)
215226 repo_tabs(owner: owner.clone(), repo: name.clone(), default_branch: default_branch.clone(), active: active.clone(), can_admin: can_admin, lang: lang, open_issues: Some(open_issues), open_pulls: Some(open_pulls), discussions: discussions, wiki: wiki, security: security)
216- if !hide_search && active == "code" {
217- <form method="get" action=(search_action.as_str()) class="plain-search" role="search">
218- <input type="search" name="q" data-live-search="" placeholder=(search_label) aria-label=(search_label) autocomplete="off">
219- </form>
220- }
221227 </section>
222228 if archived {
223229 <p class="state" role="status">(g::t(lang, K::ArchivedNotice))</p>
224230 }
225- // The description belongs to the Code tab only; sub-pages keep the compact head.
226- if active == "code" && !description.is_empty() {
227- <p class="lead">(description.as_str())</p>
228- }
229- })
231+ }
232+ // Boxed: this head is part of nearly every repo page's view.
233+ .boxed())
230234 }
231235
232236 /// Clone button that opens a popover with both clone URLs as selectable read-only fields and, when
@@ -240,7 +244,7 @@ async fn clone_popover(
240244 ) -> Result<impl View> {
241245 Ok(view! {
242246 <details class="clone pop">
243- <summary class="act">(g::t(lang, K::CloneTitle))</summary>
247+ <summary class="button primary">(g::t(lang, K::CloneTitle))</summary>
244248 <div class="pop-panel">
245249 <label for="clone-https">"HTTPS"</label>
246250 <input id="clone-https" class="mono" type="text" readonly=(true) value=(https.as_str())>
@@ -260,26 +264,6 @@ async fn clone_popover(
260264 })
261265 }
262266
263-/// Head of the README pane, shared by the repo home and the tree pages: the file name, then the repo
264-/// facts (licence, size, top language) and the Clone popover as text links on the same line.
265-#[component]
266-pub(crate) async fn readme_head(
267- label: String,
268- facts: Option<TreeFacts>,
269- https: String,
270- ssh: String,
271- downloads: Option<(String, String)>,
272- lang: Lang,
273-) -> Result<impl View> {
274- Ok(view! {
275- <div class="acts">
276- <span class="name">(label.as_str())</span>
277- readme_meta(lang: lang, facts: facts)
278- clone_popover(https: https, ssh: ssh, downloads: downloads, lang: lang)
279- </div>
280- })
281-}
282-
283267 /// Shown for an empty repo (or one whose default branch is missing): the branches that exist,
284268 /// or push instructions when there are none.
285269 #[component]
@@ -292,7 +276,9 @@ async fn branches_card(
292276 let empty = branches.is_empty();
293277 Ok(view! {
294278 <section class="sec">
295- <h2>(g::t(lang, K::BranchesTitle))</h2>
279+ if !empty {
280+ <h2>(g::t(lang, K::BranchesTitle))</h2>
281+ }
296282 if empty {
297283 <p class="state">(g::t(lang, K::EmptyRepoPush))</p>
298284 <p class="hint">(g::t(lang, K::OverHttps))</p>
@@ -511,75 +497,41 @@ async fn repo_page(cx: &Cx) -> Result<impl View> {
511497 let viewer_user = ctx.viewer.as_ref().map(|(user, _)| user);
512498 let packages = packages::repo_package_links(state, viewer_user, &repo.id).await?;
513499 let now = now_unix();
514- let downloads = (
515- repo_href(&owner_name, &repo_name, "archive", &format!("{branch}.zip")),
516- repo_href(
517- &owner_name,
518- &repo_name,
519- "archive",
520- &format!("{branch}.tar.gz"),
521- ),
522- );
523- // The dock: the history strip of the newest commits (cached per head), the newest run and the
524- // head commit's subject. Empty repos have no tree, so they have no dock.
500+ if head.is_none() {
501+ header.clone.downloads = None;
502+ }
525503 let strip = match &head {
526504 Some(commit) if tree.is_some() => commit_strip(state, repo, &ctx.path, commit).await,
527505 _ => StripFacts::default(),
528506 };
529- let ci_states = run_states(state, &repo.id).await?;
530- let bars = strip_bars(&strip.commits, &ci_states);
531- let total = strip.total;
532- let ci_href = repo_href(&owner_name, &repo_name, "ci", "");
533- let has_chips = latest.is_some() || !packages.is_empty();
534- let readme_label = readme
535- .as_ref()
536- .map(|readme| readme.name.clone())
537- .unwrap_or_else(|| "README".to_owned());
507+ let readme_file = readme.as_ref().map(|readme| readme.name.clone());
508+ let pips = run_pips(&runs);
509+ let sub = code_sub(lang, bar, facts, latest, packages, strip.total);
538510 Ok(view! {
539511 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
540- repo_head(head: header)
512+ repo_head(head: header, sub: sub, pips: pips)
541513 if !banners.is_empty() {
542514 recent_pushes(banners: banners, now: now, lang: lang)
543515 }
544516 if let Some(rows) = tree {
545- // Two panes over the dock: the tree on the left, the README on the right.
546- <div class="repo-grid repo-home canvas-repo">
547- <div class="repo-main canvas-files">
548- <div class="browse-bar" data-live-code=(follows.then_some("true")) data-live-gone=(g::t(lang, K::LivePathGone))>
517+ <div class="work">
518+ <nav class="rail" aria-label=(s(lang, "Files", "Dosyalar"))>
519+ <div class="rail-head browse-bar" data-live-code=(follows.then_some("true")) data-live-gone=(g::t(lang, K::LivePathGone))>
520+ <h2>(s(lang, "Files", "Dosyalar"))</h2>
549521 ref_selector(lang: lang, label: g::t(lang, K::BranchLabel), current: branch.clone(), branches: branches, tags: tags,
550522 branches_href: branches_href, tags_href: tags_href)
551523 file_finder(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(),
552524 ref_name: branch.clone())
553525 </div>
554- tree_table(rows: rows, lang: lang)
555- </div>
556- <div class="repo-split" role="separator" aria-orientation="vertical"
557- aria-label=(s(lang, "Resize file tree", "Dosya ağacını boyutlandır")) tabindex="0"
558- data-repo-split=""></div>
559- <div class="repo-readme canvas-readme">
560- readme_head(label: readme_label, facts: facts, https: https, ssh: ssh, downloads: Some(downloads), lang: lang)
561- <div class="canvas-body">
562- if has_chips {
563- repo_strip(lang: lang, facts: None, release: latest, packages: packages)
564- }
565- if let Some(readme) = readme {
566- readme_card(name: readme.name, markdown: readme.markdown, body: readme.body)
567- } else {
568- empty_state(title: s(lang, "No README yet", "Henüz README yok"))
569- }
570- </div>
571- </div>
526+ tree_table(rows: rows, lang: lang, current: readme_file)
527+ </nav>
528+ readme_sheet(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), ref_name: branch.clone(), dir: String::new(), readme: readme,
529+ none: s(lang, "No README yet", "Henüz README yok"))
572530 </div>
573- repo_dock(lang: lang, runs: runs, total: total, ci_href: ci_href,
574- owner: owner_name.clone(), repo: repo_name.clone(), bars: bars, latest: bar)
575531 } else {
576- if has_chips {
577- repo_strip(lang: lang, facts: None, release: latest, packages: packages)
578- }
579- <div class="browse-bar">
580- clone_popover(https: https, ssh: ssh, downloads: None, lang: lang)
532+ <div class="sheet">
533+ branches_card(branches: branch_names, push_https: push_https, push_ssh: push_ssh, lang: lang)
581534 </div>
582- branches_card(branches: branch_names, push_https: push_https, push_ssh: push_ssh, lang: lang)
583535 }
584536 )
585537 })
@@ -727,7 +679,6 @@ mod tests {
727679 assert!(body.contains("/tahinli/demo/archive/main.tar.gz"));
728680 assert!(body.contains("/tahinli/demo/branches"));
729681 assert!(body.contains("data-ref-filter"), "branch switcher rendered");
730- assert!(body.contains("canvas-dock"), "dock under the two panes");
731682
732683 // Trees list their entries and link to subtrees and blobs.
733684 let (status, body) = get(&router, "/tahinli/demo/tree/main/src").await;
crates/forge-web/src/pages/repo_collaborators.rsmodified+3 -2
@@ -202,7 +202,7 @@ async fn collaborators_pane(
202202 }
203203 </select>
204204 </div>
205- <button type="submit">(g::t(lang, K::SaveRole))</button>
205+ <button type="submit" class="primary">(g::t(lang, K::SaveRole))</button>
206206 </form>
207207 <div class="acts">
208208 confirm_act(lang: lang, label: g::t(lang, K::Remove), action: remove_action.as_str(), csrf: csrf.as_str(),
@@ -281,8 +281,9 @@ async fn collaborators_body(
281281 let add_open = matches!(notice, Some((key, true)) if !matches!(key, K::NotCollaborator));
282282 let notice = notice.map(|(key, is_error)| (g::t(lang, key), is_error));
283283 let can_delete = header.can_delete;
284+ let section_name = g::t(lang, K::Collaborators).to_owned();
284285 Ok(view! {
285- repo_head(head: header)
286+ repo_head(head: header, title: Some(section_name))
286287 settings_frame(lang: lang, title: nav_title, current: "collaborators", can_delete: can_delete,
287288 if let Some((text, is_error)) = notice {
288289 if is_error {
crates/forge-web/src/pages/repo_ctx.rsmodified+31 -3
@@ -18,8 +18,10 @@ use topcoat::router::{Body, Layer, LayerFuture, Next, Path, StatusCode};
1818
1919 use crate::auth::current_user;
2020 use crate::i18n::{self, Lang};
21+use crate::pages::repo::{https_clone_url, ssh_clone_url};
2122 use crate::pages::repo_mirrors::redacted_url;
2223 use crate::state::AppState;
24+use crate::views::repo_href;
2325
2426 pub struct RepoCtx {
2527 pub repo: Repo,
@@ -58,8 +60,6 @@ pub struct RepoHead {
5860 /// The current header tab: `code`, `issues`, `pulls`, `commits`, `branches`, `tags` or
5961 /// `settings`, or `security`.
6062 pub active: &'static str,
61- /// Hide the header's code-search box (the code search page draws its own).
62- pub hide_search: bool,
6363 /// Whether the viewer may open the Settings tab.
6464 pub can_admin: bool,
6565 /// Whether the viewer may delete the repo: the settings nav lists Danger zone only then.
@@ -95,6 +95,17 @@ pub struct RepoHead {
9595 pub wiki: bool,
9696 /// Whether the Security tab shows: advisories are enabled and the viewer may manage alerts.
9797 pub security: bool,
98+ /// What the Code tab's Clone popover offers.
99+ pub clone: CloneLinks,
100+}
101+
102+/// The repo's clone URLs and the default branch's archives. `downloads` is `None` before the first
103+/// commit.
104+#[derive(Clone)]
105+pub struct CloneLinks {
106+ pub https: String,
107+ pub ssh: String,
108+ pub downloads: Option<(String, String)>,
98109 }
99110
100111 /// The "Mirror of" line's values: the redacted source URL and the last sync, already formatted in the
@@ -246,7 +257,6 @@ impl RepoCtx {
246257 description: self.repo.description.clone(),
247258 archived: self.repo.archived,
248259 active,
249- hide_search: false,
250260 can_admin: self.can_admin(),
251261 can_delete: self.can_delete(),
252262 open_issues: self.open_issues(state).await?,
@@ -260,6 +270,24 @@ impl RepoCtx {
260270 forks,
261271 live: format!("/{}/{}/events", self.repo.owner_name, self.repo.name),
262272 mirror,
273+ clone: CloneLinks {
274+ https: https_clone_url(&state.config, &self.repo.owner_name, &self.repo.name),
275+ ssh: ssh_clone_url(&state.config, &self.repo.owner_name, &self.repo.name),
276+ downloads: Some((
277+ repo_href(
278+ &self.repo.owner_name,
279+ &self.repo.name,
280+ "archive",
281+ &format!("{}.zip", self.repo.default_branch),
282+ ),
283+ repo_href(
284+ &self.repo.owner_name,
285+ &self.repo.name,
286+ "archive",
287+ &format!("{}.tar.gz", self.repo.default_branch),
288+ ),
289+ )),
290+ },
263291 discussions,
264292 wiki,
265293 security,
crates/forge-web/src/pages/repo_mirrors.rsmodified+10 -12
@@ -387,11 +387,13 @@ async fn rows_of(state: &AppState, ctx: &RepoCtx, frame: &Frame) -> Result<Vec<M
387387 .collect())
388388 }
389389
390-/// Header, sub-navigation and the one-line notice.
390+/// Header, the rail and the one-line notice. `heading` is the page's title: the list's name, or the
391+/// mirror's redacted URL on its own page.
391392 #[component]
392393 async fn frame_top(
393394 head: RepoHead,
394395 title: String,
396+ heading: String,
395397 notice: Option<(&'static str, bool)>,
396398 archived: bool,
397399 lang: Lang,
@@ -399,7 +401,7 @@ async fn frame_top(
399401 ) -> Result<impl View> {
400402 let can_delete = head.can_delete;
401403 Ok(view! {
402- repo_head(head: head)
404+ repo_head(head: head, title: Some(heading))
403405 settings_frame(lang: lang, title: title, current: "mirrors", can_delete: can_delete,
404406 if let Some((text, is_error)) = notice {
405407 if is_error {
@@ -521,10 +523,9 @@ async fn mirrors_list_body(
521523 let pull_open = pull_form.as_ref().is_some_and(|pull| pull.error.is_some());
522524 let push_open = draft.error.is_some();
523525 Ok(view! {
524- frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang,
526+ frame_top(head: head, title: title.clone(), heading: g::t(lang, K::Mirrors).to_owned(), notice: notice, archived: archived, lang: lang,
525527 <section class="sec">
526- <h2>(g::t(lang, K::Mirrors))</h2>
527- if archived && empty {
528+ if empty {
528529 <p class="state">(g::t(lang, K::NoMirrors))</p>
529530 }
530531 for row in rows.iter() {
@@ -562,9 +563,7 @@ async fn mirrors_list_body(
562563 <section class="sec" id="add-pull-mirror">
563564 <h2>(g::t(lang, K::AddPullMirror))</h2>
564565 <p class="hint">(g::t(lang, K::MirrorsIntro))</p>
565- if empty {
566- <p class="state">(g::t(lang, K::NoMirrors))</p>
567- } else {
566+ if !empty {
568567 <p class="hint">(g::t(lang, K::AddPullIntro))</p>
569568 }
570569 <div class="acts">
@@ -578,9 +577,7 @@ async fn mirrors_list_body(
578577 }
579578 <section class="sec" id="add-push-mirror">
580579 <h2>(g::t(lang, K::AddPushMirror))</h2>
581- if empty && !can_pull {
582- <p class="state">(g::t(lang, K::NoMirrors))</p>
583- } else {
580+ if !empty || can_pull {
584581 <p class="hint">(g::t(lang, K::AddPushIntro))</p>
585582 }
586583 <div class="acts">
@@ -812,8 +809,9 @@ async fn mirror_body(
812809 g::t(lang, K::DeleteTextPush)
813810 };
814811 let current_url = redacted_url(&mirror.url);
812+ let heading = current_url.clone();
815813 Ok(view! {
816- frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang,
814+ frame_top(head: head, title: title.clone(), heading: heading, notice: notice, archived: archived, lang: lang,
817815 if archived {
818816 <section class="sec">
819817 <h2>(mirror_kind(lang, mirror.direction))</h2>
crates/forge-web/src/pages/repo_rename.rsmodified+2 -2
@@ -123,7 +123,7 @@ async fn rename_body(
123123 let rename_open = rename_error.is_some();
124124 let transfer_open = transfer_error.is_some();
125125 Ok(view! {
126- repo_head(head: head)
126+ repo_head(head: head, title: Some(g::t(lang, K::RenameTransferNav).to_owned()))
127127 settings_frame(lang: lang, title: nav_title, current: "rename", can_delete: can_delete,
128128 if let Some(key) = notice {
129129 <p class="state" role="status">(g::t(lang, key))</p>
@@ -166,7 +166,7 @@ async fn rename_body(
166166 <label for="transfer-confirm">(g::t(lang, K::TypeToConfirmBefore))<code>(title.clone())</code>(g::t(lang, K::TypeToConfirmAfter))</label>
167167 <input id="transfer-confirm" type="text" name="confirm" autocomplete="off" spellcheck="false" required=(true)>
168168 </div>
169- <button type="submit" class="act danger">(g::t(lang, K::TransferRepo))</button>
169+ <button type="submit" class="danger small">(g::t(lang, K::TransferRepo))</button>
170170 </form>
171171 )
172172 </div>
crates/forge-web/src/pages/repo_scrub.rsmodified+17 -7
@@ -19,9 +19,11 @@ use topcoat::view::{View, component, view};
1919
2020 use crate::i18n::Lang;
2121 use crate::i18n::code::{self as g};
22+use crate::pages::passkeys::s;
2223 use crate::pages::repo_ctx::{RepoCtx, load_repo};
2324 use crate::pages::tree::{entry_rows, load_readme, read_dir, readme_card};
2425 use crate::state::AppState;
26+use crate::views::parts::{SubPart, head};
2527 use crate::views::{now_unix, shell};
2628
2729 /// Most parts kept in memory at once. The oldest entry goes first.
@@ -202,15 +204,23 @@ async fn scrub_page(cx: &Cx) -> Result<impl View> {
202204 let rows = parts.rows.clone();
203205 let readme = parts.readme.clone();
204206 let lang = ctx.lang;
207+ let short: String = oid.chars().take(7).collect();
208+ let sub = vec![
209+ SubPart::text(s(lang, "Files at this commit", "Bu commit'teki dosyalar")),
210+ SubPart::text(title.clone()),
211+ ];
205212 Ok(view! {
206213 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
207- <div data-scrub-tree="" data-scrub-when=(when.as_str())>
208- scrub_table(rows: rows, lang: lang)
209- </div>
210- <div data-scrub-readme="">
211- if let Some(readme) = readme {
212- readme_card(name: readme.name, markdown: readme.markdown, body: readme.body)
213- }
214+ head(title: short.as_str(), sub: sub)
215+ <div class="sheet">
216+ <div data-scrub-tree="" data-scrub-when=(when.as_str())>
217+ scrub_table(rows: rows, lang: lang)
218+ </div>
219+ <div data-scrub-readme="">
220+ if let Some(readme) = readme {
221+ readme_card(name: readme.name, markdown: readme.markdown, body: readme.body)
222+ }
223+ </div>
214224 </div>
215225 )
216226 })
crates/forge-web/src/pages/repo_secrets.rsmodified+3 -3
@@ -149,7 +149,7 @@ impl SecretsData {
149149 }
150150 }
151151
152-/// Header, sub-navigation and the one-line notice.
152+/// Header, the rail and the one-line notice.
153153 #[component]
154154 async fn frame_top(
155155 lang: Lang,
@@ -162,7 +162,7 @@ async fn frame_top(
162162 let notice = notice.map(|(key, is_error)| (g::t(lang, key), is_error));
163163 let can_delete = head.can_delete;
164164 Ok(view! {
165- repo_head(head: head)
165+ repo_head(head: head, title: Some(g::t(lang, K::Secrets).to_owned()))
166166 settings_frame(lang: lang, title: title, current: "secrets", can_delete: can_delete,
167167 if let Some((text, is_error)) = notice {
168168 if is_error {
@@ -203,7 +203,7 @@ async fn secrets_body(
203203 <section class="sec">
204204 <h2>(g::t(lang, K::AddOrUpdate))</h2>
205205 <div class="acts">
206- reveal(label: g::t(lang, K::SaveSecret), id: Some("add-secret"), open: add_open,
206+ reveal(label: crate::pages::passkeys::s(lang, "Add secret", "Gizli anahtar ekle"), id: Some("add-secret"), open: add_open,
207207 if let Some(message) = error {
208208 alert(message: message.as_str())
209209 }
crates/forge-web/src/pages/repo_security.rsmodified+36 -34
@@ -121,41 +121,43 @@ async fn security_body(
121121 ) -> Result<impl View> {
122122 let open_count = rows.iter().filter(|r| r.open).count();
123123 Ok(view! {
124- repo_head(head: head)
125- <section class="sec">
126- <h2>(i18n::t(lang, Key::Security))</h2>
127- if !enabled {
128- <p class="state">(g::t(lang, K::SecurityOff))</p>
129- } else {
130- <p class="state">(g::dependencies_summary(lang, dependencies, open_count))</p>
131- <p class="hint">(g::t(lang, K::LockfilesRead))</p>
132- }
133- if rows.is_empty() {
134- <p class="state">(g::t(lang, K::NoAlerts))</p>
135- }
136- <div>
137- for row in rows.iter() {
138- <details class="row-open" data-kb-row="">
139- <summary class="line">
140- <span class="name">(row.advisory.as_str())</span>
141- <span class="val"><code>(row.package.as_str())</code> " " <code>(row.version.as_str())</code> " · " (row.severity.as_str()) " · " <span class=(row.state_class)>(row.state_text)</span> " · " rel_time(lang: lang, stamp: row.created_at.as_str())</span>
142- </summary>
143- <div class="opened">
144- <p class="hint"><a href=(row.osv_href.as_str()) rel="noopener noreferrer">(crate::pages::passkeys::s(lang, "Details on osv.dev", "osv.dev'de ayrıntılar"))</a></p>
145- <p class="hint">(row.summary.as_str())</p>
146- <div class="acts">
147- if row.open {
148- post_act(label: g::t(lang, K::Dismiss), action: row.dismiss_action.as_str(), csrf: csrf.as_str(), fields: row.fields.clone())
149- }
150- if row.dismissed {
151- post_act(label: g::t(lang, K::Reopen), action: row.reopen_action.as_str(), csrf: csrf.as_str(), fields: row.fields.clone())
152- }
153- </div>
154- </div>
155- </details>
124+ repo_head(head: head, title: Some(i18n::t(lang, Key::Security).to_owned()))
125+ <div class="sheet">
126+ <section class="sec">
127+ <h2>(i18n::t(lang, Key::Security))</h2>
128+ if !enabled {
129+ <p class="state">(g::t(lang, K::SecurityOff))</p>
130+ } else {
131+ <p class="state">(g::dependencies_summary(lang, dependencies, open_count))</p>
132+ <p class="hint">(g::t(lang, K::LockfilesRead))</p>
133+ }
134+ if rows.is_empty() {
135+ <p class="state">(g::t(lang, K::NoAlerts))</p>
156136 }
157- </div>
158- </section>
137+ <div>
138+ for row in rows.iter() {
139+ <details class="row-open" data-kb-row="">
140+ <summary class="line">
141+ <span class="name">(row.advisory.as_str())</span>
142+ <span class="val"><code>(row.package.as_str())</code> " " <code>(row.version.as_str())</code> " · " (row.severity.as_str()) " · " <span class=(row.state_class)>(row.state_text)</span> " · " rel_time(lang: lang, stamp: row.created_at.as_str())</span>
143+ </summary>
144+ <div class="opened">
145+ <p class="hint"><a href=(row.osv_href.as_str()) rel="noopener noreferrer">(crate::pages::passkeys::s(lang, "Details on osv.dev", "osv.dev'de ayrıntılar"))</a></p>
146+ <p class="hint">(row.summary.as_str())</p>
147+ <div class="acts">
148+ if row.open {
149+ post_act(label: g::t(lang, K::Dismiss), action: row.dismiss_action.as_str(), csrf: csrf.as_str(), fields: row.fields.clone())
150+ }
151+ if row.dismissed {
152+ post_act(label: g::t(lang, K::Reopen), action: row.reopen_action.as_str(), csrf: csrf.as_str(), fields: row.fields.clone())
153+ }
154+ </div>
155+ </div>
156+ </details>
157+ }
158+ </div>
159+ </section>
160+ </div>
159161 })
160162 }
161163
crates/forge-web/src/pages/repo_settings.rsmodified+47 -83
@@ -40,7 +40,7 @@ use crate::pages::repo::repo_head;
4040 use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo};
4141 use crate::pages::repo_settings_live::settings_head;
4242 use crate::state::AppState;
43-use crate::views::parts::{confirm_act, post_act};
43+use crate::views::parts::{RailItem, confirm_act, post_act, rail};
4444 use crate::views::{alert, enc, shell};
4545
4646 path_param!(owner);
@@ -291,7 +291,7 @@ async fn danger_zone(
291291 <input id="delete-confirm" type="text" name="confirm" autocomplete="off" spellcheck="false" required=(true)>
292292 </div>
293293 <div class="acts">
294- <button type="submit" class="act danger">(g::t(lang, K::DeleteRepo))</button>
294+ <button type="submit" class="danger small">(g::t(lang, K::DeleteRepo))</button>
295295 <button type="button" class="act quiet" data-close-details="">(g::t(lang, K::Cancel))</button>
296296 </div>
297297 </form>
@@ -302,10 +302,11 @@ async fn danger_zone(
302302 })
303303 }
304304
305-/// The settings frame: the second-level links (`.sub`) above the page's own content (its children).
306-/// `current` names the section shown (`general`, `branches`, `webhooks`, ...) and gets `aria-current`.
307-/// The General page's sections (`branches`, `discussions`, `danger`) are `?section=` links right after
308-/// General; the danger link is only for a viewer who may delete the repo (`can_delete`).
305+/// The settings frame: the rail of settings pages beside the sheet holding the page's own content
306+/// (its children). Every settings page shows the same rail. `current` names the page shown
307+/// (`general`, `branches`, `webhooks`, ...) and marks its rail item. On the General page the sections
308+/// (`branches`, `discussions`, `danger`) are tabs above the frame; the danger tab only for a viewer
309+/// who may delete the repo (`can_delete`).
309310 #[component]
310311 pub async fn settings_frame(
311312 lang: Lang,
@@ -314,83 +315,40 @@ pub async fn settings_frame(
314315 can_delete: bool,
315316 #[default] child: Child<'_>,
316317 ) -> Result<impl View> {
317- let general = format!("/{title}/settings");
318- let branches = format!("/{title}/settings?section=branches");
319- let discussions = format!("/{title}/settings?section=discussions");
320- let danger = format!("/{title}/settings?section=danger");
321- let branches_on = current == "branches";
322- let discussions_on = current == "discussions";
323- let danger_on = current == "danger";
318+ let general_on = matches!(current, "general" | "branches" | "discussions" | "danger");
324319 let discussions_label = crate::i18n::community::t(lang, crate::i18n::community::K::Discussions);
325- let collaborators = format!("/{title}/settings/collaborators");
326- let rename = format!("/{title}/settings/rename");
327- let hooks = format!("/{title}/settings/hooks");
328- let mirrors = format!("/{title}/settings/mirrors");
329- let secrets = format!("/{title}/settings/secrets");
330- let general_on = current == "general";
331- let collaborators_on = current == "collaborators";
332- let rename_on = current == "rename";
333- let hooks_on = current == "webhooks";
334- let mirrors_on = current == "mirrors";
335- let secrets_on = current == "secrets";
336- let wiki = format!("/{title}/settings/wiki");
337- let wiki_on = current == "wiki";
320+ let item = |name: &str, href: String, on: bool| RailItem {
321+ name: name.to_owned(),
322+ val: String::new(),
323+ href,
324+ current: on,
325+ };
326+ let items = vec![
327+ item(g::t(lang, K::General), format!("/{title}/settings"), general_on),
328+ item(g::t(lang, K::Collaborators), format!("/{title}/settings/collaborators"), current == "collaborators"),
329+ item(g::t(lang, K::RenameTransferNav), format!("/{title}/settings/rename"), current == "rename"),
330+ item(g::t(lang, K::Webhooks), format!("/{title}/settings/hooks"), current == "webhooks"),
331+ item(g::t(lang, K::Mirrors), format!("/{title}/settings/mirrors"), current == "mirrors"),
332+ item(g::t(lang, K::Secrets), format!("/{title}/settings/secrets"), current == "secrets"),
333+ item(crate::i18n::code::t(lang, crate::i18n::code::K::TabWiki), format!("/{title}/settings/wiki"), current == "wiki"),
334+ ];
338335 Ok(view! {
339- <nav class="sub" aria-label=(g::t(lang, K::SettingsNavLabel))>
340- if general_on {
341- <a href=(general) aria-current="page">(g::t(lang, K::General))</a>
342- } else {
343- <a href=(general)>(g::t(lang, K::General))</a>
344- }
345- if branches_on {
346- <a href=(branches.as_str()) aria-current="page">(g::t(lang, K::BranchProtection))</a>
347- } else {
348- <a href=(branches.as_str())>(g::t(lang, K::BranchProtection))</a>
349- }
350- if discussions_on {
351- <a href=(discussions.as_str()) aria-current="page">(discussions_label)</a>
352- } else {
353- <a href=(discussions.as_str())>(discussions_label)</a>
354- }
355- if can_delete {
356- if danger_on {
357- <a href=(danger.as_str()) aria-current="page">(g::t(lang, K::DangerZone))</a>
358- } else {
359- <a href=(danger.as_str())>(g::t(lang, K::DangerZone))</a>
336+ if general_on {
337+ <nav class="tabs" aria-label=(g::t(lang, K::SettingsNavLabel))>
338+ <a href=(format!("/{title}/settings")) aria-current=((current == "general").then_some("page"))>(g::t(lang, K::General))</a>
339+ <a href=(format!("/{title}/settings?section=branches")) aria-current=((current == "branches").then_some("page"))>(g::t(lang, K::BranchProtection))</a>
340+ <a href=(format!("/{title}/settings?section=discussions")) aria-current=((current == "discussions").then_some("page"))>(discussions_label)</a>
341+ if can_delete {
342+ <a href=(format!("/{title}/settings?section=danger")) aria-current=((current == "danger").then_some("page"))>(g::t(lang, K::DangerZone))</a>
360343 }
361- }
362- if collaborators_on {
363- <a href=(collaborators) aria-current="page">(g::t(lang, K::Collaborators))</a>
364- } else {
365- <a href=(collaborators)>(g::t(lang, K::Collaborators))</a>
366- }
367- if rename_on {
368- <a href=(rename) aria-current="page">(g::t(lang, K::RenameTransferNav))</a>
369- } else {
370- <a href=(rename)>(g::t(lang, K::RenameTransferNav))</a>
371- }
372- if hooks_on {
373- <a href=(hooks) aria-current="page">(g::t(lang, K::Webhooks))</a>
374- } else {
375- <a href=(hooks)>(g::t(lang, K::Webhooks))</a>
376- }
377- if mirrors_on {
378- <a href=(mirrors) aria-current="page">(g::t(lang, K::Mirrors))</a>
379- } else {
380- <a href=(mirrors)>(g::t(lang, K::Mirrors))</a>
381- }
382- if secrets_on {
383- <a href=(secrets) aria-current="page">(g::t(lang, K::Secrets))</a>
384- } else {
385- <a href=(secrets)>(g::t(lang, K::Secrets))</a>
386- }
387- if wiki_on {
388- <a href=(wiki) aria-current="page">(crate::i18n::code::t(lang, crate::i18n::code::K::TabWiki))</a>
389- } else {
390- <a href=(wiki)>(crate::i18n::code::t(lang, crate::i18n::code::K::TabWiki))</a>
391- }
392- </nav>
393- (child)
344+ </nav>
345+ }
346+ <div class="work">
347+ rail(label: g::t(lang, K::SettingsNavLabel), items: items)
348+ <div class="sheet">
349+ (child)
350+ </div>
351+ </div>
394352 })
395353 }
396354
@@ -811,8 +769,8 @@ struct SettingsView {
811769 contexts: Vec<String>,
812770 }
813771
814-/// The settings body: the repo header tabs with Settings active, the sub-navigation, then one section
815-/// (`section`: general, branches, discussions or danger) in one left aligned column.
772+/// The settings body: the repo header with Settings active, then the rail and one section (`section`:
773+/// general, branches, discussions or danger) in the sheet.
816774 #[component]
817775 async fn settings_body(
818776 lang: Lang,
@@ -871,10 +829,16 @@ async fn settings_body(
871829 let (description, visibility) = (head.description.clone(), head.visibility);
872830 let discussions_on = head.discussions;
873831 let notice = notice.map(|(key, is_error)| (g::t(lang, key), is_error));
832+ let section_name = match section {
833+ "branches" => g::t(lang, K::BranchProtection),
834+ "discussions" => crate::i18n::community::t(lang, crate::i18n::community::K::Discussions),
835+ "danger" => g::t(lang, K::DangerZone),
836+ _ => g::t(lang, K::General),
837+ };
874838 // Only one section is rendered. The danger section is only chosen for a viewer who may delete
875839 // (see `pick_section`), and it is last so that its moves come after every clone.
876840 Ok(view! {
877- repo_head(head: head)
841+ repo_head(head: head, title: Some(section_name.to_owned()))
878842 settings_frame(lang: lang, title: title.clone(), current: section, can_delete: can_delete,
879843 if let Some((text, is_error)) = notice {
880844 if is_error {
crates/forge-web/src/pages/repo_side.rsmodified+51 -324
@@ -11,25 +11,20 @@ use forge_core::Repo;
1111 use forge_core::ci::{JobState, RunState};
1212 use forge_git::churn::{self, CommitChurn};
1313 use forge_git::{browse, history};
14-use time::OffsetDateTime;
15-use time::format_description::well_known::Rfc3339;
1614 use topcoat::Result;
17-use topcoat::view::{View, component, view};
1815
1916 use crate::i18n::Lang;
20-use crate::i18n::releases_ci as rc;
21-use crate::i18n::timeline::{self as tl, K as TK};
22-use crate::pages::ci_estimate::{self, Est, Step};
23-use crate::pages::ci_runs::{duration_templates, duration_text, run_href, state_text};
17+use crate::i18n::timeline as tl;
18+use crate::pages::ci_runs::run_href;
2419 use crate::pages::packages::PackageLink;
2520 use crate::pages::passkeys::s;
2621 use crate::pages::releases::LatestRelease;
2722 use crate::pages::tree::LatestBar;
2823 use crate::repo_stats::{LangShare, languages, license_file, license_id};
2924 use crate::state::AppState;
30-use crate::views::commit_line::commit_line;
31-use crate::views::timeline::{StripBar, history_strip};
32-use crate::views::{human_size, now_unix, rel_time, short_oid};
25+use crate::views::parts::SubPart;
26+use crate::views::timeline::StripBar;
27+use crate::views::{human_size, short_oid};
3328
3429 /// CI runs the home page shows: the newest.
3530 const RUNS_SHOWN: u32 = 1;
@@ -186,41 +181,13 @@ pub fn strip_bars(commits: &[CommitChurn], ci: &HashMap<String, RunState>) -> Ve
186181 .collect()
187182 }
188183
189-/// One CI run as the column shows it: a link to the run, its dot, and one line of words. A run
190-/// still going has a clock that ticks.
184+/// One CI run as the column shows it: a link to the run and its state, for the pips.
191185 pub struct RunRow {
192186 pub href: String,
193- pub number: i64,
194187 pub state: RunState,
195- pub dot: &'static str,
196- /// Unix seconds the run started, for the ticking clock of a run still going.
197- pub since: Option<String>,
198- /// The text before the clock: the current job's name.
199- pub pre: Option<String>,
200- /// The right-hand text, or the elapsed time of a run still going.
201- pub label: String,
202- /// The expected total of a running run, from its past runs. When set, the bar is its fill.
203- pub est: Option<Est>,
204188 pub title: String,
205189 }
206190
207-/// The dot of a run: glowing while it goes, green passed, red failed, grey otherwise.
208-fn run_dot(run: RunState) -> &'static str {
209- match run {
210- RunState::Success => "health-dot ok",
211- RunState::Failure | RunState::Error => "health-dot bad",
212- RunState::Running | RunState::Queued => "health-dot ember",
213- RunState::Cancelled | RunState::WaitingApproval => "health-dot",
214- }
215-}
216-
217-/// Unix seconds of an RFC 3339 stamp.
218-fn unix(stamp: &str) -> Option<i64> {
219- OffsetDateTime::parse(stamp, &Rfc3339)
220- .ok()
221- .map(|at| at.unix_timestamp())
222-}
223-
224191 /// The newest runs of the repo, with their jobs.
225192 pub async fn run_rows(state: &AppState, lang: Lang, repo: &Repo) -> Result<Vec<RunRow>> {
226193 let title = format!("{}/{}", repo.owner_name, repo.name);
@@ -238,97 +205,14 @@ pub async fn run_rows(state: &AppState, lang: Lang, repo: &Repo) -> Result<Vec<R
238205 )
239206 })
240207 .count();
241- let started = jobs
242- .iter()
243- .filter_map(|job| job.started_at.as_deref())
244- .min();
245208 let branch = run
246209 .git_ref
247210 .strip_prefix("refs/heads/")
248211 .or_else(|| run.git_ref.strip_prefix("refs/tags/"))
249212 .unwrap_or(&run.git_ref);
250- let (since, pre, label, est) = if matches!(run.state, RunState::Running | RunState::Queued)
251- {
252- let current = jobs
253- .iter()
254- .find(|job| job.state == JobState::Running)
255- .or_else(|| jobs.iter().find(|job| job.state == JobState::Queued))
256- .map(|job| job.name.as_str())
257- .unwrap_or("");
258- let current = if current.is_empty() && run.state == RunState::Queued {
259- s(lang, "queued", "sırada")
260- } else {
261- current
262- };
263- let since_stamp = started.unwrap_or(run.created_at.as_str());
264- let took = duration_text(lang, Some(since_stamp), None);
265- let est = if run.state == RunState::Running {
266- let samples = state
267- .store
268- .recent_job_samples(&repo.id, std::slice::from_ref(&run.git_ref))
269- .await?;
270- let steps: Vec<Step> = jobs
271- .iter()
272- .map(|job| Step {
273- name: job.name.clone(),
274- needs: ci_estimate::needs_of(&job.spec_json),
275- state: job.state,
276- started: job.started_at.as_deref().and_then(unix),
277- finished: job.finished_at.as_deref().and_then(unix),
278- })
279- .collect();
280- let now = now_unix();
281- unix(since_stamp).and_then(|origin| {
282- let end = ci_estimate::run_end(now, &steps, &samples, &run.git_ref)?;
283- Some(ci_estimate::estimate(lang, origin, now, end))
284- })
285- } else {
286- None
287- };
288- let label = match est.as_ref() {
289- Some(est) => format!("{took} \u{b7} {}", est.phrase),
290- None => took,
291- };
292- (
293- unix(since_stamp).map(|secs| secs.to_string()),
294- (!current.is_empty()).then(|| format!("{current} \u{b7} ")),
295- label,
296- est,
297- )
298- } else {
299- let failed = jobs
300- .iter()
301- .find(|job| matches!(job.state, JobState::Failure | JobState::Error))
302- .map(|job| job.name.as_str());
303- let word = match run.state {
304- RunState::Success => s(lang, "passed", "geçti").to_owned(),
305- RunState::Failure | RunState::Error => match failed {
306- Some(name) => format!("{name} {}", s(lang, "failed", "başarısız")),
307- None => s(lang, "failed", "başarısız").to_owned(),
308- },
309- RunState::Cancelled => s(lang, "cancelled", "iptal edildi").to_owned(),
310- RunState::WaitingApproval | RunState::Running | RunState::Queued => {
311- state_text(lang, run.state.as_str())
312- }
313- };
314- // The same words as the running clock and the CI pages: "4m 12s".
315- let took = duration_text(lang, started, run.finished_at.as_deref());
316- let label = if took.is_empty() || run.finished_at.is_none() {
317- word
318- } else {
319- format!("{word} \u{b7} {took}")
320- };
321- (None, None, label, None)
322- };
323213 rows.push(RunRow {
324214 href: run_href(&title, run.number),
325- number: run.number,
326215 state: run.state,
327- dot: run_dot(run.state),
328- since,
329- pre,
330- label,
331- est,
332216 title: format!(
333217 "{}: {done}/{total} \u{b7} {branch} \u{b7} {}",
334218 s(lang, "Jobs passed", "Geçen işler"),
@@ -356,209 +240,64 @@ pub async fn runs_fingerprint(state: &AppState, repo_id: &str) -> Result<String>
356240 Ok(out.join("\n"))
357241 }
358242
359-/// One language's slice of the header's language bar: where it starts and how wide it is, in
360-/// percent of the bar, and its shade (0 the biggest).
361-pub struct LangSlice {
362- pub x: String,
363- pub width: String,
364- pub class: &'static str,
365-}
366-
367-/// The bar's slices in order. Each shade is a class (the page's CSP allows no inline styles), and
368-/// the SVG takes its geometry from attributes.
369-fn lang_slices(langs: &[LangShare]) -> Vec<LangSlice> {
370- const SHADES: [&str; 5] = ["lang-0", "lang-1", "lang-2", "lang-3", "lang-4"];
371- let mut at = 0u32;
372- langs
373- .iter()
374- .enumerate()
375- .map(|(i, share)| {
376- let slice = LangSlice {
377- x: format!("{at}%"),
378- width: format!("{}%", share.percent),
379- class: if share.others.is_empty() {
380- SHADES[i.min(3)]
381- } else {
382- SHADES[4]
383- },
384- };
385- at += share.percent;
386- slice
387- })
388- .collect()
389-}
390-
391-/// The facts line under the repo header, in place of a side column: license, size and a bar of
392-/// the languages on the left; the latest release and the packages as chips on the right. `facts`
393-/// is None for a repo with no commit yet.
394-#[component]
395-pub async fn repo_strip(
243+/// What the Code tab's sub line adds after the description: the commit on show, then the repo's
244+/// facts, its latest release, its packages and how many commits it has.
245+pub fn code_sub(
396246 lang: Lang,
247+ latest: Option<LatestBar>,
397248 facts: Option<TreeFacts>,
398249 release: Option<LatestRelease>,
399250 packages: Vec<PackageLink>,
400-) -> Result<impl View> {
401- let size = facts.as_ref().map(|f| human_size(lang, f.size));
402- let license = facts.as_ref().and_then(|f| f.license.clone());
403- let langs = facts.map(|f| f.languages).unwrap_or_default();
404- let slices = lang_slices(&langs);
405- let bar_label = langs
406- .iter()
407- .map(|share| format!("{} {}%", lang_name(lang, share), share.percent))
408- .collect::<Vec<_>>()
409- .join(", ");
410- Ok(view! {
411- <div class="repo-strip">
412- if let Some((file, id)) = license.as_ref() {
413- <span class="strip-fact" title=(s(lang, "License", "Lisans"))>
414- <svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v18M5 7h14M7 7l-3 7a3 3 0 0 0 6 0zM17 7l-3 7a3 3 0 0 0 6 0z"/></svg>
415- if id.is_empty() { (file.as_str()) } else { (id.as_str()) }
416- </span>
417- }
418- if let Some(size) = size.as_ref() {
419- <span class="strip-fact" title=(s(lang, "Size", "Boyut"))>(size.as_str())</span>
420- }
421- if !langs.is_empty() {
422- <div class="strip-langs">
423- <svg class="lang-bar" viewBox="0 0 100 6" preserveAspectRatio="none" role="img" aria-label=(bar_label.as_str())>
424- for slice in slices.iter() {
425- <rect class=(slice.class) x=(slice.x.as_str()) y="0" width=(slice.width.as_str()) height="100%"></rect>
426- }
427- </svg>
428- <ul class="lang-legend">
429- for (share, slice) in langs.iter().zip(slices.iter()) {
430- <li title=(lang_meta(lang, share))><span class=(format!("lang-dot {}", slice.class)) aria-hidden="true"></span>(lang_name(lang, share))" "<span class="muted">(format!("{}%", share.percent))</span></li>
431- }
432- </ul>
433- </div>
434- }
435- <div class="strip-chips">
436- if let Some(release) = release.as_ref() {
437- <a class="strip-chip" href=(release.href.as_str()) title=(format!("{}{}", release.title, release_counts(lang, release)))>
438- <span class="sr-only">(rc::t(lang, rc::K::LatestReleaseHeading))" "</span>
439- <svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8z"/><circle cx="7.5" cy="7.5" r="1.5"/></svg>
440- (release.tag.as_str())
441- <span class="muted">rel_time(lang: lang, stamp: release.when.iso.as_str())</span>
442- </a>
443- }
444- for link in packages.iter() {
445- <a class="strip-chip" href=(link.href.as_str()) title=(link.latest.as_str())>
446- <svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M21 8 12 3 3 8v8l9 5 9-5zM3 8l9 5 9-5M12 13v8"/></svg>
447- (link.name.as_str())
448- </a>
449- }
450- </div>
451- </div>
452- })
453-}
454-
455-/// The README pane's header line: the license, the size and the top language, as text beside the
456-/// file name. The full language split is the title. Nothing when the tree has no facts.
457-#[component]
458-pub async fn readme_meta(lang: Lang, facts: Option<TreeFacts>) -> Result<impl View> {
251+ total: u64,
252+) -> Vec<SubPart> {
253+ let mut parts = Vec::new();
459254 let facts = facts.unwrap_or_default();
460- let mut parts: Vec<String> = Vec::new();
255+ if let Some(share) = facts.languages.first() {
256+ parts.push(SubPart::text(lang_name(lang, share)));
257+ }
461258 if let Some((file, id)) = facts.license.as_ref() {
462- parts.push(if id.is_empty() {
463- file.clone()
464- } else {
465- id.clone()
466- });
259+ parts.push(SubPart::text(if id.is_empty() { file } else { id }.as_str()));
467260 }
468261 if facts.size > 0 {
469- parts.push(human_size(lang, facts.size));
262+ parts.push(SubPart::text(human_size(lang, facts.size)));
470263 }
471- if let Some(share) = facts.languages.first() {
472- parts.push(format!("{} {}%", lang_name(lang, share), share.percent));
264+ if let Some(bar) = latest {
265+ let mut sha = SubPart::link(bar.short.as_str(), bar.last.href.as_str());
266+ sha.class = "mono";
267+ parts.push(sha);
268+ parts.push(SubPart::link(bar.last.summary.as_str(), bar.last.href.as_str()));
269+ parts.push(SubPart::text(bar.author.as_str()));
270+ parts.push(SubPart::text(bar.last.age.as_str()));
473271 }
474- let all = facts
475- .languages
476- .iter()
477- .map(|share| format!("{} {}%", lang_name(lang, share), share.percent))
478- .collect::<Vec<_>>()
479- .join(", ");
480- let text = parts.join(" \u{b7} ");
481- let show = !parts.is_empty();
482- Ok(view! {
483- if show {
484- <span class="readme-meta" title=(all.as_str())>(text.as_str())</span>
485- }
486- })
487-}
488-
489-/// The dot's state word is accent only while the run goes; every other state is plain text.
490-fn dock_state_class(run: RunState) -> &'static str {
491- match run {
492- RunState::Running | RunState::Queued => "dock-state is-live",
493- _ => "dock-state",
272+ if total > 0 {
273+ parts.push(SubPart::text(tl::commit_count(lang, total)));
494274 }
275+ if let Some(release) = release {
276+ parts.push(SubPart::link(
277+ format!("{}{}", release.tag, release_counts(lang, &release)),
278+ release.href.as_str(),
279+ ));
280+ }
281+ for link in packages {
282+ parts.push(SubPart::link(link.name.as_str(), link.href.as_str()));
283+ }
284+ parts
495285 }
496286
497-/// The repo's bottom dock, shown under the panes on the repo home and the tree pages: one info row
498-/// (the newest CI run's dot, number and state, the commit's sha, author and subject with a
499-/// full-message expander, the commit count and All runs), then the history strip. `latest` is the
500-/// commit the page shows. The clock attributes on the root let the page's ticker count a running run.
501-#[component]
502-pub async fn repo_dock(
503- lang: Lang,
504- runs: Vec<RunRow>,
505- total: u64,
506- ci_href: String,
507- owner: String,
508- repo: String,
509- bars: Vec<StripBar>,
510- latest: Option<LatestBar>,
511-) -> Result<impl View> {
512- // The clock: the server's time and the duration words the page's ticker rewrites with.
513- let now = now_unix();
514- let (fm, fs) = duration_templates(lang);
515- let commits = tl::commit_count(lang, total);
516- let all_runs = tl::t(lang, TK::AllRuns);
517- let aria = tl::t(lang, TK::Timeline);
518- let expand = s(lang, "Full commit message", "Commit mesajının tamamı");
519- Ok(view! {
520- <section class="repo-dock canvas-dock" aria-label=(aria) data-now=(now.to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())>
521- <div class="dock-info">
522- if let Some(run) = runs.first() {
523- <a class="dock-run" href=(run.href.as_str()) title=(run.title.as_str())>
524- <span class=(run.dot)></span>
525- <span class="side-run-name">(format!("CI #{}", run.number))</span>
526- </a>
527- <span class=(dock_state_class(run.state))>(state_text(lang, run.state.as_str()))</span>
528- if let Some(since) = run.since.as_deref() {
529- if let Some(est) = run.est.as_ref() {
530- <span class="dock-clock muted" data-since=(since) data-pre=(run.pre.as_deref()) data-expected=(est.expected.as_str()) data-left=(est.left.as_str()) data-over=(est.over.as_str()) data-lm=(est.minutes.as_str())>(run.label.as_str())</span>
531- } else {
532- <span class="dock-clock muted" data-since=(since) data-pre=(run.pre.as_deref())>(run.label.as_str())</span>
533- }
534- }
535- }
536- if let Some(bar) = latest {
537- <span class="sha dock-sha">(bar.short.as_str())</span>
538- if let (Some(src), Some(href)) = (bar.avatar, bar.author_href) {
539- <a class="dock-author" href=(href) title=(bar.author.as_str())>
540- <img class="avatar avatar-sm dock-avatar" src=(src) alt=(bar.author.as_str()) width="20" height="20">
541- </a>
542- } else {
543- <span class="avatar avatar-sm avatar-blank dock-avatar" aria-hidden="true" title=(bar.author.as_str())>(bar.author.chars().next().map(|c| c.to_uppercase().collect::<String>()).unwrap_or_default())</span>
544- }
545- <a class="dock-subject" href=(bar.last.href.as_str()) title=(bar.last.absolute.as_str())>commit_line(subject: bar.last.summary.clone())</a>
546- <details class="dock-expand">
547- <summary aria-label=(expand) title=(expand)><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
548- <div class="dock-message">
549- <p class="dock-message-by muted small">(bar.author.as_str())</p>
550- <pre class="dock-message-text">(bar.message.as_str())</pre>
551- </div>
552- </details>
553- }
554- <span class="dock-count muted small">(commits.as_str())</span>
555- <a class="small dock-all" href=(ci_href.as_str())>(all_runs)</a>
556- </div>
557- <div class="dock-history">
558- history_strip(lang: lang, owner: owner, repo: repo, bars: bars)
559- </div>
560- </section>
561- })
287+/// The newest runs for a head, oldest first, each a pip that opens its run.
288+pub fn run_pips(runs: &[RunRow]) -> Vec<(String, String, &'static str)> {
289+ runs.iter()
290+ .take(8)
291+ .rev()
292+ .map(|run| {
293+ let class = match run.state {
294+ RunState::Failure | RunState::Error => "bad",
295+ RunState::Running | RunState::Queued => "live",
296+ _ => "",
297+ };
298+ (run.href.clone(), run.title.clone(), class)
299+ })
300+ .collect()
562301 }
563302
564303 /// " · 2 assets · 41 downloads" after the release's age; empty without assets.
@@ -591,15 +330,3 @@ fn lang_name(lang: Lang, share: &LangShare) -> String {
591330 }
592331 }
593332
594-/// "412 files · 2.9 MB", or the folded languages on the remainder row.
595-fn lang_meta(lang: Lang, share: &LangShare) -> String {
596- if !share.others.is_empty() {
597- return share.others.join(", ");
598- }
599- let files = match lang {
600- Lang::Tr => format!("{} dosya", share.files),
601- Lang::En if share.files == 1 => "1 file".to_owned(),
602- Lang::En => format!("{} files", share.files),
603- };
604- format!("{files} \u{b7} {}", human_size(lang, share.bytes))
605-}
crates/forge-web/src/pages/repo_transfer.rsmodified+28 -26
@@ -74,32 +74,34 @@ async fn transfer_body(
7474 settings: Option<String>,
7575 ) -> Result<impl View> {
7676 Ok(view! {
77- repo_head(head: head)
78- <section class="sec">
79- <h2>(g::t(lang, K::TransferTitle))</h2>
80- if let Some(summary) = summary.as_ref() {
81- <p class="state">(summary.before.as_str()) rel_time(lang: lang, stamp: summary.expires_at.as_str()) (summary.after)</p>
82- <div class="acts">
83- if let Some(action) = accept {
84- post_act(label: g::t(lang, K::AcceptTransfer), action: action.as_str(), csrf: csrf.as_str())
85- }
86- if let Some(action) = decline {
87- confirm_act(lang: lang, label: g::t(lang, K::DeclineTransfer), action: action.as_str(), csrf: csrf.as_str())
88- }
89- if let Some(action) = cancel {
90- confirm_act(lang: lang, label: g::t(lang, K::CancelTransfer), action: action.as_str(), csrf: csrf.as_str())
91- }
92- </div>
93- }
94- if summary.is_none() {
95- <p class="state">(g::t(lang, K::NoPendingTransfer))</p>
96- }
97- if let Some(href) = settings {
98- <div class="acts">
99- <a class="act quiet" href=(href.as_str())>(g::t(lang, K::StartTransferLink))</a>
100- </div>
101- }
102- </section>
77+ repo_head(head: head, title: Some(g::t(lang, K::TransferTitle).to_owned()))
78+ <div class="sheet">
79+ <section class="sec">
80+ <h2>(g::t(lang, K::TransferTitle))</h2>
81+ if let Some(summary) = summary.as_ref() {
82+ <p class="state">(summary.before.as_str()) rel_time(lang: lang, stamp: summary.expires_at.as_str()) (summary.after)</p>
83+ <div class="acts">
84+ if let Some(action) = accept {
85+ post_act(label: g::t(lang, K::AcceptTransfer), action: action.as_str(), csrf: csrf.as_str())
86+ }
87+ if let Some(action) = decline {
88+ confirm_act(lang: lang, label: g::t(lang, K::DeclineTransfer), action: action.as_str(), csrf: csrf.as_str())
89+ }
90+ if let Some(action) = cancel {
91+ confirm_act(lang: lang, label: g::t(lang, K::CancelTransfer), action: action.as_str(), csrf: csrf.as_str())
92+ }
93+ </div>
94+ }
95+ if summary.is_none() {
96+ <p class="state">(g::t(lang, K::NoPendingTransfer))</p>
97+ }
98+ if let Some(href) = settings {
99+ <div class="acts">
100+ <a class="act" href=(href.as_str())>(g::t(lang, K::StartTransferLink))</a>
101+ </div>
102+ }
103+ </section>
104+ </div>
103105 })
104106 }
105107
crates/forge-web/src/pages/repo_webhooks.rsmodified+41 -35
@@ -31,7 +31,7 @@ use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo};
3131 use crate::pages::repo_settings::settings_frame;
3232 use crate::pages::repo_settings_live::settings_head;
3333 use crate::state::AppState;
34-use crate::views::parts::{confirm_act, post_act, reveal};
34+use crate::views::parts::{confirm_act, post_act};
3535 use crate::views::{alert, enc, now_unix, relative_time, shell};
3636 use crate::webhooks::client::{WebhookPolicy, validate_url};
3737 use crate::webhooks::emit::emit_ping;
@@ -486,19 +486,26 @@ impl Frame {
486486 }
487487 }
488488
489-/// Header, sub-navigation, the one-line notice, and the archived note.
489+/// Header, the rail, the one-line notice, and the archived note. `heading` is the page's title (the
490+/// list's name, or the hook's URL); `action` is the head's main action as (href, label), if any.
490491 #[component]
491492 async fn frame_top(
492493 head: RepoHead,
493494 title: String,
495+ heading: String,
494496 notice: Option<(&'static str, bool)>,
495497 archived: bool,
496498 lang: Lang,
499+ #[default] action: Option<(String, &'static str)>,
497500 #[default] child: Child<'_>,
498501 ) -> Result<impl View> {
499502 let can_delete = head.can_delete;
500503 Ok(view! {
501- repo_head(head: head)
504+ repo_head(head: head, title: Some(heading),
505+ if let Some((href, label)) = action {
506+ <a class="button primary" href=(href.as_str())>(label)</a>
507+ }
508+ )
502509 settings_frame(lang: lang, title: title, current: "webhooks", can_delete: can_delete,
503510 if let Some((text, is_error)) = notice {
504511 if is_error {
@@ -529,7 +536,7 @@ async fn hook_form(
529536 lang: Lang,
530537 ) -> Result<impl View> {
531538 Ok(view! {
532- <form method="post" action=(action.as_str()) class="fields">
539+ <form method="post" action=(action.as_str())>
533540 if let Some(message) = error {
534541 alert(message: message.as_str())
535542 }
@@ -550,20 +557,27 @@ async fn hook_form(
550557 <section class="sec">
551558 <h2>(crate::pages::passkeys::s(lang, "Delivery", "Teslimat"))</h2>
552559 <div class="field" role="group" aria-labelledby="hook-events-title">
553- <p class="field-title" id="hook-events-title">(g::t(lang, K::Events))</p>
554- for event in events.iter() {
560+ <span class="field-label" id="hook-events-title">(g::t(lang, K::Events))</span>
561+ <div class="checks">
562+ for event in events.iter() {
563+ <label class="switch">
564+ <input type="checkbox" name=(event.name.as_str()) value="on" checked=(event.checked)>
565+ <span>(event.label)</span>
566+ </label>
567+ }
568+ </div>
569+ </div>
570+ <div class="field">
571+ <span class="field-label">(crate::pages::passkeys::s(lang, "State", "Durum"))</span>
572+ <div class="checks">
555573 <label class="switch">
556- <input type="checkbox" name=(event.name.as_str()) value="on" checked=(event.checked)>
557- <span>(event.label)</span>
574+ <input type="checkbox" name="active" value="on" checked=(active)>
575+ <span>(g::t(lang, K::ActiveField))</span>
558576 </label>
559- }
577+ </div>
560578 </div>
561- <label class="switch">
562- <input type="checkbox" name="active" value="on" checked=(active)>
563- <span>(g::t(lang, K::ActiveField))</span>
564- </label>
579+ <button type="submit" class="primary">(submit)</button>
565580 </section>
566- <button type="submit" class="primary">(submit)</button>
567581 </form>
568582 })
569583 }
@@ -574,32 +588,20 @@ async fn hooks_list_body(
574588 title: String,
575589 notice: Option<(&'static str, bool)>,
576590 archived: bool,
577- csrf: String,
578591 rows: Vec<HookRow>,
579592 lang: Lang,
580593 ) -> Result<impl View> {
581594 let new_action = format!("{}/new", hooks_href(&title));
582- let blank = HookDraft::blank();
583- let events = event_boxes(lang, &blank.events);
595+ let add = (!archived).then(|| (new_action, g::t(lang, K::AddWebhook)));
584596 let empty = rows.is_empty();
585597 Ok(view! {
586- frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang,
598+ frame_top(head: head, title: title.clone(), heading: g::t(lang, K::Webhooks).to_owned(), notice: notice, archived: archived, lang: lang, action: add,
587599 <section class="sec">
588- <h2>(g::t(lang, K::Webhooks))</h2>
589600 if empty {
590601 <p class="state">(g::t(lang, K::NoWebhooks))</p>
591602 } else {
592603 <p class="hint">(g::t(lang, K::WebhooksIntro))</p>
593604 }
594- if !archived {
595- <div class="acts">
596- reveal(label: g::t(lang, K::AddWebhook), id: Some("add-webhook"),
597- hook_form(action: new_action, csrf: csrf, url: String::new(), events: events,
598- active: blank.active, secret_hint: g::t(lang, K::SecretHintNew).to_owned(),
599- error: None, submit: g::t(lang, K::CreateWebhook), lang: lang)
600- )
601- </div>
602- }
603605 for row in rows.iter() {
604606 <a class="line" href=(row.href.as_str()) data-kb-row="">
605607 <span class="name"><span class=(row.dot_class) role="img" aria-label=(row.dot_text) title=(row.dot_text)></span> (row.url.as_str())</span>
@@ -686,8 +688,14 @@ async fn hook_body(
686688 let test_action = format!("{edit_action}/test");
687689 let delete_action = format!("{edit_action}/delete");
688690 let events = event_boxes(lang, &draft.events);
691+ // The hook's name is its URL; a hook with no URL yet shows the list's name.
692+ let heading = if draft.url.is_empty() {
693+ g::t(lang, K::Webhooks).to_owned()
694+ } else {
695+ draft.url.clone()
696+ };
689697 Ok(view! {
690- frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang,
698+ frame_top(head: head, title: title.clone(), heading: heading, notice: notice, archived: archived, lang: lang,
691699 if archived {
692700 <section class="sec">
693701 <h2>(crate::pages::passkeys::s(lang, "Endpoint", "Uç nokta"))</h2>
@@ -732,7 +740,7 @@ async fn hooks_list_page(cx: &Cx) -> Result<impl View> {
732740 let owner = path_param::<Owner>(cx);
733741 let name = path_param::<Repo>(cx);
734742 let ctx = load_repo(cx, owner, name).await?;
735- let (_, session) = require_user(cx).await?;
743+ require_user(cx).await?;
736744 if !ctx.can_admin() {
737745 return Err(forbidden().into());
738746 }
@@ -759,11 +767,10 @@ async fn hooks_list_page(cx: &Cx) -> Result<impl View> {
759767 rows.push(hook_row(lang, tz, &frame.title, hook, last, &last_stamp));
760768 }
761769 let notice = notice_from_query(cx, lang);
762- let csrf = session.csrf_token.clone();
763770 Ok(view! {
764771 shell(title: frame.page_title.as_str(), viewer: ctx.viewer.as_ref(),
765772 hooks_list_body(head: frame.head, title: frame.title, notice: notice,
766- archived: frame.archived, csrf: csrf, rows: rows, lang: lang))
773+ archived: frame.archived, rows: rows, lang: lang))
767774 })
768775 }
769776
@@ -803,9 +810,8 @@ async fn hook_new_body(
803810 let events = event_boxes(lang, &draft.events);
804811 let back = hooks_href(&title);
805812 Ok(view! {
806- frame_top(head: head, title: title.clone(), notice: None, archived: archived, lang: lang,
813+ frame_top(head: head, title: title.clone(), heading: g::t(lang, K::AddWebhook).to_owned(), notice: None, archived: archived, lang: lang,
807814 <section class="sec">
808- <h2>(g::t(lang, K::AddWebhook))</h2>
809815 <p class="hint">(g::t(lang, K::AddWebhookIntro))</p>
810816 <div class="acts">
811817 <a class="act quiet" href=(back.as_str())>(g::t(lang, K::BackToWebhooks))</a>
@@ -1722,7 +1728,7 @@ mod tests {
17221728 assert!(body.contains("Add webhook"), "{body}");
17231729 assert!(body.contains("none yet"), "{body}");
17241730 assert!(
1725- body.contains("<nav class=\"sub\" aria-label=\"Settings\">"),
1731+ body.contains("<nav class=\"rail\" aria-label=\"Settings\">"),
17261732 "{body}"
17271733 );
17281734 let (status, _, body) = send(
crates/forge-web/src/pages/review_requests.rsmodified+26 -28
@@ -13,7 +13,6 @@ use topcoat::router::error::{SeeOther, forbidden, not_found, see_other};
1313 use topcoat::router::request::uri;
1414 use topcoat::router::response::Response;
1515 use topcoat::router::{Body, StatusCode, page, path_param, route};
16-use crate::views::parts::reveal;
1716 use topcoat::view::{View, component, view};
1817
1918 use crate::auth::{current_user, require_user};
@@ -22,9 +21,11 @@ use crate::i18n::{self, Lang};
2221 use crate::live::{Topic, stream_wakes};
2322 use crate::notify;
2423 use crate::pages::issue_parts::{ItemKind, check_write, may_change, parse_number};
24+use crate::pages::passkeys::s;
2525 use crate::pages::repo_ctx::{RepoCtx, load_repo};
2626 use crate::state::AppState;
27-use crate::views::{rel_time, repo_href, shell};
27+use crate::views::parts::{SubPart, head, post_act, reveal};
28+use crate::views::{alert, rel_time, repo_href, shell};
2829
2930 path_param!(owner);
3031 path_param!(repo);
@@ -210,28 +211,22 @@ pub(crate) async fn reviewers_box(lang: Lang, reviewers: ReviewersView) -> Resul
210211 } = reviewers;
211212 let message = error.map(|code| error_text(lang, code));
212213 Ok(view! {
213- <section class="sec reviewers-box" id="reviewers">
214+ <section class="sec meta" id="reviewers">
214215 <h2>(ga::t(lang, AK::Reviewers))</h2>
215216 if let Some(message) = message {
216- <p class="alert" role="alert">(message)</p>
217+ alert(message: message)
217218 }
218219 if names.is_empty() {
219- <p class="state">(ga::t(lang, AK::NoReviewers))</p>
220+ <p class="hint">(ga::t(lang, AK::NoReviewers))</p>
221+ }
222+ for name in names.iter() {
223+ <div class="line">
224+ <span class="name"><a href=(format!("/{name}"))>(name.as_str())</a></span>
225+ if write {
226+ post_act(label: ga::t(lang, AK::WithdrawRequest), action: action.as_str(), csrf: csrf.as_str(), fields: vec![("action".to_owned(), "withdraw".to_owned()), ("username".to_owned(), name.to_owned())])
227+ }
228+ </div>
220229 }
221- <div class="plain-rows">
222- for name in names.iter() {
223- <div class="line">
224- <a class="name" href=(format!("/{name}"))>(name.as_str())</a>
225- if write {
226- <form method="post" action=(action.as_str()) class="act-form">
227- <input type="hidden" name="csrf" value=(csrf.as_str())>
228- <input type="hidden" name="username" value=(name.as_str())>
229- <button type="submit" name="action" value="withdraw" class="act quiet">(ga::t(lang, AK::WithdrawRequest))</button>
230- </form>
231- }
232- </div>
233- }
234- </div>
235230 if write {
236231 <div class="acts">
237232 reveal(label: ga::t(lang, AK::RequestReview), id: Some("request-review"),
@@ -291,16 +286,19 @@ async fn review_requests(cx: &Cx) -> Result<impl View> {
291286 }
292287 let heading = ga::t(lang, AK::ReviewRequests);
293288 let empty = rows.is_empty();
289+ let sub = vec![SubPart::text(s(
290+ lang,
291+ "Pull requests waiting for your review",
292+ "İncelemeni bekleyen değişiklik istekleri",
293+ ))];
294294 Ok(view! {
295295 shell(title: heading, viewer: Some(&viewer),
296- <section data-live="/review-requests/events">
297- <h1 class="sr-only">(heading)</h1>
298- </section>
299- if empty {
300- <p class="state">(ga::t(lang, AK::NoReviewRequests))</p>
301- }
302- if !empty {
303- <div class="plain-rows">
296+ head(title: heading, sub: sub, live: Some("/review-requests/events"))
297+ <div class="sheet">
298+ <div class="sec">
299+ if empty {
300+ <p class="state">(ga::t(lang, AK::NoReviewRequests))</p>
301+ }
304302 for row in rows.iter() {
305303 <a class="line" href=(row.1.as_str()) data-kb-row="">
306304 <span class="name">(row.2.as_str())</span>
@@ -310,7 +308,7 @@ async fn review_requests(cx: &Cx) -> Result<impl View> {
310308 </a>
311309 }
312310 </div>
313- }
311+ </div>
314312 )
315313 })
316314 }
crates/forge-web/src/pages/settings_appearance.rsmodified+64 -48
@@ -24,7 +24,9 @@ use crate::custom_colour;
2424 use crate::i18n::accents::{accent_name, base_name};
2525 use crate::i18n::misc::{self as g, K};
2626 use crate::i18n::{self, Lang};
27+use crate::pages::passkeys::s;
2728 use crate::state::AppState;
29+use crate::views::parts::{SubPart, head};
2830 use crate::views::shell;
2931
3032 /// Language codes offered on the page. `auto` follows the browser. Other codes must be
@@ -316,9 +318,10 @@ async fn colour_row(row: ColourRow) -> Result<impl View> {
316318 "accent-swatch hue-swatch"
317319 };
318320 Ok(view! {
319- <div class="colour-line">
320321 <fieldset class="colour-picker" data-colour-row="true" data-kind=(kind) data-lightness=(lightness.as_str())>
321- <legend>(legend)</legend>
322+ <legend class="sr-only">(legend)</legend>
323+ <div class="field">
324+ <span class="field-label" aria-hidden="true">(legend)</span>
322325 <div class="colour-choices">
323326 for choice in choices.into_iter() {
324327 <label class="colour-choice">
@@ -336,15 +339,13 @@ async fn colour_row(row: ColourRow) -> Result<impl View> {
336339 <span class="accent-swatch" data-accent-light-swatch=(choice.value) aria-hidden="true"></span>
337340 }
338341 }
339- <span>(choice.label)</span>
342+ <span class="sr-only">(choice.label)</span>
340343 </label>
341344 }
342- </div>
343- <div class="hue-row">
344345 <label class="colour-choice">
345346 <input type="radio" name=(field) value=(value.as_str()) checked=(stripe.custom) data-hue-custom="true" data-autosubmit="true">
346347 <span class=(custom_swatch) aria-hidden="true"></span>
347- <span>(custom_label)</span>
348+ <span class="sr-only">(custom_label)</span>
348349 </label>
349350 <div class="tune">
350351 <input type="range" class="hue-stripe" min="0" max="359" value=(hue_value.as_str()) aria-label=(hue_label) data-hue-stripe="true" data-autosubmit="true">
@@ -355,8 +356,8 @@ async fn colour_row(row: ColourRow) -> Result<impl View> {
355356 <small class="hex-note" data-hex-note="true" data-message=(note)></small>
356357 </div>
357358 </div>
359+ </div>
358360 </fieldset>
359- </div>
360361 })
361362 }
362363
@@ -429,42 +430,45 @@ async fn appearance_body(page: AppearancePage) -> Result<impl View> {
429430 sound_on,
430431 } = page;
431432 Ok(view! {
433+ <div class="sheet fit">
432434 <form id="appearance-form" method="post" action="/settings/appearance" class="appearance" data-appearance="true">
433- <h1 class="sr-only">(g::t(lang, K::Appearance))</h1>
434435 <input type="hidden" name="csrf" value=(csrf.as_str())>
435436 <section class="sec">
436- <h2>(crate::pages::passkeys::s(lang, "Theme and language", "Tema ve dil"))</h2>
437- <div class="field-pair">
438- <div class="field">
439- <label for="theme">(g::t(lang, K::ThemeLabel))</label>
440- <select id="theme" name="theme" data-autosubmit="true">
441- for choice in theme.into_iter() {
442- <option value=(choice.value) selected=(choice.selected)>(choice.label)</option>
443- }
444- </select>
445- <p class="hint">(g::t(lang, K::MatchSystemHelp))</p>
446- </div>
447- <div class="field">
448- <label for="language">(g::t(lang, K::LanguageLabel))</label>
449- <select id="language" name="language" data-autosubmit="true">
450- for choice in language.into_iter() {
451- <option value=(choice.value) selected=(choice.selected)>(choice.label)</option>
452- }
453- </select>
437+ <h2>(s(lang, "Theme and language", "Tema ve dil"))</h2>
438+ <div class="field">
439+ <span class="field-label" id="theme-label">(g::t(lang, K::ThemeLabel))</span>
440+ <div class="choice" role="radiogroup" aria-labelledby="theme-label">
441+ for choice in theme.into_iter() {
442+ <label>
443+ <input type="radio" name="theme" value=(choice.value) checked=(choice.selected) data-autosubmit="true">
444+ <span>(choice.label)</span>
445+ </label>
446+ }
454447 </div>
455448 </div>
449+ <div class="field">
450+ <label for="language">(g::t(lang, K::LanguageLabel))</label>
451+ <select id="language" name="language" data-autosubmit="true">
452+ for choice in language.into_iter() {
453+ <option value=(choice.value) selected=(choice.selected)>(choice.label)</option>
454+ }
455+ </select>
456+ </div>
456457 </section>
457458 <section class="sec">
458459 <h2>(colours)</h2>
459460 <fieldset class="colour-group" data-colour-group="true" data-tab=(tab)>
460461 <legend class="sr-only">(colours)</legend>
461- <div class="tabs" role="group">
462- for choice in tabs.into_iter() {
463- <label>
464- <input type="radio" name="colour_tab" value=(choice.value) checked=(choice.selected) data-colour-tab=(choice.value)>
465- <span>(choice.label)</span>
466- </label>
467- }
462+ <div class="field">
463+ <span class="field-label" id="colour-tab-label">(s(lang, "For", "Tema"))</span>
464+ <div class="choice" role="radiogroup" aria-labelledby="colour-tab-label">
465+ for choice in tabs.into_iter() {
466+ <label>
467+ <input type="radio" name="colour_tab" value=(choice.value) checked=(choice.selected) data-colour-tab=(choice.value)>
468+ <span>(choice.label)</span>
469+ </label>
470+ }
471+ </div>
468472 </div>
469473 colour_panel(group: light)
470474 colour_panel(group: dark)
@@ -473,23 +477,27 @@ async fn appearance_body(page: AppearancePage) -> Result<impl View> {
473477 <section class="sec">
474478 <h2>(g::t(lang, K::SoundLabel))</h2>
475479 <input type="hidden" name="sound_shown" value="1">
476- <label class="switch">
477- <input type="checkbox" name="sound" value="on" checked=(sound_on) data-autosubmit="true">
478- <span>(g::t(lang, K::SoundSwitch))</span>
479- </label>
480- <p class="hint">(g::t(lang, K::SoundOwnRuns)) " · " (g::t(lang, K::SoundFootOwn))</p>
481- <div class="line">
482- <span class="name">(g::t(lang, K::SoundPassed))</span>
483- <span class="val">(g::t(lang, K::SoundPassedNote))</span>
484- <button type="button" class="act" data-sound-play="passed">(g::t(lang, K::SoundPlay))</button>
485- </div>
486- <div class="line">
487- <span class="name">(g::t(lang, K::SoundFailed))</span>
488- <span class="val">(g::t(lang, K::SoundFailedNote))</span>
489- <button type="button" class="act" data-sound-play="failed">(g::t(lang, K::SoundPlay))</button>
480+ <div class="field">
481+ <span class="field-label" id="alerts-label">(s(lang, "Run alerts", "Çalışma uyarıları"))</span>
482+ <div class="sound-row">
483+ <div class="choice" role="radiogroup" aria-labelledby="alerts-label">
484+ <label>
485+ <input type="radio" name="sound" value="on" checked=(sound_on) data-autosubmit="true">
486+ <span>(s(lang, "On", "Açık"))</span>
487+ </label>
488+ <label>
489+ <input type="radio" name="sound" value="off" checked=(!sound_on) data-autosubmit="true">
490+ <span>(s(lang, "Off", "Kapalı"))</span>
491+ </label>
492+ </div>
493+ <span class="hint">(g::t(lang, K::SoundOwnRuns))</span>
494+ <button type="button" class="act play" data-sound-play="passed" title=(g::t(lang, K::SoundPassedNote))>(g::t(lang, K::SoundPassed))</button>
495+ <button type="button" class="act play" data-sound-play="failed" title=(g::t(lang, K::SoundFailedNote))>(g::t(lang, K::SoundFailed))</button>
496+ </div>
490497 </div>
491498 </section>
492499 </form>
500+ </div>
493501 })
494502 }
495503
@@ -597,8 +605,16 @@ async fn appearance_page(cx: &Cx) -> Result<impl View> {
597605 .user_prefs(&viewer.0.id)
598606 .await?;
599607 let page = page_for(&viewer, lang, &prefs);
608+ let sub = vec![SubPart::text(s(
609+ lang,
610+ "Saved to your account, follows you on every device",
611+ "Hesabına kaydedilir, her cihazda seninle gelir",
612+ ))];
600613 Ok(view! {
601- shell(title: g::t(lang, K::Appearance), viewer: Some(&viewer), appearance_body(page: page))
614+ shell(title: g::t(lang, K::Appearance), viewer: Some(&viewer),
615+ head(title: g::t(lang, K::Appearance), sub: sub)
616+ appearance_body(page: page)
617+ )
602618 })
603619 }
604620
crates/forge-web/src/pages/settings_export.rsmodified+8 -9
@@ -26,6 +26,7 @@ use crate::i18n::migrate::{self as g, K};
2626 use crate::i18n::{self, Lang};
2727 use crate::pages::ci_runs::{changed_event, events_response};
2828 use crate::state::AppState;
29+use crate::views::parts::{SubPart, head};
2930 use crate::views::{alert, csrf_field, human_size, rel_time, shell};
3031
3132 path_param!(export_id);
@@ -62,19 +63,17 @@ async fn export_view(lang: Lang, csrf: &str, exports: Vec<DataExport>) -> Result
6263 let empty = exports.is_empty();
6364 let ttl_note = g::export_ttl_note(lang, exporter::EXPORT_TTL_DAYS);
6465 Ok(view! {
65- <h1 class="sr-only">(g::t(lang, K::ExportTitle))</h1>
66- <div class="export-page" data-live=(live.as_deref()) data-live-state=(if building { "building" } else { "idle" })>
66+ head(title: g::t(lang, K::ExportTitle), sub: vec![SubPart::text(g::t(lang, K::ExportIntro))],
67+ <form method="post" action="/settings/export">
68+ csrf_field(token: csrf)
69+ <button type="submit" class="primary" disabled=(building)>(g::t(lang, K::ExportRequest))</button>
70+ </form>
71+ )
72+ <div class="sheet fit export-page" data-live=(live.as_deref()) data-live-state=(if building { "building" } else { "idle" })>
6773 <section class="sec">
6874 <h2>(crate::pages::passkeys::s(lang, "Archive", "Arşiv"))</h2>
69- <p class="hint">(g::t(lang, K::ExportIntro))</p>
7075 <p class="hint">(g::t(lang, K::ExportContents))</p>
7176 <p class="hint">(g::t(lang, K::ExportEmailNote)) " " (ttl_note.as_str())</p>
72- <div class="acts">
73- <form method="post" action="/settings/export" class="act-form">
74- csrf_field(token: csrf)
75- <button type="submit" class="act" disabled=(building)>(g::t(lang, K::ExportRequest))</button>
76- </form>
77- </div>
7877 </section>
7978 <section class="sec">
8079 <h2>(crate::pages::passkeys::s(lang, "Your archives", "Arşivleriniz"))</h2>
crates/forge-web/src/pages/settings_gpg.rsmodified+54 -47
@@ -8,7 +8,7 @@ use topcoat::Result;
88 use topcoat::context::{Cx, app_context};
99 use topcoat::router::content::Form;
1010 use topcoat::router::error::{SeeOther, not_found, see_other};
11-use topcoat::router::{page, route};
11+use topcoat::router::{page, query_params, route};
1212 use topcoat::view::{View, component, view};
1313
1414 use crate::audit::{self, Actor, Target};
@@ -16,8 +16,9 @@ use crate::auth::{require_csrf, require_user};
1616 use crate::i18n::{self, Key, Lang, t};
1717 use crate::signatures;
1818 use crate::state::AppState;
19-use crate::pages::settings_keys::{KeysDraft, keys_page_view};
20-use crate::views::parts::{confirm_act, reveal};
19+use crate::pages::passkeys::s;
20+use crate::pages::settings_keys::{AddQuery, KeyKind, KeysDraft, keys_page_view};
21+use crate::views::parts::confirm_act;
2122 use crate::views::{added_status, alert, user_facing_message};
2223
2324 #[derive(Deserialize)]
@@ -44,58 +45,64 @@ pub(crate) async fn gpg_section(
4445 armored: &str,
4546 error: Option<String>,
4647 available: bool,
48+ add: bool,
4749 ) -> Result<impl View> {
4850 let empty = keys.is_empty();
49- let open = error.is_some();
5051 Ok(view! {
51- <section class="sec" id="gpg">
52- <h2>(t(lang, Key::GpgKeys))</h2>
53- if !available {
54- <p class="hint">(t(lang, Key::GpgUnavailable))</p>
55- }
56- if empty {
57- <p class="state">(t(lang, Key::NoGpgKeys))</p>
58- }
59- <div>
60- for key in keys.into_iter() {
61- <details class="row-open">
62- <summary class="line">
63- <span class="name">(key.emails.join(", "))</span>
64- <span class="val">added_status(lang: lang, added: Some(key.created_at.as_str()), used: None)</span>
65- </summary>
66- <div class="opened">
67- <code class="hint">(key.fingerprint.clone())</code>
68- <div class="acts">
69- confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/gpg/delete", csrf: csrf, fields: vec![("id".to_owned(), key.id.clone())])
70- </div>
71- </div>
72- </details>
52+ if !available {
53+ <p class="state">(t(lang, Key::GpgUnavailable))</p>
54+ }
55+ if add {
56+ <div class="sheet-add" id="add-gpg-key">
57+ if let Some(message) = error {
58+ alert(message: message.as_str())
7359 }
74- </div>
75- <div class="acts">
76- reveal(label: t(lang, Key::AddKeyButton), id: Some("add-gpg-key"), open: open,
77- if let Some(message) = error {
78- alert(message: message.as_str())
79- }
80- <form method="post" action="/settings/gpg" class="fields">
81- <input type="hidden" name="csrf" value=(csrf)>
82- <div class="field">
83- <label for="gpg-key">(t(lang, Key::ArmoredPublicKeyLabel))</label>
84- <textarea id="gpg-key" name="armored" rows="8" spellcheck="false" required=(true)>(armored)</textarea>
85- <p class="hint">(t(lang, Key::ArmoredHint))</p>
86- </div>
60+ <form method="post" action="/settings/gpg" class="fields">
61+ <input type="hidden" name="csrf" value=(csrf)>
62+ <div class="field">
63+ <label for="gpg-key">(t(lang, Key::ArmoredPublicKeyLabel))</label>
64+ <textarea id="gpg-key" name="armored" rows="8" spellcheck="false" required=(true)>(armored)</textarea>
65+ <p class="hint">(t(lang, Key::ArmoredHint))</p>
66+ </div>
67+ <div class="acts asks">
8768 <button type="submit" class="primary">(t(lang, Key::AddKeyButton))</button>
88- </form>
89- )
69+ <a class="act" href="/settings/gpg">(s(lang, "Keep it", "Vazgeç"))</a>
70+ </div>
71+ </form>
9072 </div>
91- </section>
73+ }
74+ if empty {
75+ <p class="state">(t(lang, Key::NoGpgKeys))</p>
76+ }
77+ for key in keys.into_iter() {
78+ <details class="row-open">
79+ <summary class="line">
80+ <span class="name">(key.emails.join(", "))</span>
81+ <span class="val">added_status(lang: lang, added: Some(key.created_at.as_str()), used: None)</span>
82+ </summary>
83+ <div class="opened">
84+ <code class="hint">(key.fingerprint.clone())</code>
85+ <div class="acts">
86+ confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/gpg/delete", csrf: csrf, fields: vec![("id".to_owned(), key.id.clone())])
87+ </div>
88+ </div>
89+ </details>
90+ }
9291 })
9392 }
9493
95-#[route(GET "/settings/gpg")]
96-async fn gpg_page(cx: &Cx) -> Result<SeeOther> {
97- require_user(cx).await?;
98- Ok(see_other("/settings/keys#gpg"))
94+#[page("/settings/gpg")]
95+async fn gpg_page(cx: &Cx) -> Result<impl View> {
96+ let viewer = require_user(cx).await?;
97+ let lang = i18n::lang(cx, Some(&viewer.0));
98+ let state = app_context::<AppState>(cx);
99+ let draft = KeysDraft {
100+ add: query_params::<AddQuery>(cx)?.add.is_some(),
101+ ..KeysDraft::default()
102+ };
103+ Ok(view! {
104+ keys_page_view(lang: lang, state: state, viewer: &viewer, kind: KeyKind::Gpg, draft: draft)
105+ })
99106 }
100107
101108 #[page(POST "/settings/gpg")]
@@ -143,7 +150,7 @@ async fn gpg_add(cx: &Cx, Form(form): Form<AddKeyForm>) -> Result<impl View> {
143150 ..KeysDraft::default()
144151 };
145152 Ok(view! {
146- keys_page_view(lang: lang, state: state, viewer: &viewer, draft: draft)
153+ keys_page_view(lang: lang, state: state, viewer: &viewer, kind: KeyKind::Gpg, draft: draft)
147154 })
148155 }
149156
crates/forge-web/src/pages/settings_gpg_tests.rsmodified+3 -11
@@ -157,17 +157,9 @@ async fn gpg_refusals_and_the_listing_share_one_site() {
157157 "the key survives refused deletes"
158158 );
159159
160- // The GPG page now redirects to the keys page, which lists the key.
161- let redirect = call(&site, "GET", "/settings/gpg", Some(&cookie), None).await;
162- assert_eq!(redirect.status, 303, "gpg page redirects");
163- assert_eq!(
164- redirect.location.as_deref(),
165- Some("/settings/keys#gpg"),
166- "gpg page redirects to the keys page"
167- );
168-
169- // The listing is read from the keys page. The notice shows only when GPG is missing on this server.
170- let reply = call(&site, "GET", "/settings/keys", Some(&cookie), None).await;
160+ // The listing is the GPG kind of the keys page. The notice shows only when GPG is missing on this
161+ // server.
162+ let reply = call(&site, "GET", "/settings/gpg", Some(&cookie), None).await;
171163 assert_eq!(reply.status, 200, "listing page");
172164 assert!(
173165 reply.body.contains(FINGERPRINT),
crates/forge-web/src/pages/settings_keys.rsmodified+148 -51
@@ -1,5 +1,5 @@
1-//! Page: keys (`/settings/keys`): SSH keys, GPG keys and access tokens on one page. Only ed25519
2-//! and ECDSA SSH keys are accepted.
1+//! Page: keys (`/settings/keys`, `/settings/gpg`, `/settings/tokens`): SSH keys, GPG keys and access
2+//! tokens, one kind at a time, with the kinds in the rail. Only ed25519 and ECDSA SSH keys are accepted.
33
44 use base64::prelude::{BASE64_STANDARD, BASE64_STANDARD_NO_PAD, Engine as _};
55 use forge_core::{AuditAction, Session, SshKey, User};
@@ -9,7 +9,7 @@ use topcoat::Result;
99 use topcoat::context::{Cx, app_context};
1010 use topcoat::router::content::Form;
1111 use topcoat::router::error::{SeeOther, see_other};
12-use topcoat::router::{page, route};
12+use topcoat::router::{page, query_params, route};
1313 use topcoat::view::{View, component, view};
1414
1515 use crate::audit::{self, Actor, Target};
@@ -18,7 +18,8 @@ use crate::i18n::{self, Key, Lang, t, unsupported_key_type};
1818 use crate::state::AppState;
1919 use crate::pages::settings_gpg::gpg_section;
2020 use crate::pages::settings_tokens::tokens_section;
21-use crate::views::parts::{confirm_act, reveal};
21+use crate::pages::passkeys::s;
22+use crate::views::parts::{RailItem, SubPart, confirm_act, head, rail};
2223 use crate::views::{added_status, alert, shell, user_facing_message};
2324
2425 /// Algorithms accepted for web-registered keys. `ssh-rsa` is rejected with its own message.
@@ -148,14 +149,64 @@ pub(crate) struct KeysDraft {
148149 pub gpg_error: Option<String>,
149150 pub token: Option<String>,
150151 pub token_error: Option<String>,
152+ /// The add form is open, by `?add` or because it came back with an error.
153+ pub add: bool,
151154 }
152155
153-/// The keys page for the viewer, with what a form sent back.
156+/// Which kind of key the page shows.
157+#[derive(Clone, Copy, PartialEq, Eq)]
158+pub(crate) enum KeyKind {
159+ Ssh,
160+ Gpg,
161+ Tokens,
162+}
163+
164+impl KeyKind {
165+ fn href(self) -> &'static str {
166+ match self {
167+ KeyKind::Ssh => "/settings/keys",
168+ KeyKind::Gpg => "/settings/gpg",
169+ KeyKind::Tokens => "/settings/tokens",
170+ }
171+ }
172+
173+ fn title(self, lang: Lang) -> &'static str {
174+ match self {
175+ KeyKind::Ssh => t(lang, Key::SshKeys),
176+ KeyKind::Gpg => t(lang, Key::GpgKeys),
177+ KeyKind::Tokens => t(lang, Key::AccessTokens),
178+ }
179+ }
180+
181+ fn add_label(self, lang: Lang) -> &'static str {
182+ match self {
183+ KeyKind::Ssh => s(lang, "Add SSH key", "SSH anahtarı ekle"),
184+ KeyKind::Gpg => s(lang, "Add GPG key", "GPG anahtarı ekle"),
185+ KeyKind::Tokens => t(lang, Key::NewToken),
186+ }
187+ }
188+
189+ fn about(self, lang: Lang) -> &'static str {
190+ match self {
191+ KeyKind::Ssh => s(lang, "Push and pull over SSH", "SSH ile gönder ve çek"),
192+ KeyKind::Gpg => s(lang, "Verify the commits you sign", "İmzaladığın commit'leri doğrula"),
193+ KeyKind::Tokens => s(lang, "Sign in from the command line and from scripts", "Komut satırından ve betiklerden giriş yap"),
194+ }
195+ }
196+}
197+
198+#[query_params(error = bad_request)]
199+pub(crate) struct AddQuery {
200+ pub add: Option<String>,
201+}
202+
203+/// The keys page for the viewer, one kind at a time, with what a form sent back.
154204 #[component]
155205 pub(crate) async fn keys_page_view(
156206 lang: Lang,
157207 state: &AppState,
158208 viewer: &(User, Session),
209+ kind: KeyKind,
159210 draft: KeysDraft,
160211 ) -> Result<impl View> {
161212 let keys = state.store.list_ssh_keys(&viewer.0.id).await?;
@@ -163,15 +214,58 @@ pub(crate) async fn keys_page_view(
163214 let tokens = state.store.list_tokens(&viewer.0.id).await?;
164215 let available = crate::signatures::gpg_available(state).await;
165216 let csrf = viewer.1.csrf_token.as_str();
217+ let count = |k: KeyKind| match k {
218+ KeyKind::Ssh => keys.len(),
219+ KeyKind::Gpg => gpg_keys.len(),
220+ KeyKind::Tokens => tokens.len(),
221+ };
222+ let items: Vec<RailItem> = [KeyKind::Ssh, KeyKind::Gpg, KeyKind::Tokens]
223+ .into_iter()
224+ .map(|k| RailItem {
225+ name: k.title(lang).to_owned(),
226+ val: count(k).to_string(),
227+ href: k.href().to_owned(),
228+ current: k == kind,
229+ })
230+ .collect();
231+ let sub = vec![
232+ SubPart::text(kind.about(lang)),
233+ SubPart::text(key_count(lang, count(kind))),
234+ ];
235+ let add_href = format!("{}?add", kind.href());
236+ let add_open = draft.add
237+ || draft.ssh_error.is_some()
238+ || draft.gpg_error.is_some()
239+ || draft.token_error.is_some();
166240 Ok(view! {
167- shell(title: pk_title(lang), viewer: Some(viewer),
168- ssh_section(lang: lang, csrf: csrf, keys: keys, public_key: draft.public_key.as_str(), error: draft.ssh_error)
169- gpg_section(lang: lang, csrf: csrf, keys: gpg_keys, armored: draft.armored.as_str(), error: draft.gpg_error, available: available)
170- tokens_section(lang: lang, csrf: csrf, tokens: tokens, created: draft.token, error: draft.token_error)
241+ shell(title: kind.title(lang), viewer: Some(viewer),
242+ head(title: kind.title(lang), sub: sub,
243+ <a class="button primary" href=(add_href)>(kind.add_label(lang))</a>
244+ )
245+ <div class="work">
246+ rail(label: pk_title(lang), items: items)
247+ <div class="sheet fit">
248+ if kind == KeyKind::Ssh {
249+ ssh_section(lang: lang, csrf: csrf, keys: keys, public_key: draft.public_key.as_str(), error: draft.ssh_error, add: add_open)
250+ } else if kind == KeyKind::Gpg {
251+ gpg_section(lang: lang, csrf: csrf, keys: gpg_keys, armored: draft.armored.as_str(), error: draft.gpg_error, available: available, add: add_open)
252+ } else {
253+ tokens_section(lang: lang, csrf: csrf, tokens: tokens, created: draft.token, error: draft.token_error, add: add_open)
254+ }
255+ </div>
256+ </div>
171257 )
172258 })
173259 }
174260
261+fn key_count(lang: Lang, n: usize) -> String {
262+ match lang {
263+ Lang::Tr => format!("{n} anahtar"),
264+ Lang::En if n == 1 => "1 key".to_owned(),
265+ Lang::En => format!("{n} keys"),
266+ }
267+}
268+
175269 fn pk_title(lang: Lang) -> &'static str {
176270 crate::pages::passkeys::s(lang, "Keys", "Anahtarlar")
177271 }
@@ -183,52 +277,51 @@ async fn ssh_section(
183277 keys: Vec<SshKey>,
184278 public_key: &str,
185279 error: Option<String>,
280+ add: bool,
186281 ) -> Result<impl View> {
187282 let empty = keys.is_empty();
188- let open = error.is_some();
189283 Ok(view! {
190- <section class="sec" id="ssh">
191- <h2>(t(lang, Key::SshKeys))</h2>
192- if empty {
193- <p class="state">(t(lang, Key::NoSshKeys))</p>
194- }
195- <div>
196- for key in keys.into_iter() {
197- <details class="row-open">
198- <summary class="line">
199- <span class="name">(key.title.clone())</span>
200- <span class="val">(key.algorithm.clone()) " · " added_status(lang: lang, added: Some(key.created_at.as_str()), used: key.last_used_at.as_deref())</span>
201- </summary>
202- <div class="opened">
203- <code class="hint">(key.fingerprint.clone())</code>
204- <div class="acts">
205- confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/keys/delete", csrf: csrf, fields: vec![("id".to_owned(), key.id.clone())])
206- </div>
207- </div>
208- </details>
284+ if add {
285+ <div class="sheet-add" id="add-key">
286+ if let Some(message) = error {
287+ alert(message: message.as_str())
209288 }
210- </div>
211- <div class="acts">
212- reveal(label: t(lang, Key::AddKeyButton), id: Some("add-key"), open: open,
213- if let Some(message) = error {
214- alert(message: message.as_str())
215- }
216- <form data-hard="true" method="post" action="/settings/keys" class="fields">
217- <input type="hidden" name="csrf" value=(csrf)>
218- <div class="field">
219- <label for="ssh-title">(t(lang, Key::TitleOptional))</label>
220- <input id="ssh-title" type="text" name="title" maxlength="100" autocomplete="off">
221- </div>
222- <div class="field">
223- <label for="ssh-key">(t(lang, Key::PublicKeyLabel))</label>
224- <textarea id="ssh-key" name="public_key" rows="4" spellcheck="false" required=(true)>(public_key)</textarea>
225- <p class="hint">(t(lang, Key::PublicKeyHint))</p>
226- </div>
289+ <form data-hard="true" method="post" action="/settings/keys" class="fields">
290+ <input type="hidden" name="csrf" value=(csrf)>
291+ <div class="field">
292+ <label for="ssh-title">(t(lang, Key::TitleOptional))</label>
293+ <input id="ssh-title" type="text" name="title" maxlength="100" autocomplete="off">
294+ </div>
295+ <div class="field">
296+ <label for="ssh-key">(t(lang, Key::PublicKeyLabel))</label>
297+ <textarea id="ssh-key" name="public_key" rows="4" spellcheck="false" required=(true)>(public_key)</textarea>
298+ <p class="hint">(t(lang, Key::PublicKeyHint))</p>
299+ </div>
300+ <div class="acts asks">
227301 <button type="submit" class="primary">(t(lang, Key::AddKeyButton))</button>
228- </form>
229- )
302+ <a class="act" href="/settings/keys">(s(lang, "Keep it", "Vazgeç"))</a>
303+ </div>
304+ </form>
230305 </div>
231- </section>
306+ }
307+ if empty {
308+ <p class="state">(t(lang, Key::NoSshKeys))</p>
309+ }
310+ for key in keys.into_iter() {
311+ <details class="row-open">
312+ <summary class="line">
313+ <span class="name">(key.title.clone())</span>
314+ <span class="val mono">(key.fingerprint.chars().take(15).collect::<String>())</span>
315+ <span class="val">added_status(lang: lang, added: Some(key.created_at.as_str()), used: key.last_used_at.as_deref())</span>
316+ </summary>
317+ <div class="opened">
318+ <code class="hint">(key.algorithm.clone()) " " (key.fingerprint.clone())</code>
319+ <div class="acts">
320+ confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/keys/delete", csrf: csrf, fields: vec![("id".to_owned(), key.id.clone())])
321+ </div>
322+ </div>
323+ </details>
324+ }
232325 })
233326 }
234327
@@ -237,8 +330,12 @@ async fn keys_page(cx: &Cx) -> Result<impl View> {
237330 let viewer = require_user(cx).await?;
238331 let lang = i18n::lang(cx, Some(&viewer.0));
239332 let state = app_context::<AppState>(cx);
333+ let draft = KeysDraft {
334+ add: query_params::<AddQuery>(cx)?.add.is_some(),
335+ ..KeysDraft::default()
336+ };
240337 Ok(view! {
241- keys_page_view(lang: lang, state: state, viewer: &viewer, draft: KeysDraft::default())
338+ keys_page_view(lang: lang, state: state, viewer: &viewer, kind: KeyKind::Ssh, draft: draft)
242339 })
243340 }
244341
@@ -297,7 +394,7 @@ async fn keys_add(cx: &Cx, Form(form): Form<AddKeyForm>) -> Result<impl View> {
297394 ..KeysDraft::default()
298395 };
299396 Ok(view! {
300- keys_page_view(lang: lang, state: state, viewer: &viewer, draft: draft)
397+ keys_page_view(lang: lang, state: state, viewer: &viewer, kind: KeyKind::Ssh, draft: draft)
301398 })
302399 }
303400
crates/forge-web/src/pages/settings_notifications.rsmodified+72 -69
@@ -17,8 +17,9 @@ use topcoat::view::{View, component, view};
1717 use crate::auth::{require_csrf, require_user};
1818 use crate::i18n::push as push_text;
1919 use crate::i18n::{self, Key, Lang, t};
20+use crate::pages::passkeys::s;
2021 use crate::state::AppState;
21-use crate::views::parts::confirm_act;
22+use crate::views::parts::{SubPart, confirm_act, head};
2223 use crate::views::{csrf_field, rel_time, shell};
2324
2425 #[query_params(error = bad_request)]
@@ -70,80 +71,82 @@ async fn notifications_body(page: NotificationsPage) -> Result<impl View> {
7071 // locked and the notes below say why.
7172 let blocked = unverified_note.is_some() || server_note.is_some();
7273 Ok(view! {
73- <h1 class="sr-only">(t(lang, Key::Notifications))</h1>
74+ head(title: t(lang, Key::Notifications), sub: vec![SubPart::text(s(lang, "Email, and push to your devices", "E-posta ve cihazlarına bildirim"))])
7475 if let Some(message) = notice {
7576 <p class="state" role="status">(message.as_str())</p>
7677 }
77- <section class="sec" id="email">
78- <h2>(crate::pages::passkeys::s(lang, "Email", "E-posta"))</h2>
79- <form id="notify-form" method="post" action="/settings/notifications" class="notify-form">
80- <input type="hidden" name="csrf" value=(csrf.as_str())>
81- </form>
82- <label class="switch">
83- <input type="checkbox" form="notify-form" name="email_notifications" value="1" checked=(on) disabled=(blocked) data-autosubmit="true">
84- <span>(t(lang, Key::EmailNotifyLabel))</span>
85- </label>
86- <p class="hint">(t(lang, Key::EmailNotifyHelp))</p>
87- if let Some(message) = server_note {
88- <p class="hint warn" role="note">(message)</p>
89- }
90- if let Some(message) = unverified_note {
91- <p class="hint" role="note">(message)</p>
92- }
93- <noscript>
78+ <div class="sheet">
79+ <section class="sec" id="email">
80+ <h2>(s(lang, "Email", "E-posta"))</h2>
81+ <form id="notify-form" method="post" action="/settings/notifications" class="notify-form">
82+ <input type="hidden" name="csrf" value=(csrf.as_str())>
83+ </form>
84+ <label class="switch">
85+ <input type="checkbox" form="notify-form" name="email_notifications" value="1" checked=(on) disabled=(blocked) data-autosubmit="true">
86+ <span>(t(lang, Key::EmailNotifyLabel))</span>
87+ </label>
88+ <p class="hint">(t(lang, Key::EmailNotifyHelp))</p>
89+ if let Some(message) = server_note {
90+ <p class="hint warn" role="note">(message)</p>
91+ }
92+ if let Some(message) = unverified_note {
93+ <p class="hint" role="note">(message)</p>
94+ }
95+ <noscript>
96+ <div class="acts">
97+ <button type="submit" form="notify-form" class="primary" disabled=(blocked)>(t(lang, Key::Save))</button>
98+ </div>
99+ </noscript>
100+ </section>
101+ <section class="sec" id="device" data-push="true" data-live="/settings/notifications/push/events">
102+ <h2>(push_text::t(lang, push_text::K::DeviceHeading))</h2>
103+ <p class="state" data-push-state="on" hidden=(true)>(push_text::t(lang, push_text::K::DeviceOn))</p>
104+ <p class="state" data-push-state="off" hidden=(true)>(push_text::t(lang, push_text::K::DeviceOff))</p>
105+ <p class="hint">(push_text::t(lang, push_text::K::DeviceHelp))</p>
106+ <p class="hint" role="note" data-push-state="unsupported" hidden=(true)>(push_text::t(lang, push_text::K::DeviceUnsupported))</p>
107+ <p class="hint" role="note" data-push-state="https" hidden=(true)>(push_text::t(lang, push_text::K::DeviceNeedsHttps))</p>
108+ <p class="hint" role="note" data-push-state="ios" hidden=(true)>(push_text::t(lang, push_text::K::DeviceIosHint))</p>
109+ <p class="hint" role="note" data-push-state="denied" hidden=(true)>(push_text::t(lang, push_text::K::DeviceDenied))</p>
110+ <p class="hint warn" role="alert" data-push-state="error" hidden=(true)>(push_text::t(lang, push_text::K::DeviceError))</p>
94111 <div class="acts">
95- <button type="submit" form="notify-form" class="primary" disabled=(blocked)>(t(lang, Key::Save))</button>
112+ <button type="button" class="act" data-push-action="enable" hidden=(true)>(push_text::t(lang, push_text::K::TurnOn))</button>
113+ <button type="button" class="act quiet" data-push-action="disable" hidden=(true)>(push_text::t(lang, push_text::K::TurnOff))</button>
114+ <form method="post" action="/settings/notifications/push/test">
115+ csrf_field(token: csrf.as_str())
116+ <button type="submit" class="act" data-push-test="true" disabled=(!can_test)>(push_text::t(lang, push_text::K::SendTest))</button>
117+ </form>
96118 </div>
97- </noscript>
98- </section>
99- <section class="sec" id="device" data-push="true" data-live="/settings/notifications/push/events">
100- <h2>(push_text::t(lang, push_text::K::DeviceHeading))</h2>
101- <p class="state" data-push-state="on" hidden=(true)>(push_text::t(lang, push_text::K::DeviceOn))</p>
102- <p class="state" data-push-state="off" hidden=(true)>(push_text::t(lang, push_text::K::DeviceOff))</p>
103- <p class="hint">(push_text::t(lang, push_text::K::DeviceHelp))</p>
104- <p class="hint" role="note" data-push-state="unsupported" hidden=(true)>(push_text::t(lang, push_text::K::DeviceUnsupported))</p>
105- <p class="hint" role="note" data-push-state="https" hidden=(true)>(push_text::t(lang, push_text::K::DeviceNeedsHttps))</p>
106- <p class="hint" role="note" data-push-state="ios" hidden=(true)>(push_text::t(lang, push_text::K::DeviceIosHint))</p>
107- <p class="hint" role="note" data-push-state="denied" hidden=(true)>(push_text::t(lang, push_text::K::DeviceDenied))</p>
108- <p class="hint warn" role="alert" data-push-state="error" hidden=(true)>(push_text::t(lang, push_text::K::DeviceError))</p>
109- <div class="acts">
110- <button type="button" class="act" data-push-action="enable" hidden=(true)>(push_text::t(lang, push_text::K::TurnOn))</button>
111- <button type="button" class="act quiet" data-push-action="disable" hidden=(true)>(push_text::t(lang, push_text::K::TurnOff))</button>
112- <form method="post" action="/settings/notifications/push/test" class="act-form">
113- csrf_field(token: csrf.as_str())
114- <button type="submit" class="act" data-push-test="true" disabled=(!can_test)>(push_text::t(lang, push_text::K::SendTest))</button>
115- </form>
116- </div>
117- if !can_test {
118- <p class="hint">(push_text::t(lang, push_text::K::TestNoDevices))</p>
119- }
120- </section>
121- <section class="sec" id="devices">
122- <h2>(push_text::t(lang, push_text::K::DevicesHeading))</h2>
123- if devices.is_empty() {
124- <p class="state">(push_text::t(lang, push_text::K::DevicesEmpty))</p>
125- }
126- for device in devices.into_iter() {
127- <details class="row-open">
128- <summary class="line">
129- <span class="name">(device.agent_label.as_str())</span>
130- <span class="val">(push_text::added_label(lang)) " " rel_time(lang: lang, stamp: device.created_at.as_str())</span>
131- </summary>
132- <div class="opened">
133- <p class="hint">
134- if let Some(stamp) = device.last_success_at.as_deref() {
135- (push_text::last_delivered_label(lang)) " " rel_time(lang: lang, stamp: stamp)
136- } else {
137- (push_text::t(lang, push_text::K::NeverDelivered))
138- }
139- </p>
140- <div class="acts">
141- confirm_act(lang: lang, label: push_text::t(lang, push_text::K::RemoveDevice), action: "/settings/notifications/push/remove", csrf: csrf.as_str(), fields: vec![("id".to_owned(), device.id.clone())])
119+ if !can_test {
120+ <p class="hint">(push_text::t(lang, push_text::K::TestNoDevices))</p>
121+ }
122+ </section>
123+ <section class="sec" id="devices">
124+ <h2>(push_text::t(lang, push_text::K::DevicesHeading))</h2>
125+ if devices.is_empty() {
126+ <p class="state">(push_text::t(lang, push_text::K::DevicesEmpty))</p>
127+ }
128+ for device in devices.into_iter() {
129+ <details class="row-open">
130+ <summary class="line">
131+ <span class="name">(device.agent_label.as_str())</span>
132+ <span class="val">(push_text::added_label(lang)) " " rel_time(lang: lang, stamp: device.created_at.as_str())</span>
133+ </summary>
134+ <div class="opened">
135+ <p class="hint">
136+ if let Some(stamp) = device.last_success_at.as_deref() {
137+ (push_text::last_delivered_label(lang)) " " rel_time(lang: lang, stamp: stamp)
138+ } else {
139+ (push_text::t(lang, push_text::K::NeverDelivered))
140+ }
141+ </p>
142+ <div class="acts">
143+ confirm_act(lang: lang, label: push_text::t(lang, push_text::K::RemoveDevice), action: "/settings/notifications/push/remove", csrf: csrf.as_str(), fields: vec![("id".to_owned(), device.id.clone())])
144+ </div>
142145 </div>
143- </div>
144- </details>
145- }
146- </section>
146+ </details>
147+ }
148+ </section>
149+ </div>
147150 })
148151 }
149152
crates/forge-web/src/pages/settings_profile.rsmodified+5 -2
@@ -23,8 +23,9 @@ use crate::audit::{self, Actor, Target};
2323 use crate::auth::{require_csrf, require_user};
2424 use crate::i18n::{self, Key, Lang, about_too_long, display_name_too_long, t};
2525 use crate::live::Topic;
26+use crate::pages::passkeys::s;
2627 use crate::state::AppState;
27-use crate::views::parts::{confirm_act, reveal};
28+use crate::views::parts::{SubPart, confirm_act, head, reveal};
2829 use crate::views::{alert, avatar_url, shell, user_facing_message};
2930
3031 /// Longest "about" text, in characters.
@@ -140,10 +141,11 @@ async fn profile_body(page: ProfilePage) -> Result<impl View> {
140141 } = page;
141142 let avatar_open = errors.avatar.is_some();
142143 Ok(view! {
143- <h1 class="sr-only">(t(lang, Key::Profile))</h1>
144+ head(title: t(lang, Key::Profile), sub: vec![SubPart::text(s(lang, "What others see on your profile", "Başkalarının profilinde gördükleri"))])
144145 if let Some(message) = notice {
145146 <p class="state" role="status">(message)</p>
146147 }
148+ <div class="sheet fit">
147149 <section class="sec">
148150 <h2>(t(lang, Key::Avatar))</h2>
149151 <img class="avatar" src=(avatar_src.as_str()) alt=(t(lang, Key::AvatarAlt)) width="48" height="48">
@@ -216,6 +218,7 @@ async fn profile_body(page: ProfilePage) -> Result<impl View> {
216218 </div>
217219 </section>
218220 </form>
221+ </div>
219222 })
220223 }
221224
crates/forge-web/src/pages/settings_security.rsmodified+90 -3
@@ -28,7 +28,7 @@ use crate::i18n::{self, Key, Lang, password_too_long, password_too_short, t};
2828 use crate::pages::passkeys::{PasskeyPanel, build_panel, passkeys_panel, s};
2929 use crate::state::AppState;
3030 use crate::throttle::{self, LOGIN_USER_LIMIT, TWO_FACTOR_USER_LIMIT};
31-use crate::views::parts::{post_act, reveal};
31+use crate::views::parts::{RailItem, SubPart, head, post_act, rail, reveal};
3232 use crate::views::{added_status, alert, rel_time, shell, user_facing_message};
3333
3434 /// Shortest and longest new passwords, in characters.
@@ -44,6 +44,8 @@ const MAX_DEVICE_NAME_CHARS: usize = 40;
4444 #[query_params(error = bad_request)]
4545 struct SecurityQuery {
4646 saved: Option<String>,
47+ /// The topic to show: password, email, two-factor, passkeys, sessions or danger.
48+ part: Option<String>,
4749 }
4850
4951 #[derive(Deserialize)]
@@ -130,6 +132,8 @@ struct Shown {
130132 codes: Option<Vec<String>>,
131133 /// Set when a check was refused by the throttle. The response then answers 429.
132134 throttled: Option<Duration>,
135+ /// The topic asked for in the address.
136+ part: Option<String>,
133137 }
134138
135139 /// Which two-factor panel an error belongs to. That panel stays open with its message.
@@ -184,6 +188,8 @@ struct SecurityPage {
184188 owned_repos: Vec<String>,
185189 /// Web sessions open on the account, the count the Sessions topic shows.
186190 session_count: usize,
191+ /// The topic asked for in the address, when no error or notice picks one.
192+ part: Option<String>,
187193 }
188194
189195 #[component]
@@ -208,8 +214,10 @@ async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
208214 passkeys,
209215 owned_repos,
210216 session_count,
217+ part,
211218 } = page;
212219 let two_factor_on = two_factor.is_some();
220+ let passkey_count = passkeys.items.len();
213221 let pending_set = pending.is_some();
214222 let password_open = password_error.is_some();
215223 let email_open = email_error.is_some();
@@ -227,11 +235,73 @@ async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
227235 let delete_open = delete_error.is_some();
228236 let delete_blocked = !owned_repos.is_empty();
229237 let sessions_line = format!("{session_count} {}", s(lang, "active", "etkin"));
238+ let two_factor_val = if two_factor_on {
239+ t(lang, Key::PillOn)
240+ } else {
241+ t(lang, Key::PillOff)
242+ };
243+ // One topic shows at a time: the one with an error or fresh codes, else the one asked for.
244+ const TOPICS: [&str; 6] = ["password", "email", "two-factor", "passkeys", "sessions", "danger"];
245+ let active: &'static str = if password_open {
246+ "password"
247+ } else if email_open {
248+ "email"
249+ } else if regenerate_open || disable_open || setup_error.is_some() || codes.is_some() || (pending_set && part.is_none()) {
250+ "two-factor"
251+ } else if delete_open {
252+ "danger"
253+ } else {
254+ part.as_deref()
255+ .and_then(|asked| TOPICS.into_iter().find(|topic| *topic == asked))
256+ .unwrap_or("password")
257+ };
258+ // The kinds of security, one per topic. Each shows its topic in the sheet.
259+ let items: Vec<RailItem> = vec![
260+ RailItem {
261+ name: t(lang, Key::Password).to_owned(),
262+ val: String::new(),
263+ href: "?part=password".to_owned(),
264+ current: active == "password",
265+ },
266+ RailItem {
267+ name: t(lang, Key::Email).to_owned(),
268+ val: String::new(),
269+ href: "?part=email".to_owned(),
270+ current: active == "email",
271+ },
272+ RailItem {
273+ name: t(lang, Key::TwoFactorAuth).to_owned(),
274+ val: two_factor_val.to_owned(),
275+ href: "?part=two-factor".to_owned(),
276+ current: active == "two-factor",
277+ },
278+ RailItem {
279+ name: s(lang, "Passkeys", "Geçiş anahtarları").to_owned(),
280+ val: passkey_count.to_string(),
281+ href: "?part=passkeys".to_owned(),
282+ current: active == "passkeys",
283+ },
284+ RailItem {
285+ name: t(lang, Key::Sessions).to_owned(),
286+ val: session_count.to_string(),
287+ href: "?part=sessions".to_owned(),
288+ current: active == "sessions",
289+ },
290+ RailItem {
291+ name: t(lang, Key::DangerZone).to_owned(),
292+ val: String::new(),
293+ href: "?part=danger".to_owned(),
294+ current: active == "danger",
295+ },
296+ ];
230297 Ok(view! {
231- <h1 class="sr-only">(t(lang, Key::Security))</h1>
298+ head(title: t(lang, Key::Security), sub: vec![SubPart::text(s(lang, "Sign-in, email, two-factor, passkeys and sessions", "Giriş, e-posta, iki adımlı doğrulama, geçiş anahtarları ve oturumlar"))])
232299 if let Some(message) = notice {
233300 <p class="state" role="status">(message)</p>
234301 }
302+ <div class="work">
303+ rail(label: t(lang, Key::Security), items: items)
304+ <div class="sheet" data-topic=(active)>
235305 <section class="sec" id="password">
236306 <h2>(t(lang, Key::Password))</h2>
237307 if let Some(stamp) = password_changed {
@@ -436,6 +506,8 @@ async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
436506 </div>
437507 }
438508 </section>
509+ </div>
510+ </div>
439511 })
440512 }
441513
@@ -554,6 +626,7 @@ async fn build_page(
554626 password_changed,
555627 two_factor,
556628 session_count: state.store.list_sessions(&viewer.0.id).await?.len(),
629+ part: shown.part,
557630 })
558631 }
559632
@@ -652,9 +725,23 @@ fn check_new_password(lang: Lang, new: &str, confirm: &str) -> Option<String> {
652725 async fn security_page(cx: &Cx) -> Result<impl View> {
653726 let viewer = require_user(cx).await?;
654727 let lang = i18n::lang(cx, Some(&viewer.0));
655- let saved = query_params::<SecurityQuery>(cx)?.saved.clone();
728+ let query = query_params::<SecurityQuery>(cx)?;
729+ let saved = query.saved.clone();
730+ // A notice belongs to a topic: the page opens on it.
731+ let part = query.part.clone().or_else(|| {
732+ saved.as_deref().map(|saved| {
733+ match saved {
734+ "password" => "password",
735+ "2fa-off" => "two-factor",
736+ s if s.starts_with("passkey") => "passkeys",
737+ _ => "email",
738+ }
739+ .to_owned()
740+ })
741+ });
656742 let shown = Shown {
657743 notice: notice_for(lang, saved.as_deref()),
744+ part,
658745 ..Shown::default()
659746 };
660747 respond(cx, viewer, shown).await
crates/forge-web/src/pages/settings_sessions.rsmodified+24 -15
@@ -15,9 +15,9 @@ use crate::auth::{logout, require_csrf, require_user};
1515 use crate::i18n::{self, Key, Lang, t};
1616 use crate::pages::passkeys::s;
1717 use crate::state::AppState;
18-use crate::views::parts::confirm_act;
18+use crate::views::parts::{SubPart, confirm_act, head};
1919 use crate::views::{rel_time, shell};
20-use crate::web_push::agent_label;
20+use crate::web_push::agent_label_in;
2121
2222 #[derive(Deserialize)]
2323 struct RevokeForm {
@@ -38,7 +38,7 @@ fn session_label(lang: Lang, session: &Session) -> String {
3838 session
3939 .user_agent
4040 .as_deref()
41- .map_or_else(|| t(lang, Key::UnknownBrowser).to_owned(), agent_label)
41+ .map_or_else(|| t(lang, Key::UnknownBrowser).to_owned(), |agent| agent_label_in(lang, agent))
4242 }
4343
4444 #[component]
@@ -50,13 +50,13 @@ async fn sessions_view(
5050 ) -> Result<impl View> {
5151 let others = sessions.iter().filter(|s| s.id != current_id).count();
5252 Ok(view! {
53- <h1 class="sr-only">(t(lang, Key::Sessions))</h1>
54- if others > 0 {
55- <div class="acts">
56- confirm_act(lang: lang, label: t(lang, Key::RevokeAllOthers), action: "/settings/sessions/revoke-others", csrf: csrf, note: Some(s(lang, "Every other browser is signed out at once. This one stays signed in.", "Diğer tüm tarayıcılarda oturum hemen kapanır. Bu tarayıcıda oturum açık kalır.").to_owned()))
57- </div>
58- }
59- <div>
53+ head(title: t(lang, Key::Sessions), sub: vec![SubPart::text(s(lang, "Where you are signed in", "Oturum açık olduğun yerler"))])
54+ <div class="sheet fit">
55+ if others > 0 {
56+ <div class="acts">
57+ confirm_act(lang: lang, label: t(lang, Key::RevokeAllOthers), action: "/settings/sessions/revoke-others", csrf: csrf, note: Some(s(lang, "Every other browser is signed out at once. This one stays signed in.", "Diğer tüm tarayıcılarda oturum hemen kapanır. Bu tarayıcıda oturum açık kalır.").to_owned()))
58+ </div>
59+ }
6060 for session in sessions.into_iter() {
6161 <details class="row-open">
6262 <summary class="line">
@@ -70,7 +70,9 @@ async fn sessions_view(
7070 </summary>
7171 <div class="opened">
7272 session_details(lang: lang, csrf: csrf, session: session.clone(), current: session.id == current_id)
73- <p class="back-act"><a class="act" href=(format!("/settings/sessions/{}", session.id))>(s(lang, "Open page", "Sayfayı aç"))</a></p>
73+ <div class="acts">
74+ <a class="act" href=(format!("/settings/sessions/{}", session.id))>(s(lang, "Open page", "Sayfayı aç"))</a>
75+ </div>
7476 </div>
7577 </details>
7678 }
@@ -128,11 +130,18 @@ async fn session_detail_view(
128130 session: Session,
129131 current: bool,
130132 ) -> Result<impl View> {
133+ let label = session_label(lang, &session);
131134 Ok(view! {
132- <h1 class="h1">(session_label(lang, &session))</h1>
133- <p class="hint">(i18n::dated_label(lang, Key::LastSeen)) " " rel_time(lang: lang, stamp: session.last_seen.as_str())</p>
134- session_details(lang: lang, csrf: csrf, session: session.clone(), current: current)
135- <p class="back-act"><a class="act" href="/settings/sessions">(t(lang, Key::BackToSessions))</a></p>
135+ head(title: label.as_str())
136+ <div class="sheet fit">
137+ <div class="sheet-tools">
138+ <a class="act" href="/settings/sessions">(t(lang, Key::BackToSessions))</a>
139+ </div>
140+ <section class="sec">
141+ <p class="hint">(i18n::dated_label(lang, Key::LastSeen)) " " rel_time(lang: lang, stamp: session.last_seen.as_str())</p>
142+ session_details(lang: lang, csrf: csrf, session: session.clone(), current: current)
143+ </section>
144+ </div>
136145 })
137146 }
138147
crates/forge-web/src/pages/settings_tokens.rsmodified+74 -67
@@ -13,7 +13,7 @@ use topcoat::context::{Cx, app_context};
1313 use topcoat::router::content::Form;
1414 use topcoat::router::error::{SeeOther, see_other};
1515 use topcoat::router::response::response_headers;
16-use topcoat::router::{page, route};
16+use topcoat::router::{page, query_params, route};
1717 use topcoat::view::{View, component, view};
1818
1919 use crate::api::packages::PACKAGES_SCOPE;
@@ -22,9 +22,10 @@ use crate::auth::{require_csrf, require_user};
2222 use crate::i18n::packages::{self as pk, K as PK};
2323 use crate::i18n::releases_ci::{self as rc, K as RC};
2424 use crate::i18n::{self, Key, Lang, t, token_name_length};
25-use crate::pages::settings_keys::{KeysDraft, keys_page_view};
25+use crate::pages::passkeys::s;
26+use crate::pages::settings_keys::{AddQuery, KeyKind, KeysDraft, keys_page_view};
2627 use crate::state::AppState;
27-use crate::views::parts::{confirm_act, reveal};
28+use crate::views::parts::confirm_act;
2829 use crate::views::{alert, rel_time, rel_time_or_never};
2930
3031 /// Scopes are fixed to `repo` for M1.
@@ -78,79 +79,85 @@ pub(crate) async fn tokens_section(
7879 tokens: Vec<AccessToken>,
7980 created: Option<String>,
8081 error: Option<String>,
82+ add: bool,
8183 ) -> Result<impl View> {
8284 let empty = tokens.is_empty();
83- let open = error.is_some();
8485 Ok(view! {
85- <section class="sec" id="tokens">
86- <h2>(t(lang, Key::AccessTokens))</h2>
87- if let Some(token) = created {
88- <div class="opened" role="status" data-once="">
89- <p class="state">(t(lang, Key::YourNewToken))</p>
90- <p class="hint">(t(lang, Key::CopyNow))</p>
91- <div class="copy-box">
92- <pre class="code"><code id="new-token">(token)</code></pre>
93- <button type="button" data-copy="new-token" data-copied=(rc::t(lang, RC::CopyDone)) data-failed=(rc::t(lang, RC::CopyFailed))>(pk::t(lang, PK::CopyCommand))</button>
94- </div>
95- <p class="hint">(t(lang, Key::UseAsPassword))</p>
86+ if let Some(token) = created {
87+ <div class="sheet-add" role="status" data-once="">
88+ <p class="state">(t(lang, Key::YourNewToken))</p>
89+ <p class="hint">(t(lang, Key::CopyNow))</p>
90+ <div class="copy-box">
91+ <pre class="code"><code id="new-token">(token)</code></pre>
92+ <button type="button" class="small" data-copy="new-token" data-copied=(rc::t(lang, RC::CopyDone)) data-failed=(rc::t(lang, RC::CopyFailed))>(pk::t(lang, PK::CopyCommand))</button>
9693 </div>
97- }
98- if empty {
99- <p class="state">(t(lang, Key::NoAccessTokens))</p>
100- }
101- <div>
102- for token in tokens.into_iter() {
103- <details class="row-open">
104- <summary class="line">
105- <span class="name">(token.name.clone())</span>
106- <span class="val">(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())</span>
107- </summary>
108- <div class="opened">
109- <p class="hint">(i18n::dated_label(lang, Key::Created)) " " rel_time(lang: lang, stamp: token.created_at.as_str())</p>
110- <div class="acts">
111- confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/tokens/delete", csrf: csrf, fields: vec![("id".to_owned(), token.id.clone())], note: Some(delete_message(lang).to_owned()))
112- </div>
113- </div>
114- </details>
115- }
94+ <p class="hint">(t(lang, Key::UseAsPassword))</p>
11695 </div>
117- <div class="acts">
118- reveal(label: t(lang, Key::NewToken), id: Some("add-token"), open: open,
119- if let Some(message) = error {
120- alert(message: message.as_str())
121- }
122- <form method="post" action="/settings/tokens" class="fields">
123- <input type="hidden" name="csrf" value=(csrf)>
124- <div class="field">
125- <label for="token-name">(t(lang, Key::Name))</label>
126- <input id="token-name" type="text" name="name" maxlength="64" required=(true) autocomplete="off">
127- </div>
128- <div class="field">
129- <label for="token-expires">(t(lang, Key::Expires))</label>
130- <select id="token-expires" name="expires">
131- <option value="30">(t(lang, Key::ExpiresIn30))</option>
132- <option value="90" selected=(true)>(t(lang, Key::ExpiresIn90))</option>
133- <option value="365">(t(lang, Key::ExpiresIn365))</option>
134- <option value="never">(t(lang, Key::ExpiresNever))</option>
135- </select>
136- </div>
137- <label class="switch">
138- <input type="checkbox" name="packages" value="on">
139- <span>(pk::t(lang, PK::ScopePackages))</span>
140- </label>
141- <p class="hint">(pk::t(lang, PK::ScopePackagesHelp)) " " (t(lang, Key::ScopeNote))</p>
96+ }
97+ if add {
98+ <div class="sheet-add" id="add-token">
99+ if let Some(message) = error {
100+ alert(message: message.as_str())
101+ }
102+ <form method="post" action="/settings/tokens" class="fields">
103+ <input type="hidden" name="csrf" value=(csrf)>
104+ <div class="field">
105+ <label for="token-name">(t(lang, Key::Name))</label>
106+ <input id="token-name" type="text" name="name" maxlength="64" required=(true) autocomplete="off">
107+ </div>
108+ <div class="field">
109+ <label for="token-expires">(t(lang, Key::Expires))</label>
110+ <select id="token-expires" name="expires">
111+ <option value="30">(t(lang, Key::ExpiresIn30))</option>
112+ <option value="90" selected=(true)>(t(lang, Key::ExpiresIn90))</option>
113+ <option value="365">(t(lang, Key::ExpiresIn365))</option>
114+ <option value="never">(t(lang, Key::ExpiresNever))</option>
115+ </select>
116+ </div>
117+ <label class="switch">
118+ <input type="checkbox" name="packages" value="on">
119+ <span>(pk::t(lang, PK::ScopePackages))</span>
120+ </label>
121+ <p class="hint">(pk::t(lang, PK::ScopePackagesHelp)) " " (t(lang, Key::ScopeNote))</p>
122+ <div class="acts asks">
142123 <button type="submit" class="primary">(t(lang, Key::CreateToken))</button>
143- </form>
144- )
124+ <a class="act" href="/settings/tokens">(s(lang, "Keep it", "Vazgeç"))</a>
125+ </div>
126+ </form>
145127 </div>
146- </section>
128+ }
129+ if empty {
130+ <p class="state">(t(lang, Key::NoAccessTokens))</p>
131+ }
132+ for token in tokens.into_iter() {
133+ <details class="row-open">
134+ <summary class="line">
135+ <span class="name">(token.name.clone())</span>
136+ <span class="val">(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())</span>
137+ </summary>
138+ <div class="opened">
139+ <p class="hint">(i18n::dated_label(lang, Key::Created)) " " rel_time(lang: lang, stamp: token.created_at.as_str())</p>
140+ <div class="acts">
141+ confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/tokens/delete", csrf: csrf, fields: vec![("id".to_owned(), token.id.clone())], note: Some(delete_message(lang).to_owned()))
142+ </div>
143+ </div>
144+ </details>
145+ }
147146 })
148147 }
149148
150-#[route(GET "/settings/tokens")]
151-async fn tokens_page(cx: &Cx) -> Result<SeeOther> {
152- require_user(cx).await?;
153- Ok(see_other("/settings/keys#tokens"))
149+#[page("/settings/tokens")]
150+async fn tokens_page(cx: &Cx) -> Result<impl View> {
151+ let viewer = require_user(cx).await?;
152+ let lang = i18n::lang(cx, Some(&viewer.0));
153+ let state = app_context::<AppState>(cx);
154+ let draft = KeysDraft {
155+ add: query_params::<AddQuery>(cx)?.add.is_some(),
156+ ..KeysDraft::default()
157+ };
158+ Ok(view! {
159+ keys_page_view(lang: lang, state: state, viewer: &viewer, kind: KeyKind::Tokens, draft: draft)
160+ })
154161 }
155162
156163 #[page(POST "/settings/tokens")]
@@ -214,7 +221,7 @@ async fn tokens_create(cx: &Cx, Form(form): Form<CreateTokenForm>) -> Result<imp
214221 ..KeysDraft::default()
215222 };
216223 Ok(view! {
217- keys_page_view(lang: lang, state: state, viewer: &viewer, draft: draft)
224+ keys_page_view(lang: lang, state: state, viewer: &viewer, kind: KeyKind::Tokens, draft: draft)
218225 })
219226 }
220227
crates/forge-web/src/pages/setup.rsmodified+4 -4
@@ -14,6 +14,7 @@ use crate::audit::{self, Actor, Target};
1414 use crate::auth::{check_pre_csrf, clear_pre_csrf, hash_password_async, login, pre_csrf_token};
1515 use crate::i18n::{self, Key, Lang, password_too_long, password_too_short, t};
1616 use crate::state::AppState;
17+use crate::views::parts::{SubPart, head};
1718 use crate::views::{alert, shell, user_facing_message};
1819
1920 const MIN_PASSWORD_CHARS: usize = 12;
@@ -42,9 +43,8 @@ async fn setup_form(
4243 error: Option<String>,
4344 ) -> Result<impl View> {
4445 Ok(view! {
45- <section>
46- <h1>(t(lang, Key::WelcomeToForge))</h1>
47- <p class="hint">(t(lang, Key::SetupSub))</p>
46+ head(title: t(lang, Key::WelcomeToForge), sub: vec![SubPart::text(t(lang, Key::SetupSub))])
47+ <div class="sheet fit">
4848 <form data-hard="true" method="post" action="/setup" class="fields">
4949 if let Some(message) = error {
5050 alert(message: message.as_str())
@@ -69,7 +69,7 @@ async fn setup_form(
6969 </div>
7070 <button type="submit" class="primary">(t(lang, Key::CreateAdmin))</button>
7171 </form>
72- </section>
72+ </div>
7373 })
7474 }
7575
crates/forge-web/src/pages/snippets.rsmodified+65 -67
@@ -27,7 +27,7 @@ use crate::pages::snippets_live::{bump_snippet, item_live_url, list_live_url};
2727 use crate::render::highlight::highlight_lines;
2828 use crate::render::markdown::render_markdown;
2929 use crate::state::AppState;
30-use crate::views::parts::confirm_act;
30+use crate::views::parts::{SubPart, confirm_act, head};
3131 use crate::views::{alert, empty_state, rel_time, shell, user_facing_message};
3232
3333 path_param!(id);
@@ -296,13 +296,12 @@ async fn snippet_list_body(
296296 live: Option<String>,
297297 ) -> Result<impl View> {
298298 Ok(view! {
299- <div data-live=(live.as_deref())>
300- <h1 class="sr-only">(g::t(lang, K::Snippets))</h1>
299+ head(title: g::t(lang, K::Snippets),
301300 if signed_in {
302- <div class="acts">
303- <a class="act" href="/snippets/new">(g::t(lang, K::NewSnippet))</a>
304- </div>
301+ <a class="button primary" href="/snippets/new">(g::t(lang, K::NewSnippet))</a>
305302 }
303+ )
304+ <div class="sheet" data-live=(live.as_deref())>
306305 if rows.is_empty() {
307306 empty_state(title: g::t(lang, K::NoSnippets))
308307 } else {
@@ -392,7 +391,6 @@ async fn snippet_form(
392391 lang: Lang,
393392 csrf: &str,
394393 action: &str,
395- heading: &str,
396394 title: &str,
397395 description: &str,
398396 visibility: &str,
@@ -415,7 +413,6 @@ async fn snippet_form(
415413 if let Some(message) = error {
416414 alert(message: message.as_str())
417415 }
418- <h1 class="sr-only">(heading)</h1>
419416 <form method="post" action=(action) class="fields snippet-form">
420417 <input type="hidden" name="csrf" value=(csrf)>
421418 <div class="field">
@@ -429,19 +426,21 @@ async fn snippet_form(
429426 placeholder=(g::t(lang, K::DescriptionOptional))>
430427 </div>
431428 <div class="field" role="radiogroup" aria-labelledby="snippet-visibility">
432- <p class="state" id="snippet-visibility">(g::t(lang, K::Visibility))</p>
433- <label class="switch" title=(g::t(lang, K::PublicOption))>
434- <input type="radio" name="visibility" value="public" checked=(public)>
435- <span>(g::t(lang, K::VisibilityPublic))</span>
436- </label>
437- <label class="switch" title=(g::t(lang, K::UnlistedOption))>
438- <input type="radio" name="visibility" value="unlisted" checked=(unlisted)>
439- <span>(g::t(lang, K::VisibilityUnlisted))</span>
440- </label>
441- <label class="switch" title=(g::t(lang, K::PrivateOption))>
442- <input type="radio" name="visibility" value="private" checked=(private)>
443- <span>(g::t(lang, K::VisibilityPrivate))</span>
444- </label>
429+ <label id="snippet-visibility">(g::t(lang, K::Visibility))</label>
430+ <div class="choice">
431+ <label title=(g::t(lang, K::PublicOption))>
432+ <input type="radio" name="visibility" value="public" checked=(public)>
433+ <span>(g::t(lang, K::VisibilityPublic))</span>
434+ </label>
435+ <label title=(g::t(lang, K::UnlistedOption))>
436+ <input type="radio" name="visibility" value="unlisted" checked=(unlisted)>
437+ <span>(g::t(lang, K::VisibilityUnlisted))</span>
438+ </label>
439+ <label title=(g::t(lang, K::PrivateOption))>
440+ <input type="radio" name="visibility" value="private" checked=(private)>
441+ <span>(g::t(lang, K::VisibilityPrivate))</span>
442+ </label>
443+ </div>
445444 </div>
446445 <button type="submit" class="primary">(g::t(lang, K::SaveSnippet))</button>
447446 snippet_files(lang: lang, slots: slots, active: active, removable: removable, can_add: can_add,
@@ -468,40 +467,39 @@ async fn snippet_body(
468467 let history_href = format!("/snippets/{snippet_id}/revisions");
469468 let delete_action = format!("/snippets/{snippet_id}/delete");
470469 Ok(view! {
471- <div data-live=(live.as_deref())>
472- <h1 class="h1">(title)</h1>
473- <p class="hint">(owner) " · " (visibility) " · " (g::updated_before(lang)) rel_time(lang: lang, stamp: updated_at) (g::updated_after(lang))</p>
474- </div>
475- if !description.is_empty() {
476- <p class="state">(description)</p>
477- }
478- <nav class="sub" aria-label=(g::t(lang, K::SnippetNav))>
479- <a href=(history_href)>(g::t(lang, K::Revisions))</a>
480- </nav>
481- if let Some(token) = owner_csrf {
482- <div class="acts">
483- <a class="act" href=(edit_href)>(g::t(lang, K::Edit))</a>
470+ head(title: title, sub: vec![SubPart::text(owner), SubPart::text(visibility)],
471+ <a class="button" href=(history_href)>(g::t(lang, K::Revisions))</a>
472+ if let Some(token) = owner_csrf {
473+ <a class="button" href=(edit_href)>(g::t(lang, K::Edit))</a>
484474 confirm_act(lang: lang, label: g::t(lang, K::Delete), action: delete_action.as_str(), csrf: token.as_str())
485- </div>
486- }
487- for file in files.into_iter() {
488- <section class="sec snippet-file">
489- <h2>(file.name.clone())</h2>
490- <nav class="sub" aria-label=(g::t(lang, K::FileNav))>
491- <a href=(file.raw.clone())>(g::t(lang, K::Raw))</a>
492- </nav>
493- if file.markdown {
494- <div class="markdown-body">(Unescaped::new_unchecked(file.body.clone()))</div>
495- } else if file.highlighted {
496- <pre class="code snippet-code"><code>(Unescaped::new_unchecked(file.body.clone()))</code></pre>
497- } else {
498- <pre class="code snippet-code"><code>(file.body.clone())</code></pre>
475+ }
476+ )
477+ <div class="sheet" data-live=(live.as_deref())>
478+ <section class="sec">
479+ if !description.is_empty() {
480+ <p>(description)</p>
481+ }
482+ <p class="hint">(g::updated_before(lang)) rel_time(lang: lang, stamp: updated_at) (g::updated_after(lang))</p>
483+ if !is_owner {
484+ <p class="hint">(g::t(lang, K::OnlyOwnerEdits))</p>
499485 }
500486 </section>
501- }
502- if !is_owner {
503- <p class="hint">(g::t(lang, K::OnlyOwnerEdits))</p>
504- }
487+ for file in files.into_iter() {
488+ <section class="sec snippet-file">
489+ <div class="sheet-tools">
490+ <strong>(file.name.clone())</strong>
491+ <a class="act" href=(file.raw.clone())>(g::t(lang, K::Raw))</a>
492+ </div>
493+ if file.markdown {
494+ <div class="markdown-body">(Unescaped::new_unchecked(file.body.clone()))</div>
495+ } else if file.highlighted {
496+ <pre class="code snippet-code"><code>(Unescaped::new_unchecked(file.body.clone()))</code></pre>
497+ } else {
498+ <pre class="code snippet-code"><code>(file.body.clone())</code></pre>
499+ }
500+ </section>
501+ }
502+ </div>
505503 })
506504 }
507505
@@ -516,24 +514,21 @@ async fn revisions_body(
516514 let back = format!("/snippets/{snippet_id}");
517515 let heading = g::revisions_of(lang, title);
518516 Ok(view! {
519- <div data-live=(live.as_deref())>
520- <h1 class="h1">(heading.as_str())</h1>
521- <nav class="sub">
522- <a href=(back)>(g::t(lang, K::BackToSnippet))</a>
523- </nav>
524- </div>
525- if revisions.is_empty() {
526- <p class="state">(g::t(lang, K::NoRevisions))</p>
527- } else {
528- <div>
517+ head(title: heading.as_str(),
518+ <a class="button" href=(back)>(g::t(lang, K::BackToSnippet))</a>
519+ )
520+ <div class="sheet" data-live=(live.as_deref())>
521+ if revisions.is_empty() {
522+ <p class="state">(g::t(lang, K::NoRevisions))</p>
523+ } else {
529524 for rev in revisions.into_iter() {
530525 <div class="line" data-kb-row="">
531526 <span class="name">(g::t(lang, K::RevisionLabel))(rev.number)</span>
532527 <span class="val">(rev.author) " · " rel_time(lang: lang, stamp: rev.at.as_str()) " · " (rev.file_names)</span>
533528 </div>
534529 }
535- </div>
536- }
530+ }
531+ </div>
537532 })
538533 }
539534
@@ -554,9 +549,12 @@ async fn snippet_form_page(
554549 let visibility = draft.visibility.clone();
555550 Ok(view! {
556551 shell(title: heading, viewer: Some(viewer),
557- snippet_form(lang: lang, csrf: csrf.as_str(), action: action, heading: heading,
558- title: title.as_str(), description: description.as_str(),
559- visibility: visibility.as_str(), slots: slots, active: active, error: error)
552+ head(title: heading)
553+ <div class="sheet">
554+ snippet_form(lang: lang, csrf: csrf.as_str(), action: action,
555+ title: title.as_str(), description: description.as_str(),
556+ visibility: visibility.as_str(), slots: slots, active: active, error: error)
557+ </div>
560558 )
561559 })
562560 }
crates/forge-web/src/pages/tree.rsmodified+89 -111
@@ -22,18 +22,18 @@ use crate::pages::code_live::{follows_branch, live_url};
2222 use crate::pages::finder::file_finder;
2323 use crate::pages::passkeys::s;
2424 use crate::pages::refs::{load_refs, ref_links};
25-use crate::pages::repo::{https_clone_url, readme_head, repo_head, ssh_clone_url};
25+use crate::pages::repo::repo_head;
2626 use crate::pages::repo_ctx::load_repo;
2727 use crate::pages::repo_side::{
28- commit_strip, repo_dock, run_rows, run_states, strip_bars, tree_facts,
28+ code_sub, commit_strip, run_pips, run_rows, tree_facts,
2929 };
3030 use crate::raw::raw_url;
3131 use crate::render::emoji::emojify;
3232 use crate::render::markdown::{LinkContext, render_markdown};
3333 use crate::state::AppState;
3434 use crate::views::{
35- Crumb, avatar_url, display_name, empty_state, iso_time, now_unix, ref_selector, relative_time,
36- repo_href, shell, short_oid, user_href,
35+ display_name, empty_state, iso_time, now_unix, ref_selector, relative_time, repo_href, shell,
36+ short_oid,
3737 };
3838
3939 /// Files at the root of a directory that count as its README, in priority order.
@@ -125,12 +125,6 @@ pub struct LatestBar {
125125 pub last: LastCommit,
126126 pub short: String,
127127 pub author: String,
128- /// Profile link, only when the author maps to a forge user.
129- pub author_href: Option<String>,
130- /// Avatar of that user. None for plain-text authors.
131- pub avatar: Option<String>,
132- /// The full commit message, body included, emoji rendered.
133- pub message: String,
134128 }
135129
136130 /// Latest commit bar for `dir` at `commit` (`""` is the root). Errors and timeouts leave the bar
@@ -163,21 +157,14 @@ pub async fn latest_bar(
163157 };
164158
165159 let user = author_account(state, repo, &info.author_email).await;
166- let (author, author_href, avatar) = match user {
167- Some(user) => (
168- display_name(lang, &user.username),
169- Some(user_href(&user.username)),
170- Some(avatar_url(&user.username, user.avatar_hash.as_deref())),
171- ),
172- None => (info.author_name.clone(), None, None),
160+ let author = match user {
161+ Some(user) => display_name(lang, &user.username),
162+ None => info.author_name.clone(),
173163 };
174164 Some(LatestBar {
175165 last: last_commit_view(lang, repo, &info, now_unix(), tz),
176166 short: short_oid(&info.oid).to_owned(),
177167 author,
178- author_href,
179- avatar,
180- message: emojify(&info.message).into_owned(),
181168 })
182169 }
183170
@@ -289,28 +276,6 @@ fn blob_href(repo: &RepoRow, ref_name: &str, rel: &str) -> Option<String> {
289276 ))
290277 }
291278
292-/// Breadcrumb for `path` under `kind` ("tree" or "blob"). Every segment links.
293-pub fn path_crumbs(repo: &RepoRow, ref_name: &str, kind: &str, path: &str) -> Vec<Crumb> {
294- let mut out = vec![Crumb {
295- label: repo.name.clone(),
296- href: Some(repo_href(&repo.owner_name, &repo.name, "", "")),
297- }];
298- let mut prefix = String::new();
299- for seg in path.split('/').filter(|s| !s.is_empty()) {
300- prefix = child_path(&prefix, seg);
301- out.push(Crumb {
302- label: seg.to_owned(),
303- href: Some(repo_href(
304- &repo.owner_name,
305- &repo.name,
306- kind,
307- &format!("{ref_name}/{prefix}"),
308- )),
309- });
310- }
311- out
312-}
313-
314279 /// Link context for markdown in the directory `dir`: relative links resolve against `dir`.
315280 pub fn link_context(state: &AppState, repo: &RepoRow, ref_name: &str, dir: &str) -> LinkContext {
316281 let at = |section: &str| {
@@ -382,32 +347,80 @@ pub async fn load_readme(
382347 }
383348 }
384349
385-/// One row of a listing: a stretched link to the entry (the whole row is the target), its icon,
386-/// its name and its age right after the name. Submodules have no page, so their row shows the short sha.
350+/// A folder's rows in the rail: its name, then its age. `current` marks the file the sheet shows.
351+/// Submodules have no page, so their row shows the short sha. A long folder scrolls here alone.
387352 #[component]
388-pub async fn tree_table(rows: Vec<EntryRow>, lang: Lang) -> Result<impl View> {
353+pub async fn tree_table(
354+ rows: Vec<EntryRow>,
355+ lang: Lang,
356+ #[default] current: Option<String>,
357+) -> Result<impl View> {
389358 Ok(view! {
390- <div class="tree-list">
359+ <div class="rail-list tree-list">
391360 for row in rows.into_iter() {
392- <div class="line tree-entry" data-kb-row="">
393- <span class="tree-kind">
394- if row.kind == "dir" {
395- <svg class="kind-icon is-dir" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>
396- } else {
397- <svg class="kind-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>
361+ if let Some(href) = row.href {
362+ <a class="rail-item tree-entry" href=(href) data-kb-row="" aria-current=((current.as_deref() == Some(row.name.as_str())).then_some("page"))>
363+ <span class="sr-only">(g::kind_label(lang, row.kind))</span>
364+ <span class="nm dir">(row.name)if row.kind == "dir" { "/" }</span>
365+ if let Some(last) = row.last {
366+ <time class="val" data-rel="true" datetime=(last.iso) title=(last.absolute)>(last.age)</time>
398367 }
368+ </a>
369+ } else {
370+ <div class="rail-item tree-entry" data-kb-row="">
399371 <span class="sr-only">(g::kind_label(lang, row.kind))</span>
400- </span>
401- if let Some(href) = row.href {
402- <a class="tree-entry-name" href=(href)>(row.name)</a>
403- } else {
404- <span class="tree-entry-name">(row.name)</span>
405- <span class="tree-entry-sha mono">(row.short)</span>
406- }
407- if let Some(last) = row.last {
408- <time class="tree-entry-age" data-rel="true" datetime=(last.iso) title=(last.absolute)>(last.age)</time>
409- }
410- </div>
372+ <span class="nm dir">(row.name)</span>
373+ <span class="val">(row.short)</span>
374+ </div>
375+ }
376+ }
377+ </div>
378+ })
379+}
380+
381+/// The sheet beside a folder: its README, with Source, History and Raw as tools, or `none`.
382+#[component]
383+pub async fn readme_sheet(
384+ lang: Lang,
385+ owner: String,
386+ repo: String,
387+ ref_name: String,
388+ dir: String,
389+ readme: Option<Readme>,
390+ none: &str,
391+) -> Result<impl View> {
392+ let search = repo_href(&owner, &repo, "search", "");
393+ let readme_name = readme.as_ref().map(|readme| readme.name.clone());
394+ let links = readme.as_ref().map(|readme| {
395+ let path = if dir.is_empty() {
396+ readme.name.clone()
397+ } else {
398+ format!("{dir}/{}", readme.name)
399+ };
400+ let target = format!("{ref_name}/{path}");
401+ (
402+ repo_href(&owner, &repo, "blob", &target),
403+ repo_href(&owner, &repo, "commits", &target),
404+ repo_href(&owner, &repo, "raw", &target),
405+ )
406+ });
407+ // The tools row names what is shown: the README, or the folder (the repo name at the root).
408+ let shown = readme_name.unwrap_or_else(|| if dir.is_empty() { repo.clone() } else { dir.clone() });
409+ Ok(view! {
410+ <div class="sheet">
411+ <div class="sheet-tools">
412+ <strong>(shown)</strong>
413+ if let Some((source, history, raw)) = links {
414+ <a class="act" href=(source)>(s(lang, "Source", "Kaynak"))</a>
415+ <a class="act" href=(history)>(s(lang, "History", "Geçmiş"))</a>
416+ <a class="act" href=(raw)>(s(lang, "Raw", "Ham"))</a>
417+ }
418+ <a class="act" href=(search)>(g::t(lang, K::SearchCodePlaceholder))</a>
419+ </div>
420+ if let Some(readme) = readme {
421+ readme_card(name: readme.name, markdown: readme.markdown, body: readme.body)
422+ } else {
423+ empty_state(title: none)
411424 }
412425 </div>
413426 })
@@ -457,18 +470,16 @@ async fn tree_page(cx: &Cx) -> Result<impl View> {
457470 .map(|e| e.name)
458471 .collect()
459472 };
460- let (last, bar, strip, ci_states, runs) = tokio::join!(
473+ let (last, bar, strip, runs) = tokio::join!(
461474 last_commits(state, &ctx.path, &commit, &dir, &names),
462475 latest_bar(state, repo, &ctx.path, &commit, "", lang, ctx.viewer_tz()),
463476 commit_strip(state, repo, &ctx.path, &commit),
464- run_states(state, &repo.id),
465477 run_rows(state, lang, repo),
466478 );
467- let ci_states = ci_states?;
468479 let runs = runs?;
469480 let facts = tree_facts(state, repo, &ctx.path, &commit, &root_names).await?;
470- let bars = strip_bars(&strip.commits, &ci_states);
471- let total = strip.total;
481+ let pips = run_pips(&runs);
482+ let sub = code_sub(lang, bar, Some(facts), None, Vec::new(), strip.total);
472483 let refs: Vec<RefInfo> = load_refs(ctx.path.clone()).await?;
473484 let readme = load_readme(state, repo, &ctx.path, &ref_name, &commit, &dir, &entries).await?;
474485 let rows = entry_rows(
@@ -484,7 +495,6 @@ async fn tree_page(cx: &Cx) -> Result<impl View> {
484495 let (branches, tags) = ref_links(&refs, &ref_name, &repo.default_branch, repo);
485496 let branches_href = repo_href(&repo.owner_name, &repo.name, "branches", "");
486497 let tags_href = repo_href(&repo.owner_name, &repo.name, "tags", "");
487- let ci_href = repo_href(&repo.owner_name, &repo.name, "ci", "");
488498 let live = follows_branch(&refs, &ref_name)
489499 .then(|| live_url(&repo.owner_name, &repo.name, &refs, &ref_name));
490500
@@ -494,61 +504,29 @@ async fn tree_page(cx: &Cx) -> Result<impl View> {
494504 let dock_owner = finder_owner.clone();
495505 let dock_repo = finder_repo.clone();
496506 let finder_ref = ref_name.clone();
497- let https = https_clone_url(&state.config, &repo.owner_name, &repo.name);
498- let ssh = ssh_clone_url(&state.config, &repo.owner_name, &repo.name);
499- let downloads = (
500- repo_href(
501- &repo.owner_name,
502- &repo.name,
503- "archive",
504- &format!("{ref_name}.zip"),
505- ),
506- repo_href(
507- &repo.owner_name,
508- &repo.name,
509- "archive",
510- &format!("{ref_name}.tar.gz"),
511- ),
512- );
513- let readme_label = readme
514- .as_ref()
515- .map(|readme| readme.name.clone())
516- .unwrap_or_else(|| "README".to_owned());
507+ let readme_file = readme.as_ref().map(|readme| readme.name.clone());
517508 let mut header = ctx.head(state, "code").await?;
518509 // The header and the browse bar share the branch's stream: the client follows the first
519510 // [data-live] on the page, which is the header.
520511 if let Some(url) = &live {
521512 header.live = url.clone();
522513 }
523- // The same two panes as the repo home, over the same dock, so the page fits the window.
524514 Ok(view! {
525515 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
526- repo_head(head: header)
527- <div class="repo-grid repo-home canvas-repo tree-browse">
528- <div class="repo-main canvas-files">
529- <div class="browse-bar" data-live=(live.as_deref()) data-live-code=(live.is_some().then_some("true")) data-live-gone=(g::t(lang, K::LivePathGone))>
516+ repo_head(head: header, sub: sub, pips: pips)
517+ <div class="work">
518+ <nav class="rail" aria-label=(s(lang, "Files", "Dosyalar"))>
519+ <div class="rail-head browse-bar" data-live=(live.as_deref()) data-live-code=(live.is_some().then_some("true")) data-live-gone=(g::t(lang, K::LivePathGone))>
520+ <h2>(s(lang, "Files", "Dosyalar"))</h2>
530521 ref_selector(lang: lang, label: mi::t(lang, MK::RefLabel), current: ref_name.clone(), branches: branches, tags: tags,
531522 branches_href: branches_href, tags_href: tags_href)
532523 file_finder(lang: lang, owner: finder_owner, repo: finder_repo, ref_name: finder_ref)
533524 </div>
534- tree_table(rows: rows, lang: lang)
535- </div>
536- <div class="repo-split" role="separator" aria-orientation="vertical"
537- aria-label=(s(lang, "Resize file tree", "Dosya ağacını boyutlandır")) tabindex="0"
538- data-repo-split=""></div>
539- <div class="repo-readme canvas-readme">
540- readme_head(label: readme_label, facts: Some(facts), https: https, ssh: ssh, downloads: Some(downloads), lang: lang)
541- <div class="canvas-body">
542- if let Some(readme) = readme {
543- readme_card(name: readme.name, markdown: readme.markdown, body: readme.body)
544- } else {
545- empty_state(title: s(lang, "No README in this folder", "Bu klasörde README yok"))
546- }
547- </div>
548- </div>
525+ tree_table(rows: rows, lang: lang, current: readme_file)
526+ </nav>
527+ readme_sheet(lang: lang, owner: dock_owner, repo: dock_repo, ref_name: ref_name.clone(), dir: dir.clone(), readme: readme,
528+ none: s(lang, "No README in this folder", "Bu klasörde README yok"))
549529 </div>
550- repo_dock(lang: lang, runs: runs, total: total, ci_href: ci_href,
551- owner: dock_owner, repo: dock_repo, bars: bars, latest: bar)
552530 )
553531 })
554532 }
crates/forge-web/src/pages/user_prefs.rsmodified+5 -61
@@ -1,5 +1,4 @@
1-//! Route: `POST /-/prefs`, a signed-in user's account preferences: the tree width of a repo home,
2-//! the profile corner's position and the diff view. The values live in the `user_prefs` table
1+//! Route: `POST /-/prefs`, a signed-in user's account preferences: the diff view. The values live in the `user_prefs` table
32 //! (store/user_prefs.rs). Only the keys below are accepted; each has its own check. An empty value
43 //! deletes the key. Signed-out callers get what `require_csrf` gives.
54
@@ -15,16 +14,9 @@ use topcoat::router::{Body, route};
1514 use crate::auth::require_csrf;
1615 use crate::state::AppState;
1716
18-/// Key of the repo home's file tree width, in CSS pixels.
19-pub const TREE_WIDTH: &str = "tree_width";
20-/// Key of the profile corner's position: `x,y` as fractions of the free space, each 0 to 1.
21-pub const CORNER_POS: &str = "corner_pos";
2217 /// Key of the diff view: `split` or `unified`.
2318 pub const DIFF_VIEW: &str = "diff_view";
2419
25-const MIN_TREE_WIDTH: u32 = 120;
26-const MAX_TREE_WIDTH: u32 = 4000;
27-
2820 #[derive(Deserialize)]
2921 struct PrefForm {
3022 #[serde(default)]
@@ -39,37 +31,6 @@ struct PrefForm {
3931 /// the value to store (normalised), and `Err` is the reason a 400 gives.
4032 pub fn clean_pref(key: &str, value: &str) -> std::result::Result<Option<String>, &'static str> {
4133 match key {
42- TREE_WIDTH => {
43- if value.is_empty() {
44- return Ok(None);
45- }
46- let width = value
47- .bytes()
48- .all(|b| b.is_ascii_digit())
49- .then(|| value.parse::<u32>().ok())
50- .flatten()
51- .filter(|w| (MIN_TREE_WIDTH..=MAX_TREE_WIDTH).contains(w));
52- width
53- .map(|w| Some(w.to_string()))
54- .ok_or("tree_width must be a whole number from 120 to 4000")
55- }
56- CORNER_POS => {
57- if value.is_empty() {
58- return Ok(None);
59- }
60- let fraction = |s: &str| {
61- s.parse::<f64>()
62- .ok()
63- .filter(|v| v.is_finite() && (0.0..=1.0).contains(v))
64- };
65- match value.split_once(',') {
66- Some((x, y)) => match (fraction(x), fraction(y)) {
67- (Some(x), Some(y)) => Ok(Some(format!("{x},{y}"))),
68- _ => Err("corner_pos must be two numbers from 0 to 1 written x,y"),
69- },
70- None => Err("corner_pos must be two numbers from 0 to 1 written x,y"),
71- }
72- }
7334 DIFF_VIEW => match value {
7435 "" => Ok(None),
7536 "split" | "unified" => Ok(Some(value.to_owned())),
@@ -103,7 +64,7 @@ mod tests {
10364 use crate::test_support::{app_router, create_session, test_state};
10465
10566 #[tokio::test]
106- async fn prefs_route_refuses_unknown_keys_and_stores_a_corner_position() {
67+ async fn prefs_route_refuses_unknown_keys_and_stores_the_diff_view() {
10768 let dir = tempfile::tempdir().expect("tempdir");
10869 let state = test_state(dir.path()).await;
10970 let user = state
@@ -131,28 +92,11 @@ mod tests {
13192 let _ = to_bytes(unknown.into_body(), usize::MAX).await.unwrap();
13293
13394 let stored = router
134- .handle(post("csrf=prefs-csrf&key=corner_pos&value=0.5%2C0.25"))
95+ .handle(post("csrf=prefs-csrf&key=diff_view&value=split"))
13596 .await;
136- assert_eq!(stored.status().as_u16(), 204, "corner position saved");
97+ assert_eq!(stored.status().as_u16(), 204, "diff view saved");
13798 let _ = to_bytes(stored.into_body(), usize::MAX).await.unwrap();
13899 let prefs = state.store.user_prefs(&user.id).await.unwrap();
139- assert_eq!(prefs.get(CORNER_POS).map(String::as_str), Some("0.5,0.25"));
140-
141- let page = router
142- .handle(
143- Request::builder()
144- .method("GET")
145- .uri("/tahinli")
146- .header("cookie", cookie.as_str())
147- .body(Body::empty())
148- .unwrap(),
149- )
150- .await;
151- assert_eq!(page.status().as_u16(), 200);
152- let bytes = to_bytes(page.into_body(), usize::MAX).await.unwrap();
153- assert!(
154- String::from_utf8_lossy(&bytes).contains("data-corner-pos=\"0.5,0.25\""),
155- "the page carries the stored corner"
156- );
100+ assert_eq!(prefs.get(DIFF_VIEW).map(String::as_str), Some("split"));
157101 }
158102 }
crates/forge-web/src/pages/wiki.rsmodified+151 -67
@@ -17,7 +17,7 @@ use topcoat::context::{Cx, app_context};
1717 use topcoat::router::content::Form;
1818 use topcoat::router::error::{SeeOther, forbidden, not_found, see_other};
1919 use topcoat::router::{page, path_param, route};
20-use topcoat::view::{Unescaped, View, component, view};
20+use topcoat::view::{Child, Unescaped, View, component, view};
2121
2222 use crate::audit::{self, Actor, Target};
2323 use crate::auth::{require_csrf, require_user};
@@ -30,6 +30,7 @@ use crate::pages::repo_settings::settings_frame;
3030 use crate::pages::wiki_live::{bump_wiki, page_live_url, wiki_live_url};
3131 use crate::render::markdown::render_markdown;
3232 use crate::state::AppState;
33+use crate::views::parts::{RailItem, rail};
3334 use crate::views::{alert, empty_state, rel_time, repo_href, shell};
3435
3536 path_param!(owner);
@@ -147,44 +148,87 @@ fn revision_rows(ctx: &RepoCtx, revs: &[PageRevision]) -> Vec<RevisionRow> {
147148 .collect()
148149 }
149150
150-/// The header every wiki screen shares: the page name as its heading when the screen has links
151-/// of its own (a page, its history, an edit), then the wiki's navigation as second-level text
152-/// links (Home, All pages, any page-specific `extra` links) with "New page" as an action.
151+/// The links every wiki sheet offers: Home, All pages, the screen's own `extra` links, and New
152+/// page for a writer.
153+fn wiki_links(
154+ lang: Lang,
155+ owner: &str,
156+ repo: &str,
157+ can_write: bool,
158+ extra: Vec<(String, String)>,
159+) -> Vec<(String, String)> {
160+ let mut links = vec![
161+ (
162+ g::t(lang, K::Home).to_owned(),
163+ repo_href(owner, repo, "wiki", ""),
164+ ),
165+ (
166+ g::t(lang, K::AllPages).to_owned(),
167+ repo_href(owner, repo, "wiki", "-/pages"),
168+ ),
169+ ];
170+ links.extend(extra);
171+ if can_write {
172+ links.push((
173+ g::t(lang, K::NewPage).to_owned(),
174+ repo_href(owner, repo, "wiki", "-/new"),
175+ ));
176+ }
177+ links
178+}
179+
180+/// The page list beside a wiki page: every page, the one on screen marked.
153181 #[component]
154-async fn wiki_head(
182+async fn wiki_rail(
155183 lang: Lang,
156184 owner: String,
157185 repo: String,
158- can_write: bool,
159- title: String,
160- extra: Vec<(String, String)>,
161- live: Option<String>,
186+ names: Vec<String>,
187+ current: String,
162188 ) -> Result<impl View> {
163- let home = repo_href(&owner, &repo, "wiki", "");
164- let pages = repo_href(&owner, &repo, "wiki", "-/pages");
165- let new = repo_href(&owner, &repo, "wiki", "-/new");
166- let heading_shown = !extra.is_empty();
189+ let items: Vec<RailItem> = names
190+ .into_iter()
191+ .map(|name| RailItem {
192+ href: repo_href(&owner, &repo, "wiki", &name),
193+ current: name == current,
194+ name: name.replace('-', " "),
195+ val: String::new(),
196+ })
197+ .collect();
167198 Ok(view! {
168- <div data-live=(live.as_deref())>
169- if heading_shown {
170- <h1 class="h1">(title.as_str())</h1>
171- } else {
172- <h1 class="sr-only">(title.as_str())</h1>
173- }
174- <nav class="sub" aria-label=(g::t(lang, K::PageNav))>
175- <a href=(home)>(g::t(lang, K::Home))</a>
176- <a href=(pages)>(g::t(lang, K::AllPages))</a>
177- for (label, href) in extra.into_iter() {
178- <a href=(href)>(label)</a>
199+ rail(label: g::t(lang, K::PageNav), items: items)
200+ })
201+}
202+
203+/// A wiki screen's sheet: its tools row (name and links), then the screen. `live` is the stream
204+/// the screen follows.
205+#[component]
206+async fn wiki_sheet(
207+ #[default] title: Option<String>,
208+ links: Vec<(String, String)>,
209+ #[default] live: Option<String>,
210+ #[default] child: Child<'_>,
211+) -> Result<impl View> {
212+ Ok(view! {
213+ <div class="sheet" data-live=(live.as_deref())>
214+ <div class="sheet-tools">
215+ if let Some(title) = title {
216+ <strong>(title.as_str())</strong>
179217 }
180- if can_write {
181- <a class="act" href=(new)>(g::t(lang, K::NewPage))</a>
218+ for (label, href) in links.into_iter() {
219+ <a class="act" href=(href)>(label)</a>
182220 }
183- </nav>
221+ </div>
222+ (child)
184223 </div>
185224 })
186225 }
187226
227+/// The page names of the wiki, for the rail and the page list.
228+async fn page_names(dir: PathBuf) -> Result<Vec<String>> {
229+ blocking(move || wiki::list_pages(&dir)).await
230+}
231+
188232 /// The Edit / History links shown in the header of a rendered page.
189233 fn page_links(
190234 lang: Lang,
@@ -251,13 +295,11 @@ async fn wiki_list_body(
251295 if rows.is_empty() {
252296 empty_state(title: g::t(lang, K::NoPagesYet))
253297 } else {
254- <div class="wiki-pages">
255- for (title, href) in rows.into_iter() {
256- <a class="line" href=(href) data-kb-row="">
257- <span class="name">(title.as_str())</span>
258- </a>
259- }
260- </div>
298+ for (title, href) in rows.into_iter() {
299+ <a class="line" href=(href) data-kb-row="">
300+ <span class="name">(title.as_str())</span>
301+ </a>
302+ }
261303 }
262304 })
263305 }
@@ -268,14 +310,12 @@ async fn wiki_history_body(lang: Lang, rows: Vec<RevisionRow>) -> Result<impl Vi
268310 if rows.is_empty() {
269311 empty_state(title: g::t(lang, K::NoChangesYet))
270312 } else {
271- <div class="wiki-history">
272- for row in rows.into_iter() {
273- <a class="line" href=(row.href) data-kb-row="">
274- <span class="name">(row.subject.as_str())</span>
275- <span class="val"><code>(row.short.as_str())</code> " · " (row.author.as_str()) " · " rel_time(lang: lang, stamp: row.when.as_str())</span>
276- </a>
277- }
278- </div>
313+ for row in rows.into_iter() {
314+ <a class="line" href=(row.href) data-kb-row="">
315+ <span class="name">(row.subject.as_str())</span>
316+ <span class="val"><code>(row.short.as_str())</code> " · " (row.author.as_str()) " · " rel_time(lang: lang, stamp: row.when.as_str())</span>
317+ </a>
318+ }
279319 }
280320 })
281321 }
@@ -339,6 +379,7 @@ async fn wiki_home(cx: &Cx) -> Result<impl View> {
339379 let state = app_context::<AppState>(cx);
340380 ensure_enabled(state, &ctx).await?;
341381 let dir = wiki_dir(state, &ctx)?;
382+ let names = page_names(dir.clone()).await?;
342383 let (_, home) = load_page(dir, "Home".to_owned()).await?;
343384 let can_write = ctx.can_write();
344385 let owner_name = ctx.repo.owner_name.clone();
@@ -351,25 +392,32 @@ async fn wiki_home(cx: &Cx) -> Result<impl View> {
351392 ctx.repo.name,
352393 g::t(lang, K::Wiki)
353394 );
354- let (head_title, links) = if body_html.is_some() {
395+ let live = wiki_live_url(&owner_name, &repo_name);
396+ let (head_title, sheet_title, extra) = if body_html.is_some() {
355397 (
356- g::t(lang, K::Home).to_owned(),
398+ Some(g::t(lang, K::Home).to_owned()),
399+ None,
357400 page_links(lang, &owner_name, &repo_name, "Home", can_write),
358401 )
359402 } else {
360- (g::t(lang, K::Wiki).to_owned(), Vec::new())
403+ (None, Some(g::t(lang, K::Wiki).to_owned()), Vec::new())
361404 };
405+ let links = wiki_links(lang, &owner_name, &repo_name, can_write, extra);
362406 let header = ctx.head(state, "wiki").await?;
363407 Ok(view! { cx =>
364408 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
365- repo_head(head: header)
366- wiki_head(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), can_write: can_write, title: head_title.clone(), extra: links.clone(), live: Some(wiki_live_url(&owner_name, &repo_name)))
367- if let Some(html) = body_html.clone() {
368- wiki_view_body(html: html)
369- }
370- if body_html.is_none() {
371- wiki_empty_body(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), can_write: can_write)
372- }
409+ repo_head(head: header, title: head_title)
410+ <div class="work">
411+ wiki_rail(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), names: names, current: "Home".to_owned())
412+ wiki_sheet(title: sheet_title, links: links, live: Some(live),
413+ if let Some(html) = body_html.clone() {
414+ wiki_view_body(html: html)
415+ }
416+ if body_html.is_none() {
417+ wiki_empty_body(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), can_write: can_write)
418+ }
419+ )
420+ </div>
373421 )
374422 })
375423 }
@@ -383,7 +431,7 @@ async fn wiki_pages(cx: &Cx) -> Result<impl View> {
383431 ensure_enabled(state, &ctx).await?;
384432 let lang = i18n::lang(cx, ctx.viewer.as_ref().map(|(user, _)| user));
385433 let dir = wiki_dir(state, &ctx)?;
386- let names = blocking(move || wiki::list_pages(&dir)).await?;
434+ let names = page_names(dir).await?;
387435 let can_write = ctx.can_write();
388436 let owner_name = ctx.repo.owner_name.clone();
389437 let repo_name = ctx.repo.name.clone();
@@ -393,12 +441,14 @@ async fn wiki_pages(cx: &Cx) -> Result<impl View> {
393441 ctx.repo.name,
394442 g::t(lang, K::WikiPages)
395443 );
444+ let links = wiki_links(lang, &owner_name, &repo_name, can_write, Vec::new());
396445 let header = ctx.head(state, "wiki").await?;
397446 Ok(view! { cx =>
398447 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
399- repo_head(head: header)
400- wiki_head(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), can_write: can_write, title: g::t(lang, K::AllPages).to_owned(), extra: Vec::new(), live: Some(wiki_live_url(&owner_name, &repo_name)))
401- wiki_list_body(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), names: names)
448+ repo_head(head: header, title: Some(g::t(lang, K::AllPages).to_owned()))
449+ wiki_sheet(links: links, live: Some(wiki_live_url(&owner_name, &repo_name)),
450+ wiki_list_body(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), names: names)
451+ )
402452 )
403453 })
404454 }
@@ -415,6 +465,7 @@ async fn wiki_page_view(cx: &Cx) -> Result<impl View> {
415465 return Err(not_found().into());
416466 }
417467 let dir = wiki_dir(state, &ctx)?;
468+ let names = page_names(dir.clone()).await?;
418469 let (_, text) = load_page(dir, page_name.clone()).await?;
419470 let Some(text) = text else {
420471 return Err(not_found().into());
@@ -430,12 +481,23 @@ async fn wiki_page_view(cx: &Cx) -> Result<impl View> {
430481 ctx.repo.owner_name,
431482 ctx.repo.name
432483 );
484+ let links = wiki_links(
485+ lang,
486+ &owner_name,
487+ &repo_name,
488+ can_write,
489+ page_links(lang, &owner_name, &repo_name, &page_name, can_write),
490+ );
433491 let header = ctx.head(state, "wiki").await?;
434492 Ok(view! { cx =>
435493 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
436- repo_head(head: header)
437- wiki_head(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), can_write: can_write, title: page_name.replace('-', " "), extra: page_links(lang, &owner_name, &repo_name, &page_name, can_write), live: Some(page_live_url(&owner_name, &repo_name, &page_name)))
438- wiki_view_body(html: html)
494+ repo_head(head: header, title: Some(page_name.replace('-', " ")))
495+ <div class="work">
496+ wiki_rail(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), names: names, current: page_name.clone())
497+ wiki_sheet(links: links, live: Some(page_live_url(&owner_name, &repo_name, &page_name)),
498+ wiki_view_body(html: html)
499+ )
500+ </div>
439501 )
440502 })
441503 }
@@ -452,6 +514,7 @@ async fn wiki_page_history(cx: &Cx) -> Result<impl View> {
452514 return Err(not_found().into());
453515 }
454516 let dir = wiki_dir(state, &ctx)?;
517+ let names = page_names(dir.clone()).await?;
455518 let git = state.git.clone();
456519 let revs = wiki::page_history(&git, &dir, &page_name).await?;
457520 let rows = revision_rows(&ctx, &revs);
@@ -464,12 +527,27 @@ async fn wiki_page_history(cx: &Cx) -> Result<impl View> {
464527 ctx.repo.owner_name,
465528 ctx.repo.name
466529 );
530+ let can_write = ctx.can_write();
531+ let links = wiki_links(
532+ lang,
533+ &owner_name,
534+ &repo_name,
535+ can_write,
536+ vec![(
537+ g::t(lang, K::BackToPage).to_owned(),
538+ repo_href(&owner_name, &repo_name, "wiki", &page_name),
539+ )],
540+ );
467541 let header = ctx.head(state, "wiki").await?;
468542 Ok(view! { cx =>
469543 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
470- repo_head(head: header)
471- wiki_head(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), can_write: ctx.can_write(), title: format!("{} \u{b7} {}", page_name.replace('-', " "), g::t(lang, K::History)), extra: vec![(g::t(lang, K::BackToPage).to_owned(), repo_href(&owner_name, &repo_name, "wiki", &page_name))], live: Some(page_live_url(&owner_name, &repo_name, &page_name)))
472- wiki_history_body(lang: lang, rows: rows)
544+ repo_head(head: header, title: Some(format!("{} \u{b7} {}", page_name.replace('-', " "), g::t(lang, K::History))))
545+ <div class="work">
546+ wiki_rail(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), names: names, current: page_name.clone())
547+ wiki_sheet(links: links, live: Some(page_live_url(&owner_name, &repo_name, &page_name)),
548+ wiki_history_body(lang: lang, rows: rows)
549+ )
550+ </div>
473551 )
474552 })
475553 }
@@ -487,6 +565,7 @@ async fn edit_screen(
487565 let (user, session) = require_user(cx).await?;
488566 let lang = i18n::lang(cx, Some(&user));
489567 let dir = wiki_dir(state, &ctx)?;
568+ let names = page_names(dir.clone()).await?;
490569 let head = blocking(move || wiki::head_commit(&dir)).await?;
491570 let action = if is_new {
492571 repo_href(&ctx.repo.owner_name, &ctx.repo.name, "wiki", "-/new")
@@ -522,11 +601,16 @@ async fn edit_screen(
522601 repo_href(&owner_name, &repo_name, "wiki", &name),
523602 )]
524603 };
604+ let links = wiki_links(lang, &owner_name, &repo_name, !is_new, back_links);
525605 Ok(view! { cx =>
526606 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
527- repo_head(head: header)
528- wiki_head(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), can_write: !is_new, title: head_title.clone(), extra: back_links.clone(), live: None)
529- wiki_edit_body(lang: lang, action: action, csrf: csrf, base: base, name: name.clone(), is_new: is_new, content: content, error: error)
607+ repo_head(head: header, title: Some(head_title))
608+ <div class="work">
609+ wiki_rail(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), names: names, current: name.clone())
610+ wiki_sheet(links: links,
611+ wiki_edit_body(lang: lang, action: action, csrf: csrf, base: base, name: name.clone(), is_new: is_new, content: content, error: error)
612+ )
613+ </div>
530614 )
531615 })
532616 }
@@ -726,7 +810,7 @@ async fn wiki_settings_page(cx: &Cx) -> Result<impl View> {
726810 let csrf = session.csrf_token.clone();
727811 Ok(view! { cx =>
728812 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
729- repo_head(head: header)
813+ repo_head(head: header, title: Some(g::t(lang, K::Wiki).to_owned()))
730814 settings_frame(lang: lang, title: format!("{}/{}", ctx.repo.owner_name, ctx.repo.name), current: "wiki",
731815 can_delete: ctx.can_delete(),
732816 wiki_settings_body(lang: lang, action: action, csrf: csrf, enabled: enabled)
crates/forge-web/src/views/commit_line.rsmodified+0 -11
@@ -5,19 +5,8 @@
55 use topcoat::Result;
66 use topcoat::view::{View, component, view};
77
8-use crate::render::commit_message::CommitMessage;
98 use crate::render::emoji::emojify;
109
11-/// The first clause of a subject, or the emojified subject when it does not parse. For text that
12-/// is not rendered through `commit_line`, such as a heading.
13-pub fn headline(subject: &str) -> String {
14- let emojified = emojify(subject);
15- match CommitMessage::parse(&emojified) {
16- Some(message) => message.title(),
17- None => emojified.into_owned(),
18- }
19-}
20-
2110 /// One subject on one line as it was written, header included, truncated by CSS. The full subject
2211 /// is the `title` attribute.
2312 #[component]
crates/forge-web/src/views/commit_status.rsmodified+3 -3
@@ -140,7 +140,7 @@ pub async fn checks_summary(
140140 <strong>(text)</strong>
141141 if has_items {
142142 <details class="checks-details">
143- <summary class="small muted">(g::t(lang, K::ShowChecks))</summary>
143+ <summary class="act">(g::t(lang, K::ShowChecks))</summary>
144144 status_list(items: items, lang: lang)
145145 </details>
146146 }
@@ -175,10 +175,10 @@ pub async fn status_list(items: Vec<StatusItem>, lang: Lang) -> Result<impl View
175175 <span class=(item.icon_class.as_str())>(item.icon)</span>
176176 <code>(item.context.as_str())</code>
177177 if item.has_description {
178- <span class="muted small">(description_text(lang, item.description.as_str()))</span>
178+ <span class="hint">(description_text(lang, item.description.as_str()))</span>
179179 }
180180 if item.has_link {
181- <a class="small" href=(item.link.as_str()) rel="nofollow noopener noreferrer">(g::t(lang, K::DetailsLink))</a>
181+ <a class="act" href=(item.link.as_str()) rel="nofollow noopener noreferrer">(g::t(lang, K::DetailsLink))</a>
182182 }
183183 </li>
184184 }
crates/forge-web/src/views/diff.rsmodified+38 -14
@@ -85,6 +85,8 @@ pub struct DiffOpts {
8585 pub query: Vec<(String, String)>,
8686 /// `.patch` and `.diff` download links, when the page has them.
8787 pub downloads: Option<(String, String)>,
88+ /// Shows this file alone, with no list of files: the review page picks one from its rail.
89+ pub only: Option<usize>,
8890 }
8991
9092 impl DiffOpts {
@@ -146,6 +148,7 @@ impl DiffOpts {
146148 path: request.path().to_owned(),
147149 query,
148150 downloads,
151+ only: None,
149152 })
150153 }
151154
@@ -526,8 +529,11 @@ pub async fn diff_section(
526529 .files
527530 .iter()
528531 .enumerate()
529- .map(|(i, file)| FileView::new(i, file, oid, parent, owner, repo, lang, &mut comments))
532+ .map(|(i, file)| (i, FileView::new(i, file, oid, parent, owner, repo, lang, &mut comments)))
533+ .filter(|(i, _)| opts.only.is_none_or(|only| only == *i))
534+ .map(|(_, file)| file)
530535 .collect();
536+ let alone = opts.only.is_some();
531537 if split {
532538 for file in &mut files {
533539 file.split_rows = split_rows(std::mem::take(&mut file.rows));
@@ -562,9 +568,15 @@ pub async fn diff_section(
562568
563569 Ok(view! {
564570 <section class="diff-section">
565- <h2>(files_label.as_str()) " " <span class="diff-stats"><span class="add">(add_label.as_str())</span> " " <span class="del">(del_label.as_str())</span></span></h2>
566- if let Some(bar) = toolbar {
567- diff_toolbar(bar: bar, lang: lang)
571+ if !alone || toolbar.is_some() {
572+ <div class="diff-head">
573+ if !alone {
574+ <h2>(files_label.as_str()) " " <span class="diff-stats"><span class="add">(add_label.as_str())</span> " " <span class="del">(del_label.as_str())</span></span></h2>
575+ }
576+ if let Some(bar) = toolbar {
577+ diff_toolbar(bar: bar, lang: lang)
578+ }
579+ </div>
568580 }
569581 if truncated_files {
570582 <p class="state">(truncated_note.as_str())</p>
@@ -572,6 +584,7 @@ pub async fn diff_section(
572584 if no_files {
573585 <p class="state">(g::t(lang, K::NoFileChanges))</p>
574586 } else {
587+ if !alone {
575588 <ul class="diff-index">
576589 for item in nav.iter() {
577590 <li>
@@ -581,6 +594,7 @@ pub async fn diff_section(
581594 </li>
582595 }
583596 </ul>
597+ }
584598 for file in files.into_iter() {
585599 diff_file(file: file, lang: lang, split: split, anchored: anchored)
586600 }
@@ -601,8 +615,8 @@ async fn diff_toolbar(bar: Toolbar, lang: Lang) -> Result<impl View> {
601615 <a href=(bar.split_href.as_str()) aria-pressed=(split_on)>(b::t(lang, b::K::Split))</a>
602616 <a href=(bar.ws_href.as_str()) aria-pressed=(ws_on)>(b::t(lang, b::K::IgnoreWhitespace))</a>
603617 if let Some((patch, diff)) = bar.downloads {
604- <a class="act quiet" href=(patch.as_str()) title=(b::t(lang, b::K::PatchTitle))>(b::t(lang, b::K::PatchLink))</a>
605- <a class="act quiet" href=(diff.as_str()) title=(b::t(lang, b::K::DiffTitle))>(b::t(lang, b::K::DiffLink))</a>
618+ <a class="act" href=(patch.as_str()) title=(b::t(lang, b::K::PatchTitle))>(b::t(lang, b::K::PatchLink))</a>
619+ <a class="act" href=(diff.as_str()) title=(b::t(lang, b::K::DiffTitle))>(b::t(lang, b::K::DiffLink))</a>
606620 }
607621 </nav>
608622 })
@@ -622,13 +636,11 @@ async fn diff_file(file: FileView, lang: Lang, split: bool, anchored: bool) -> R
622636 };
623637 Ok(view! {
624638 <section class="diff-file" id=(file.anchor.as_str()) data-keep-anchor=(file.label.as_str())>
625- <header class="diff-file-header">
626- <code class="diff-path">(file.label.as_str())</code>
627- <span class="diff-file-meta">
628- <span class="hint">(file.status)</span>
629- <span class="diff-stats"><span class="add">(add_label.as_str())</span> " " <span class="del">(del_label.as_str())</span></span>
630- </span>
631- </header>
639+ <div class="sheet-tools diff-file-header">
640+ <strong class="diff-path">(file.label.as_str())</strong>
641+ <span class="hint">(file.status)</span>
642+ <span class="diff-stats"><span class="add">(add_label.as_str())</span> " " <span class="del">(del_label.as_str())</span></span>
643+ </div>
632644 if file.binary {
633645 <p class="state diff-collapsed">(g::t(lang, K::BinaryFileChanged))</p>
634646 } else {
@@ -642,6 +654,18 @@ async fn diff_file(file: FileView, lang: Lang, split: bool, anchored: bool) -> R
642654 if has_rows {
643655 <div class="diff-file-body">
644656 <table class=(table_class)>
657+ // A fixed split table takes its column widths from here, not from its
658+ // first row, which is a hunk header spanning all of them.
659+ if split {
660+ <colgroup>
661+ if anchored { <col class="col-plus"> }
662+ <col class="col-ln">
663+ <col class="col-code">
664+ if anchored { <col class="col-plus"> }
665+ <col class="col-ln">
666+ <col class="col-code">
667+ </colgroup>
668+ }
645669 for row in rows.into_iter() {
646670 diff_line(row: row, lang: lang)
647671 }
@@ -817,7 +841,7 @@ async fn inline_comment_form(form: InlineForm, lang: Lang) -> Result<impl View>
817841 if let Some(text) = suggest_line {
818842 <button type="button" class="act" data-suggest=(text.as_str())>(suggest_label)</button>
819843 }
820- <a class="act quiet" href=(cancel_href.as_str())>(g::t(lang, K::CancelLink))</a>
844+ <a class="act" href=(cancel_href.as_str())>(g::t(lang, K::CancelLink))</a>
821845 </div>
822846 </form>
823847 })
crates/forge-web/src/views/mod.rsmodified+108 -174
@@ -41,7 +41,6 @@ use crate::i18n::packages::{self as pk, K as PK};
4141 use crate::i18n::{self, Key, Lang, t};
4242 use crate::pages::assets::highlight_css_text;
4343 use crate::pages::passkeys::s;
44-use crate::pages::user_prefs::{CORNER_POS, TREE_WIDTH, clean_pref};
4544 use crate::state::AppState;
4645
4746 /// Stylesheet URL. The version is a hash of the compiled CSS (build.rs), so a changed stylesheet
@@ -115,6 +114,9 @@ const TOP_LEVEL_PAGES: &[&str] = &[
115114 "import",
116115 "review-requests",
117116 "setup",
117+ "needs-you",
118+ "verify",
119+ "reset",
118120 "org",
119121 ];
120122
@@ -183,15 +185,22 @@ fn path_segments(path: &str, title: &str) -> Vec<(String, Option<String>)> {
183185 // Titles read "owner/repo · Page": the path bar has the repo already. A page titled by
184186 // the repo alone is named by its route.
185187 [_, ..] => {
186- let page = title.rsplit(" · ").next().unwrap_or(title);
187- let page = if page == format!("{owner}/{repo}") {
188- parts[2..]
188+ // A title ending in the repo plus a word ("Install · owner/repo wiki") reads by
189+ // the part before it.
190+ let full = format!("{owner}/{repo}");
191+ let mut tail = title.rsplit(" · ");
192+ let named = match tail.next() {
193+ Some(last) if last == full => None,
194+ Some(last) if last.starts_with(&format!("{full} ")) => tail.next(),
195+ last => last,
196+ };
197+ let page = match named {
198+ Some(page) => page.to_owned(),
199+ None => parts[2..]
189200 .iter()
190201 .map(|part| crumb_label(part))
191202 .collect::<Vec<_>>()
192- .join("/")
193- } else {
194- page.to_owned()
203+ .join("/"),
195204 };
196205 segments.push((page, None));
197206 }
@@ -336,29 +345,14 @@ struct ProfileCorner {
336345 failing_href: String,
337346 }
338347
339-/// The floating account panel fixed at the bottom left of the window (signed in only). It opens
340-/// upward: the avatar, the viewer's full name, the chips, the notifications bell with its unread count and popover, then
341-/// the profile, settings, admin and log out links and the theme choice.
348+/// The profile at the start of the top bar (signed in only): the avatar, with a dot when something
349+/// waits. Its menu holds the name, notifications with their popover, what waits on the viewer, the
350+/// profile, settings and admin links, the theme choice and log out.
342351 #[component]
343352 async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> {
344- let review_chip = (corner.reviews > 0).then(|| {
345- (
346- corner.reviews.to_string(),
347- mi::review_requests_count(lang, corner.reviews),
348- )
349- });
350- let mention_chip = (corner.mentions > 0).then(|| {
351- (
352- corner.mentions.to_string(),
353- mi::mentions_count(lang, corner.mentions),
354- )
355- });
356- let failing_chip = (corner.failing > 0).then(|| {
357- (
358- corner.failing.to_string(),
359- mi::failing_runs_count(lang, corner.failing),
360- )
361- });
353+ let review_chip = (corner.reviews > 0).then(|| mi::review_requests_count(lang, corner.reviews));
354+ let mention_chip = (corner.mentions > 0).then(|| mi::mentions_count(lang, corner.mentions));
355+ let failing_chip = (corner.failing > 0).then(|| mi::failing_runs_count(lang, corner.failing));
362356 let bell_label = mi::t(lang, MK::AllNotifications);
363357 let theme_label = mi::t(lang, MK::ThemeLabel);
364358 let match_label = mi::t(lang, MK::MatchSystem);
@@ -399,24 +393,49 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View>
399393 let loading_label = mi::t(lang, MK::PeekLoading);
400394 let error_label = mi::t(lang, MK::PeekError);
401395 Ok(view! {
402- <div class="corner-wrap">
403396 <details class="corner" data-unread-stream="">
404397 <summary class="corner-btn" aria-label=(corner.username.as_str())>
405- <span class="corner-avatar"><img class="avatar avatar-sm" src=(corner.avatar.as_str()) alt="" width="28" height="28"></span>
406- <span class="corner-name" title=(corner.username.as_str())>(corner.name.as_str())</span>
407- <span class="corner-chips" data-review=(review_template.as_str()) data-review-one=(review_one.as_str()) data-mention=(mention_template.as_str()) data-mention-one=(mention_one.as_str()) data-failing=(failing_template.as_str()) data-failing-one=(failing_one.as_str())>
408- if let Some((count, title)) = review_chip {
409- <a class="chip chip-review" href=(corner.review_href.as_str()) title=(title.as_str())><svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg>(count.as_str())</a>
398+ <img class="avatar corner-avatar" src=(corner.avatar.as_str()) alt="" width="32" height="32">
399+ </summary>
400+ <div class="corner-menu">
401+ <p class="corner-who" title=(corner.username.as_str())>(corner.name.as_str())</p>
402+ <a class="corner-link corner-bell" href="/notifications" title=(bell_label) aria-expanded="false">
403+ <span>(bell_title)</span>
404+ if corner.unread > 0 {
405+ <span class="bell-count">(corner.unread.to_string())</span>
410406 }
411- if let Some((count, title)) = mention_chip {
412- <a class="chip chip-mention" href=(corner.mention_href.as_str()) title=(title.as_str())><svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"/></svg>(count.as_str())</a>
407+ </a>
408+ <div class="bell-pop" popover="auto" role="dialog" aria-label=(bell_title) data-loading=(loading_label) data-error=(error_label)>
409+ <div class="bell-box">
410+ <div class="bell-head">
411+ <span>(bell_title)</span>
412+ <form method="post" action="/notifications/mark_all_read" class="bell-clear">
413+ <input type="hidden" name="csrf" value=(corner.csrf.as_str())>
414+ <button type="submit" class="link-button" title=(clear_title)>(clear_label)</button>
415+ </form>
416+ </div>
417+ <div class="bell-list"></div>
418+ <a class="button small bell-open" href="/notifications">(open_label)</a>
419+ </div>
420+ </div>
421+ <div class="corner-chips" data-review=(review_template.as_str()) data-review-one=(review_one.as_str()) data-mention=(mention_template.as_str()) data-mention-one=(mention_one.as_str()) data-failing=(failing_template.as_str()) data-failing-one=(failing_one.as_str())>
422+ if let Some(title) = review_chip {
423+ <a class="corner-link chip-review" href=(corner.review_href.as_str())>(title.as_str())</a>
413424 }
414- if let Some((count, title)) = failing_chip {
415- <a class="chip chip-failing" href=(corner.failing_href.as_str()) title=(title.as_str())><svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18"/></svg>(count.as_str())</a>
425+ if let Some(title) = mention_chip {
426+ <a class="corner-link chip-mention" href=(corner.mention_href.as_str())>(title.as_str())</a>
416427 }
417- </span>
418- </summary>
419- <div class="corner-menu">
428+ if let Some(title) = failing_chip {
429+ <a class="corner-link chip-failing" href=(corner.failing_href.as_str())>(title.as_str())</a>
430+ }
431+ </div>
432+ <div class="corner-sep"></div>
433+ <a class="corner-link" href=(profile_href.as_str())>(profile_label)</a>
434+ <a class="corner-link" href="/settings/profile">(settings_label)</a>
435+ if corner.is_admin {
436+ <a class="corner-link" href="/admin/users">(admin_label)</a>
437+ }
438+ <div class="corner-sep"></div>
420439 <div class="corner-theme"><span>(theme_label)</span>
421440 <form method="post" action="/-/theme" class="corner-theme-set" data-no-tick="true">
422441 <input type="hidden" name="csrf" value=(corner.csrf.as_str())>
@@ -432,43 +451,19 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View>
432451 </button>
433452 </form>
434453 </div>
435- <a class="corner-link" href=(profile_href.as_str())>(profile_label)</a>
436- <a class="corner-link" href="/settings/profile">(settings_label)</a>
437- if corner.is_admin {
438- <a class="corner-link" href="/admin/users">(admin_label)</a>
439- }
440454 <form data-hard="true" method="post" action="/logout">
441455 <input type="hidden" name="csrf" value=(corner.csrf.as_str())>
442456 <button type="submit" class="corner-link link-button">(logout_label)</button>
443457 </form>
444458 </div>
445459 </details>
446- <a class="corner-bell" href="/notifications" title=(bell_label) aria-label=(bell_label) aria-expanded="false"><svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg>
447- if corner.unread > 0 {
448- <span class="bell-count">(corner.unread.to_string())</span>
449- }
450- </a>
451- <div class="bell-pop" popover="auto" role="dialog" aria-label=(bell_title) data-loading=(loading_label) data-error=(error_label)>
452- <div class="bell-box">
453- <div class="bell-head">
454- <span>(bell_title)</span>
455- <form method="post" action="/notifications/mark_all_read" class="bell-clear">
456- <input type="hidden" name="csrf" value=(corner.csrf.as_str())>
457- <button type="submit" class="link-button" title=(clear_title)>(clear_label)</button>
458- </form>
459- </div>
460- <div class="bell-list"></div>
461- <a class="button bell-open" href="/notifications">(open_label)</a>
462- </div>
463- </div>
464- </div>
465460 })
466461 }
467462
468-/// Page shell: sticky top bar (logo, path bar and, signed in, the live strip), the section sidebar
469-/// on section pages, `child` as the page content, and for signed-in viewers the floating profile
470-/// corner fixed at the bottom left. `viewer` drives the chrome: the live strip and the profile
471-/// corner when signed in; search, theme, Explore and Log in otherwise. `extra_stylesheet` adds one
463+/// Page shell: the top bar (profile, wordmark, path bar, Explore and, signed in, the live strip),
464+/// the section tabs on section pages, and `child` as the page content. A page's `.head` is placed
465+/// above those tabs by the stylesheet, so a page only writes its head and its sheets. `viewer`
466+/// drives the chrome: the live strip and the profile when signed in; search, theme and Log in otherwise. `extra_stylesheet` adds one
472467 /// more stylesheet link to the head (such as a repo's generated label colors).
473468 #[component]
474469 pub async fn shell(
@@ -506,14 +501,6 @@ pub async fn shell(
506501 _ => None,
507502 };
508503 let banner = crate::pages::banner::current(__cx, prefs.as_ref());
509- let tree_w = prefs
510- .as_ref()
511- .and_then(|p| p.get(TREE_WIDTH))
512- .and_then(|v| clean_pref(TREE_WIDTH, v).ok().flatten());
513- let corner_pos = prefs
514- .as_ref()
515- .and_then(|p| p.get(CORNER_POS))
516- .and_then(|v| clean_pref(CORNER_POS, v).ok().flatten());
517504 let sound_attr = crate::pages::settings_appearance::sound_attr(prefs.as_ref());
518505 let banner_back = back.clone().unwrap_or_else(|| "/".to_owned());
519506 let dismiss_label = crate::i18n::accounts::t(lang, crate::i18n::accounts::A::Dismiss);
@@ -583,12 +570,20 @@ pub async fn shell(
583570 theme_state,
584571 mi::t(lang, theme_next),
585572 );
586- let anonymous = viewer.is_none();
587- let search_label = o::t(lang, OK::SearchPublicRepos);
588573 let palette_label = br::t(lang, br::K::PaletteOpen).to_owned();
589574 let explore_label = t(lang, Key::Explore);
590575 // The path bar: one segment per part of the request path, the last one unlinked.
591- let segments = path_segments(uri(__cx).path(), title);
576+ let mut segments = path_segments(uri(__cx).path(), title);
577+ // A page with no place of its own in the path, such as settings, names its section and itself.
578+ if segments.is_empty() {
579+ if let Some(section) = &section {
580+ let first = section.items.first().map(|item| item.href.clone());
581+ if section.title != title {
582+ segments.push((section.title.clone(), first));
583+ }
584+ }
585+ segments.push((title.to_owned(), None));
586+ }
592587 let path_attr = segments
593588 .iter()
594589 .map(|(label, _)| label.as_str())
@@ -641,10 +636,6 @@ pub async fn shell(
641636 || "/notifications".to_owned(),
642637 |(owner, repo, number)| repo_href(owner, repo, "ci", &format!("runs/{number}")),
643638 );
644- // The corner's drag saves its position with this token, the same one the page's forms send.
645- let prefs_csrf = viewer
646- .map(|(_, session)| session.csrf_token.clone())
647- .unwrap_or_default();
648639 let corner = viewer.map(|(user, session)| ProfileCorner {
649640 username: user.username.clone(),
650641 name: user
@@ -674,7 +665,7 @@ pub async fn shell(
674665 <meta charset="utf-8">
675666 <meta name="viewport" content="width=device-width, initial-scale=1">
676667 <meta name="referrer" content="same-origin">
677- <meta name="theme-color" content="#5f7f67">
668+ <meta name="theme-color" content="#b44d1a">
678669 <meta name="apple-mobile-web-app-capable" content="yes">
679670 <link rel="manifest" href="/manifest.webmanifest">
680671 <link rel="apple-touch-icon" href="/assets/icons/apple-touch-icon.png">
@@ -690,22 +681,17 @@ pub async fn shell(
690681 }
691682 <script src=(NAV_SCRIPT_HREF) defer="defer"></script>
692683 </head>
693- <body data-link-restarting=(lk::t(lang, LinkKey::Restarting)) data-link-back=(lk::t(lang, LinkKey::BackSubmit)) data-done-saved=(lk::t(lang, LinkKey::Saved)) data-done-ok=(lk::t(lang, LinkKey::Done)) data-draft-restored=(lk::t(lang, LinkKey::DraftRestored)) data-draft-discard=(lk::t(lang, LinkKey::DraftDiscard)) data-select-filter=(lk::t(lang, LinkKey::SelectFilter)) data-select-none=(lk::t(lang, LinkKey::SelectNone)) data-signed-in=(signed_in.then(|| "true".to_owned())) data-tree-w=(tree_w) data-corner-pos=(corner_pos)>
684+ <body data-link-restarting=(lk::t(lang, LinkKey::Restarting)) data-link-back=(lk::t(lang, LinkKey::BackSubmit)) data-done-saved=(lk::t(lang, LinkKey::Saved)) data-done-ok=(lk::t(lang, LinkKey::Done)) data-draft-restored=(lk::t(lang, LinkKey::DraftRestored)) data-draft-discard=(lk::t(lang, LinkKey::DraftDiscard)) data-select-filter=(lk::t(lang, LinkKey::SelectFilter)) data-select-none=(lk::t(lang, LinkKey::SelectNone)) data-signed-in=(signed_in.then(|| "true".to_owned()))>
694685 <header class="topbar">
695686 <div class="top-start">
696- <a class="wordmark" href="/">
697- <svg class="ico wordmark-mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 19c0-7 5-12 14-13-1 9-6 14-13 14"/><path d="M5 19l6-6"/></svg>
698- "forge"
699- </a>
700- <a class="top-explore" href="/explore" title=(explore_label) aria-label=(explore_label)>
701- <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="m15.5 8.5-2 5-5 2 2-5z"/></svg>
702- <span>(explore_label)</span>
703- </a>
687+ if let Some(corner) = corner {
688+ <div class="corner-float">
689+ profile_corner(lang: lang, corner: corner)
690+ </div>
691+ }
692+ <a class="wordmark" href="/">"forge"</a>
704693 </div>
705694 <nav class="pathbar" aria-label=(mi::t(lang, MK::BreadcrumbNav))>
706- if signed_in {
707- <svg class="ico pathbar-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>
708- }
709695 <ol class="pathbar-segs">
710696 for crumb in crumbs.iter() {
711697 if let Some(href) = &crumb.href {
@@ -733,6 +719,7 @@ pub async fn shell(
733719 </button>
734720 }
735721 </nav>
722+ <a class="top-explore" href="/explore">(explore_label)</a>
736723 if signed_in {
737724 <div class="live-strip" data-activity="/-/activity" data-passed=(mi::t(lang, MK::Passed)) data-failed=(mi::t(lang, MK::Failed)) data-cancelled=(mi::t(lang, MK::Cancelled))
738725 data-count-running=(running_tpl.as_str()) data-count-failed=(failed_tpl.as_str()) data-count-passed=(passed_tpl.as_str()) data-count-cancelled=(cancelled_tpl.as_str())
@@ -754,10 +741,6 @@ pub async fn shell(
754741 }
755742 </div>
756743 } else {
757- <form class="top-search" role="search" method="get" action="/explore">
758- <svg class="ico top-search-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>
759- <input type="search" name="q" data-live-search="" autocomplete="off" placeholder=(search_label) aria-label=(search_label)>
760- </form>
761744 <form class="theme-form" method="post" action="/-/theme">
762745 if let Some(csrf) = theme_csrf {
763746 <input type="hidden" name="csrf" value=(csrf.as_str())>
@@ -795,33 +778,12 @@ pub async fn shell(
795778 <div class="shell-body">
796779 <main tabindex="-1" data-width=(width)>
797780 if let Some(section) = section {
798- section_tabs(label: section.title.as_str(), items: section.items, current: section.current, live: section.live)
781+ section_tabs(key: section.key, label: section.title.as_str(), items: section.items, current: section.current, live: section.live)
799782 }
800783 (child)
801784 </main>
802- <footer class="site-footer">
803- <span>"forge"</span>
804- if anonymous {
805- <form method="post" action="/-/theme" class="theme-picker">
806- <label>
807- <span>(mi::t(lang, MK::ThemeLabel))</span>
808- <select name="theme">
809- <option value="auto">(mi::t(lang, MK::MatchSystem))</option>
810- <option value="light">(mi::t(lang, MK::Light))</option>
811- <option value="dark">(mi::t(lang, MK::Dark))</option>
812- </select>
813- </label>
814- <button type="submit" class="link-button">(mi::t(lang, MK::ApplyTheme))</button>
815- </form>
816- }
817- </footer>
818785 </div>
819786 </div>
820- if let Some(corner) = corner {
821- <div class="corner-float" data-prefs-csrf=(prefs_csrf.as_str())>
822- profile_corner(lang: lang, corner: corner)
823- </div>
824- }
825787 </body>
826788 </html>
827789 }
@@ -841,6 +803,8 @@ pub struct NavItem {
841803 /// A section's tabs: the admin area or the user's settings, one row of text links above the page.
842804 #[derive(Clone)]
843805 pub struct Section {
806+ /// `admin` or `settings`: what the stylesheet keys on, the same in every language.
807+ pub key: &'static str,
844808 pub title: String,
845809 pub items: Vec<NavItem>,
846810 pub current: &'static str,
@@ -1008,9 +972,9 @@ pub fn section_for(lang: Lang, path: &str) -> Option<Section> {
1008972 let mut parts = path.trim_matches('/').split('/');
1009973 let first = parts.next()?;
1010974 let second = parts.next().unwrap_or("");
1011- let (title, items) = match first {
1012- "admin" => (ad::t(lang, AK::AdminArea).to_owned(), admin_items(lang)),
1013- "settings" => (o::t(lang, OK::Settings).to_owned(), settings_items(lang)),
975+ let (key, title, items) = match first {
976+ "admin" => ("admin", ad::t(lang, AK::AdminArea).to_owned(), admin_items(lang)),
977+ "settings" => ("settings", o::t(lang, OK::Settings).to_owned(), settings_items(lang)),
1014978 _ => return None,
1015979 };
1016980 let second = match second {
@@ -1029,6 +993,7 @@ pub fn section_for(lang: Lang, path: &str) -> Option<Section> {
1029993 ""
1030994 };
1031995 Some(Section {
996+ key,
1032997 title,
1033998 items,
1034999 current,
@@ -1039,6 +1004,7 @@ pub fn section_for(lang: Lang, path: &str) -> Option<Section> {
10391004 /// One row of text tabs, with `aria-current="page"` on the current one.
10401005 #[component]
10411006 async fn section_tabs(
1007+ key: &'static str,
10421008 label: &str,
10431009 items: Vec<NavItem>,
10441010 current: &str,
@@ -1053,7 +1019,7 @@ async fn section_tabs(
10531019 })
10541020 .collect();
10551021 Ok(view! {
1056- <nav class="tabs" aria-label=(label) data-live=(live)>
1022+ <nav class="tabs" aria-label=(label) data-section=(key) data-live=(live)>
10571023 for (item, on) in links.into_iter() {
10581024 <a href=(item.href) aria-current=(on.then_some("page"))>(item.label)</a>
10591025 }
@@ -1160,7 +1126,7 @@ pub async fn security_headers(cx: &Cx, body: Body, next: Next<'_>) -> Result<Res
11601126 next.run(cx, body).await
11611127 }
11621128
1163-// Repo browsing helpers: URLs, times and sizes, and the shared breadcrumb, tabs and ref selector.
1129+// Repo browsing helpers: URLs, times and sizes, and the shared tabs and ref selector.
11641130
11651131 /// Percent-encodes everything except unreserved characters and `/`.
11661132 pub fn enc(s: &str) -> String {
@@ -1361,31 +1327,6 @@ pub fn human_size(lang: Lang, bytes: u64) -> String {
13611327 }
13621328 }
13631329
1364-/// One breadcrumb segment. `href` is None for the current location.
1365-pub struct Crumb {
1366- pub label: String,
1367- pub href: Option<String>,
1368-}
1369-
1370-#[component]
1371-pub async fn breadcrumb(lang: Lang, crumbs: Vec<Crumb>) -> Result<impl View> {
1372- Ok(view! {
1373- <nav class="crumbs" aria-label=(mi::t(lang, MK::BreadcrumbNav))>
1374- <ol>
1375- for crumb in crumbs.into_iter() {
1376- <li>
1377- if let Some(href) = crumb.href {
1378- <a href=(href)>(crumb.label)</a>
1379- } else {
1380- <span aria-current="page">(crumb.label)</span>
1381- }
1382- </li>
1383- }
1384- </ol>
1385- </nav>
1386- })
1387-}
1388-
13891330 fn tab_class(on: bool) -> &'static str {
13901331 if on { "tab active" } else { "tab" }
13911332 }
@@ -1451,7 +1392,6 @@ pub async fn repo_tabs(
14511392 Ok(view! {
14521393 <nav class="repo-tabs" aria-label=(g::t(lang, K::RepositoryNav))>
14531394 <a class=(tab_class(code_on)) href=(home)>
1454- <span class="tab-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="m16 18 6-6-6-6M8 6l-6 6 6 6"/></svg></span>
14551395 (t(lang, Key::Code))
14561396 </a>
14571397 <details class="menu tab-more">
@@ -1466,49 +1406,43 @@ pub async fn repo_tabs(
14661406 </div>
14671407 </details>
14681408 <a class=(tab_class(issues_on)) href=(issues)>
1469- <span class="tab-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="1"/></svg></span>
14701409 (g::t(lang, K::TabIssues))
14711410 if let Some(count) = issues_count {
14721411 " " <span class="tab-count" data-arrive=(count.as_str())>(count.as_str())</span>
14731412 }
14741413 </a>
14751414 <a class=(tab_class(pulls_on)) href=(pulls)>
1476- <span class="tab-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><circle cx="6" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="18" r="3"/><path d="M6 9v6M18 15V9a3 3 0 0 0-3-3h-3"/></svg></span>
14771415 (g::t(lang, K::TabPulls))
14781416 if let Some(count) = pulls_count {
14791417 " " <span class="tab-count" data-arrive=(count.as_str())>(count.as_str())</span>
14801418 }
14811419 </a>
14821420 <a class=(tab_class(ci_on)) href=(ci)>
1483- <span class="tab-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M10 8.5v7l5.5-3.5z"/></svg></span>
14841421 (g::t(lang, K::TabCi))
14851422 </a>
14861423 if discussions {
14871424 <a class=(tab_class(discussions_on)) href=(discussions_tab)>
1488- <span class="tab-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg></span>
14891425 (g::t(lang, K::TabDiscussions))
14901426 </a>
14911427 }
14921428 if wiki {
14931429 <a class=(tab_class(wiki_on)) href=(wiki_tab)>
1494- <span class="tab-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M2 4h6a4 4 0 0 1 4 4v12a3 3 0 0 0-3-3H2zM22 4h-6a4 4 0 0 0-4 4v12a3 3 0 0 1 3-3h7z"/></svg></span>
14951430 (g::t(lang, K::TabWiki))
14961431 </a>
14971432 }
14981433 if security {
14991434 <a class=(tab_class(security_on)) href=(security_tab)>
1500- <span class="tab-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg></span>
15011435 (t(lang, Key::Security))
15021436 </a>
15031437 }
15041438 if can_admin {
15051439 <a class=(tab_class(settings_on)) href=(settings)>
1506- <span class="tab-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1 7 17M17 7l2.1-2.1"/></svg></span>
15071440 (g::t(lang, K::TabSettings))
15081441 </a>
15091442 }
15101443 </nav>
1511- })
1444+ }
1445+ .boxed())
15121446 }
15131447
15141448 /// A branch or tag in the ref switcher. `href` points at its root tree; `updated` is the commit
@@ -1901,10 +1835,10 @@ mod shell_tests {
19011835
19021836 // An anonymous page renders the default colours.
19031837 let tag = html_tag(&html);
1904- assert!(tag.contains("data-accent-light=\"sage\""), "{tag}");
1905- assert!(tag.contains("data-accent-dark=\"sage\""), "{tag}");
1906- assert!(tag.contains("data-base-light=\"fern\""), "{tag}");
1907- assert!(tag.contains("data-base-dark=\"fern\""), "{tag}");
1838+ assert!(tag.contains("data-accent-light=\"ember\""), "{tag}");
1839+ assert!(tag.contains("data-accent-dark=\"ember\""), "{tag}");
1840+ assert!(tag.contains("data-base-light=\"anvil\""), "{tag}");
1841+ assert!(tag.contains("data-base-dark=\"anvil\""), "{tag}");
19081842 }
19091843
19101844 /// The `<html …>` start tag of a page.
@@ -1976,10 +1910,10 @@ mod shell_tests {
19761910 ["removed-palette", "removed-palette", "x", "x"],
19771911 )
19781912 .await;
1979- assert!(removed.contains("data-accent-light=\"sage\""), "{removed}");
1980- assert!(removed.contains("data-accent-dark=\"sage\""), "{removed}");
1981- assert!(removed.contains("data-base-light=\"fern\""), "{removed}");
1982- assert!(removed.contains("data-base-dark=\"fern\""), "{removed}");
1913+ assert!(removed.contains("data-accent-light=\"ember\""), "{removed}");
1914+ assert!(removed.contains("data-accent-dark=\"ember\""), "{removed}");
1915+ assert!(removed.contains("data-base-light=\"anvil\""), "{removed}");
1916+ assert!(removed.contains("data-base-dark=\"anvil\""), "{removed}");
19831917 // A removed preset (`ochre`, `mist`) falls back too, and a hue passes through as itself.
19841918 let retired = html_tag_for_colours(
19851919 &router,
@@ -1989,10 +1923,10 @@ mod shell_tests {
19891923 ["ochre", "terracotta", "mist", "stone"],
19901924 )
19911925 .await;
1992- assert!(retired.contains("data-accent-light=\"sage\""), "{retired}");
1993- assert!(retired.contains("data-accent-dark=\"sage\""), "{retired}");
1994- assert!(retired.contains("data-base-light=\"fern\""), "{retired}");
1995- assert!(retired.contains("data-base-dark=\"fern\""), "{retired}");
1926+ assert!(retired.contains("data-accent-light=\"ember\""), "{retired}");
1927+ assert!(retired.contains("data-accent-dark=\"ember\""), "{retired}");
1928+ assert!(retired.contains("data-base-light=\"anvil\""), "{retired}");
1929+ assert!(retired.contains("data-base-dark=\"anvil\""), "{retired}");
19961930 let hued = html_tag_for_colours(
19971931 &router,
19981932 &store,
crates/forge-web/src/views/parts.rsmodified+149 -6
@@ -1,12 +1,19 @@
1-//! The parts every page acts through: the two ways an action opens in place. See the page language
2-//! in `style/_min.scss`. An action sits right under what it acts on, as a text link.
1+//! The parts every page acts through: the ways an action opens in place. See the page language in
2+//! `docs/ui-language.md`.
33
44 use topcoat::Result;
5-use topcoat::view::{Child, View, component, view};
5+use topcoat::view::{Child, View, ViewExt, component, view};
66
77 use crate::i18n::Lang;
88 use crate::pages::passkeys::s;
99
10+/// The width class of a strip segment holding `part` of `total`: `fr1` to `fr40`, since a page may
11+/// not set inline styles. A segment with nothing in it still shows.
12+pub fn seg_fr(part: u64, total: u64) -> String {
13+ let n = (part.saturating_mul(40) + total / 2).checked_div(total).unwrap_or(1);
14+ format!("fr{}", n.clamp(1, 40))
15+}
16+
1017 /// A text link that opens its form in place, on its own line under the links beside it. `open`
1118 /// starts it open, as a form sent back with an error must.
1219 #[component]
@@ -46,9 +53,9 @@ pub async fn confirm_act(
4653 if let Some(note) = note {
4754 <p class="hint">(note)</p>
4855 }
49- <div class="acts">
50- <button type="submit" class="act danger">(label)</button>
51- <button type="button" class="act quiet" data-close-details="">(s(lang, "Cancel", "Vazgeç"))</button>
56+ <div class="acts asks">
57+ <button type="submit" class="danger small">(label)</button>
58+ <button type="button" class="act" data-close-details="">(s(lang, "Keep it", "Vazgeç"))</button>
5259 </div>
5360 </form>
5461 </details>
@@ -73,3 +80,139 @@ pub async fn post_act(
7380 </form>
7481 })
7582 }
83+
84+/// One piece of a head's sub line. Pieces are joined with a middle dot.
85+#[derive(Clone, Default)]
86+pub struct SubPart {
87+ pub text: String,
88+ pub href: Option<String>,
89+ /// `""`, `"mono"` for a hash or a number, `"b"` for the one piece that matters most.
90+ pub class: &'static str,
91+}
92+
93+impl SubPart {
94+ pub fn text(text: impl Into<String>) -> Self {
95+ Self {
96+ text: text.into(),
97+ ..Self::default()
98+ }
99+ }
100+
101+ pub fn link(text: impl Into<String>, href: impl Into<String>) -> Self {
102+ Self {
103+ text: text.into(),
104+ href: Some(href.into()),
105+ ..Self::default()
106+ }
107+ }
108+
109+ pub fn mono(text: impl Into<String>) -> Self {
110+ Self {
111+ text: text.into(),
112+ class: "mono",
113+ ..Self::default()
114+ }
115+ }
116+
117+ pub fn strong(text: impl Into<String>) -> Self {
118+ Self {
119+ text: text.into(),
120+ class: "b",
121+ ..Self::default()
122+ }
123+ }
124+}
125+
126+/// The line under a head's title. `pips` are recent runs, oldest first, as (href, title, class).
127+#[component]
128+pub async fn head_sub(
129+ parts: Vec<SubPart>,
130+ #[default] pips: Vec<(String, String, &'static str)>,
131+) -> Result<impl View> {
132+ let last = pips.len().saturating_sub(1);
133+ let show = !parts.is_empty() || !pips.is_empty();
134+ let has_pips = !pips.is_empty();
135+ Ok(view! {
136+ if show {
137+ <p class="head-sub">
138+ for (n, part) in parts.into_iter().enumerate() {
139+ if n > 0 {
140+ <span class="sep" aria-hidden="true">"·"</span>
141+ }
142+ if let Some(href) = part.href {
143+ <a class=(part.class) href=(href)>(part.text)</a>
144+ } else {
145+ <span class=(part.class)>(part.text)</span>
146+ }
147+ }
148+ if has_pips {
149+ <span class="pips">
150+ for (n, (href, title, class)) in pips.into_iter().enumerate() {
151+ <a class=(if n == last { format!("pip cur {class}") } else { format!("pip {class}") }) href=(href) title=(title.clone()) aria-label=(title)></a>
152+ }
153+ </span>
154+ }
155+ </p>
156+ }
157+ }
158+ .boxed())
159+}
160+
161+/// What a page is, and what you can do about it, together: the title with the page's actions right
162+/// beside it (`child`), then the sub line. Every page starts with one. Section tabs follow it.
163+#[component]
164+pub async fn head(
165+ title: &str,
166+ #[default] sub: Vec<SubPart>,
167+ #[default] live: Option<&str>,
168+ #[default] child: Child<'_>,
169+) -> Result<impl View> {
170+ Ok(view! {
171+ <section class="head" data-live=(live)>
172+ <div class="head-title">
173+ <h1>(title)</h1>
174+ (child)
175+ </div>
176+ head_sub(parts: sub)
177+ </section>
178+ }
179+ .boxed())
180+}
181+
182+/// One row of a rail.
183+#[derive(Clone, Default)]
184+pub struct RailItem {
185+ pub name: String,
186+ pub val: String,
187+ pub href: String,
188+ pub current: bool,
189+}
190+
191+/// The rail: one list beside the sheet, never two. It scrolls on its own. `label` names it for
192+/// screen readers, `heading` is the optional small heading above it. `child` goes between the two,
193+/// for a filter.
194+#[component]
195+pub async fn rail(
196+ label: &str,
197+ items: Vec<RailItem>,
198+ #[default] heading: Option<&str>,
199+ #[default] child: Child<'_>,
200+) -> Result<impl View> {
201+ Ok(view! {
202+ <nav class="rail" aria-label=(label)>
203+ if let Some(heading) = heading {
204+ <h2>(heading)</h2>
205+ }
206+ (child)
207+ <div class="rail-list">
208+ for item in items.into_iter() {
209+ <a class="rail-item" href=(item.href) aria-current=(item.current.then_some("page"))>
210+ <span class="nm">(item.name)</span>
211+ <span class="val">(item.val)</span>
212+ </a>
213+ }
214+ </div>
215+ </nav>
216+ }
217+ .boxed())
218+}
crates/forge-web/src/views/repo_list.rsmodified+4 -4
@@ -81,13 +81,13 @@ pub struct SortLink {
8181 #[component]
8282 pub async fn sort_chips(links: Vec<SortLink>, lang: Lang) -> Result<impl View> {
8383 Ok(view! {
84- <nav class="sub" aria-label=(g::t(lang, K::SortNav))>
85- <span>(g::t(lang, K::SortBy))</span>
84+ <nav class="sort" aria-label=(g::t(lang, K::SortNav))>
85+ <span class="hint">(g::t(lang, K::SortBy))</span>
8686 for link in links.into_iter() {
8787 if link.current {
88- <span class="current" aria-current="true">(link.label)</span>
88+ <span class="act current" aria-current="true">(link.label)</span>
8989 } else {
90- <a href=(link.href.as_str())>(link.label)</a>
90+ <a class="act" href=(link.href.as_str())>(link.label)</a>
9191 }
9292 }
9393 </nav>
crates/forge-web/src/views/review_thread.rsmodified+70 -103
@@ -1,7 +1,7 @@
11 //! One review thread: a root comment and its replies, with the path and line, badges, an optional
22 //! diff hunk, and the reply and resolve controls. The Files tab renders it under its diff line;
33 //! the Conversation tab (`return_to = "conversation"`) renders it in the timeline. Resolved
4-//! threads collapse into a `<details>`. Markup uses the `review-*` classes.
4+//! threads collapse into a `<details>`. The comments sit in one `.thread`, one block per comment.
55
66 use std::collections::HashMap;
77 use std::sync::Arc;
@@ -15,7 +15,7 @@ use crate::i18n::Lang;
1515 use crate::i18n::pulls_review::{self as g, K};
1616 use crate::pages::issue_parts::When;
1717 use crate::render::markdown::{LinkContext, render_markdown};
18-use crate::views::parts::{confirm_act, post_act};
18+use crate::views::parts::{confirm_act, post_act, reveal};
1919 use crate::views::{avatar_url, display_name, now_unix, user_href, user_link};
2020
2121 /// What the Apply control of a suggestion shows. A root without a state shows the diff only.
@@ -125,15 +125,13 @@ fn body_parts(
125125
126126 /// The controls and content of a thread, shared by the open and the collapsed (resolved) forms.
127127 struct ThreadParts {
128- location: String,
129- outdated: bool,
130- pending: bool,
131128 hunk: Option<String>,
132129 comments: Vec<CommentRow>,
133130 resolve_action: Option<String>,
134131 resolve_value: String,
135132 resolve_label: String,
136133 reply_action: Option<String>,
134+ reply_id: String,
137135 csrf: String,
138136 return_to: String,
139137 lang: Lang,
@@ -194,6 +192,7 @@ pub async fn review_thread_in(
194192 let Thread { root, replies } = thread;
195193 let suggest = ctx.suggest.get(&root.id).copied();
196194 let anchor = format!("rc-{}", root.id);
195+ let reply_id = format!("reply-{}", root.id);
197196 let location = format!("{}:{}", root.path, root.line);
198197 let hunk = (show_hunk && !root.diff_hunk.is_empty()).then(|| root.diff_hunk.clone());
199198 let resolved = root.resolved;
@@ -218,48 +217,59 @@ pub async fn review_thread_in(
218217 .collect();
219218
220219 let parts = ThreadParts {
221- location: location.clone(),
222- outdated,
223- pending,
224220 hunk,
225221 comments,
226222 resolve_action,
227223 resolve_value: resolve_value.to_owned(),
228224 resolve_label: resolve_label.to_owned(),
229225 reply_action,
226+ reply_id,
230227 csrf: ctx.csrf.clone(),
231228 return_to,
232229 lang,
233230 };
234231
235232 // One `<details>` for every thread: open unless resolved, so a resolved thread starts
236- // collapsed and can still be expanded.
233+ // collapsed and can still be expanded. Its summary row carries the location and the badges.
237234 let summary = if resolved {
238235 g::resolved_conversation(lang, &location)
239236 } else {
240237 location
241238 };
239+ let outdated_text = g::t(lang, K::Outdated);
240+ let pending_text = g::t(lang, K::Pending);
242241 Ok(view! {
243- <details class="review-thread" id=(anchor.as_str()) open=(!resolved)>
244- <summary class="review-thread-summary">(summary.as_str())</summary>
245- thread_parts(parts: parts)
242+ <details class="row-open review-thread" id=(anchor.as_str()) open=(!resolved)>
243+ <summary class="line">
244+ <span class="name">(summary.as_str())</span>
245+ <span class="val">
246+ if outdated {
247+ <span class="badge">(outdated_text)</span>
248+ }
249+ if pending {
250+ <span class="badge">(pending_text)</span>
251+ }
252+ </span>
253+ </summary>
254+ <div class="opened">
255+ thread_parts(parts: parts)
256+ </div>
246257 </details>
247258 })
248259 }
249260
261+/// The diff hunk, the comments, then the thread's tools and reply form. Split into siblings so
262+/// each component's view stays small enough to type-check.
250263 #[component]
251264 async fn thread_parts(parts: ThreadParts) -> Result<impl View> {
252- // Split into three siblings so each component's view stays small enough to type-check.
253265 let ThreadParts {
254- location,
255- outdated,
256- pending,
257266 hunk,
258267 comments,
259268 resolve_action,
260269 resolve_value,
261270 resolve_label,
262271 reply_action,
272+ reply_id,
263273 csrf,
264274 return_to,
265275 lang,
@@ -269,31 +279,39 @@ async fn thread_parts(parts: ThreadParts) -> Result<impl View> {
269279 resolve_value,
270280 resolve_label,
271281 reply_action,
282+ reply_id,
272283 csrf: csrf.clone(),
273284 return_to: return_to.clone(),
274285 lang,
275286 };
276287 Ok(view! {
277- thread_top(location: location, outdated: outdated, pending: pending, hunk: hunk, lang: lang)
278- for comment in comments.into_iter() {
279- thread_comment(comment: comment, csrf: csrf.clone(), return_to: return_to.clone(),
280- lang: lang)
288+ if let Some(text) = hunk {
289+ <pre class="review-hunk"><code>(text.as_str())</code></pre>
281290 }
291+ <div class="thread">
292+ for comment in comments.into_iter() {
293+ thread_comment(comment: comment, csrf: csrf.clone(), return_to: return_to.clone(),
294+ lang: lang)
295+ }
296+ </div>
282297 thread_footer(footer: footer)
283298 })
284299 }
285300
286-/// Actions and the reply form at the foot of a thread.
301+/// Tools and the reply form at the foot of a thread.
287302 struct ThreadFooter {
288303 resolve_action: Option<String>,
289304 resolve_value: String,
290305 resolve_label: String,
291306 reply_action: Option<String>,
307+ reply_id: String,
292308 csrf: String,
293309 return_to: String,
294310 lang: Lang,
295311 }
296312
313+/// The resolve button, and Reply, which opens its form in place. Each is empty when the viewer
314+/// may not use it.
297315 #[component]
298316 async fn thread_footer(footer: ThreadFooter) -> Result<impl View> {
299317 let ThreadFooter {
@@ -301,84 +319,33 @@ async fn thread_footer(footer: ThreadFooter) -> Result<impl View> {
301319 resolve_value,
302320 resolve_label,
303321 reply_action,
322+ reply_id,
304323 csrf,
305324 return_to,
306325 lang,
307326 } = footer;
327+ let reply_label = g::t(lang, K::ReplyLabel);
328+ let reply_button = g::t(lang, K::ReplyButton);
308329 Ok(view! {
309- thread_actions(resolve_action: resolve_action, resolve_value: resolve_value,
310- resolve_label: resolve_label, csrf: csrf.clone(), return_to: return_to.clone())
311- if let Some(action) = reply_action {
312- reply_form(action: action, csrf: csrf, return_to: return_to, lang: lang)
313- }
314- })
315-}
316-
317-/// The header (path, line, badges) and the optional diff hunk.
318-#[component]
319-async fn thread_top(
320- location: String,
321- outdated: bool,
322- pending: bool,
323- hunk: Option<String>,
324- lang: Lang,
325-) -> Result<impl View> {
326- let outdated_text = g::t(lang, K::Outdated);
327- let pending_text = g::t(lang, K::Pending);
328- Ok(view! {
329- <header class="review-thread-head">
330- <code>(location.as_str())</code>
331- if outdated {
332- <span class="review-badge review-badge-outdated">(outdated_text)</span>
333- }
334- if pending {
335- <span class="review-badge review-badge-pending">(pending_text)</span>
336- }
337- </header>
338- if let Some(text) = hunk {
339- <pre class="review-hunk"><code>(text.as_str())</code></pre>
340- }
341- })
342-}
343-
344-/// The resolve or unresolve button. Empty when the viewer may not resolve.
345-#[component]
346-async fn thread_actions(
347- resolve_action: Option<String>,
348- resolve_value: String,
349- resolve_label: String,
350- csrf: String,
351- return_to: String,
352-) -> Result<impl View> {
353- Ok(view! {
354- <div class="acts review-thread-actions">
355- if let Some(action) = resolve_action {
330+ if let Some(action) = resolve_action {
331+ <div class="acts">
356332 post_act(label: resolve_label.as_str(), action: action.as_str(), csrf: csrf.as_str(),
357333 fields: vec![("resolved".to_owned(), resolve_value.clone()), ("return".to_owned(), return_to.clone())])
358- }
359- </div>
360- })
361-}
362-
363-#[component]
364-async fn reply_form(
365- action: String,
366- csrf: String,
367- return_to: String,
368- lang: Lang,
369-) -> Result<impl View> {
370- let label = g::t(lang, K::ReplyLabel);
371- let button = g::t(lang, K::ReplyButton);
372- Ok(view! {
373- <form method="post" action=(action.as_str()) class="review-reply fields">
374- <input type="hidden" name="csrf" value=(csrf.as_str())>
375- <input type="hidden" name="return" value=(return_to.as_str())>
376- <label class="field">
377- <span>(label)</span>
378- <textarea name="body" rows="3"></textarea>
379- </label>
380- <button type="submit" class="primary">(button)</button>
381- </form>
334+ </div>
335+ }
336+ if let Some(action) = reply_action {
337+ reveal(label: reply_button,
338+ <form method="post" action=(action.as_str()) class="fields">
339+ <input type="hidden" name="csrf" value=(csrf.as_str())>
340+ <input type="hidden" name="return" value=(return_to.as_str())>
341+ <div class="field">
342+ <label for=(reply_id.as_str())>(reply_label)</label>
343+ <textarea id=(reply_id.as_str()) name="body" rows="3"></textarea>
344+ </div>
345+ <button type="submit" class="primary">(reply_button)</button>
346+ </form>
347+ )
348+ }
382349 })
383350 }
384351
@@ -405,15 +372,15 @@ async fn thread_comment(
405372 let delete = g::t(lang, K::DeleteButton);
406373 let has_acts = edit_href.is_some() || delete_href.is_some();
407374 Ok(view! {
408- <article class="review-comment">
409- <header class="review-comment-head">
375+ <div>
376+ <p class="who">
410377 <a href=(profile.as_str()) aria-label=(login.as_str())><img class="avatar avatar-sm" src=(avatar.as_str()) alt="" width="24" height="24"></a>
411- <strong>user_link(shown: author.as_str(), login: login.as_str())</strong>
412- <time data-rel="true" datetime=(when.iso.as_str()) title=(when.absolute.as_str())>(when.relative.as_str())</time>
378+ user_link(shown: author.as_str(), login: login.as_str())
379+ <span><time data-rel="true" datetime=(when.iso.as_str()) title=(when.absolute.as_str())>(when.relative.as_str())</time></span>
413380 if let Some(href) = history_href {
414- <a class="issue-edited" href=(href.as_str())>(edited)</a>
381+ <a class="act" href=(href.as_str())>(edited)</a>
415382 }
416- </header>
383+ </p>
417384 for part in parts.into_iter() {
418385 comment_part(part: part, csrf: csrf.clone(), return_to: return_to.clone(),
419386 lang: lang)
@@ -429,7 +396,7 @@ async fn thread_comment(
429396 }
430397 </div>
431398 }
432- </article>
399+ </div>
433400 })
434401 }
435402
@@ -458,11 +425,11 @@ async fn comment_part(
458425 let added_sign = "+";
459426 Ok(view! {
460427 if !suggestion {
461- <div class="markdown-body review-comment-body">(Unescaped::new_unchecked(html))</div>
428+ <div class="markdown-body">(Unescaped::new_unchecked(html))</div>
462429 }
463430 if suggestion {
464431 <div class="review-suggestion">
465- <div class="review-suggestion-caption">(caption)</div>
432+ <p class="hint">(caption)</p>
466433 if !old.is_empty() {
467434 <div class="review-suggestion-line del"><span class="review-suggestion-sign">(removed_sign)</span><code>(old.as_str())</code></div>
468435 }
@@ -470,13 +437,13 @@ async fn comment_part(
470437 <div class="review-suggestion-line add"><span class="review-suggestion-sign">(added_sign)</span><code>(line.as_str())</code></div>
471438 }
472439 if let Some(action) = apply_action {
473- <div class="acts review-suggestion-apply">
440+ <div class="acts">
474441 post_act(label: apply_label, action: action.as_str(), csrf: csrf.as_str(),
475442 fields: vec![("block".to_owned(), block.clone()), ("return".to_owned(), return_to.clone())])
476443 </div>
477444 }
478445 if outdated {
479- <p class="review-suggestion-outdated">(outdated_text)</p>
446+ <p class="hint">(outdated_text)</p>
480447 }
481448 </div>
482449 }
crates/forge-web/src/views/timeline.rsmodified+1 -1
@@ -84,7 +84,7 @@ pub async fn history_strip(
8484 Ok(view! {
8585 if show {
8686 <div class="history-strip">
87- <p class="history-label label">(heading.as_str())</p>
87+ <p class="hint history-label">(heading.as_str())</p>
8888 <div class="history-bars" role="group" aria-label=(aria)>
8989 for item in items.iter() {
9090 <a class=(item.class.as_str()) href=(item.href.as_str()) aria-label=(item.label.as_str()) title=(item.label.as_str()) data-oid=(item.oid.as_str()) data-arrive=(item.oid.as_str())></a>
crates/forge-web/src/web_push/mod.rsmodified+14 -1
@@ -160,6 +160,11 @@ pub fn safe_url(url: &str) -> String {
160160
161161 /// A short label for a device, from its User-Agent: "Chrome on Android", "Safari on iPhone".
162162 pub fn agent_label(user_agent: &str) -> String {
163+ agent_label_in(Lang::En, user_agent)
164+}
165+
166+/// [`agent_label`] in the viewer's language: "Chrome on Linux", "Linux üzerinde Chrome".
167+pub fn agent_label_in(lang: Lang, user_agent: &str) -> String {
163168 let os = if user_agent.contains("iPhone") {
164169 "iPhone"
165170 } else if user_agent.contains("iPad") {
@@ -174,6 +179,8 @@ pub fn agent_label(user_agent: &str) -> String {
174179 "ChromeOS"
175180 } else if user_agent.contains("Linux") {
176181 "Linux"
182+ } else if lang == Lang::Tr {
183+ "bilinmeyen sistem"
177184 } else {
178185 "Unknown system"
179186 };
@@ -187,10 +194,16 @@ pub fn agent_label(user_agent: &str) -> String {
187194 "Chrome"
188195 } else if user_agent.contains("Safari/") {
189196 "Safari"
197+ } else if lang == Lang::Tr {
198+ "Tarayıcı"
190199 } else {
191200 "Browser"
192201 };
193- format!("{browser} on {os}")
202+ match lang {
203+ Lang::Tr if os == "bilinmeyen sistem" => format!("{browser}, {os}"),
204+ Lang::Tr => format!("{os} üzerinde {browser}"),
205+ Lang::En => format!("{browser} on {os}"),
206+ }
194207 }
195208
196209 /// The HTTP client for push requests: the webhook outbound policy (no internal addresses, no
docs/ui-language.mdadded+133 -0
@@ -0,0 +1,133 @@
1+# Forge page language
2+
3+Every page follows this, with no exceptions. The look lives in one place, `style/_one.scss`, the parts
4+in `crates/forge-web/src/views/parts.rs`. A page writes structure and classes only: no page has its
5+own button, field, menu, tab, tag or box. If something does not fit, change the part, never the page.
6+
7+`scripts/audit/measure.ts` reads the computed look of every control on every page and reports anything
8+outside this language.
9+
10+## A page
11+
12+`main` holds these and nothing else, in this order:
13+
14+1. **Head**: `<section class="head">`, written with `head(title: .., sub: .., <actions>)` or, in a repo,
15+ `repo_head(head: header, title: .., sub: .., <actions>)`. One visible `h1`. What the page is and what
16+ you can do about it sit together: the actions come right after the title, never at the far end.
17+2. **Tabs**: `<nav class="tabs">`, the sections of the area you are in. Settings and admin get theirs from
18+ the shell, and a page's head goes above them by itself. A repo's are inside `repo_head`.
19+3. **Strip** (`.strip`): only CI steps and files under review. It shows the whole thing and is how you
20+ move through it. Never on repo or settings pages.
21+4. **Work**: one `.sheet`, or `.work` when the page has a list to pick from:
22+ `<div class="work"> rail(..) <div class="sheet">..</div> </div>`.
23+
24+Also allowed in `main`: `.state` and `.alert` for a message about the whole page.
25+
26+No visible title is ever missing, and no `h1 class="sr-only"`. No page sets a width: the sheet takes the
27+room. A page without a sub-list has no rail.
28+
29+## The rail
30+
31+`rail(label: .., items: vec![RailItem { name, val, href, current }])`. It holds **one** list, never two. A
32+long list scrolls by itself, with a filter input above it. One folder at a time; the path bar goes up.
33+Sections never go in the rail: they go in `.tabs`.
34+
35+## The sheet
36+
37+`<div class="sheet">`, white, radius 16, hairline ring. Add `fit` for a sheet that should hug its content.
38+
39+- `<div class="sheet-tools"><strong>Name</strong> <a class="act">Tool</a> ...</div>`: 48px row, the name
40+ of what is showing and its quiet tools right after it.
41+- `<section class="sec"><h2>Topic</h2> ... </section>`: one topic. Hairline between topics.
42+- A list: rows, with no heading if the tools row names it.
43+- The sheet holds the content. Nothing nests a box in a box: no `.card`, `.rows-pane`, `.fit-pane`,
44+ `.row-line`, `.row-field`, `.page-head`, sidebars or second columns.
45+
46+## Rows
47+
48+`<a class="line" data-kb-row=""><span class="name">..</span><span class="val">..</span></a>` when the item
49+has its own page. When it opens in place:
50+
51+```html
52+<details class="row-open">
53+ <summary class="line"><span class="name">laptop</span><span class="val">SHA256:9fK2c1Qx</span></summary>
54+ <div class="opened">..</div>
55+</details>
56+```
57+
58+Details come right after the title on one line. Nothing is pushed to the far end of a row:
59+no `margin-left:auto`, no `justify-content:space-between`, no second column at the right.
60+
61+## Actions
62+
63+- **Button**: `<button>` (soft), `<button class="primary">` (filled), `.small`. A head holds the page's
64+ main action as `.primary` and its others as soft. A form's submit is `.primary`, once, under its fields.
65+ `a.button` for a link that acts like one.
66+- **Tool**: `.act`, a quiet word (14px, dim, radius 12). `.act.danger` for destructive. This is what goes in
67+ tools rows, in rows and in `.acts`.
68+- `reveal(label, id, open)`: a tool that opens its form in place. `open` when a form came back with an error.
69+- `confirm_act(lang, label, action, csrf, fields, note)`: every destructive action. It always asks first, in
70+ place, with a small filled danger button and "Keep it". There are no one-click deletes.
71+- `post_act(label, action, csrf, fields)`: a tool that posts at once, for what loses nothing.
72+- No optimistic UI. Show done only after the server said so.
73+
74+## Forms
75+
76+```html
77+<form class="fields">
78+ <div class="field"><label for="x">Name</label><input id="x"><p class="hint">One line.</p></div>
79+ <button type="submit" class="primary">Save</button>
80+</form>
81+```
82+
83+The label sits beside its control in one column, the hint after the control. `.field-pair` for two short
84+fields. A checkbox is `<label class="switch"><input type="checkbox"><span>..</span></label>`, the box right
85+before its label. Few fixed options are `.choice`:
86+
87+```html
88+<div class="choice"><label><input type="radio" name="theme" value="auto" checked><span>Auto</span></label> ..</div>
89+```
90+
91+Longer lists are a `<select>`. Fields are soft filled shapes with no line around them. Every control has a
92+label. Errors are `alert` at the top of the form they belong to, which stays open with the user's text.
93+
94+## Lists and search
95+
96+Every search bar is live: `data-live-search` on a real GET form's input in `.plain-search`. It sits in the
97+tools row or above the rail's list. Filters are the rail, or `.tabs` when there are only a few. Pagers
98+appear only when another page exists. An empty list is `.state` with one line and its action as `.act`.
99+
100+## Menus
101+
102+Every dropdown, menu, popover and hover panel is the same panel: `.menu-list`, `.pop-panel` or
103+`.row-menu-panel`, radius 20, shadow and ring, rows 34px high. Instant, no animation. No browser
104+triangles. It never leaves the window, on a phone either.
105+
106+## Colour
107+
108+Tokens only: `--bg`, `--surface`, `--surface-2`, `--text`, `--muted`, `--border`, `--border-strong`, `--accent`,
109+`--accent-soft`, `--bad`, `--danger-bg`, `--add-bg`, `--del-bg`. Accent marks the one live or selected
110+thing. Running colour is the accent. Passed is neutral. Failed is `--bad`. Cancelled is grey, never red.
111+Added is blue and deleted is rose. Graphs use the same set: neutral marks, accent for now.
112+
113+## Type
114+
115+Figtree for words, IBM Plex Mono for hashes, numbers beside names, paths and logs. No uppercase, no
116+letter-spacing, no Archivo. `h1` 26/34 bold; `h2` 13 semibold dim; body 15/22; tools 14; hints 13.
117+
118+## Words
119+
120+Short, plain, sentence case, no em dashes. All text goes through i18n, or
121+`crate::pages::passkeys::s(lang, "English", "Türkçe")`, in proper Turkish ("çevrim içi" is two words). A
122+Turkish page shows no English, an English page no Turkish.
123+
124+## Rules that stayed
125+
126+- No page transitions, no decorative motion. Live arrivals only, off for reduced motion.
127+- CSP is strict: no inline style attributes, no inline script.
128+- List rows carry `data-kb-row`. Live pages keep `data-live`, `data-arrive` and every data attribute
129+ nav.js reads.
130+- Signed-in preferences live in the database.
131+- A setting must visibly change something, or it goes.
132+- A phone (390px) is one column: no sideways scroll, tabs scroll inside their row.
133+- Pages fit one screen where they can: use tabs and the rail, not stacked unrelated topics.
scripts/audit/measure.tsmodified+113 -54
@@ -1,7 +1,8 @@
11 #!/usr/bin/env bun
2-// Measures pages against the page language in a real headless browser. For every path and window it
3-// checks the left edge, sideways overflow, controls past the column and old layout classes, then
4-// opens each menu and disclosure on the page and checks the panel stays in the window.
2+// Measures pages against docs/ui-language.md in a real headless browser. For every path and window it
3+// reads the computed look of every control and checks it against the one set of shapes, sizes and
4+// fonts, checks the page's skeleton, then opens each menu and disclosure on the page and checks the
5+// panel keeps the one look and stays in the window.
56 //
67 // Usage: bun scripts/audit/measure.ts BASE SESSION_COOKIE PATHS_FILE OUT_DIR [--shots] [--menus]
78 // PATHS_FILE has one path a line. Results go to OUT_DIR/measure.json; shots to OUT_DIR/shots.
@@ -14,12 +15,11 @@ const shots = process.argv.includes("--shots");
1415 const menus = process.argv.includes("--menus");
1516 const FLOATING = "details.menu, details.pins-menu, details.ref-select, details.clone, details.corner, details.strip-runs, details.row-menu, details.commit-status, details.reaction-picker";
1617 const paths = readFileSync(pathsFile, "utf8").split("\n").map((l) => l.trim()).filter(Boolean);
17-const windows = [
18- [1920, 1080],
19- [2560, 1440],
20- [390, 844],
21-];
22-const PORT = 9333;
18+// AUDIT_WINDOWS=1440x900,390x844 picks the windows, AUDIT_THEME=dark the theme, AUDIT_LANG=tr the language.
19+const windows = (process.env.AUDIT_WINDOWS ?? "1920x1080,2560x1440,390x844").split(",").map((w) => w.split("x").map(Number));
20+const theme = process.env.AUDIT_THEME ?? "light";
21+// A port of its own, so several audits can run at once without reading each other's browser.
22+const PORT = Number(process.env.AUDIT_CDP_PORT) || 9400 + Math.floor(Math.random() * 500);
2323
2424 // A __Host- cookie cannot live on plain http, so a small proxy adds it. Streams never end and would
2525 // starve the browser's connections, so they answer at once.
@@ -36,6 +36,7 @@ const proxy = Bun.serve({
3636 const headers = new Headers(req.headers);
3737 headers.delete("host");
3838 if (cookie !== "-") headers.set("cookie", cookie);
39+ if (process.env.AUDIT_LANG) headers.set("accept-language", process.env.AUDIT_LANG);
3940 const r = await fetch(forge + url.pathname + url.search, { method: req.method, headers, body: req.body, redirect: "manual" });
4041 const back = new Headers(r.headers);
4142 back.delete("content-encoding");
@@ -107,64 +108,106 @@ async function shot(name: string) {
107108 if (r?.data) await Bun.write(`${out}/shots/${name}.png`, Buffer.from(r.data, "base64"));
108109 }
109110
110-// Runs in the page. Everything it reports is a broken rule.
111-const CHECK = `(() => {
111+// Runs in the page. Everything it reports is a broken rule of docs/ui-language.md.
112+const DESIGN = `(() => {
112113 const bad = [];
113- const main = document.querySelector('main');
114- if (!main) return ['no main'];
115- const w = innerWidth;
116- if (document.documentElement.scrollWidth > w + 1) {
117- const over = [...main.querySelectorAll('*')].find((e) => e.getBoundingClientRect().right > w + 1 && !e.closest('pre, .diff, .table-scroll, [data-scroll-x]'));
118- bad.push('sideways overflow ' + document.documentElement.scrollWidth + ' at ' + (over ? over.tagName + '.' + over.className : '?'));
114+ const ALLOWED_FONT = new Set(['11','12','12.5','13','13.5','14','15','17','22','24','26']);
115+ const ALLOWED_RADIUS = new Set(['0','2','3','5','6','10','11','12','14','15','16','18','19','20','30','50%','999','9999']);
116+ const seen = (e) => { const r = e.getBoundingClientRect(); return r.width > 0 && r.height > 0 && getComputedStyle(e).visibility !== 'hidden'; };
117+ const name = (e) => e.tagName.toLowerCase() + (e.classList.length ? '.' + [...e.classList].join('.') : '') + ' < ' + (e.parentElement.classList[0] || e.parentElement.tagName.toLowerCase());
118+ const num = (v) => String(Math.round(parseFloat(v) * 10) / 10);
119+ const px = (e) => { const c = getComputedStyle(e), r = e.getBoundingClientRect(); return { h: Math.round(r.height), r: c.borderTopLeftRadius.endsWith('%') ? c.borderTopLeftRadius : num(c.borderTopLeftRadius), fs: num(c.fontSize), w: c.fontWeight, ff: c.fontFamily, bg: c.backgroundColor, b: parseFloat(c.borderTopWidth) + parseFloat(c.borderLeftWidth) + parseFloat(c.borderRightWidth) + parseFloat(c.borderBottomWidth) }; };
120+ const none = (bg) => bg === 'rgba(0, 0, 0, 0)' || bg === 'transparent';
121+ // Every kind of control has these shapes and no others: height, radius, font size.
122+ const CONTROLS = [[38,'19','15'],[32,'15','13'],[32,'15','14'],[32,'16','14'],[30,'12','14'],[34,'12','14'],[28,'14','14'],[36,'18','14']];
123+ const root = document.querySelector('main');
124+ if (!root) return ['no main'];
125+ // The page's skeleton.
126+ // A live wrapper with display: contents is not a part of the page: its children are.
127+ const flat = (e) => [...e.children].flatMap((c) => getComputedStyle(c).display === 'contents' ? flat(c) : [c]);
128+ const parts = flat(root);
129+ const heads = parts.filter((c) => c.matches('.head'));
130+ if (heads.length !== 1 && !root.querySelector(':scope > .auth')) bad.push('page: ' + heads.length + ' heads');
131+ const h1 = [...document.querySelectorAll('h1')].filter((h) => seen(h) && !h.closest('.markdown-body') && !h.classList.contains('sr-only'));
132+ if (h1.length !== 1) bad.push('page: ' + h1.length + ' visible h1');
133+ for (const c of parts) {
134+ if (!c.matches('.head, .tabs, .sheet, .work, .state, .alert, .strip, .jobs, .diff-section, .auth, script, style, template, dialog, [hidden], svg, .recent-pushes') ) bad.push('page: stray child of main: ' + name(c));
119135 }
120- const cs = getComputedStyle(main);
121- const left = main.getBoundingClientRect().left + parseFloat(cs.paddingLeft);
122- const right = main.getBoundingClientRect().right - parseFloat(cs.paddingRight);
123- const bar = document.querySelector('.pathbar');
124- if (w >= 900 && bar && Math.abs(bar.getBoundingClientRect().left - left) > 1) bad.push('edge: path bar ' + bar.getBoundingClientRect().left + ' main ' + left);
125- for (const e of main.querySelectorAll('a, button, input, select, textarea, summary')) {
126- const r = e.getBoundingClientRect();
127- if (!r.width || e.closest('pre, [popover], .menu-list, .pop-panel, .corner-menu, .tabs, .sub, .repo-tabs, .profile-tabs, .heat-grid, details:not([open]) > :not(summary)')) continue;
128- const where = ' in ' + (e.parentElement.className || e.parentElement.tagName) + ' < ' + (e.parentElement.parentElement.className || e.parentElement.parentElement.tagName);
129- if (r.right > right + 1) bad.push('past the column: ' + e.tagName + ' "' + (e.textContent || e.name || '').trim().slice(0, 30) + '" right ' + Math.round(r.right) + ' > ' + Math.round(right) + where);
130- if (r.left < left - 1) bad.push('left of the edge: ' + e.tagName + '.' + e.className + ' "' + (e.textContent || '').trim().slice(0, 30) + '"' + where);
131- }
132- const width = main.dataset.width;
133- if (width !== 'wide') {
134- for (const c of ['card', 'rows-pane', 'row-line', 'fit-pane', 'page-head', 'row-field', 'side-link', 'settings-layout']) {
135- const n = main.querySelectorAll('.' + c).length;
136- if (n) bad.push('old layout .' + c + ' x' + n);
136+ // Every control, found by what it is and not by its class.
137+ const scope = [...document.querySelectorAll('.topbar *, main *')];
138+ for (const e of scope) {
139+ if (!seen(e) || e.closest('.markdown-body, pre, .sr-only, svg')) continue;
140+ const c = getComputedStyle(e);
141+ const p = px(e);
142+ const label = name(e);
143+ const tag = e.tagName;
144+ const isText = tag === 'INPUT' && !['checkbox','radio','color','file','range','hidden'].includes(e.type);
145+ const isBtn = tag === 'BUTTON' || (tag === 'INPUT' && ['submit','button'].includes(e.type)) || e.matches('summary.button, a.button, summary.act, a.act');
146+ if (isBtn && !e.closest('.heat-grid, .corner-theme-set, .choice, .swatches, .colour-grid') && !e.matches('.icon-btn, .rail-item, .line, .corner-link, .swatch')) {
147+ if (!CONTROLS.some(([h, r, fs]) => p.h === h && p.r === r && p.fs === fs)) bad.push('control shape ' + p.h + '/' + p.r + '/' + p.fs + ': ' + label);
137148 }
138- }
139- if (width !== 'wide') {
140- for (const e of main.querySelectorAll('div, section, article, ul, ol, form, aside, nav')) {
141- const c = getComputedStyle(e);
142- const r = e.getBoundingClientRect();
143- if (r.height < 64 || r.width < 200 || e.closest('pre, table, .copy-box, .heatmap, [popover], .menu-list, .pop-panel, .corner-menu, .diff-file, .snippet-files, details > .status-list')) continue;
144- const filled = c.backgroundColor !== 'rgba(0, 0, 0, 0)';
145- const boxed = parseFloat(c.borderTopWidth) > 0 && parseFloat(c.borderLeftWidth) > 0 && parseFloat(c.borderRightWidth) > 0;
146- if (filled || boxed) bad.push('box: ' + e.tagName + '.' + String(e.className).slice(0, 40));
149+ if (isText || tag === 'SELECT') {
150+ // One height a place: 32 in a tools row, 36 in the top bar, 38 everywhere else.
151+ const want = e.closest('.sheet-tools') ? 32 : e.closest('.topbar, .pathbar, .top-search') ? 36 : 38;
152+ if (p.h !== want) bad.push('field height ' + p.h + ' (want ' + want + '): ' + label);
153+ if (p.b) bad.push('field border: ' + label);
154+ if (none(p.bg) && !e.closest('.plain-search, .top-search')) bad.push('field without fill: ' + label);
147155 }
148- for (const e of main.querySelectorAll('select')) {
149- if (!e.closest('.field') && e.getBoundingClientRect().width > 320) bad.push('stretched select ' + (e.name || ''));
156+ if (tag === 'TEXTAREA' && p.b) bad.push('field border: ' + label);
157+ if (tag === 'TEXTAREA' && p.r !== '12') bad.push('textarea radius ' + p.r + ': ' + label);
158+ if (!/figtree/i.test(p.ff) && !/plex/i.test(p.ff) && !e.matches('input[type=checkbox], input[type=radio]')) bad.push('font ' + p.ff.split(',')[0] + ': ' + label);
159+ if (e.childNodes.length && [...e.childNodes].some((n) => n.nodeType === 3 && n.textContent.trim())) {
160+ if (!ALLOWED_FONT.has(p.fs)) bad.push('font size ' + p.fs + ': ' + label);
161+ if (c.textTransform === 'uppercase') bad.push('uppercase: ' + label);
162+ if (c.fontStretch !== '100%') bad.push('font stretch ' + c.fontStretch + ': ' + label);
150163 }
151- for (const e of main.querySelectorAll('label:not(.colour-choice):has(> input[type=checkbox], > input[type=radio])')) {
152- const i = e.querySelector('input').getBoundingClientRect();
153- const t = e.querySelector('span, small');
154- if (t && t.getBoundingClientRect().top >= i.bottom - 1) bad.push('tick above its label: ' + t.textContent.trim().slice(0, 30));
164+ if (!none(p.bg) || p.b) {
165+ if (!ALLOWED_RADIUS.has(p.r) && !p.r.endsWith('%')) bad.push('radius ' + p.r + ': ' + label);
155166 }
167+ const sides = [c.borderTopWidth, c.borderRightWidth, c.borderBottomWidth, c.borderLeftWidth].filter((v) => parseFloat(v) > 0).length;
168+ if (sides === 4 && !e.closest('table') && !e.matches('input[type=checkbox], input[type=radio]')) bad.push('box border: ' + label);
169+ if (parseFloat(c.borderLeftWidth) >= 2 && sides === 1) bad.push('side stripe: ' + label);
170+ if (c.boxShadow !== 'none' && /\\) -?\\d+px -?\\d+px [1-9]\\d*px/.test(c.boxShadow) && !e.matches('.corner-menu, .menu-list, .pop-panel, .ref-menu, .row-menu-panel, .tab-more-list, .strip-list, .bell-box, .palette-box, .decide, .decide-panel, .status-list, .ci-pop')) bad.push('shadow: ' + label);
171+ }
172+ // A form's submit and its Cancel are one row: neither sits alone as a child of the fields.
173+ for (const e of root.querySelectorAll('.fields > a.act, .fields > button.act')) {
174+ if (seen(e)) bad.push('act outside its acts row: ' + name(e));
175+ }
176+ // Field widths by kind, in a labelled field: a word 280, a sentence or more 560.
177+ for (const e of root.querySelectorAll('.field > input[type=text], .field > input[type=email], .field > input[type=password], .field > input[type=url], .field > input:not([type]), .field > textarea')) {
178+ if (!seen(e) || e.closest('.sheet-tools, .decide-panel, .review-inline-form')) continue;
179+ const w = Math.round(e.getBoundingClientRect().width);
180+ const room = Math.round(e.parentElement.getBoundingClientRect().width);
181+ const want = e.tagName === 'TEXTAREA' || e.matches('[name=title], [name=summary], [name=description]') ? 560 : 280;
182+ if (w !== want && w < room - 4) bad.push('field width ' + w + ' (want ' + want + '): ' + name(e));
183+ }
184+ if (document.documentElement.scrollWidth > innerWidth + 1) {
185+ const over = [...root.querySelectorAll('*')].find((e) => e.getBoundingClientRect().right > innerWidth + 1 && !e.closest('pre, table, .diff, .log'));
186+ bad.push('sideways overflow ' + document.documentElement.scrollWidth + ' at ' + (over ? name(over) : '?'));
156187 }
157188 // A pane that lost its height: its content is there and nothing of it can be seen.
158- for (const e of main.querySelectorAll('div, section, ul, ol, pre, article')) {
189+ for (const e of root.querySelectorAll('div, section, ul, ol, pre, article')) {
159190 const r = e.getBoundingClientRect();
160191 if (r.height >= 4 || r.width < 40 || e.closest('.sr-only, [hidden]') || !e.innerText?.trim()) continue;
161192 if (e.children.length === 1 && e.firstElementChild.matches('.sr-only')) continue;
162- if (getComputedStyle(e).display !== 'none') bad.push('collapsed: ' + e.tagName + '.' + String(e.className).slice(0, 40) + ' height ' + Math.round(r.height));
193+ if (getComputedStyle(e).display !== 'none') bad.push('collapsed: ' + name(e));
163194 }
164- for (const b of main.querySelectorAll('.acts > button:not(.act, .primary), .sec button.danger:not(.act)')) bad.push('button where a text link belongs: ' + b.textContent.trim().slice(0, 30));
165195 return [...new Set(bad)];
166196 })()`;
167197
198+// The rules a floating panel must keep, run while it is open.
199+const PANEL = `((root) => {
200+ const bad = [];
201+ const shaped = (e) => { const c = getComputedStyle(e); return c.position === 'absolute' || c.position === 'fixed'; };
202+ const panel = [...root.querySelectorAll('*')].find((e) => shaped(e) && e.getBoundingClientRect().width > 80 && !e.closest('summary'));
203+ if (panel) {
204+ const c = getComputedStyle(panel);
205+ if (c.borderTopLeftRadius !== '20px') bad.push('panel radius ' + c.borderTopLeftRadius + ': ' + panel.className);
206+ if (c.boxShadow === 'none') bad.push('panel without shadow: ' + panel.className);
207+ }
208+ return bad;
209+})`;
210+
168211 // Opens each closed disclosure and popover in turn, checks its panel, shuts it.
169212 const OPEN = `(async () => {
170213 const bad = [];
@@ -184,6 +227,8 @@ const OPEN = `(async () => {
184227 if (!r.width || !r.height || k.closest('pre')) continue;
185228 if (r.right > innerWidth + 1 || r.left < -1) { bad.push('open panel leaves the window: ' + (summary.textContent || '').trim().slice(0, 30) + ' at ' + k.tagName + '.' + k.className + ' ' + Math.round(r.left) + '-' + Math.round(r.right)); break; }
186229 }
230+ bad.push(...${PANEL}(root));
231+ bad.push(...(${PANEL})(root));
187232 if (document.documentElement.scrollWidth > innerWidth + 1) bad.push('opening makes the page wide: ' + (summary.textContent || '').trim().slice(0, 30));
188233 }
189234 if (e.tagName === 'DETAILS') { e.open = false; } else { document.querySelector(':popover-open')?.hidePopover(); }
@@ -195,6 +240,7 @@ const OPEN = `(async () => {
195240 await send("Page.enable");
196241 await send("Runtime.enable");
197242 await send("Network.enable");
243+await send("Emulation.setEmulatedMedia", { features: [{ name: "prefers-color-scheme", value: theme }] });
198244 mkdirSync(`${out}/shots`, { recursive: true });
199245 const report: Record<string, string[]> = {};
200246 let openedTotal = 0;
@@ -202,10 +248,12 @@ for (const path of paths) {
202248 for (const [width, height] of windows) {
203249 await send("Emulation.setDeviceMetricsOverride", { width, height, deviceScaleFactor: 1, mobile: false });
204250 await go(base + path);
205- const bad: string[] = (await js(CHECK)) ?? ["page did not answer"];
251+ // An account's own theme wins over the system's: the audit asks for the one it measures.
252+ if (process.env.AUDIT_THEME) await js(`document.documentElement.setAttribute('data-theme', ${JSON.stringify(theme)})`);
253+ const bad: string[] = (await js(DESIGN)) ?? ["page did not answer"];
206254 const code = await js("document.title");
207255 if (/not found|error/i.test(code ?? "")) bad.push("title: " + code);
208- const name = path.replace(/[^a-z0-9]+/gi, "_") + "_" + width;
256+ const name = path.replace(/[^a-z0-9]+/gi, "_").slice(0, 120) + "_" + width + (theme === "dark" ? "_dark" : "");
209257 if (shots) await shot(name);
210258 // --menus: one shot per floating panel, open, for review by eye.
211259 if (menus) {
@@ -229,5 +277,16 @@ for (const path of paths) {
229277
230278 proc.kill();
231279 writeFileSync(`${out}/measure.json`, JSON.stringify(report, null, 1));
280+// The same problems grouped, worst first, with one page for each.
281+const groups = new Map<string, { n: number; at: string }>();
282+for (const [view, list] of Object.entries(report)) {
283+ for (const line of list) {
284+ const g = groups.get(line) ?? { n: 0, at: view };
285+ g.n++;
286+ groups.set(line, g);
287+ }
288+}
289+const sorted = [...groups].sort((a, b) => b[1].n - a[1].n).map(([line, g]) => `${String(g.n).padStart(4)} ${line} (${g.at})`);
290+writeFileSync(`${out}/measure.txt`, sorted.join("\n") + "\n");
232291 console.log(`${paths.length} paths, ${paths.length * windows.length} views, ${openedTotal} panels opened, ${Object.keys(report).length} views with problems`);
233292 process.exit(0);
scripts/audit/mock.pyadded+194 -0
@@ -0,0 +1,194 @@
1+#!/usr/bin/env python3
2+"""Fills a seeded audit server with what seed.py cannot make without real runners: runners in every
3+state, a history of finished, failed, running and cancelled CI runs with steps and logs, and an hour of
4+host samples behind the runner graphs.
5+
6+Usage: scripts/audit/mock.py OUT_DIR db with the server stopped, as it holds the database
7+ scripts/audit/mock.py OUT_DIR samples with the server up
8+"""
9+import hashlib
10+import json
11+import math
12+import os
13+import random
14+import secrets
15+import sqlite3
16+import sys
17+import time
18+import urllib.request
19+
20+out, phase = sys.argv[1], sys.argv[2]
21+seed = json.load(open(os.path.join(out, "seed.json")))
22+data = os.path.join(out, "data")
23+SECRET = "mock-runner-secret"
24+random.seed(7)
25+now = time.time()
26+
27+
28+def stamp(t):
29+ return time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(t)) + ".000000000Z"
30+
31+
32+def uid():
33+ alphabet = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
34+ return "01MOCK" + "".join(random.choice(alphabet) for _ in range(20))
35+
36+
37+def fill_database():
38+ db = sqlite3.connect(os.path.join(data, "forge.db"), timeout=30)
39+ db.row_factory = sqlite3.Row
40+ # Runners: two online, one busy, one offline, one disabled. The mock ones go first: they are older
41+ # than the seeded runner, which is the one to keep.
42+ db.execute("delete from ci_runners where id like '01MOCK%'")
43+ first = db.execute("select id from ci_runners order by created_at limit 1").fetchone()["id"]
44+ db.execute(
45+ "update ci_runners set name='build-01', labels='[\"linux\",\"x86_64\",\"large\"]', secret_hash=?, last_seen_at=?,"
46+ " reported_concurrency=4, reported_version='0.9.2', reported_cpus=16, reported_memory_bytes=68719476736,"
47+ " reported_build='949180b', reported_memory_free=41000000000, reported_memory_budget=60000000000 where id=?",
48+ (hashlib.sha256(SECRET.encode()).hexdigest(), stamp(now - 3), first),
49+ )
50+ runners = [first]
51+ for name, labels, seen, disabled, cpus, memory in [
52+ ("build-02", '["linux","x86_64"]', now - 8, 0, 8, 34359738368),
53+ ("arm-builder", '["linux","arm64"]', now - 40, 0, 4, 17179869184),
54+ ("old-mac", '["macos","arm64"]', now - 86400 * 3, 0, 8, 17179869184),
55+ ("retired-box", '["linux","x86_64"]', now - 86400 * 20, 1, 2, 8589934592),
56+ ]:
57+ rid = uid()
58+ runners.append(rid)
59+ db.execute(
60+ "insert into ci_runners (id,name,labels,secret_hash,created_at,last_seen_at,disabled,reported_concurrency,"
61+ "reported_version,reported_cpus,reported_memory_bytes) values (?,?,?,?,?,?,?,?,?,?,?)",
62+ (rid, name, labels, secrets.token_hex(32), stamp(now - 86400 * 40), stamp(seen), disabled, 2, "0.9.2", cpus, memory),
63+ )
64+
65+ # Runs: the newest last, as the numbers go up.
66+ repo = db.execute(
67+ "select r.id from repos r join users u on u.id=r.owner_id where r.name=? and u.username=?",
68+ (seed["repo"], seed["admin"]),
69+ ).fetchone()["id"]
70+ actor = db.execute("select id from users where username=?", (seed["admin"],)).fetchone()["id"]
71+ head = seed["head_oid"]
72+ first_oid = seed["first_oid"]
73+ db.execute("delete from ci_job_steps where job_id like '01MOCK%'")
74+ db.execute("delete from ci_jobs where id like '01MOCK%'")
75+ db.execute("delete from ci_runs where id like '01MOCK%'")
76+ number = (db.execute("select max(number) n from ci_runs where repo_id=?", (repo,)).fetchone()["n"] or 0) + 1
77+ JOBS = {
78+ "test": ["Checkout", "Unit tests", "E2E tests"],
79+ "lint": ["Checkout", "Clippy", "Format"],
80+ "package": ["Build", "Package"],
81+ }
82+ PLAN = [
83+ "success", "success", "failure", "success", "cancelled", "success", "success", "failure",
84+ "success", "success", "success", "running",
85+ ]
86+ LOG = """{step}
87+ Compiling forge-core v0.9.2
88+ Compiling forge-git v0.9.2
89+ Compiling forge-web v0.9.2
90+ Finished `dev` profile in 41.08s
91+ Running unittests src/lib.rs
92+ running 214 tests
93+ test store::ci::tests::a_requeued_job_starts_with_no_steps ... ok
94+ test store::ci::tests::steps_take_the_jobs_result ... ok
95+ test wiki_e2e::follows_a_push ... {result}
96+ """
97+ logs = os.path.join(data, "ci", "logs")
98+ os.makedirs(logs, exist_ok=True)
99+ failed_run = None
100+ running_run = None
101+ for i, state in enumerate(PLAN):
102+ start = now - (len(PLAN) - i) * 3600 * 2
103+ run_id = uid()
104+ took = random.randint(420, 1500)
105+ finished = None if state == "running" else stamp(start + took)
106+ db.execute(
107+ "insert into ci_runs (id,repo_id,number,trigger,git_ref,commit_oid,actor_id,state,created_at,finished_at)"
108+ " values (?,?,?,?,?,?,?,?,?,?)",
109+ (run_id, repo, number, "push", "refs/heads/main", head if i % 2 else first_oid, actor, state, stamp(start), finished),
110+ )
111+ if state == "failure":
112+ failed_run = number
113+ if state == "running":
114+ running_run = number
115+ start = now - 420
116+ for j, (name, steps) in enumerate(JOBS.items()):
117+ job_id = uid()
118+ job_state = state
119+ if state == "failure" and name != "test":
120+ job_state = "success" if name == "lint" else "skipped"
121+ if state == "running" and name == "package":
122+ job_state = "blocked"
123+ if state == "running" and name == "lint":
124+ job_state = "success"
125+ began = start + j * 20
126+ length = took // len(JOBS)
127+ ended = None if job_state in ("running", "blocked") else stamp(began + length)
128+ lines = []
129+ offset = 0
130+ step_rows = []
131+ for k, step in enumerate(steps):
132+ step_start = began + k * length // len(steps)
133+ bad = job_state == "failure" and k == len(steps) - 1
134+ live = job_state == "running" and k == len(steps) - 1
135+ text = "::group::" + step + "\n" + LOG.format(step="$ " + step.lower(), result="FAILED" if bad else "ok")
136+ if bad:
137+ text += "error: stream closed before the push event arrived\n --> crates/forge-e2e/tests/e2e/wiki_e2e.rs:212:9\n"
138+ text += "::endgroup::\n"
139+ step_rows.append((job_id, k, step, stamp(step_start), None if live or bad else stamp(step_start + length // len(steps)), offset))
140+ offset += len(text.encode())
141+ lines.append(text)
142+ body = "".join(lines) if job_state not in ("blocked", "skipped") else ""
143+ db.execute(
144+ "insert into ci_jobs (id,run_id,name,spec,state,runner_id,exit_code,queued_at,started_at,finished_at,heartbeat_at,log_bytes,step_scanned)"
145+ " values (?,?,?,?,?,?,?,?,?,?,?,?,?)",
146+ (job_id, run_id, name, '{"image":"docker.io/library/rust:1","run":"cargo test","needs":[],"secrets":[],"env":{},"artifacts":[],"runs_on":[],"cache":[],"timeout_minutes":60,"network":true}',
147+ job_state, runners[j % 2] if job_state != "blocked" else None, 1 if job_state == "failure" else 0, stamp(began - 5), stamp(began), ended,
148+ stamp(now) if job_state == "running" else None, len(body.encode()), len(body.encode())),
149+ )
150+ if body:
151+ db.executemany("insert into ci_job_steps (job_id,seq,name,started_at,finished_at,log_offset) values (?,?,?,?,?,?)", step_rows)
152+ with open(os.path.join(logs, job_id + ".log"), "w") as f:
153+ f.write(body)
154+ number += 1
155+ db.commit()
156+
157+ seed["runner_id"] = first
158+ seed["failed_run"] = failed_run
159+ seed["running_run"] = running_run
160+ seed["runners"] = runners
161+ json.dump(seed, open(os.path.join(out, "seed.json"), "w"))
162+ print(f"[mock] done: failed #{failed_run}, running #{running_run}")
163+
164+
165+def send_samples():
166+ # An hour of samples behind the graphs: the server keeps them in memory, so they go in as a runner's would.
167+ samples = []
168+ for m in range(0, 3600, 10):
169+ t = now - 3600 + m
170+ wave = (math.sin(m / 400) + 1) / 2
171+ samples.append({
172+ "at_ms": int(t * 1000),
173+ "cpu_percent": round(15 + 70 * wave + random.uniform(-5, 5), 1),
174+ "mem_used_bytes": int((18 + 22 * wave) * 2**30),
175+ "mem_total_bytes": 64 * 2**30,
176+ "net_rx_bytes_per_s": int((2 + 40 * wave) * 2**20),
177+ "net_tx_bytes_per_s": int((1 + 12 * wave) * 2**20),
178+ "running_jobs": int(wave * 4),
179+ })
180+ request = urllib.request.Request(
181+ seed["base"] + "/api/v1/ci/runners/metrics",
182+ json.dumps({"samples": samples}).encode(),
183+ {"Content-Type": "application/json", "Authorization": "Bearer " + SECRET},
184+ )
185+ try:
186+ print("[mock] samples", urllib.request.urlopen(request).status)
187+ except OSError as e:
188+ print("[mock] samples failed:", e)
189+
190+
191+if phase == "db":
192+ fill_database()
193+else:
194+ send_samples()
scripts/audit/paths.pyadded+21 -0
@@ -0,0 +1,21 @@
1+#!/usr/bin/env python3
2+"""Prints one path a line for every GET page, filled from seed.json, for scripts/audit/measure.ts.
3+
4+Usage: scripts/audit/paths.py OUT_DIR SRC_DIR
5+"""
6+import json
7+import os
8+import re
9+import sys
10+
11+out, SRC = sys.argv[1], sys.argv[2]
12+seed = json.load(open(os.path.join(out, "seed.json")))
13+# The route table lives in shoot.py, which also starts a browser when run, so only that part is taken.
14+text = open(os.path.join(os.path.dirname(__file__), "shoot.py"), encoding="utf-8").read()
15+exec(text[text.index("def discover():"): text.index("def slugify(")])
16+seen = []
17+for pat in discover():
18+ for url, _ in concrete(pat):
19+ if url not in seen:
20+ seen.append(url)
21+print("\n".join(seen))
scripts/audit/run.shmodified+4 -0
@@ -65,6 +65,8 @@ transport = "log"
6565 enabled = true
6666 EOF
6767
68+# With --keep-data the seed is there already, so the mock data goes in before the server takes the database.
69+[[ $KEEP == 1 ]] && python3 "$ROOT/scripts/audit/mock.py" "$OUT" db
6870 echo "[run] starting forge on 127.0.0.1:$PORT"
6971 "$BIN" --config "$OUT/forge.toml" > "$OUT/forge.log" 2>&1 &
7072 FORGE_PID=$!
@@ -89,6 +91,8 @@ if [[ $KEEP == 0 ]]; then
8991 python3 "$ROOT/scripts/audit/seed.py" "http://127.0.0.1:$PORT" "$OUT" 2>&1 | tee "$OUT/seed.log"
9092 fi
9193
94+[[ $KEEP == 1 ]] && python3 "$ROOT/scripts/audit/mock.py" "$OUT" samples
95+
9296 # AUDIT_SERVE=1 stops here and keeps the seeded server up, for scripts/audit/measure.ts.
9397 if [[ -n "${AUDIT_SERVE:-}" ]]; then
9498 echo "[run] serving on http://127.0.0.1:$PORT"
style/_admin_rows.scssmodified+7 -5
@@ -212,11 +212,13 @@
212212 opacity: 1;
213213 }
214214
215-.mx-table summary {
216- margin-top: 6px;
217- color: var(--text-2);
218- font-size: 0.8125rem;
219- cursor: pointer;
215+.mx-table > summary.act {
216+ margin-left: -10px;
217+ list-style: none;
218+
219+ &::-webkit-details-marker {
220+ display: none;
221+ }
220222 }
221223
222224 .mx-table-scroll {
style/_alive_head.scssdeleted+0 -83
@@ -1,83 +0,0 @@
1-// alive_head: see memory design/ALIVE.md.
2-// Repo head: the code-pages menu after the Code tab and the actions menu at the right end. Both
3-// panels float over the page. The tab bar clips its overflow (it scrolls on narrow windows), so the
4-// tab menu takes no position of its own: its panel is placed at its static position, and its
5-// containing block is an ancestor outside the bar, which the bar does not clip. The page head has
6-// no overflow rule, so the actions panel is not clipped either.
7-
8-// Code pages menu (Commits, Branches, Tags, Releases).
9-.tab-more {
10- position: static;
11- flex: none;
12-}
13-
14-.repo-tabs .tab-more-toggle {
15- display: inline-flex;
16- align-items: center;
17- margin-left: -16px;
18- padding: 0 2px;
19- border: 0;
20- border-radius: 0;
21- list-style: none;
22- cursor: pointer;
23-
24- &::-webkit-details-marker {
25- display: none;
26- }
27-
28- svg {
29- width: 14px;
30- height: 14px;
31- fill: none;
32- stroke: currentColor;
33- stroke-width: 2;
34- stroke-linecap: round;
35- stroke-linejoin: round;
36- }
37-}
38-
39-.tab-more[open] > .tab-more-toggle {
40- color: var(--text);
41-}
42-
43-.tab-more-list {
44- position: absolute;
45- z-index: 10;
46- display: flex;
47- flex-direction: column;
48- min-width: 180px;
49- margin-top: 6px;
50- padding: 6px 0;
51- background: var(--surface);
52- border: 1px solid var(--border);
53- border-radius: var(--radius-lg);
54-}
55-
56-.tab-more-link {
57- display: block;
58- padding: 8px 14px;
59- color: var(--muted);
60- white-space: nowrap;
61- text-decoration: none;
62-
63- &:hover {
64- color: var(--text);
65- text-decoration: none;
66- }
67-
68- &.is-current {
69- color: var(--text);
70- font-weight: 600;
71- }
72-}
73-
74-.head-more-list {
75- right: 0;
76- display: flex;
77- flex-direction: column;
78- align-items: flex-start;
79- gap: 10px;
80- min-width: 240px;
81- padding: 12px 14px;
82-}
83-
style/_alive_heat.scssdeleted+0 -47
@@ -1,47 +0,0 @@
1-// alive_heat: see memory design/ALIVE.md.
2-// Heat as age. nav.js sets data-heat on a row from its newest time[data-rel]: 3 under an hour,
3-// 2 under a day, 1 under a week, no attribute when older. Tone only: the name moves from --text-2
4-// (the floor, which passes 4.5:1 in both themes) towards --text. No accent, and the only motion
5-// is the colour fade on the name. The hover colour of a tree name is restored at the end.
6-
7-// The base state, for every row in these lists: the name is --text-2.
8-[data-kb-row] .commit-summary,
9-.repo-item .repo-name,
10-.pin-card .repo-name {
11- color: var(--text-2);
12-}
13-
14-@media (prefers-reduced-motion: no-preference) {
15- [data-kb-row] .commit-summary,
16- .repo-item .repo-name,
17- .pin-card .repo-name {
18- transition: color 1s;
19- }
20-}
21-
22-// Level 1: slightly brighter than the base.
23-[data-kb-row][data-heat="1"] .commit-summary,
24-.repo-item[data-heat="1"] .repo-name,
25-.pin-card[data-heat="1"] .repo-name {
26- color: color-mix(in srgb, var(--text) 30%, var(--text-2));
27-}
28-
29-// Level 2: brighter.
30-[data-kb-row][data-heat="2"] .commit-summary,
31-.repo-item[data-heat="2"] .repo-name,
32-.pin-card[data-heat="2"] .repo-name {
33- color: color-mix(in srgb, var(--text) 65%, var(--text-2));
34-}
35-
36-// Level 3: the newest rows. The name is --text and bold, and the time is --text.
37-[data-kb-row][data-heat="3"] .commit-summary,
38-.repo-item[data-heat="3"] .repo-name,
39-.pin-card[data-heat="3"] .repo-name {
40- color: var(--text);
41- font-weight: 600;
42-}
43-
44-[data-heat="3"] time[data-rel] {
45- color: var(--text);
46-}
47-
style/_alive_issue.scssdeleted+0 -8
@@ -1,8 +0,0 @@
1-// alive_issue: see memory design/ALIVE.md.
2-
3-// A sidebar part whose form is on the wire: dimmed, no spinner. The swap that follows replaces it.
4-.issue-side-section.is-pending,
5-.issue-check.is-pending {
6- opacity: 0.6;
7- cursor: progress;
8-}
style/_alive_lists.scssdeleted+0 -26
@@ -1,26 +0,0 @@
1-
2-
3-// Commit page: one line under the title holds the hash, signature, author, time, parents, checks
4-// and the Browse files link. It wraps on a narrow window and never becomes a card.
5-.commit-facts {
6- display: flex;
7- flex-wrap: wrap;
8- align-items: center;
9- gap: 6px 14px;
10- margin: 0 0 12px;
11- font-size: 0.875rem;
12- line-height: 1.5;
13-
14- > .commit-hash {
15- height: auto;
16- padding: 2px 8px;
17- border-radius: var(--radius-full);
18- font-family: var(--mono);
19- font-size: 0.8125rem;
20- }
21-
22- > .checks-summary {
23- flex: 0 0 auto;
24- }
25-
26-}
style/_alive_motion.scssdeleted+0 -92
@@ -1,92 +0,0 @@
1-// alive_motion: see memory design/ALIVE.md. Motion only where something real happened: an arrival after
2-// a live update, the running bar's breath, a finished bar settling, and the CI tab's live dot. The
3-// classes come from nav.js (`arrived`, `hs-settle`, `tab-live`); everything moves only when the reader
4-// has not asked for less motion.
5-
6-@media (prefers-reduced-motion: no-preference) {
7- @keyframes arrive-in {
8- from { opacity: 0; transform: translateY(-6px); }
9- to { opacity: 1; transform: none; }
10- }
11-
12- @keyframes arrive-grow {
13- from { transform: scaleY(0); }
14- to { transform: scaleY(1); }
15- }
16-
17- @keyframes arrive-count {
18- 0% { transform: scale(1); }
19- 40% { transform: scale(1.3); }
20- 100% { transform: scale(1); }
21- }
22-
23- @keyframes arrive-lift {
24- 0% { filter: brightness(1.6); }
25- 100% { filter: brightness(1); }
26- }
27-
28- @keyframes hs-breathe {
29- 0%, 100% { opacity: 1; }
30- 50% { opacity: 0.35; }
31- }
32-
33- // Only the start is given: the bar settles to its own final tone.
34- @keyframes hs-settle {
35- from { background-color: var(--accent); }
36- }
37-
38- @keyframes tab-breathe {
39- 0%, 100% { opacity: 1; }
40- 50% { opacity: 0.35; }
41- }
42-
43- // Rows slide in with a short fade; the commit bars grow from the strip's floor; a count and a
44- // calendar cell mark the change. Later rules win the same-specificity ties.
45- [data-arrive].arrived {
46- animation: arrive-in 300ms ease-out both;
47- }
48-
49- .hs-bar.arrived {
50- transform-origin: 50% 100%;
51- animation: arrive-grow 300ms ease-out both;
52- }
53-
54- .tab-count.arrived {
55- display: inline-block;
56- animation: arrive-count 300ms ease-out;
57- }
58-
59- .cell.arrived {
60- animation: arrive-lift 300ms ease-out;
61- }
62-
63- .history-bars > a.hs-live {
64- animation: hs-breathe 2.4s ease-in-out infinite;
65- }
66-
67- .history-bars > a.hs-settle {
68- animation: hs-settle 1.2s ease-out;
69- }
70-
71- .repo-tabs a.tab-live::after {
72- animation: tab-breathe 2.4s ease-in-out infinite;
73- }
74-}
75-
76-// The running bar is the accent in every state, with or without motion.
77-.history-bars > a.hs-live {
78- background: var(--accent);
79- opacity: 1;
80-}
81-
82-// The CI tab's dot while a run goes: static under reduced motion, breathing otherwise.
83-.repo-tabs a.tab-live::after {
84- content: "";
85- display: inline-block;
86- width: 6px;
87- height: 6px;
88- margin-left: 6px;
89- border-radius: 50%;
90- background: var(--accent);
91- vertical-align: middle;
92-}
style/_alive_scrub.scssdeleted+0 -61
@@ -1,61 +0,0 @@
1-// alive_scrub: see memory design/ALIVE.md. The timeline scrub on the repo home (nav.js).
2-
3-// Touch drags across the strip move the preview instead of scrolling the page.
4-.history-bars > a {
5- touch-action: none;
6-}
7-
8-.history-bars.is-scrubbing {
9- cursor: ew-resize;
10-}
11-
12-// The bar the preview shows, and the bar under the pointer while scrubbing: full tone, in the accent.
13-.history-bars > a.is-scrubbed {
14- background: var(--accent);
15- opacity: 1;
16-}
17-
18-// The preview's listing is not the latest commit: a quiet label says so.
19-.scrub-marker {
20- color: var(--muted);
21- margin: 0 0 8px;
22-}
23-
24-// The dock note: the commit shown, its age, and the way back.
25-.scrub-note {
26- display: inline-flex;
27- align-items: center;
28- gap: 8px;
29- color: var(--muted);
30-}
31-
32-.scrub-sha {
33- color: var(--text);
34-}
35-
36-.scrub-back {
37- background: none;
38- border: 0;
39- padding: 0;
40- color: var(--text);
41- font: inherit;
42- text-decoration: underline;
43- text-underline-offset: 3px;
44- cursor: pointer;
45-}
46-
47-.scrub-back:focus-visible {
48- outline: 2px solid var(--focus);
49- outline-offset: 2px;
50-}
51-
52-// The label takes a row of the tree pane, on the rows' own inset.
53-.repo-home .tree-list > .scrub-marker {
54- flex: none;
55- margin: 0;
56- padding: 8px 14px;
57-}
58-
59-.repo-home .tree-list .tree-entry {
60- cursor: default;
61-}
style/_alive_settings.scssdeleted+0 -189
@@ -1,189 +0,0 @@
1-
2-
3-// Branch protection: the rules are a list pane, the rule being edited fills the pane beside it. The
4-// rows stay one `details` group, so the panes are drawn by the list and the open row's form is laid
5-// over the right one: opening a row needs no script and closes the row that was open.
6-@media (min-width: 900px) {
7-
8- .rule-list {
9- position: relative;
10- display: block;
11- flex: 1 1 auto;
12- min-height: 0;
13- margin: 0;
14- overflow: visible;
15- border: 0;
16- background: none;
17-
18- &::before,
19- &::after {
20- content: "";
21- position: absolute;
22- top: 0;
23- bottom: 0;
24- box-sizing: border-box;
25- background: var(--surface);
26- border: 1px solid var(--border);
27- border-radius: 10px;
28- }
29-
30- &::before {
31- left: 0;
32- width: 300px;
33- }
34-
35- &::after {
36- left: 312px;
37- right: 0;
38- }
39-
40- > * + * {
41- border-top: 0;
42- }
43-
44- > .rule-row,
45- > .rule-builtin {
46- position: static;
47- box-sizing: border-box;
48- width: 300px;
49- }
50- }
51-
52- .rule-row > summary,
53- .rule-new > summary,
54- .rule-builtin {
55- position: relative;
56- z-index: 1;
57- box-sizing: border-box;
58- height: 36px;
59- padding: 0 14px;
60- box-shadow: inset 0 -1px var(--border);
61- font-size: 13px;
62- overflow: hidden;
63- white-space: nowrap;
64- }
65-
66- .rule-builtin {
67- display: flex;
68- align-items: center;
69- gap: 12px;
70- }
71-
72- .rule-row > summary:focus-visible {
73- outline-offset: -2px;
74- }
75-
76- .rule-row[open] > summary {
77- background: var(--surface-2);
78- }
79-
80- .rule-row[open] > summary .rule-edit {
81- visibility: hidden;
82- }
83-
84- .rule-row[open] > summary .rule-chevron {
85- transform: rotate(-45deg);
86- }
87-
88- .rule-pills {
89- display: flex;
90- gap: 6px;
91- min-width: 0;
92- overflow: hidden;
93- }
94-
95- .rule-pick {
96- position: absolute;
97- z-index: 1;
98- top: 20px;
99- left: 332px;
100- margin: 0;
101- }
102-
103- .rule-list:has(details[open]) .rule-pick {
104- display: none;
105- }
106-
107- .rule-row > .rule-form {
108- position: absolute;
109- z-index: 1;
110- inset: 0 0 0 312px;
111- display: grid;
112- grid-template-columns: repeat(2, minmax(0, 1fr));
113- align-content: start;
114- gap: 20px 32px;
115- box-sizing: border-box;
116- padding: 20px;
117- overflow: auto;
118- border: 0;
119- background: none;
120-
121- input[type="text"],
122- input[name="pattern"] {
123- max-width: none;
124- }
125-
126- > :not(.rule-section, .rule-pair) {
127- grid-column: 1 / -1;
128- }
129-
130- > .rule-section:has(input[name="required_checks"]) {
131- order: 1;
132- }
133-
134- > .rule-pair {
135- display: contents;
136-
137- > .rule-section {
138- order: 2;
139- }
140- }
141-
142- }
143-
144- .rule-section {
145- > legend {
146- margin-bottom: 8px;
147- font-family: var(--mono);
148- font-size: 11px;
149- font-weight: 500;
150- letter-spacing: 0.12em;
151- }
152-
153- > p.muted.small {
154- max-width: none;
155- }
156- }
157-
158- .rule-form .switch-row:first-child {
159- border-top: 0;
160- }
161-}
162-
163-// Branch protection rows: the open row differs from a closed one only in its background. Both keep
164-// the Edit text and a right chevron, so nothing swaps when a row opens.
165-.rule-row > summary .rule-chevron,
166-.rule-row[open] > summary .rule-chevron {
167- transform: rotate(-45deg);
168-}
169-
170-.rule-row[open] > summary .rule-edit {
171- visibility: visible;
172-}
173-
174-// Appearance: the preset swatches fit in rows of seven or more; the seven accents sit on one row.
175-.colour-choices {
176- display: grid;
177- grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr));
178- gap: 12px 8px;
179-}
180-
181-.colour-choices > .colour-choice {
182- width: auto;
183-}
184-
185-// The sound row spans the left column, so its label stays on one line beside the switch.
186-@media (min-width: 1100px) {
187-
188-}
189-
style/_authoring.scssmodified+1 -1
@@ -102,7 +102,7 @@ textarea.md-drop {
102102 .review-pending {
103103 &::before {
104104 content: "\00b7";
105- margin-right: 0.4em;
105+ margin: 0 0.4em;
106106 }
107107 }
108108
style/_browse.scssmodified+0 -9
@@ -10,15 +10,6 @@
1010 margin: 0 0 12px;
1111 }
1212
13-.seg {
14- display: inline-flex;
15- border: 1px solid var(--border-strong);
16- border-radius: var(--radius-md);
17- overflow: hidden;
18- background: var(--surface);
19-
20-}
21-
2213 // Split view: two sides per row, code wraps instead of scrolling sideways.
2314 .diff-table.diff-split {
2415 width: 100%;
style/_canvas.scssdeleted+0 -103
@@ -1,103 +0,0 @@
1-// The shell of the approved canvases. Imported after every other sheet, so it wins by order.
2-// Sizes are the canvases' own: a 54px path row with no box and no rule, a 36px tab row, 40px page
3-// margins, the body's accent wash, and no footer once signed in.
4-
5-@media (min-width: 900px) {
6- .topbar {
7- height: 54px;
8- padding: 0 40px;
9- background: transparent;
10- border-bottom: 0;
11- }
12-
13- .pathbar,
14- .pathbar:has(.pathbar-edit) {
15- max-width: none;
16- padding: 0;
17- background: transparent;
18- border: 0;
19- box-shadow: none;
20- border-radius: 0;
21- }
22-
23- .pathbar-ico {
24- display: none;
25- }
26-
27- .pathbar-segs {
28- font-family: var(--mono);
29- font-size: 13px;
30- }
31-
32- // The profile corner floats over the left of the page's foot. Panes stop above it, so it covers
33- // nothing; only pages with a dock or a left column that leaves it room reach the window's foot.
34- .shell-body > main {
35- padding: 0 40px 72px;
36- }
37-
38- .shell-body > main:has(.repo-home, .ci-run, .ci-job, .pull-page) {
39- padding-bottom: 20px;
40- }
41-
42- // The accent wash shows through on signed-in pages: the shell itself paints nothing.
43- .shell,
44- .shell-body {
45- background: transparent;
46- }
47-
48- body[data-signed-in] .site-footer {
49- display: none;
50- }
51-
52- .corner-float {
53- left: 40px;
54- bottom: 20px;
55- display: flex;
56- align-items: center;
57- box-sizing: border-box;
58- height: 40px;
59- padding: 0 8px 0 5px;
60- background: var(--surface-2);
61- border-radius: 9px;
62- box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
63- }
64-
65- .corner-float .corner-avatar .avatar {
66- width: 28px;
67- height: 28px;
68- border-radius: 6px;
69- }
70-
71- // The tab row: 36px, one hairline, the active tab a 2px accent rule on it.
72- .repo-tabs {
73- min-height: 36px;
74- }
75-
76- .repo-tabs {
77- gap: 22px;
78-
79- .tab {
80- padding: 0;
81- height: 36px;
82- line-height: 36px;
83- font-size: 14px;
84- color: var(--text-2);
85- }
86-
87- .tab[aria-current="page"],
88- .tab.active {
89- color: var(--text);
90- font-weight: 600;
91- box-shadow: inset 0 -2px var(--accent);
92- }
93-
94- .tab-count {
95- height: 18px;
96- padding: 0 4px;
97- background: transparent;
98- font-family: var(--mono);
99- font-size: 11px;
100- line-height: 18px;
101- }
102- }
103-}
style/_canvas_account.scssdeleted+0 -28
@@ -1,28 +0,0 @@
1-// canvas_account: details of the account, explore, admin and snippet pages.
2-// Imported last in main.scss, so these rules win over the page partials they correct.
3-
4-// Page heads: one 40px row, the right action centred in it at 32px, so at least 4px of the
5-// row sits under the button before the rule.
6-@media (min-width: 900px) {
7-
8-}
9-
10-// Heatmap: the last column's month label ends at the grid's edge and runs back over the
11-// columns before it, so "Nov" does not clip at the card's right edge.
12-.heat-months > span:last-child {
13- justify-self: end;
14-}
15-
16-// Explore: one pane with the shared 14px inset, nothing more.
17-.explore {
18- padding: 0;
19-}
20-
21-.explore > ul,
22-.explore > .repo-list {
23- margin: 0;
24-}
25-
26-.srv-form {
27- margin-top: 12px;
28-}
style/_canvas_ci.scssdeleted+0 -110
@@ -1,110 +0,0 @@
1-// The CI pages as the approved canvases (memory design/ALIVE.md): the runs list keeps its rows, drawn
2-// as the canvas's rows, and the selected run's column stacks the head and the panes.
3-
4-// The runs list: a hairline under each row, 14 px sides, the open run on --surface-2.
5-.ci-split > .ci-side .ci-row {
6- padding: 10px 14px;
7- box-shadow: inset 0 -1px var(--border);
8- border-radius: 0;
9-}
10-
11-.ci-split > .ci-side .ci-row[aria-current="true"] {
12- background: var(--surface-2);
13-}
14-
15-// The selected run's column: its head, its panes, and no scrolling of its own.
16-.ci-split > .ci-detail {
17- display: flex;
18- flex-direction: column;
19- gap: 12px;
20- min-width: 0;
21- min-height: 0;
22- overflow: hidden;
23- padding: 0;
24- background: none;
25- border: 0;
26- box-shadow: none;
27-}
28-
29-.ci-split > .ci-detail > .ci-tl-main {
30- flex: 1 1 0;
31- min-height: 0;
32-}
33-
34-// The page reaches the window's foot, and the dock is the repo page's: 156px with the label in a
35-// 254px column, so the floating profile corner covers no bars.
36-.ci-run.fit-pane,
37-.ci-job.fit-pane {
38- height: calc(100dvh - var(--pane-top, 107px) - 20px);
39-}
40-
41-.ci-dock {
42- flex: none;
43- height: 156px;
44- box-sizing: border-box;
45-}
46-
47-.ci-tl-tab {
48- flex-direction: row;
49-}
50-
51-// The dock's note sits under the `Last 48 commits` label, in the 254px label column, so no bar sits
52-// under it. Below 900px the dock stacks and the note takes its own line.
53-.ci-dock .ci-dock-note {
54- top: 34px;
55- left: 14px;
56- right: auto;
57- width: 226px;
58- margin: 0;
59- font-size: 12px;
60- line-height: 1.3;
61- color: var(--muted);
62-}
63-
64-// The header's actions (Re-run, Re-run failed jobs, Cancel) and the log toolbar's buttons are one size:
65-// 32px high, 13px text. Copy log and Full log take the same treatment.
66-.ci-tl-actions button,
67-.ci-tl-actions .button {
68- height: 32px;
69- font-size: 13px;
70-}
71-
72-.ci-tl-tools .ci-mini {
73- display: inline-flex;
74- align-items: center;
75- justify-content: center;
76- box-sizing: border-box;
77- height: 32px;
78- padding: 0 12px;
79- font-size: 13px;
80- line-height: 1;
81- text-decoration: none;
82-}
83-
84-.ci-tl-tools .ci-logsearch {
85- height: 32px;
86- box-sizing: border-box;
87-}
88-
89-@media (max-width: 899px) {
90- .ci-dock .ci-dock-note {
91- position: static;
92- width: auto;
93- margin-bottom: 6px;
94- }
95-}
96-
97-.ci-tl-tools a.ci-mini {
98- display: inline-flex;
99- align-items: center;
100- box-sizing: border-box;
101- height: 32px;
102- padding: 0 12px;
103- border: 1px solid var(--border);
104- border-radius: 7px;
105- background: transparent;
106- font-size: 13px;
107- font-weight: 600;
108- color: var(--text);
109- text-decoration: none;
110-}
style/_canvas_commits.scssdeleted+0 -17
@@ -1,17 +0,0 @@
1-
2-
3-@keyframes commits-beat {
4- 50% {
5- opacity: 0.4;
6- }
7-}
8-
9-@media (prefers-reduced-motion: reduce) {
10-
11-}
12-
13-// Below 900px the page stacks and the pane is as tall as its rows.
14-@media (max-width: 899px) {
15-
16-}
17-
style/_canvas_detail.scssdeleted+0 -192
@@ -1,192 +0,0 @@
1-// canvas_detail: the small fixes of the issue and pull conversation, and the label style.
2-// Tokens only; motion is not used here.
3-
4-// Mono uppercase section label (the Add a comment heading).
5-.label,
6-.issue-comment > .label {
7- @extend %mono-label;
8- margin: 0 0 10px;
9- color: var(--muted);
10-}
11-
12-// Conversation: the outer pane is not a card. Each comment, the merge box and the compose box sit
13-// directly on the page as 10px panes, with the same gap between them.
14-@media (min-width: 900px) {
15- .issue-layout > .issue-column.fit-pane {
16- gap: 12px;
17- padding: 0;
18- border: 0;
19- border-radius: 0;
20- background: none;
21-
22- > .issue-timeline {
23- gap: 12px;
24- }
25- }
26-}
27-
28-.issue-item,
29-.review-item,
30-.merge-box,
31-.issue-comment {
32- border-radius: 10px;
33-}
34-
35-.issue-comment {
36- margin: 0;
37- padding: 14px;
38- border: 1px solid var(--border);
39- background: var(--surface);
40- box-shadow: none;
41-}
42-
43-// Event rows sit under the comment avatars: the avatar starts 15px in (border plus 14px head pad).
44-.issue-timeline > .issue-event {
45- padding: 0 15px;
46-}
47-
48-// Right sidebar: one pane, hairline-separated sections, scrolling inside itself. The notifications
49-// section is a plain section, not a card nested in the pane.
50-@media (min-width: 900px) {
51- .issue-layout > .issue-sidebar.fit-pane {
52- padding: 0 14px;
53- overflow-y: auto;
54-
55- > .issue-side-section {
56- margin: 0;
57- padding: 14px 0;
58- }
59-
60- }
61-}
62-
63-// The list toolbar's selects match its 32px search field.
64-.issue-search select {
65- height: 32px;
66- min-height: 0;
67- padding-block: 0;
68-}
69-
70-// The commit page: the facts sit on one line's top, and the disclosure has air above the file count.
71-.commit-facts {
72- align-items: flex-start;
73-}
74-
75-// Labels: one line each, columns line up down the pane. Edit opens under its row and holds Delete,
76-// so a pane of labels is not a pane of red buttons.
77-.label-edit-body {
78- display: flex;
79- align-items: flex-end;
80- gap: 12px;
81- padding: 4px 0 14px;
82-
83-}
84-
85-.label-edit-form {
86- display: flex;
87- flex: 1 1 auto;
88- align-items: flex-end;
89- gap: 12px;
90- min-width: 0;
91-
92- > label {
93- display: flex;
94- flex-direction: column;
95- gap: 4px;
96- margin: 0;
97- font-size: 13px;
98- }
99-
100- > label:has(> input[type="text"]) {
101- flex: 1 1 0;
102- min-width: 0;
103- }
104-
105- > label:has(> input[type="color"]) {
106- flex-direction: column;
107- align-items: flex-start;
108- gap: 4px;
109- }
110-
111- input[type="color"] {
112- width: 36px;
113- height: var(--control-h);
114- }
115-
116- > button {
117- align-self: flex-end;
118- }
119-}
120-
121-// New label: the colour's label sits at the left, like every other field.
122-.stack > label:has(> input[type="color"]) {
123- flex-direction: row;
124- justify-content: flex-start;
125- text-align: left;
126-}
127-
128-// A chip whose colour is close to the page (white on light, black on dark) keeps a visible edge.
129-.label-chip {
130- box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--text) 14%, transparent);
131-}
132-
133-// Server settings use the pane's width, in columns wide enough for a label and its two badges on
134-// one line.
135-.srv-page form.srv-form {
136- max-width: none;
137- padding-bottom: 20px;
138-}
139-
140-// File pages: the path row has no rules of its own, the tab row's rule is the only one above it.
141-.browse-bar {
142- border-top: 0;
143- border-bottom: 0;
144-}
145-
146-// CI list: the log fills its pane to the bottom edge.
147-.ci-tl-panel-log > .ci-log {
148- flex: 1 1 auto;
149- height: 100%;
150- max-height: none;
151- min-height: 0;
152-}
153-
154-// Commit page: Show checks stays on the facts line and its list opens as a menu.
155-.commit-facts > .checks-summary {
156- position: relative;
157- flex-wrap: nowrap;
158-
159- > .checks-details {
160- flex-basis: auto;
161-
162- > .status-list {
163- position: absolute;
164- top: 100%;
165- left: 0;
166- z-index: 20;
167- min-width: 320px;
168- margin-top: 6px;
169- padding: 8px 12px;
170- background: var(--surface-2);
171- border: 1px solid var(--border-strong);
172- border-radius: var(--radius-md);
173- }
174- }
175-}
176-
177-// A side pane matches the pane beside it.
178-@media (min-width: 900px) {
179-
180-}
181-
182-// Blame: a commit takes two lines; going further back is a small mark on the first.
183-.blame-table .blame-top > .blame-prior {
184- flex: none;
185- margin: 0 0 0 auto;
186- text-decoration: none;
187- color: var(--text-2);
188-
189- &:hover {
190- color: var(--accent);
191- }
192-}
style/_canvas_lists.scssdeleted+0 -282
@@ -1,282 +0,0 @@
1-// canvas_lists: matches the approved canvases, see memory design/ALIVE.md.
2-// Every list row is one line: 36px high, a hairline under it, 14px side padding, the metadata in
3-// right aligned columns and no second line. Titles clip; nothing wraps.
4-
5-// Toolbar: one 44px row at the top of the pane.
6-.issue-pane > .issue-toolbar {
7- height: 44px;
8- margin: 0;
9- padding: 0 14px;
10- flex-wrap: nowrap;
11- gap: 10px;
12- box-sizing: border-box;
13- border-bottom: 1px solid var(--border);
14-}
15-
16-.issue-pane > .issue-list {
17- border: 0;
18- border-radius: 0;
19-}
20-
21-// Issue and pull rows: state dot, title, labels, then #n, author, age, milestone and tasks on the
22-// right, then assignee avatars and the comment count at the far end.
23-.issue-pane .issue-list > .issue-row {
24- display: flex;
25- align-items: center;
26- gap: 12px;
27- height: 36px;
28- min-width: 0;
29- padding: 0 14px;
30- overflow: hidden;
31- border-top: 0;
32- border-bottom: 1px solid var(--border);
33- background: var(--surface);
34-
35- &:hover {
36- background: var(--surface-2);
37- }
38-
39- > .issue-state {
40- flex: none;
41- width: 8px;
42- height: 8px;
43- margin: 0;
44- border-width: 0;
45- border-radius: 50%;
46- background: var(--muted);
47- }
48-
49- > .issue-state-open {
50- background: var(--ok);
51- }
52-
53- > .issue-main {
54- display: flex;
55- flex: 1 1 auto;
56- align-items: center;
57- gap: 12px;
58- min-width: 0;
59- overflow: hidden;
60- }
61-
62- .issue-title-line {
63- display: flex;
64- flex: 0 1 auto;
65- flex-wrap: nowrap;
66- align-items: center;
67- gap: 8px;
68- min-width: 0;
69- overflow: hidden;
70- }
71-
72- .issue-title {
73- min-width: 0;
74- overflow: hidden;
75- font-size: 14px;
76- font-weight: 500;
77- text-overflow: ellipsis;
78- white-space: nowrap;
79- }
80-
81- .issue-title-line > :not(.issue-title) {
82- flex: none;
83- white-space: nowrap;
84- }
85-
86- > .issue-main > .issue-meta {
87- display: flex;
88- flex: none;
89- flex-wrap: nowrap;
90- align-items: center;
91- gap: 12px;
92- margin: 0 0 0 auto;
93- font-size: 13px;
94- white-space: nowrap;
95- }
96-
97- > .issue-aside {
98- flex: none;
99- gap: 8px;
100- }
101-}
102-
103-// Panes: the list sits in one pane with a 1px border, 10px radius and no shadow.
104-.lang-list,
105-.explore {
106- box-shadow: none;
107- border: 1px solid var(--border);
108- border-radius: 10px;
109- background: var(--surface);
110- overflow: hidden;
111-}
112-
113-// Repo rows (Explore and the profile tabs): mono name, visibility, the description clipped in
114-// --text-2, then stars and the update age on the right.
115-.repo-list > .repo-item {
116- display: flex;
117- flex-wrap: nowrap;
118- align-items: center;
119- gap: 16px;
120- height: 52px;
121- min-width: 0;
122- padding: 0 16px;
123- overflow: hidden;
124- border-bottom: 1px solid var(--border);
125-
126- > .repo-name {
127- flex: 0 1 auto;
128- max-width: 40%;
129- min-width: 0;
130- overflow: hidden;
131- font-family: var(--mono);
132- font-size: 14px;
133- font-weight: 500;
134- text-overflow: ellipsis;
135- white-space: nowrap;
136- }
137-
138- > .badge {
139- flex: none;
140- }
141-
142- > .repo-desc {
143- flex: 1 1 auto;
144- min-width: 0;
145- overflow: hidden;
146- color: var(--text-2);
147- font-size: 13px;
148- text-overflow: ellipsis;
149- white-space: nowrap;
150- }
151-
152- > .repo-stats {
153- flex: none;
154- margin-left: auto;
155- white-space: nowrap;
156- }
157-}
158-
159-// Notification, Needs you and review request rows: reason as a small mono tag, the title, the
160-// repo or detail, the age and the row's own actions.
161-.review-request-list > li {
162- display: flex;
163- flex-wrap: nowrap;
164- align-items: center;
165- gap: 12px;
166- height: 36px;
167- min-width: 0;
168- padding: 0 14px;
169- overflow: hidden;
170- border-bottom: 1px solid var(--border);
171-
172- > .badge {
173- flex: none;
174- font-family: var(--mono);
175- font-size: 11px;
176- }
177-
178- > .muted,
179- > time {
180- flex: none;
181- white-space: nowrap;
182- }
183-
184-}
185-
186-// Issue rows: the assignee sits in a fixed 24px slot at the right, so the columns line up whether
187-// or not a row has an assignee.
188-.issue-pane .issue-list > .issue-row > .issue-aside {
189- display: flex;
190- align-items: center;
191- justify-content: flex-start;
192- min-width: 30px;
193- height: 24px;
194-
195- > .avatar {
196- flex: none;
197- width: 24px;
198- height: 24px;
199- }
200-}
201-
202-// The #n is a right aligned column of fixed width, so the numbers line up down the list.
203-.issue-pane .issue-list > .issue-row > .issue-main > .issue-meta > span:first-child {
204- flex: none;
205- width: 5ch;
206- text-align: right;
207- font-variant-numeric: tabular-nums;
208-}
209-
210-// Toolbar controls share one 32px height, centred in the 44px toolbar.
211-.issue-pane > .issue-toolbar {
212- align-items: center;
213-
214- > input,
215- > select,
216- > button,
217- > .button,
218- > details > summary {
219- height: 32px;
220- box-sizing: border-box;
221- }
222-
223- > details > summary {
224- display: inline-flex;
225- align-items: center;
226- }
227-}
228-
229-.lang-list > .empty-state {
230- padding: 16px 14px;
231-}
232-
233-// Labels: the colour is a 32px swatch with its label to the left and a border, like the inputs.
234-label:has(> input[type="color"]) {
235- display: flex;
236- align-items: center;
237- gap: 10px;
238-}
239-
240-input[type="color"] {
241- flex: none;
242- width: 32px;
243- height: 32px;
244- box-sizing: border-box;
245- padding: 3px;
246- border: 1px solid var(--border-strong);
247- border-radius: var(--radius-md);
248- background: var(--surface);
249- cursor: pointer;
250-
251- &::-webkit-color-swatch-wrapper {
252- padding: 0;
253- }
254-
255- &::-webkit-color-swatch {
256- border: 0;
257- border-radius: 3px;
258- }
259-
260- &::-moz-color-swatch {
261- border: 0;
262- border-radius: 3px;
263- }
264-}
265-
266-// Pull Files: long diff lines scroll inside their file's body; the file header stays put.
267-.pull-diff-scroll {
268- min-width: 0;
269- overflow-x: hidden;
270-
271- .diff-section,
272- .diff-file {
273- min-width: 0;
274- max-width: 100%;
275- }
276-
277- .diff-file-body {
278- min-width: 0;
279- max-width: 100%;
280- overflow-x: auto;
281- }
282-}
style/_canvas_pull.scssdeleted+0 -402
@@ -1,402 +0,0 @@
1-// canvas_pull: the pull request head and its Files view, matched to the One Lit Thing canvas
2-// (Pull.dc.html). Imported after _pull.scss and _review_flow.scss, so it wins by order. Sizes are
3-// the canvas's own: a 24px title, 36px rows and panes, a 260px file column, and a diff pane that
4-// scrolls inside itself. The page never scrolls: .pull-page takes the rest of the window.
5-
6-// Head: the title with the review buttons on one row, the state and branches on the next.
7-.pull-head {
8- display: flex;
9- flex-direction: column;
10- gap: 6px;
11- flex: none;
12- margin: 0;
13-}
14-
15-.pull-line1 {
16- display: flex;
17- align-items: center;
18- justify-content: space-between;
19- gap: 12px;
20- min-height: 32px;
21-
22- .issue-heading {
23- min-width: 0;
24- margin: 0;
25- overflow: hidden;
26- text-overflow: ellipsis;
27- white-space: nowrap;
28- font-family: var(--display);
29- font-size: 24px;
30- font-weight: 700;
31- line-height: 1.2;
32- letter-spacing: -0.005em;
33- }
34-}
35-
36-.pull-actions {
37- display: flex;
38- align-items: center;
39- gap: 8px;
40- flex: none;
41-
42- .btn {
43- height: 32px;
44- padding: 0 12px;
45- border-radius: 7px;
46- font-size: 13px;
47- font-weight: 600;
48- background: var(--surface-2);
49- box-shadow: inset 0 0 0 1px var(--border);
50- cursor: pointer;
51- }
52-
53- .btn.main {
54- background: var(--accent);
55- color: var(--accent-ink);
56- box-shadow: none;
57- }
58-}
59-
60-.pull-line2 {
61- display: flex;
62- align-items: center;
63- gap: 8px;
64- margin: 0;
65- min-width: 0;
66- font-size: 13px;
67- white-space: nowrap;
68-
69- code {
70- font-family: var(--mono);
71- font-size: 12px;
72- }
73-}
74-
75-.pull-totals {
76- margin-left: auto;
77- font-family: var(--mono);
78- font-size: 12px;
79- color: var(--muted);
80-}
81-
82-// The page: the two columns fill what the window leaves under the head.
83-@media (min-width: 900px) {
84- .fit-pane.pull-page {
85- display: flex;
86- flex-direction: column;
87- height: max(420px, calc(100dvh - var(--pull-top, 262px)));
88- padding: 0;
89- overflow: hidden;
90- }
91-
92- .pull-cols {
93- flex: 1 1 auto;
94- min-height: 0;
95- display: grid;
96- grid-template-columns: 260px minmax(0, 1fr);
97- gap: 16px;
98- }
99-
100- // The profile corner floats over the left of the page's foot: the panes stop above it.
101- .pull-left {
102- display: flex;
103- flex-direction: column;
104- gap: 12px;
105- min-height: 0;
106- margin-bottom: 64px;
107- }
108-
109- // Panes: 36px heads with a hairline, 36px rows with a hairline, 10px corners, no shadow.
110- .pull-left > .pane,
111- .pull-diff {
112- border-radius: 10px;
113- background: var(--surface);
114- box-shadow: inset 0 0 0 1px var(--border);
115- }
116-
117- .pull-cap {
118- display: flex;
119- align-items: center;
120- gap: 8px;
121- flex: none;
122- height: 36px;
123- padding: 0 14px;
124- box-shadow: inset 0 -1px var(--border);
125- }
126-
127- .pull-count {
128- margin-left: auto;
129- font-family: var(--mono);
130- font-size: 12px;
131- color: var(--muted);
132- white-space: nowrap;
133- }
134-
135- .pull-files {
136- flex: 1 1 auto;
137- min-height: 0;
138- display: flex;
139- flex-direction: column;
140- overflow: hidden;
141- }
142-
143- .pull-file-list {
144- flex: 1 1 auto;
145- min-height: 0;
146- margin: 0;
147- padding: 0;
148- list-style: none;
149- overflow: auto;
150- }
151-
152- .pull-file {
153- display: flex;
154- align-items: center;
155- gap: 8px;
156- height: 36px;
157- padding: 0 14px;
158- box-shadow: inset 0 -1px var(--border);
159- font-size: 13px;
160- }
161-
162- .pull-file.current {
163- background: var(--surface-2);
164- }
165-
166- .pull-file-link {
167- flex: 1 1 auto;
168- min-width: 0;
169- height: 100%;
170- display: flex;
171- align-items: center;
172- gap: 8px;
173- color: inherit;
174- text-decoration: none;
175-
176- .clip {
177- flex: 1 1 auto;
178- min-width: 0;
179- }
180- }
181-
182- .pull-file-ico {
183- flex: none;
184- color: var(--muted);
185- }
186-
187- .pull-counts {
188- flex: none;
189- font-family: var(--mono);
190- font-size: 12px;
191- white-space: nowrap;
192- }
193-
194- .pull-file input[type="checkbox"] {
195- flex: none;
196- width: 14px;
197- height: 14px;
198- margin: 0;
199- }
200-
201- .pull-file .viewed-note {
202- flex: none;
203- font-family: var(--mono);
204- font-size: 11px;
205- color: var(--muted);
206- }
207-
208- .pull-checks {
209- flex: 0 1 auto;
210- max-height: 40%;
211- min-height: 0;
212- overflow: auto;
213- }
214-
215- .pull-check {
216- display: flex;
217- align-items: center;
218- gap: 10px;
219- height: 36px;
220- padding: 0 14px;
221- box-shadow: inset 0 -1px var(--border);
222- font-size: 13px;
223-
224- .clip {
225- flex: 1 1 auto;
226- min-width: 0;
227- }
228- }
229-
230- .pull-check .pull-time {
231- flex: none;
232- font-family: var(--mono);
233- font-size: 12px;
234- color: var(--muted);
235- white-space: nowrap;
236- }
237-
238- .pull-check > span:first-child {
239- flex: none;
240- width: 8px;
241- height: 8px;
242- border-radius: 50%;
243- background: var(--muted);
244- }
245-
246- .pull-check > .ok {
247- background: var(--ok);
248- }
249-
250- .pull-check > .bad {
251- background: var(--bad);
252- }
253-
254- .pull-check > .live {
255- background: var(--accent);
256- animation: pull-beat 1.6s ease-in-out infinite;
257- }
258-
259- // The diff pane: a 36px top row, then one scroller holding every file, then the compose line.
260- .pull-diff {
261- min-height: 0;
262- display: flex;
263- flex-direction: column;
264- overflow: hidden;
265- }
266-
267- .pull-diff-top {
268- flex: none;
269- display: flex;
270- align-items: center;
271- gap: 10px;
272- height: 36px;
273- padding: 0 14px;
274- box-shadow: inset 0 -1px var(--border);
275- }
276-
277- .pull-diff-scroll {
278- flex: 1 1 auto;
279- min-height: 0;
280- overflow: auto;
281- }
282-
283- // The section's own heading and file index repeat the head and the Files pane, so they are left out.
284- .pull-diff-scroll > .diff-section > h2,
285- .pull-diff-scroll > .diff-section > .diff-index {
286- display: none;
287- }
288-
289- .pull-diff-scroll .diff-section {
290- margin: 0;
291- }
292-
293- .pull-diff-scroll .diff-file {
294- margin: 0;
295- border-radius: 0;
296- background: transparent;
297- }
298-
299- // The file header sticks to the top of the pane, over the pane's own scroll, never over code.
300- .pull-diff-scroll .diff-file-header {
301- top: 0;
302- border-radius: 0;
303- }
304-
305- // Inline notes sit in an inset surface under their line.
306- .pull-diff-scroll .review-thread {
307- margin: 6px 12px 6px 96px;
308- padding: 12px;
309- border-radius: 8px;
310- background: var(--surface-2);
311- }
312-
313- // The compose line: one input and Comment, pinned at the pane's foot. Focus opens the rest.
314- .pull-compose {
315- flex: none;
316- display: flex;
317- flex-direction: column;
318- gap: 8px;
319- margin: 0;
320- padding: 10px 14px;
321- border-radius: 0;
322- box-shadow: inset 0 1px var(--border);
323- background: var(--surface);
324- }
325-
326- .pull-more {
327- display: none;
328- align-items: center;
329- gap: 12px;
330- font-size: 13px;
331-
332- h2 {
333- margin: 0;
334- font-size: 13px;
335- font-weight: 600;
336- }
337-
338- p {
339- margin: 0;
340- }
341-
342- .review-inline {
343- margin-left: auto;
344- }
345- }
346-
347- .pull-compose:focus-within .pull-more {
348- display: flex;
349- }
350-
351- .pull-compose-form {
352- display: flex;
353- align-items: center;
354- gap: 8px;
355- margin: 0;
356- }
357-
358- .pull-compose .pull-input {
359- flex: 1 1 auto;
360- min-width: 0;
361- height: 32px;
362- padding: 0 12px;
363- border: 0;
364- border-radius: 7px;
365- background: var(--bg);
366- color: var(--text);
367- box-shadow: inset 0 0 0 1px var(--border);
368- font: inherit;
369- font-size: 13px;
370- outline: none;
371- }
372-
373- .pull-compose .btn {
374- flex: none;
375- height: 36px;
376- padding: 0 14px;
377- border-radius: 7px;
378- font-size: 13px;
379- font-weight: 600;
380- background: var(--surface-2);
381- box-shadow: inset 0 0 0 1px var(--border);
382- cursor: pointer;
383- }
384-
385- .pull-compose .btn.primary {
386- background: var(--accent);
387- color: var(--accent-text);
388- box-shadow: none;
389- }
390-}
391-
392-@keyframes pull-beat {
393- 50% {
394- opacity: 0.4;
395- }
396-}
397-
398-@media (min-width: 900px) and (prefers-reduced-motion: reduce) {
399- .pull-check > .live {
400- animation: none;
401- }
402-}
style/_canvas_repo.scssdeleted+0 -608
@@ -1,608 +0,0 @@
1-// canvas_repo: the repo home and the tree pages, matched to the approved layout study
2-// (TimelineRepo.dc.html, see memory design/ALIVE.md). Two panes over one dock: the tree (340px) and
3-// the README (the rest), then the dock (156px). Tokens only. Selectors carry .repo-home.canvas-repo so
4-// they outrank the older repo home rules in _repo.scss, which are not repeated here.
5-
6-// Desktop: the panes fill the window above the dock. nav.js measures the top of .repo-home and the
7-// footer (--pane-top, --pane-foot); the dock and its 12px gap come off the height.
8-@media (min-width: 900px) {
9- .repo-home.canvas-repo {
10- --repo-home-h: max(360px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px) - 168px));
11- grid-template-columns: var(--tree-w, 340px) 12px minmax(0, 1fr);
12- grid-template-rows: minmax(0, 1fr);
13- gap: 0;
14- height: var(--repo-home-h);
15- margin-top: 12px;
16-
17- .repo-main,
18- .repo-readme {
19- height: auto;
20- min-height: 0;
21- }
22- }
23-}
24-
25-// The panes: surface, a 1px border, 10px radius, no shadow. Popovers drop out of the head, so the
26-// panes do not clip; the scrolling parts are the tree rows and the README body.
27-.repo-home.canvas-repo {
28- .canvas-files,
29- .canvas-readme {
30- display: flex;
31- flex-direction: column;
32- min-width: 0;
33- min-height: 0;
34- overflow: visible;
35- background: var(--surface);
36- border: 1px solid var(--border);
37- border-radius: 10px;
38- }
39-
40- // Tree pane: the branch selector and the go-to-file tag share the head; the rows scroll below.
41- .canvas-files {
42-
43- .ref-select {
44- position: relative;
45- flex: none;
46- z-index: 6;
47- }
48-
49- // The branch keeps its exact spelling: a name is never upper-cased.
50- .ref-select > summary {
51- display: inline-flex;
52- align-items: center;
53- gap: 6px;
54- height: 36px;
55- padding: 0;
56- background: none;
57- border: 0;
58- box-shadow: none;
59- font-family: var(--mono);
60- font-size: 13px;
61- font-weight: 500;
62- color: var(--text-2);
63- cursor: pointer;
64- list-style: none;
65- }
66-
67- .ref-select > summary::-webkit-details-marker {
68- display: none;
69- }
70-
71- .ref-select .ref-icon {
72- display: none;
73- }
74-
75- .ref-select .ref-name {
76- padding: 0;
77- background: none;
78- border: 0;
79- font: inherit;
80- letter-spacing: inherit;
81- text-transform: inherit;
82- color: inherit;
83- }
84-
85- .ref-select .ref-caret svg {
86- width: 10px;
87- height: 10px;
88- }
89-
90- .crumbs {
91- flex: 1 1 auto;
92- min-width: 0;
93- overflow: hidden;
94- font-family: var(--mono);
95- font-size: 12px;
96- }
97-
98- .crumbs ol {
99- display: flex;
100- margin: 0;
101- padding: 0;
102- list-style: none;
103- overflow: hidden;
104- white-space: nowrap;
105- }
106-
107- // The go-to-file control sits at the right end, named, with its key beside the name.
108- .finder-open {
109- position: relative;
110- align-self: center;
111- display: inline-flex;
112- align-items: center;
113- flex: none;
114- height: 20px;
115- margin: 0 0 0 auto;
116- padding: 0 7px;
117- border: 0;
118- border-radius: 5px;
119- background: var(--surface-2);
120- box-shadow: none;
121- font-family: var(--mono);
122- font-size: 11px;
123- color: var(--text-2);
124- }
125-
126- .finder-open .finder-label {
127- margin-right: 6px;
128- font-family: var(--font);
129- font-size: 12px;
130- }
131-
132- .finder-open kbd {
133- padding: 0;
134- border: 0;
135- background: none;
136- font: inherit;
137- color: inherit;
138- }
139-
140- // Rows: 30px, one line. The whole row is the target (the name link stretches over it).
141- .table-wrap.tree-list {
142- flex: 1 1 auto;
143- min-height: 0;
144- overflow-y: auto;
145- padding: 4px 0;
146- border: 0;
147- border-radius: 0;
148- background: none;
149- box-shadow: none;
150- }
151-
152- .tree-entry {
153- position: relative;
154- display: flex;
155- align-items: center;
156- gap: 10px;
157- height: 30px;
158- min-width: 0;
159- padding: 0 14px;
160- }
161-
162- .tree-entry:hover {
163- background: var(--surface-2);
164- }
165-
166- .tree-kind {
167- display: inline-flex;
168- flex: none;
169- color: var(--muted);
170- }
171-
172- .tree-kind .kind-icon {
173- width: 14px;
174- height: 14px;
175- }
176-
177- .tree-entry-name {
178- flex: 1 1 auto;
179- min-width: 0;
180- overflow: hidden;
181- font-family: var(--mono);
182- font-size: 13px;
183- white-space: nowrap;
184- text-overflow: ellipsis;
185- color: var(--text);
186- text-decoration: none;
187- }
188-
189- a.tree-entry-name::after {
190- content: "";
191- position: absolute;
192- inset: 0;
193- }
194-
195- .tree-entry-sha {
196- flex: none;
197- font-size: 12px;
198- color: var(--muted);
199- }
200-
201- .tree-entry-age {
202- flex: none;
203- margin-left: auto;
204- font-size: 12px;
205- text-align: right;
206- white-space: nowrap;
207- color: var(--muted);
208- }
209- }
210-
211- // README pane: the file name at the left, the facts and Clone at the right.
212- .canvas-readme {
213-
214- .readme-meta {
215- overflow: hidden;
216- text-overflow: ellipsis;
217- }
218-
219- // Clone is a plain button, not the filled one. The popover drops over the body.
220- .clone {
221- position: relative;
222- z-index: 6;
223- }
224-
225- .clone > summary.button {
226- height: 28px;
227- padding: 0 10px;
228- border: 0;
229- background: none;
230- box-shadow: inset 0 0 0 1px var(--border);
231- font-family: var(--font);
232- font-size: 12px;
233- font-weight: 500;
234- color: var(--text);
235- }
236-
237- // The body scrolls; padding 24px; prose left aligned, 760px, 14.5px over 1.6.
238- .canvas-body {
239- flex: 1 1 auto;
240- min-height: 0;
241- padding: 24px;
242- overflow-y: auto;
243- text-align: left;
244- }
245-
246- .canvas-body .repo-strip {
247- margin: 0 0 16px;
248- max-width: 760px;
249- }
250-
251- .canvas-body .readme {
252- max-width: 760px;
253- margin: 0;
254- padding: 0;
255- background: none;
256- border: 0;
257- box-shadow: none;
258- }
259-
260- .canvas-body .markdown-body {
261- flex: none;
262- max-width: 760px;
263- overflow: visible;
264- font-size: 14.5px;
265- line-height: 1.6;
266- color: var(--text-2);
267- }
268-
269- .canvas-body .markdown-body > * {
270- max-width: 760px;
271- margin-left: 0;
272- margin-right: 0;
273- }
274-
275- .canvas-body .markdown-body h1,
276- .canvas-body .markdown-body h2,
277- .canvas-body .markdown-body h3 {
278- color: var(--text);
279- }
280-
281- .canvas-body .readme-text {
282- font-family: var(--mono);
283- font-size: 13px;
284- white-space: pre-wrap;
285- color: var(--text-2);
286- }
287-
288- .canvas-body .empty-state {
289- text-align: left;
290- }
291- }
292-}
293-
294-// The dock: one pane under the panes, the full width. Its info row is 40px, its strip row 60px, with
295-// 20px between; the padding is 20px 16px 0. It has no overflow clip, so the message expander can
296-// open above it over the panes.
297-.canvas-dock {
298- position: relative;
299- z-index: 2;
300- box-sizing: border-box;
301- display: grid;
302- grid-template-rows: 40px 60px;
303- row-gap: 20px;
304- height: 156px;
305- min-width: 0;
306- margin-top: 12px;
307- padding: 20px 16px 0;
308- background: var(--surface);
309- border: 1px solid var(--border);
310- border-radius: 10px;
311- font-size: 13px;
312-}
313-
314-.canvas-dock .dock-info {
315- display: flex;
316- align-items: center;
317- gap: 12px;
318- height: 40px;
319- min-width: 0;
320-
321- > * {
322- flex: none;
323- white-space: nowrap;
324- }
325-
326- .dock-run {
327- display: inline-flex;
328- align-items: center;
329- gap: 8px;
330- font-weight: 600;
331- color: var(--text);
332- text-decoration: none;
333- }
334-
335- // The state word is accent only while the run goes.
336- .dock-state {
337- color: var(--text-2);
338- }
339-
340- .dock-state.is-live {
341- color: var(--accent);
342- }
343-
344- .sha {
345- font-family: var(--mono);
346- font-size: 12px;
347- color: var(--text-2);
348- }
349-
350- .dock-avatar {
351- width: 20px;
352- height: 20px;
353- }
354-
355- // The subject takes the rest of the row and clips, one line.
356- .dock-subject {
357- flex: 1 1 auto;
358- min-width: 0;
359- overflow: hidden;
360- white-space: nowrap;
361- text-overflow: ellipsis;
362- color: var(--text);
363- text-decoration: none;
364- }
365-
366- .dock-subject .commit-line {
367- display: block;
368- overflow: hidden;
369- text-overflow: ellipsis;
370- white-space: nowrap;
371- }
372-
373- .dock-expand {
374- position: relative;
375- }
376-
377- .dock-expand > summary {
378- display: inline-flex;
379- align-items: center;
380- justify-content: center;
381- width: 24px;
382- height: 24px;
383- border-radius: 6px;
384- color: var(--muted);
385- cursor: pointer;
386- list-style: none;
387- }
388-
389- .dock-expand > summary::-webkit-details-marker {
390- display: none;
391- }
392-
393- .dock-expand > summary:hover,
394- .dock-expand[open] > summary {
395- background: var(--surface-2);
396- color: var(--text);
397- }
398-
399- // The full message opens above the dock: body included, scrolling inside its own box.
400- .dock-message {
401- position: absolute;
402- bottom: calc(100% + 8px);
403- left: 0;
404- z-index: 10;
405- width: min(640px, 80vw);
406- max-height: 60vh;
407- overflow-y: auto;
408- box-sizing: border-box;
409- padding: 14px 16px;
410- background: var(--surface);
411- border: 1px solid var(--border);
412- border-radius: 10px;
413- white-space: normal;
414- }
415-
416- .dock-message-by {
417- margin: 0;
418- }
419-
420- .dock-message-text {
421- margin: 8px 0 0;
422- font-family: var(--mono);
423- font-size: 12.5px;
424- line-height: 1.5;
425- white-space: pre-wrap;
426- color: var(--text);
427- }
428-
429- .dock-count {
430- color: var(--muted);
431- }
432-
433- .dock-all {
434- font-weight: 600;
435- color: var(--text);
436- text-decoration: none;
437- }
438-}
439-
440-// The strip row: the label in a 254px column, then the bars of the last 48 commits, 60px tall.
441-.canvas-dock .dock-history {
442- display: grid;
443- grid-template-columns: 254px minmax(0, 1fr);
444- height: 60px;
445- min-width: 0;
446- order: 0;
447-}
448-
449-.canvas-dock .history-strip {
450- display: contents;
451-}
452-
453-.canvas-dock .history-label {
454- position: static;
455- align-self: start;
456- width: auto;
457- height: auto;
458- overflow: visible;
459- clip-path: none;
460- margin: 0;
461- padding-top: 2px;
462- font-family: var(--mono);
463- font-size: 12px;
464- font-weight: 500;
465- color: var(--text-2);
466-}
467-
468-.canvas-dock .history-bars {
469- gap: 3px;
470- height: 60px;
471- min-width: 0;
472- align-items: flex-end;
473-
474- > a {
475- flex: 1 1 0;
476- min-width: 2px;
477- border-radius: 2px;
478- background: var(--muted);
479- opacity: 0.55;
480- }
481-
482- > a.hs-bad {
483- background: var(--bad);
484- opacity: 1;
485- }
486-
487- // Accent means a run is going. The newest commit is only brighter: a bar says nothing of a result
488- // unless a run failed, and a repo with no CI has none.
489- > a.hs-live {
490- background: var(--accent);
491- opacity: 1;
492- }
493-
494- > a:last-child:not(.hs-bad, .hs-live) {
495- opacity: 1;
496- }
497-}
498-
499-// Narrow windows: the panes stack and the page grows; the strip, which needs the width, is left out.
500-@media (max-width: 899px) {
501- .repo-home.canvas-repo {
502- grid-template-columns: minmax(0, 1fr);
503- grid-template-rows: auto;
504- height: auto;
505- margin-top: 12px;
506- }
507-
508- .repo-home.canvas-repo .canvas-files .table-wrap.tree-list {
509- overflow: visible;
510- }
511-
512- .repo-home.canvas-repo .canvas-readme .canvas-body {
513- overflow: visible;
514- }
515-
516- .canvas-dock {
517- height: auto;
518- grid-template-rows: auto;
519- }
520-
521- .canvas-dock .dock-info {
522- flex-wrap: wrap;
523- height: auto;
524- row-gap: 8px;
525- }
526-
527- .canvas-dock .dock-subject {
528- flex: 1 1 100%;
529- order: 1;
530- }
531-}
532-
533-@media (prefers-reduced-motion: reduce) {
534- .canvas-dock .health-dot.ember {
535- animation: none;
536- }
537-}
538-
539-// Fixes from the 1440px review (2026-11-01). Each rule is named by the screen it fixes.
540-
541-// Clone popover: the SSH hint wraps inside the 420px panel instead of running past its right edge.
542-.repo-home.canvas-repo .canvas-readme .clone .pop-panel > .small {
543- max-width: 100%;
544- white-space: normal;
545- overflow-wrap: anywhere;
546-}
547-
548-// Dock: the full message opens from the expander's right edge, and never wider than the window.
549-.canvas-dock .dock-info .dock-expand .dock-message {
550- left: auto;
551- right: 0;
552- width: 640px;
553- max-width: calc(100vw - 48px);
554-}
555-
556-// Dock: the expander is a 20px square with a down chevron, the same as the tab-more toggle.
557-.canvas-dock .dock-info .dock-expand > summary {
558- width: 20px;
559- height: 20px;
560- border-radius: 5px;
561-}
562-
563-.canvas-dock .dock-info .dock-expand > summary svg {
564- width: 14px;
565- height: 14px;
566- fill: none;
567- stroke: currentColor;
568- stroke-width: 2;
569- stroke-linecap: round;
570- stroke-linejoin: round;
571-}
572-
573-// Tree pane with no README: the message sits on the pane head's 14px inset, not the body's 24px.
574-.repo-home.canvas-repo .canvas-readme .canvas-body:has(> .empty-state) {
575- padding: 14px;
576-}
577-
578-.repo-home.canvas-repo .canvas-readme .canvas-body > .empty-state {
579- padding: 0;
580-}
581-
582-// Blob page: the rendered Markdown starts 24px under the file bar.
583-.file > .markdown-body {
584- padding-top: 24px;
585-}
586-
587-// Blame: the table is wider than the pane, so the pane scrolls both ways (the scrollbar shows at the
588-// foot of the pane) and the file bar stays at the top. Long lines are never cut at the edge.
589-.file.fit-pane:has(> .blame-table) {
590- overflow: auto;
591-}
592-
593-.file.fit-pane:has(> .blame-table) > .file-head {
594- position: sticky;
595- top: 0;
596- z-index: 2;
597-}
598-
599-.file > .file-view {
600- overflow: auto;
601-}
602-
603-// Finder: the input's text sits on the same 10px inset as the result rows (1px border included).
604-dialog.finder .finder-input {
605- padding-left: 9px;
606- padding-right: 9px;
607-}
608-
style/_fit.scssdeleted+0 -11
@@ -1,11 +0,0 @@
1-// A pane that takes the window's remaining height, so the page itself does not scroll: what is too
2-// long for the window scrolls inside it. nav.js measures the top and the footer (syncShellTop). Below
3-// 900px pages stack, so a pane is as tall as its content.
4-@media (min-width: 900px) {
5- .fit-pane {
6- box-sizing: border-box;
7- height: max(360px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px)));
8- overflow: auto;
9- overscroll-behavior: contain;
10- }
11-}
style/_fit_admin.scssdeleted+0 -38
@@ -1,38 +0,0 @@
1-// One-screen layout of admin dashboards and forms. See _fit.scss.
2-//
3-// The selectors here are compound on purpose: _account_admin.scss and main.scss load after this
4-// partial, so a single class rule there would win on equal specificity.
5-
6-// A fit pane's bottom margin would add to the page height, so it goes.
7-.card.fit-pane {
8- margin-bottom: 0;
9-}
10-
11-// Instance health (/admin/health): the storage and services cards sit side by side, under the
12-// summary. The alerts and the footnote span both columns.
13-@media (min-width: 900px) {
14- .health-page {
15- display: grid;
16- grid-template-columns: repeat(2, minmax(0, 1fr));
17- column-gap: 16px;
18-
19- }
20-}
21-
22-// User detail (/admin/users/{id}): the actions and the danger zone side by side, under the header.
23-@media (min-width: 900px) {
24-
25-}
26-
27-// Mail settings (/admin/mail): the SMTP form runs three fields across, the actions span the row.
28-@media (min-width: 900px) {
29- form.stack[action="/admin/mail"] {
30- display: grid;
31- grid-template-columns: repeat(3, minmax(0, 1fr));
32- gap: 14px 24px;
33-
34- > .actions {
35- grid-column: 1 / -1;
36- }
37- }
38-}
style/_fit_code.scssdeleted+0 -53
@@ -1,53 +0,0 @@
1-// One-screen layout of code, commits and CI logs. See _fit.scss.
2-
3-// File view (blob): the file header stays put and the code, the image or the rendered Markdown is
4-// the pane under it. The line anchors (#L12) scroll that box, since it is the nearest scroller.
5-@media (min-width: 900px) {
6- .file.fit-pane {
7- display: flex;
8- flex-direction: column;
9- overflow: hidden;
10-
11- .file-head {
12- flex: none;
13- }
14-
15- .file-view,
16- .file-image,
17- .markdown-body {
18- flex: 1 1 auto;
19- min-height: 0;
20- overflow: auto;
21- }
22- }
23-}
24-
25-// Commit page: the title and the commit card stay above, and the diff fills the rest of the window.
26-// The header is tall, so the pane may get less than the usual 360px minimum.
27-@media (min-width: 900px) {
28- .commit-diff.fit-pane {
29- height: max(240px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px)));
30- }
31-}
32-
33-// Run page and runs list: the selected run (the right column of the split) is the pane. The runs
34-// list beside it (.ci-side, main.scss) uses the same height.
35-@media (min-width: 761px) {
36- .ci-main {
37- max-height: max(320px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px)));
38- overflow: auto;
39- }
40-}
41-
42-// Profile overview: a little less air between the header, the tabs, the calendar and the pins, and
43-// a smaller avatar, so the calendar and the pinned repos fit one window.
44-@media (min-width: 900px) {
45- .profile-page {
46- gap: 16px;
47- }
48-
49- .profile-avatar {
50- width: 144px;
51- height: 144px;
52- }
53-}
style/_fit_forms.scssdeleted+0 -64
@@ -1,64 +0,0 @@
1-
2-
3-@media (min-width: 900px) {
4- // A card that is a pane with a form in it: no bottom margin (the pane fills the window), and the
5- // form takes the rest of the card under the heading.
6- .fit-pane.card {
7- margin-bottom: 0;
8-
9- &:has(> form) {
10- display: flex;
11- flex-direction: column;
12-
13- > form {
14- flex: 1 1 auto;
15- min-height: 0;
16- }
17- }
18- }
19-
20- // The editor's label takes the rest of the form, and its textarea fills the label.
21- .fit-pane > form > label:has(> textarea) {
22- flex: 1 1 0;
23- min-height: 0;
24- }
25-
26- .fit-pane > form > label > textarea {
27- flex: 1 1 0;
28- min-height: 6rem;
29- height: auto;
30- }
31-
32- // The snippet form is the pane itself: its doc, its file card and the active file fill it.
33- .snippet-form.fit-pane {
34- // The pane clips its overflow, so the focus ring of the card edges gets a little room.
35- padding: 4px;
36-
37- .snippet-files {
38- flex: 1 1 auto;
39- min-height: 0;
40- }
41-
42- // The active file is shown by a :has() rule in main.scss (specificity 1,3,0). This one is one
43- // class higher, so the file can be a flex column that its contents fill.
44- @for $i from 0 through 9 {
45- .snippet-files:has(#snippet-tab-#{$i}:checked) .snippet-panel-#{$i} {
46- display: flex;
47- flex-direction: column;
48- flex: 1 1 auto;
49- min-height: 0;
50- }
51- }
52-
53- .snippet-content {
54- flex: 1 1 0;
55- min-height: 0;
56- height: auto;
57- }
58- }
59-
60- // The form's two cards share a row on the widest windows; the header and the notes span both.
61- @media (min-width: 1200px) {
62-
63- }
64-}
style/_fit_lists.scssdeleted+0 -4
@@ -1,4 +0,0 @@
1-// One-screen layout of notifications, security log and audit log. See _fit.scss.
2-@media (min-width: 900px) {
3-
4-}
style/_fit_settings.scssdeleted+0 -10
@@ -1,10 +0,0 @@
1-
2-
3-@media (min-width: 900px) {
4-
5-}
6-
7-// The new webhook form: the fields in the left column, the event list in the right one.
8-@media (min-width: 900px) {
9-
10-}
style/_fit_tables.scssdeleted+0 -5
@@ -1,5 +0,0 @@
1-
2-
3-@media (max-width: 899px) {
4-
5-}
style/_fit_threads.scssdeleted+0 -17
@@ -1,17 +0,0 @@
1-// One-screen layout of issues, pull requests and discussions. See _fit.scss.
2-// The conversation column and the side column carry .fit-pane in the markup: from 900px each scrolls
3-// on its own and the page does not. The padding keeps a focus ring and the comment box's edge from
4-// being cut by the scroller, and leaves room under the last item.
5-@media (min-width: 900px) {
6- .issue-column.fit-pane,
7- .issue-sidebar.fit-pane {
8- padding: 2px 8px 16px 2px;
9- scrollbar-gutter: stable;
10- }
11-
12- // A pull's files: the review bar and the diff scroll inside the pane. The header and tabs above it stay
13- // in view, and the sticky file headers of the diff stick inside the pane.
14- .fit-pane > .diff-section {
15- padding: 2px 8px 16px 2px;
16- }
17-}
style/_kb_rerun.scssmodified+6 -38
@@ -1,21 +1,14 @@
1-// The Re-run control of a CI run row, which r reruns from the keyboard. It is a small quiet button in
2-// the row's top corner, shown on the hovered, focused or selected row. It sits over the row's corner,
3-// so the row keeps its height, and the title leaves room for it.
4-
5-.ci-run-list > li {
6- position: relative;
7-}
1+// The Re-run control of a CI run row, which r reruns from the keyboard. It is the shared quiet action
2+// right after the row's text, shown on the hovered, focused or selected row, and always on touch.
83
94 .ci-row-rerun-form {
10- position: absolute;
11- top: 8px;
12- right: 8px;
135 margin: 0;
146 opacity: 0;
157
16- li:hover &,
17- li:focus-within &,
18- li.kb-sel & {
8+ .ci-run-item:hover &,
9+ .ci-run-item:focus-within &,
10+ .ci-run-item.kb-sel &,
11+ .ci-run-item:has(> .ci-row[aria-current="true"]) & {
1912 opacity: 1;
2013 }
2114
@@ -23,28 +16,3 @@
2316 opacity: 1;
2417 }
2518 }
26-
27-li:has(> .ci-row-rerun-form) .ci-row-title {
28- padding-right: 64px;
29-}
30-
31-.ci-row-rerun {
32- height: 28px;
33- padding: 0 10px;
34- font-size: 13px;
35- color: var(--text-2);
36- background: var(--surface);
37- border: 1px solid var(--border);
38- border-radius: var(--radius-md);
39- cursor: pointer;
40-
41- &:hover {
42- color: var(--text);
43- border-color: var(--border-strong);
44- }
45-}
46-
47-@media (prefers-reduced-motion: reduce) {
48- .ci-row-rerun-form {
49- }
50-}
style/_lang_admin.scssdeleted+0 -78
@@ -1,78 +0,0 @@
1-// Settings and admin pages: the pages behind the site section sidebar (`.shell-site`, see views/mod.rs).
2-// Main takes the window's full width. From 900px its one pane fills it, or a second pane sits beside
3-// the first at a form's width, and anything that is not a pane (the head, a notice) spans the row. Forms stop at
4-// 720px and stay left aligned. Repo, org and other pages are not affected.
5-
6-// The page's column: main itself, or the `data-live` wrapper that most admin pages put inside it.
7-$page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > main > [data-live]:not(.srv-page):not(.health-page):not(.user-page):not(.teams-page)";
8-
9-#{$page-column} {
10- min-width: 0;
11- max-width: none;
12-}
13-
14-@media (min-width: 900px) {
15- #{$page-column} {
16- display: grid;
17- grid-template-columns: minmax(0, 1fr);
18- align-content: start;
19- align-items: start;
20- gap: 16px;
21-
22- > :not(.card) {
23- grid-column: 1 / -1;
24- }
25- }
26-
27-}
28-
29-// The head's action (Security's link to the log) sits at the right end of the one row.
30-@media (min-width: 900px) {
31-
32-}
33-
34-// Panes side by side end at the same height. A card's bottom margin would shorten a stretched pane
35-// by 16px, so the split's and the grids' cards drop it; the grid gap already spaces them.
36-.health-page > .card {
37- margin-bottom: 0;
38-}
39-
40-// Server settings: every field's head is one 24px line, so the controls of a row sit on one line. A
41-// label that does not fit is clipped with its full text in `title`; the badges keep their place.
42-.srv-form .srv-field .srv-head {
43- height: 24px;
44- flex-wrap: nowrap;
45- gap: 6px;
46-}
47-
48-.srv-form .srv-field .srv-label {
49- min-width: 0;
50- margin-right: 0;
51- overflow: hidden;
52- text-overflow: ellipsis;
53- white-space: nowrap;
54-}
55-
56-.srv-form .srv-field .srv-head > .badge {
57- flex: none;
58- white-space: nowrap;
59-}
60-
61-// Paths and other fixed values: one mono line, the same height as the inputs, scrolled sideways
62-// rather than broken mid-word.
63-.srv-form .srv-field .srv-fixed {
64- display: block;
65- box-sizing: border-box;
66- height: var(--control-h);
67- min-height: 0;
68- padding: 0 12px;
69- font-size: 13px;
70- line-height: calc(var(--control-h) - 2px);
71- white-space: nowrap;
72- overflow-x: auto;
73- overflow-y: hidden;
74- overflow-wrap: normal;
75- word-break: normal;
76- scrollbar-width: thin;
77-}
78-
style/_lang_browse.scssdeleted+0 -49
@@ -1,49 +0,0 @@
1-
2-
3-@media (min-width: 900px) {
4-
5-}
6-
7-// Tree pages: the repo home's grid without the bottom dock (only the repo home shows the dock), so the
8-// listing and the README fill the window.
9-@media (min-width: 900px) {
10- .tree-browse {
11- --repo-home-h: max(360px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px)));
12- }
13-}
14-
15-// Code search: the search form and the results are one pane that fills the window. The results scroll
16-// inside it, and take the full width.
17-@media (min-width: 900px) {
18- .search-page.fit-pane {
19- display: flex;
20- flex-direction: column;
21- gap: 12px;
22- overflow: hidden;
23-
24- > :not(.search-results) {
25- flex: none;
26- }
27-
28- > .search-results {
29- flex: 1 1 auto;
30- min-height: 0;
31- overflow-y: auto;
32- overscroll-behavior: contain;
33- }
34- }
35-}
36-
37-.search-page .search-form,
38-.search-page .search-results {
39- width: 100%;
40- max-width: none;
41-}
42-
43-// Wiki: an empty list or page is left aligned in its pane, with the next step under the message.
44-.wiki-page .empty-state {
45- align-items: flex-start;
46- padding: 0;
47- text-align: left;
48-
49-}
style/_lang_ci.scssdeleted+0 -132
@@ -1,132 +0,0 @@
1-// The CI list and the job page in the page language (LANGUAGE.md): both fill the window under the head,
2-// each pane scrolls inside itself, and nothing is a centred column. Imported last, so it wins over the
3-// older split and job rules in main.scss and _fit_code.scss.
4-
5-// The timeline is drawn in 640 units: past this width its text would grow with the pane.
6-.ci-gantt {
7- max-width: 800px;
8- overflow: visible;
9-}
10-
11-// The runs list (480px, as the canvas) and the selected run fill the window down to the footer.
12-@media (min-width: 900px) {
13- .ci-split.fit-pane {
14- grid-template-columns: clamp(340px, 25vw, 480px) minmax(0, 1fr);
15- align-items: stretch;
16- gap: 12px;
17- padding: 0;
18- overflow: hidden;
19- }
20-
21- .ci-split > .ci-side,
22- .ci-split > .ci-main {
23- position: static;
24- min-height: 0;
25- max-height: none;
26- margin: 0;
27- }
28-
29- .ci-split > .ci-side {
30- display: flex;
31- flex-direction: column;
32- overflow: hidden;
33- }
34-
35- // One row of controls: the count, Run workflow and Status badge stay on one line.
36- .ci-split > .ci-side .ci-side-head,
37- .ci-split > .ci-side .ci-tools {
38- flex-wrap: nowrap;
39- }
40-
41- .ci-split > .ci-side .ci-run-list {
42- flex: 1 1 auto;
43- min-height: 0;
44- overflow-y: auto;
45- overscroll-behavior: contain;
46- }
47-
48- .ci-split > .ci-main {
49- overflow-y: auto;
50- overscroll-behavior: contain;
51- }
52-}
53-
54-// A run's page keeps the runs list at the left, in the same place, so a click only changes the right.
55-.ci-split > .ci-run {
56- display: flex;
57- flex-direction: column;
58- gap: 12px;
59- min-width: 0;
60- min-height: 0;
61-
62- > .ci-tl-main {
63- flex: 1 1 0;
64- min-height: 0;
65- }
66-}
67-
68-@media (min-width: 900px) {
69- .ci-split.fit-pane:has(> .ci-run) {
70- height: calc(100dvh - var(--pane-top, 107px) - 20px);
71- }
72-
73- .ci-split > .ci-run {
74- overflow: hidden;
75- }
76-
77- .ci-all-runs {
78- display: none;
79- }
80-}
81-
82-// Between phone and desktop the panes stack, as the rest of the site does. On a run's page the run
83-// comes first and All runs leads back, or it would sit under a whole list.
84-@media (max-width: 899px) {
85- .ci-split {
86- grid-template-columns: minmax(0, 1fr);
87- }
88-
89- // The page scrolls here. A pane share of a fixed height left a run with a long title no room at all.
90- .ci-split.fit-pane {
91- height: auto;
92- overflow: visible;
93- }
94-
95- .ci-split > .ci-detail,
96- .ci-split > .ci-run {
97- height: auto;
98- overflow: visible;
99- }
100-
101- .ci-split > .ci-detail > .ci-tl-main,
102- .ci-split > .ci-run > .ci-tl-main {
103- flex: none;
104- }
105-
106- .ci-split:has(> .ci-run) > .ci-side {
107- display: none;
108- }
109-}
110-
111-// The detail's empty state reads from the left, inside its pane.
112-.ci-split .empty-state {
113- align-items: flex-start;
114- padding: 16px 0;
115- text-align: left;
116-
117-}
118-
119-// The job page: the head and the log fill the window, the log pane takes the rest.
120-@media (min-width: 900px) {
121- .ci-job.fit-pane {
122- display: flex;
123- flex-direction: column;
124- gap: 12px;
125- padding: 0;
126- overflow: hidden;
127- }
128-
129- .ci-job .ci-tl-no a {
130- color: inherit;
131- }
132-}
style/_lang_issues.scssdeleted+0 -266
@@ -1,266 +0,0 @@
1-// Issues, pull requests and discussions in the page language (style/_language.scss, LANGUAGE.md).
2-// Lists are one pane: a toolbar row, then hairline rows with the metadata at the right end. Issue,
3-// pull and discussion pages are a conversation pane and a 300px sidebar pane, each scrolling inside
4-// itself. Forms are 720px and left aligned. Markup: `.issue-pane` wraps a list page's body.
5-
6-// Lists: one pane that fills the window. The toolbar stays at the top, the rows scroll under it,
7-// and the pager stays at the foot.
8-@media (min-width: 900px) {
9- .issue-pane.fit-pane {
10- display: flex;
11- flex-direction: column;
12- margin: 0;
13- padding: 0;
14- overflow: hidden;
15- border: 1px solid var(--border);
16- border-radius: var(--radius-lg);
17- background: var(--surface);
18-
19- > .issue-toolbar,
20- > .pager {
21- flex: none;
22- }
23-
24- > .issue-list,
25- > .issue-timeline {
26- flex: 1 1 auto;
27- min-height: 0;
28- overflow: auto;
29- overscroll-behavior: contain;
30- }
31-
32- > .issue-list {
33- border: 0;
34- border-radius: 0;
35- background: none;
36- }
37- }
38-}
39-
40-// Toolbar: tabs, search and filters, and the buttons on one row.
41-.issue-pane > .issue-toolbar {
42- display: flex;
43- flex-wrap: wrap;
44- align-items: center;
45- gap: 8px 12px;
46- margin: 0;
47- padding: 10px 14px;
48- border-bottom: 1px solid var(--border);
49-
50- > .issue-tabs {
51- flex: none;
52- gap: 2px;
53-
54- a {
55- padding: 4px 10px;
56- }
57- }
58-
59- > .issue-search {
60- flex: 1 1 16rem;
61- min-width: 0;
62- margin: 0;
63- flex-wrap: nowrap;
64-
65- input[type="search"] {
66- flex: 1 1 10rem;
67- min-width: 8rem;
68- max-width: none;
69- height: 32px;
70- }
71-
72- select,
73- button {
74- height: 32px;
75- padding: 0 10px;
76- font-size: 14px;
77- }
78- }
79-
80- > .issue-tools {
81- display: flex;
82- flex: none;
83- align-items: center;
84- gap: 8px;
85-
86- nav {
87- display: flex;
88- gap: 8px;
89- }
90-
91- .button {
92- height: 32px;
93- padding: 0 12px;
94- font-size: 13px;
95- line-height: 30px;
96- box-sizing: border-box;
97- }
98- }
99-}
100-
101-// Rows: a hairline between them, the title and metadata on the left, the assignees and the
102-// comment count right aligned at the far end of the row.
103-.issue-pane .issue-list .issue-row {
104- display: grid;
105- grid-template-columns: 14px minmax(0, 1fr) minmax(7rem, auto);
106- align-items: center;
107- gap: 12px;
108- padding: 10px 14px;
109- border-top: 1px solid var(--border);
110-
111- > .issue-state {
112- grid-column: 1;
113- margin: 0;
114- align-self: center;
115- }
116-
117- > .issue-main {
118- grid-column: 2;
119- min-width: 0;
120- }
121-
122- > .issue-aside {
123- grid-column: 3;
124- justify-content: flex-end;
125- min-width: 0;
126- }
127-
128- // A row without a state dot (discussions, the template chooser): two columns.
129- &:not(:has(> .issue-state)) {
130- grid-template-columns: minmax(0, 1fr) minmax(7rem, auto);
131-
132- > .issue-main {
133- grid-column: 1;
134- }
135-
136- > .issue-aside {
137- grid-column: 2;
138- }
139- }
140-}
141-
142-.issue-pane .issue-list .issue-row:first-child {
143- border-top: 0;
144-}
145-
146-.issue-pane .issue-row .issue-meta {
147- margin-top: 2px;
148-}
149-
150-.issue-pane .issue-row .issue-title-line {
151- gap: 6px;
152-}
153-
154-.issue-pane > .pager {
155- margin: 0;
156- padding: 8px 14px;
157- border-top: 1px solid var(--border);
158-}
159-
160-// Issue, pull request and discussion pages: the title in one line, then state and meta on one line.
161-.issue-heading {
162- overflow: hidden;
163- margin: 0;
164- font-size: 24px;
165- line-height: 1.25;
166- white-space: nowrap;
167- text-overflow: ellipsis;
168-}
169-
170-.issue-head {
171- margin-bottom: 0;
172-}
173-
174-.issue-byline {
175- margin: 4px 0 0;
176- font-size: 13px;
177- line-height: 1.4;
178-}
179-
180-@media (min-width: 900px) {
181- // The conversation is the left pane, the sidebar a 300px right pane. Both scroll inside.
182- .issue-layout {
183- grid-template-columns: minmax(0, 1fr) 300px;
184- gap: 16px;
185- height: max(360px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px)));
186- }
187-
188- .issue-layout > .issue-column.fit-pane,
189- .issue-layout > .issue-sidebar.fit-pane {
190- height: 100%;
191- margin: 0;
192- padding: 12px;
193- border: 1px solid var(--border);
194- border-radius: var(--radius-lg);
195- background: var(--surface);
196- }
197-
198- .issue-layout > .issue-column.fit-pane {
199- gap: 12px;
200- }
201-
202- // Sidebar: the sections stack with a hairline, so the labels and assignees fit one screen.
203- .issue-layout > .issue-sidebar.fit-pane {
204- gap: 0;
205-
206- > .issue-side-section:last-child {
207- border-bottom: 0;
208- }
209- }
210-}
211-
212-// Label checklist: compact chips in a wrapping row instead of one tall list.
213-.issue-side-section form.stack:has(> .issue-check) {
214- display: flex;
215- flex-direction: row;
216- flex-wrap: wrap;
217- align-items: center;
218- justify-content: flex-start;
219- gap: 6px;
220-
221- > * {
222- grid-column: auto;
223- }
224-
225- > .issue-check {
226- display: inline-flex;
227- align-items: center;
228- gap: 4px;
229- height: 26px;
230- margin: 0;
231- padding: 0 8px 0 6px;
232- border: 1px solid var(--border);
233- border-radius: var(--radius-full);
234- font-size: 12px;
235- white-space: nowrap;
236-
237- .label-chip {
238- padding: 0 4px;
239- font-size: 12px;
240- }
241- }
242-
243- > div {
244- flex: 1 0 100%;
245- }
246-}
247-
248-.issue-side-section .issue-chips {
249- display: flex;
250- flex-wrap: wrap;
251- gap: 6px;
252-}
253-
254-// Forms: 720px, left aligned. They do not stretch across a wide window.
255-.issue-new,
256-.issue-edit.card {
257- max-width: 720px;
258-}
259-
260-// Comment history: the versions scroll inside their pane.
261-.issue-timeline.fit-pane {
262- padding: 12px;
263- border: 1px solid var(--border);
264- border-radius: var(--radius-lg);
265- background: var(--surface);
266-}
style/_lang_lists.scssdeleted+0 -42
@@ -1,42 +0,0 @@
1-// Page language for the repo list and form pages: commits, branches, tags, releases, compare, labels,
2-// milestones, merge queue and security. See _language.scss and LANGUAGE.md. Markup keeps its strings and
3-// the classes tests read; this file gives the wrappers their one-screen shape. Headings are styled by
4-// selector because tests read them as plain h2 elements.
5-
6-// A list pane: one surface pane that fills the window. Its toolbar row stays at the top, its rows
7-// scroll inside `.list-scroll`, and the pager or a footnote sits at its foot. Below 900px it is as tall
8-// as its content.
9-@media (min-width: 900px) {
10- .lang-list.fit-pane {
11- display: flex;
12- flex-direction: column;
13- overflow: hidden;
14- margin-bottom: 0;
15- padding: 0;
16- background: var(--surface);
17- border-radius: var(--radius-lg);
18- border: 1px solid var(--border);
19- box-shadow: none;
20- }
21-}
22-
23-.lang-list {
24-
25- > .pager {
26- flex: none;
27- margin: 0;
28- padding: 8px 16px;
29- border-top: 1px solid var(--border);
30- }
31-
32-}
33-
34-// The release form was 960px wide; forms are 720px, left aligned.
35-.release-form {
36- max-width: 720px;
37-}
38-
39-@media (min-width: 900px) {
40-
41-}
42-
style/_lang_people.scssdeleted+0 -91
@@ -1,91 +0,0 @@
1-
2-
3-// The import pages' tab strip and cards run to the width of the page, not 960px.
4-.import-job,
5-.export-page {
6- max-width: none;
7-}
8-
9-// The head's side note (Explore's intro): a small line at the right, out of the h1's row flow.
10-@media (min-width: 900px) {
11-
12-}
13-
14-// Needs you: sections are columns on a wide window. One section takes the whole width.
15-@media (min-width: 900px) {
16-
17-}
18-
19-// Review requests: wide rows with the metadata at the right, not stacked under the title.
20-@media (min-width: 900px) {
21- .review-request-list li {
22- display: grid;
23- grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) minmax(0, 12rem) 9rem;
24- align-items: center;
25- gap: 0 16px;
26- padding: 10px 0;
27- border-bottom: 1px solid var(--border);
28-
29- &:last-child {
30- border-bottom: 0;
31- }
32- }
33-}
34-
35-// Profile: a left pane (avatar, name, bio, local time, buttons) about 300px wide, and a right pane
36-// with the tabs and the content, which takes the rest of the width. Below 900px the page stacks.
37-@media (min-width: 900px) {
38- .profile-page {
39- position: relative;
40- min-height: 340px;
41- padding-left: 324px;
42-
43- > * {
44- min-width: 0;
45- }
46-
47- > * + * {
48- margin-top: 16px;
49- }
50-
51- > :nth-child(2) {
52- margin-top: 0;
53- }
54-
55- > .profile-head {
56- position: absolute;
57- top: 0;
58- left: 0;
59- box-sizing: border-box;
60- width: 300px;
61- flex-direction: column;
62- align-items: flex-start;
63- flex-wrap: nowrap;
64- gap: 12px;
65- padding: 20px;
66- background: var(--surface);
67- border: 1px solid var(--border);
68- border-radius: var(--radius-lg);
69- }
70-
71- .profile-head .profile-about {
72- padding: 0;
73- background: none;
74- border: 0;
75- }
76-
77- .profile-head .profile-avatar {
78- width: 160px;
79- height: 160px;
80- }
81-
82- }
83-}
84-
85-// The profile's tab row sits where every other page's head row sits.
86-@media (min-width: 900px) {
87- .profile-page > nav {
88- margin-top: -8px;
89- }
90-}
91-
style/_language.scssdeleted+0 -5
@@ -1,5 +0,0 @@
1-// The page language shared by every page (see the head rules): one head row of one height with one
2-// rule under it, so nothing jumps between pages. Imported after the page partials.
3-@media (min-width: 900px) {
4-
5-}
style/_look.scssmodified+6 -6
@@ -27,13 +27,13 @@ h1 {
2727 // muted captions that head a card's table or list. Only static UI text takes this; prose and user
2828 // content (commit messages, names, descriptions) keep their case.
2929 %mono-label {
30- font-family: var(--mono);
31- font-weight: 500;
32- font-size: 11px;
33- line-height: 1.4;
34- letter-spacing: 0.12em;
35- text-transform: uppercase;
3630 color: var(--muted);
31+ font-family: var(--font);
32+ font-size: 13px;
33+ font-weight: 600;
34+ letter-spacing: 0;
35+ line-height: 1.4;
36+ text-transform: none;
3737 }
3838
3939 th,
style/_min.scssmodified+2 -3
@@ -507,8 +507,8 @@ div.line {
507507 }
508508
509509 // A tick or a radio always sits right before its own text, wherever the label is.
510-main label:not(.colour-choice):has(> input[type="checkbox"]),
511-main label:not(.colour-choice):has(> input[type="radio"]) {
510+main label:not(.colour-choice, .choice > label):has(> input[type="checkbox"]),
511+main label:not(.colour-choice, .choice > label):has(> input[type="radio"]) {
512512 display: flex;
513513 flex-direction: row;
514514 align-items: flex-start;
@@ -533,7 +533,6 @@ main label:not(.colour-choice):has(> input[type="radio"]) {
533533 // Nothing here is a box: topics sit straight on the page.
534534 main[data-width="read"] .explore,
535535 main[data-width="read"] .heat,
536-main[data-width="read"] .sec.issue-comment,
537536 main .lang-list,
538537 main .snippet-files {
539538 border: 0;
style/_min_menus.scssmodified+41 -0
@@ -74,6 +74,7 @@
7474 .watch-menu > .menu-list,
7575 .head-more-list,
7676 .pins-menu > .pop-panel,
77+.pins-menu > .menu-list,
7778 .clone > .menu-list,
7879 .clone > .pop-panel {
7980 right: auto !important;
@@ -83,6 +84,7 @@
8384
8485 @media (max-width: 899px) {
8586 .pins-menu > .pop-panel,
87+ .pins-menu > .menu-list,
8688 .clone > .menu-list,
8789 .clone > .pop-panel,
8890 .repo-readme .clone > .menu-list,
@@ -163,3 +165,42 @@
163165 white-space: normal;
164166 }
165167 }
168+
169+// The pins menu opens from its own words, as a panel with the menu's padding, over the page.
170+details.pins-menu {
171+ position: relative;
172+ display: inline-block;
173+ align-self: flex-start;
174+
175+ > .menu-list {
176+ z-index: 40;
177+ width: 320px;
178+ padding: 14px 16px;
179+ gap: 10px;
180+ }
181+
182+ > .menu-list > .hint {
183+ margin: 0;
184+ }
185+
186+ > .menu-list > button[type="submit"] {
187+ align-self: flex-start;
188+ }
189+}
190+
191+// Inside the menu each repo is a menu row: one column, 34px, no hairlines.
192+details.pins-menu > .menu-list > .pin-options {
193+ display: flex;
194+ flex-direction: column;
195+ gap: 0;
196+
197+ li {
198+ border-bottom: 0;
199+ }
200+
201+ label {
202+ min-height: 34px;
203+ align-items: center;
204+ padding: 0;
205+ }
206+}
style/_one.scssadded+2932 -0

Diff too large; view file

@@ -0,0 +1,2932 @@
1+// The one look. Imported last. Every control, list, panel and page part gets its look here and
2+// nowhere else, so moving between pages changes the content and nothing else. The rules are in
3+// docs/ui-language.md.
4+
5+:root {
6+ --radius-sm: 12px;
7+ --radius-md: 12px;
8+ --radius-lg: 20px;
9+ --radius-sheet: 16px;
10+ --control-h: 38px;
11+ --control-sm: 32px;
12+ --display: var(--font);
13+ --topbar-h: 56px;
14+ --gutter: 24px;
15+ --add-bg: #e6effb;
16+ --add-text: #1d3f6e;
17+ --add-mark: #2d68b4;
18+ --del-bg: #fbe8ea;
19+ --del-text: #8a1f2d;
20+ --del-mark: #b3202f;
21+ --bad: #b3202f;
22+ --danger: #b3202f;
23+ --caution: #b3202f;
24+ --danger-bg: #fbe8ea;
25+ --alert-bg: #fbe8ea;
26+ --alert-text: #8a1f2d;
27+ --pop-shadow: 0 12px 36px rgba(20, 18, 15, 0.14);
28+}
29+
30+@mixin one-dark {
31+ --add-bg: #17304e;
32+ --add-text: #b9d6f7;
33+ --add-mark: #7fb3ef;
34+ --del-bg: #3b1d20;
style/_one_admin.scssadded+217 -0

Diff too large; view file

style/_one_ci.scssadded+250 -0

Diff too large; view file

style/_one_code.scssadded+198 -0

Diff too large; view file

style/_one_people.scssadded+307 -0

Diff too large; view file

style/_one_review.scssadded+147 -0

Diff too large; view file

style/_one_shell.scssadded+259 -0

Diff too large; view file

style/_one_threads.scssadded+304 -0

Diff too large; view file

style/_pull.scssmodified+1 -1

Diff too large; view file

style/_system.scssdeleted+0 -614

Diff too large; view file

style/main.scssmodified+9 -149

Diff too large; view file