forge
Explore
Log in

Don't you dare go Hollow

The tab bar, sidebars and command palette are built from the same navigation lists, so the palette finds every profile tab, Organizations, New organization and each organization's Members, Teams and Settings

Browse files at this commit

8d87bc9e2e282252b87b8f7b0ddbbf0b10987aa5Ahmet Kaan GümüşParent: 75d5a52
All checks have passed
Show checks
  • feat
    • the tab bar, sidebars and command palette are built from the same navigation lists, so the palette finds every profile tab, Organizations, New organization and each organization's Members, Teams and Settings
    • Explore moves from the profile corner to a link after the search bar, an icon on narrow windows
  • style
    • pages fit the window without a page scrollbar: long lists page and dense pages use panes and columns
    • an organization's overview is redesigned with a larger avatar and a Members card, Members and Teams lose their sidebar and use the profile tabs, and Settings moves from a tab to an Edit organization button
    • CI status badges follow the theme
    • the bell's Clear action becomes Mark as read
  • fix
    • the bell popover opens once at its full height instead of jumping when its list arrives
Show full message
✨ feat: the tab bar, sidebars and command palette are built from the same navigation lists, so the palette finds every profile tab, Organizations, New organization and each organization's Members, Teams and Settings; Explore moves from the profile corner to a link after the search bar, an icon on narrow windows; 💄 style: pages fit the window without a page scrollbar: long lists page and dense pages use panes and columns; an organization's overview is redesigned with a larger avatar and a Members card, Members and Teams lose their sidebar and use the profile tabs, and Settings moves from a tab to an Edit organization button; CI status badges follow the theme; the bell's Clear action becomes Mark as read; 🐛 fix: the bell popover opens once at its full height instead of jumping when its list arrives

49 changed files +1735 -447

crates/forge-web/assets/nav.jsmodified+102 -18
@@ -330,8 +330,11 @@
330330 if (how !== 'live') { closeDropdowns(null); }
331331 var oldList = document.querySelector('.ci-run-list');
332332 var listTop = how === 'live' && oldList ? oldList.scrollTop : null;
333+ // A fit pane keeps its scroll when the page stays put (a live change, a post, a filter), by its place in the page.
334+ var paneTops = how === 'live' || how === 'post' || how === 'query' ? paneScrolls() : null;
333335 adopt(doc, keepFields, dd, how === 'live' ? captureJobs() : null);
334336 placeRun(listTop);
337+ if (paneTops) { setPaneScrolls(paneTops); }
335338 if (tailAt) {
336339 var nextTail = document.querySelector('[data-live-log]');
337340 if (nextTail) { nextTail.scrollTop = tailAt.end ? nextTail.scrollHeight : tailAt.top; }
@@ -365,13 +368,29 @@
365368 var els = document.querySelectorAll('[data-keep-anchor]');
366369 for (var i = 0; i < els.length; i++) {
367370 if (els[i].getAttribute('data-keep-anchor') === at.key) {
368- window.scrollTo(window.scrollX, window.scrollY + els[i].getBoundingClientRect().top - at.dy);
371+ var delta = els[i].getBoundingClientRect().top - at.dy;
372+ // A diff inside a fit pane moves the pane; the page itself does not scroll there.
373+ var pane = els[i].closest('.fit-pane');
374+ if (pane && pane.scrollHeight > pane.clientHeight) { pane.scrollTop += delta; }
375+ else { window.scrollTo(window.scrollX, window.scrollY + delta); }
369376 return true;
370377 }
371378 }
372379 return false;
373380 }
374381
382+ // The scroll of each fit pane on the page, in order. A pane is a new element after a swap, so its place is
383+ // set again by its index.
384+ function paneScrolls() {
385+ return Array.prototype.map.call(document.querySelectorAll('.fit-pane'), function (p) { return p.scrollTop; });
386+ }
387+
388+ function setPaneScrolls(tops) {
389+ Array.prototype.forEach.call(document.querySelectorAll('.fit-pane'), function (p, i) {
390+ if (i < tops.length) { p.scrollTop = tops[i]; }
391+ });
392+ }
393+
375394 // The runs list scrolls inside its card: bring the selected row into view there. scrollIntoView
376395 // would also scroll the page, so the list's own scrollTop is set instead.
377396 function placeRun(keepTop) {
@@ -1088,16 +1107,21 @@
10881107 }
10891108 }
10901109
1091- // Fills the popover's list with the server's fragment. A reader who closed it meanwhile, or a newer
1092- // open, leaves the answer unused.
1110+ // Fills the popover's list with the server's fragment. The popover stays invisible until then, so it
1111+ // opens at its final height; a slow answer shows the loading note first. A reader who closed it
1112+ // meanwhile, or a newer open, leaves the answer unused.
10931113 function loadPeek(pop) {
10941114 var list = pop.querySelector('.bell-list');
10951115 if (!list) { return; }
10961116 var seq = ++peekSeq;
1097- var note = document.createElement('p');
1098- note.className = 'bell-empty muted';
1099- note.textContent = pop.getAttribute('data-loading') || '';
1100- list.replaceChildren(note);
1117+ var slow = setTimeout(function () {
1118+ if (seq !== peekSeq || !isPeekOpen(pop)) { return; }
1119+ var note = document.createElement('p');
1120+ note.className = 'bell-empty muted';
1121+ note.textContent = pop.getAttribute('data-loading') || '';
1122+ list.replaceChildren(note);
1123+ pop.classList.add('bell-ready');
1124+ }, PEEK_SLOW);
11011125 fetch('/notifications/peek', { headers: { accept: 'text/html' }, credentials: 'same-origin' }).then(function (r) {
11021126 if (!r.ok) { throw new Error('status ' + r.status); }
11031127 return r.text();
@@ -1112,8 +1136,12 @@
11121136 err.className = 'bell-empty muted';
11131137 err.textContent = pop.getAttribute('data-error') || '';
11141138 list.replaceChildren(err);
1139+ }).then(function () {
1140+ clearTimeout(slow);
1141+ if (seq === peekSeq && isPeekOpen(pop)) { pop.classList.add('bell-ready'); }
11151142 });
11161143 }
1144+ var PEEK_SLOW = 300; // ms before a slow list shows its loading note
11171145 var peekSeq = 0; // a fetch's number: only the newest answer is drawn
11181146
11191147 // Records whether the popover was open when the press began. Light dismiss closes it on the press,
@@ -1158,9 +1186,12 @@
11581186 if (open) {
11591187 placePeek(bell, pop);
11601188 loadPeek(pop);
1161- } else if (hoverOn === 'bell') {
1162- // Closed by Escape or a light dismiss: the mouse no longer holds it open.
1163- hoverOn = null;
1189+ } else {
1190+ pop.classList.remove('bell-ready');
1191+ if (hoverOn === 'bell') {
1192+ // Closed by Escape or a light dismiss: the mouse no longer holds it open.
1193+ hoverOn = null;
1194+ }
11641195 }
11651196 }, true);
11661197
@@ -3153,21 +3184,73 @@
31533184 shellFrame = 0;
31543185 var shell = document.querySelector('.shell');
31553186 if (!shell) { return; }
3156- document.documentElement.style.setProperty('--shell-top', Math.round(shell.getBoundingClientRect().top) + 'px');
3187+ var root = document.documentElement.style;
3188+ root.setProperty('--shell-top', Math.round(shell.getBoundingClientRect().top) + 'px');
3189+ // A pane that fills the window sits between headers and a footer of any height: both are measured.
3190+ // The CI card sticks while the page scrolls, so its wrapper gives the top.
3191+ var pane = document.querySelector('.repo-home, .ci-split, .fit-pane');
3192+ var main = document.querySelector('main');
3193+ var foot = document.querySelector('.site-footer');
3194+ if (!pane || !main || !foot) { return; }
3195+ root.setProperty('--pane-top', Math.ceil(pane.getBoundingClientRect().top + window.scrollY) + 'px');
3196+ root.setProperty('--pane-foot', Math.ceil(foot.getBoundingClientRect().height + parseFloat(getComputedStyle(main).paddingBottom)) + 'px');
3197+ }
3198+
3199+ // A CI badge (`/{owner}/{repo}/badge.svg`, often in a README) is drawn here as HTML from the data in
3200+ // its SVG, so it takes the theme's colours: an image cannot read them, and other sites keep the SVG.
3201+ // It is fetched again after a swap, and a badge seen before is drawn at once so a live render does
3202+ // not blink.
3203+ var badgeSeen = {}; // badge URL -> { label, status }
3204+
3205+ function readBadge(href) {
3206+ return fetch(href, { credentials: 'same-origin' }).then(function (res) {
3207+ if (!res.ok) { throw new Error('badge'); }
3208+ return res.text();
3209+ }).then(function (text) {
3210+ var svg = new DOMParser().parseFromString(text, 'image/svg+xml').documentElement;
3211+ var label = svg.querySelector('text');
3212+ var status = svg.getAttribute('data-status');
3213+ if (!label || !status) { throw new Error('badge'); }
3214+ return { label: label.textContent, status: status };
3215+ });
3216+ }
3217+
3218+ function drawBadge(el, data) {
3219+ var chip = document.createElement('span');
3220+ chip.className = 'ci-chip';
3221+ chip.setAttribute('role', 'img');
3222+ chip.setAttribute('aria-label', data.label + ': ' + data.status);
3223+ chip.setAttribute('data-badge', el.getAttribute('data-badge'));
3224+ chip.setAttribute('data-status', data.status);
3225+ [data.label, data.status].forEach(function (text) {
3226+ var part = document.createElement('span');
3227+ part.textContent = text;
3228+ chip.appendChild(part);
3229+ });
3230+ el.replaceWith(chip);
31573231 }
31583232
3159- // A CI badge (`/{owner}/{repo}/badge.svg`, often in a README) is fetched again after a swap. The
3160- // document stays the same across a soft navigation, and the browser reuses an image it already
3161- // has at the same URL whatever its Cache-Control says, so the badge would keep an old state until
3162- // a reload. The badge ignores query keys it does not know, so `_r` only makes the URL new.
31633233 function syncBadges() {
3164- var stamp = String(Date.now());
31653234 document.querySelectorAll('img[src*="/badge.svg"]').forEach(function (img) {
31663235 var url;
31673236 try { url = new URL(img.getAttribute('src'), location.href); } catch (err) { return; }
31683237 if (url.origin !== location.origin || !/\/badge\.svg$/.test(url.pathname)) { return; }
3169- url.searchParams.set('_r', stamp);
3170- img.src = url.pathname + url.search;
3238+ var href = url.pathname + url.search;
3239+ img.setAttribute('data-badge', href);
3240+ if (badgeSeen[href]) { drawBadge(img, badgeSeen[href]); } else { img.classList.add('badge-wait'); }
3241+ });
3242+ var all = document.querySelectorAll('[data-badge]');
3243+ var hrefs = {};
3244+ all.forEach(function (el) { hrefs[el.getAttribute('data-badge')] = true; });
3245+ Object.keys(hrefs).forEach(function (href) {
3246+ readBadge(href).then(function (data) {
3247+ badgeSeen[href] = data;
3248+ document.querySelectorAll('[data-badge]').forEach(function (el) {
3249+ if (el.getAttribute('data-badge') === href) { drawBadge(el, data); }
3250+ });
3251+ }).catch(function () {
3252+ document.querySelectorAll('img.badge-wait').forEach(function (img) { img.classList.remove('badge-wait'); });
3253+ });
31713254 });
31723255 }
31733256
@@ -3260,6 +3343,7 @@
32603343 syncBannerExpiry();
32613344 syncShellTop();
32623345 syncDrafts();
3346+ syncBadges();
32633347
32643348 window.__forgeQuery = function (href) {
32653349 var url = pageUrl(href);
crates/forge-web/src/i18n/misc.rsmodified+6 -2
@@ -166,6 +166,7 @@ pub enum K {
166166 // Top-bar user menu: the viewer's public profile and the settings editor.
167167 YourProfile,
168168 EditProfile,
169+ EditOrganization,
169170 // Profile corner, live strip and path bar search.
170171 AllNotifications,
171172 Passed,
@@ -323,6 +324,7 @@ const ALL: &[K] = &[
323324 K::RefLabel,
324325 K::YourProfile,
325326 K::EditProfile,
327+ K::EditOrganization,
326328 K::AllNotifications,
327329 K::Passed,
328330 K::Failed,
@@ -483,8 +485,8 @@ pub fn t(lang: Lang, key: K) -> &'static str {
483485 (MarkAllAsRead, Tr) => "Tümünü okundu olarak işaretle",
484486 (MarkAllRead, En) => "Mark all read",
485487 (MarkAllRead, Tr) => "Tümünü okundu işaretle",
486- (ClearNotifications, En) => "Clear",
487- (ClearNotifications, Tr) => "Temizle",
488+ (ClearNotifications, En) => "Mark as read",
489+ (ClearNotifications, Tr) => "Okundu işaretle",
488490 (MarkRead, En) => "Mark read",
489491 (MarkRead, Tr) => "Okundu işaretle",
490492 (NoNotificationsYet, En) => "No notifications yet.",
@@ -645,6 +647,8 @@ pub fn t(lang: Lang, key: K) -> &'static str {
645647 (YourProfile, Tr) => "Profilin",
646648 (EditProfile, En) => "Edit profile",
647649 (EditProfile, Tr) => "Profili düzenle",
650+ (EditOrganization, En) => "Edit organization",
651+ (EditOrganization, Tr) => "Kuruluşu düzenle",
648652 (AllNotifications, En) => "All notifications",
649653 (AllNotifications, Tr) => "Tüm bildirimler",
650654 (Passed, En) => "passed",
crates/forge-web/src/i18n/orgs.rsmodified+11 -4
@@ -50,6 +50,8 @@ pub enum K {
5050 CreateOrg,
5151 // Organization settings.
5252 Settings,
53+ General,
54+ BackToOrganization,
5355 Description,
5456 DisplayNameLabel,
5557 DefaultRoleLabel,
@@ -62,6 +64,7 @@ pub enum K {
6264 Members,
6365 Teams,
6466 Organization,
67+ ViewAllMembers,
6568 MemberHeader,
6669 Role,
6770 RoleOwner,
@@ -121,7 +124,6 @@ pub enum K {
121124 PinsTooMany,
122125 NoPinnableRepos,
123126 TabOverview,
124- Overview,
125127 TabStars,
126128 FilterRepos,
127129 NoReposMatch,
@@ -213,6 +215,12 @@ pub fn t(lang: Lang, key: K) -> &'static str {
213215 (NewRepository, Tr) => "Yeni depo",
214216 (NewOrganization, En) => "New organization",
215217 (NewOrganization, Tr) => "Yeni kuruluş",
218+ (General, En) => "General",
219+ (General, Tr) => "Genel",
220+ (BackToOrganization, En) => "Back to organization",
221+ (BackToOrganization, Tr) => "Kuruluşa dön",
222+ (ViewAllMembers, En) => "View all",
223+ (ViewAllMembers, Tr) => "Tümünü gör",
216224 (NewOrgIntro, En) => {
217225 "An organization owns repositories and shares them with its members through teams. You become its first owner."
218226 }
@@ -375,8 +383,6 @@ pub fn t(lang: Lang, key: K) -> &'static str {
375383 (NoPinnableRepos, Tr) => "Henüz sabitlenecek depo yok.",
376384 (TabOverview, En) => "Overview",
377385 (TabOverview, Tr) => "Genel bakış",
378- (Overview, En) => "Overview",
379- (Overview, Tr) => "Genel bakış",
380386 (TabStars, En) => "Stars",
381387 (TabStars, Tr) => "Yıldızlar",
382388 (FilterRepos, En) => "Find a repository",
@@ -618,7 +624,8 @@ mod tests {
618624 K::PinsTooMany,
619625 K::NoPinnableRepos,
620626 K::TabOverview,
621- K::Overview,
627+ K::General,
628+ K::BackToOrganization,
622629 K::TabStars,
623630 K::FilterRepos,
624631 K::NoReposMatch,
crates/forge-web/src/pages/admin_health.rsmodified+47 -6
@@ -16,7 +16,7 @@ use tokio::process::Command;
1616 use topcoat::Result;
1717 use topcoat::context::{Cx, app_context};
1818 use topcoat::router::response::Response;
19-use topcoat::router::{page, route};
19+use topcoat::router::{page, query_params, route};
2020 use topcoat::view::{View, component, view};
2121
2222 use crate::i18n::accounts::{A, duration_short, meta_line, needs_attention, on_disk, t as at};
@@ -25,8 +25,19 @@ 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::repo_list::{PageLink, pager, pager_links};
2829 use crate::views::{human_size, now_unix, rel_time, shell};
2930
31+/// Active alerts per page of the alerts card. Each row is about 56px tall, so three keep the card
32+/// short enough to fit the window.
33+const ALERTS_PER_PAGE: usize = 3;
34+
35+/// The health page's query: only the alerts' page.
36+#[query_params(error = bad_request)]
37+struct HealthQuery {
38+ page: Option<String>,
39+}
40+
3041 /// How a dot or a value is drawn: a bad outcome, a good one, a plain count, or a feature that is
3142 /// not set up.
3243 #[derive(Clone, Copy, PartialEq, Eq)]
@@ -458,8 +469,18 @@ async fn since_line(lang: Lang, stamp: &str) -> Result<impl View> {
458469 }
459470
460471 #[component]
461-async fn health_view(lang: Lang, health: Health, alerts: Vec<AlertRow>) -> Result<impl View> {
462- let count = alerts.len();
472+async fn health_view(
473+ lang: Lang,
474+ health: Health,
475+ alerts: Vec<AlertRow>,
476+ total: usize,
477+ page: u64,
478+ pages: u64,
479+ nav: (Vec<PageLink>, Option<String>, Option<String>),
480+) -> Result<impl View> {
481+ // The heading counts every active alert; the card lists the current page of them.
482+ let count = total;
483+ let (links, prev, next) = nav;
463484 let Health {
464485 usage,
465486 facts,
@@ -474,7 +495,7 @@ async fn health_view(lang: Lang, health: Health, alerts: Vec<AlertRow>) -> Resul
474495 at(lang, A::Fine).to_owned()
475496 };
476497 Ok(view! {
477- <div data-live="/admin/health/events">
498+ <div data-live="/admin/health/events" class="health-page">
478499 <section class="page-head">
479500 <h1>(at(lang, A::Health))</h1>
480501 <p class="health-summary">
@@ -497,6 +518,7 @@ async fn health_view(lang: Lang, health: Health, alerts: Vec<AlertRow>) -> Resul
497518 </li>
498519 }
499520 </ul>
521+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
500522 <a class="small" href="/admin/server?tab=alerts">(alert_text::settings_link(lang))</a>
501523 </section>
502524 }
@@ -559,11 +581,30 @@ async fn health_page(cx: &Cx) -> Result<impl View> {
559581 let viewer = admin_only(cx).await?;
560582 let lang = i18n::lang(cx, Some(&viewer.0));
561583 let state = app_context::<AppState>(cx);
584+ let query = query_params::<HealthQuery>(cx)?;
562585 let health = gather(state, lang).await?;
563- let alerts = alert_rows(state, lang).await?;
586+ let all = alert_rows(state, lang).await?;
587+ let total = all.len();
588+ let pages = total.div_ceil(ALERTS_PER_PAGE).max(1);
589+ let page = query
590+ .page
591+ .as_deref()
592+ .and_then(|p| p.parse::<usize>().ok())
593+ .unwrap_or(1)
594+ .clamp(1, pages);
595+ let alerts: Vec<AlertRow> = all
596+ .into_iter()
597+ .skip((page - 1) * ALERTS_PER_PAGE)
598+ .take(ALERTS_PER_PAGE)
599+ .collect();
600+ let nav = pager_links(page as u64, pages as u64, |n| {
601+ format!("/admin/health?page={n}")
602+ });
564603 let title = at(lang, A::Health);
565604 Ok(view! {
566- shell(title: title, viewer: Some(&viewer), health_view(lang: lang, health: health, alerts: alerts))
605+ shell(title: title, viewer: Some(&viewer),
606+ health_view(lang: lang, health: health, alerts: alerts, total: total,
607+ page: page as u64, pages: pages as u64, nav: nav))
567608 })
568609 }
569610
crates/forge-web/src/pages/admin_mail.rsmodified+2 -2
@@ -245,7 +245,7 @@ async fn mail_view(
245245 // Saved by any admin session: the stream re-renders the settings with the same signal
246246 // as the queue (the save bumps it too), and the form keeps what was typed.
247247 <div data-live="/admin/mail/events">
248- <section class="card">
248+ <section class="card fit-pane">
249249 <h2>(g::t(lang, K::SmtpServer))</h2>
250250 <p class="muted small">(g::t(lang, K::MailTransportNote))</p>
251251 <p class="small">(g::t(lang, K::MailTransportInUse)) " " <code>(data.transport)</code></p>
@@ -279,7 +279,7 @@ async fn mail_view(
279279 </section>
280280 </div>
281281 } else if let Some(queue) = data.queue {
282- <section class="card">
282+ <section class="card fit-pane">
283283 <p class="muted small">(g::t(lang, K::MailQueueIntro))</p>
284284 <div class="mail-filters">
285285 for chip in queue.chips.into_iter() {
crates/forge-web/src/pages/admin_runners.rsmodified+54 -5
@@ -22,7 +22,7 @@ use topcoat::router::content::Form;
2222 use topcoat::router::error::{SeeOther, forbidden, see_other};
2323 use topcoat::router::request::uri;
2424 use topcoat::router::response::Response;
25-use topcoat::router::{page, path_param, route};
25+use topcoat::router::{page, path_param, query_params, route};
2626 use topcoat::view::{View, component, view};
2727
2828 use crate::audit::{self, Actor, Target};
@@ -36,10 +36,21 @@ 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::repo_list::{PageLink, pager, pager_links};
3940 use crate::views::{empty_state, enc, now_unix, relative_time, shell};
4041
4142 path_param!(runner_id);
4243
44+/// Runners per page on the list. Six rows fit the window beside the "Add a runner" card.
45+const PER_PAGE: usize = 6;
46+
47+/// The list's query: the page, and the notice word that a paging link keeps.
48+#[query_params(error = bad_request)]
49+struct RunnersQuery {
50+ page: Option<String>,
51+ notice: Option<String>,
52+}
53+
4354 /// Picks the English or Turkish text. The runner page strings live here, not in `i18n::admin`.
4455 fn s(lang: Lang, en: &'static str, tr: &'static str) -> &'static str {
4556 match lang {
@@ -315,9 +326,13 @@ async fn runners_view(
315326 lang: Lang,
316327 csrf: String,
317328 rows: Vec<RunnerRow>,
329+ page: u64,
330+ pages: u64,
331+ nav: (Vec<PageLink>, Option<String>, Option<String>),
318332 notice: Option<(&'static str, bool)>,
319333 note: String,
320334 ) -> Result<impl View> {
335+ let (links, prev, next) = nav;
321336 Ok(view! {
322337 <div data-live="/admin/runners/events">
323338 <section class="page-head">
@@ -330,13 +345,15 @@ async fn runners_view(
330345 <section class="card notice" role="status">(text)</section>
331346 }
332347 }
333- <section class="card">
348+ <div class="fit-split">
349+ <section class="card fit-pane fit-card fit-main">
334350 <h2>(g::t(lang, K::Runners))</h2>
335351 if rows.is_empty() {
336352 empty_state(title: g::t(lang, K::NoRunnersYet), hint: Some(g::t(lang, K::RunnersEmptyHint))) {
337353 <pre><code>"forge runner register --url <forge-url> --token <token> --name <name> --labels linux,x86_64"</code></pre>
338354 }
339355 } else {
356+ <div class="fit-scroll fit-bleed">
340357 <ul class="runner-list">
341358 for row in rows.iter() {
342359 <li class="runner-row is-linked">
@@ -390,9 +407,11 @@ async fn runners_view(
390407 </li>
391408 }
392409 </ul>
410+ </div>
411+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
393412 }
394413 </section>
395- <section class="card">
414+ <section class="card fit-side">
396415 <h2>(g::t(lang, K::AddARunner))</h2>
397416 <p class="muted small">(note.as_str())</p>
398417 <form method="post" action="/admin/runners/tokens" class="inline-form">
@@ -401,9 +420,20 @@ async fn runners_view(
401420 </form>
402421 </section>
403422 </div>
423+ </div>
404424 })
405425 }
406426
427+/// The list page's link for `page`, keeping the notice word a refused or saved action left in the
428+/// query, so paging does not lose it.
429+fn list_href(page: u64, notice: &str) -> String {
430+ if notice.is_empty() {
431+ format!("/admin/runners?page={page}")
432+ } else {
433+ format!("/admin/runners?page={page}&notice={}", enc(notice))
434+ }
435+}
436+
407437 /// A destructive button that opens the shared `confirm-inline` popover; the POST only fires from the
408438 /// confirm button inside it, and Cancel closes the popover.
409439 #[component]
@@ -600,25 +630,44 @@ async fn token_view(
600630 async fn runners_page(cx: &Cx) -> Result<impl View> {
601631 let viewer = admin_only(cx).await?;
602632 let lang = i18n::lang(cx, Some(&viewer.0));
633+ let query = query_params::<RunnersQuery>(cx)?;
603634 let state = app_context::<AppState>(cx);
604635 let tz = viewer.0.timezone.clone();
605636 let now = now_unix();
606- let rows: Vec<RunnerRow> = state
637+ let all: Vec<RunnerRow> = state
607638 .store
608639 .list_runners()
609640 .await?
610641 .iter()
611642 .map(|runner| runner_row(runner, &tz, lang, now))
612643 .collect();
644+ let pages = all.len().div_ceil(PER_PAGE).max(1);
645+ let page = query
646+ .page
647+ .as_deref()
648+ .and_then(|p| p.parse::<usize>().ok())
649+ .unwrap_or(1)
650+ .clamp(1, pages);
651+ let rows: Vec<RunnerRow> = all
652+ .into_iter()
653+ .skip((page - 1) * PER_PAGE)
654+ .take(PER_PAGE)
655+ .collect();
613656 let csrf = viewer.1.csrf_token.clone();
614657 let notice = notice_from_query(cx, lang);
658+ let kept = if notice.is_some() {
659+ query.notice.clone().unwrap_or_default()
660+ } else {
661+ String::new()
662+ };
663+ let nav = pager_links(page as u64, pages as u64, |n| list_href(n, &kept));
615664 let note = g::token_ttl_note(
616665 lang,
617666 &g::hours_text(lang, state.live().ci.registration_token_hours),
618667 );
619668 let title = g::t(lang, K::CiRunners);
620669 Ok(view! {
621- shell(title: title, viewer: Some(&viewer), runners_view(lang: lang, csrf: csrf, rows: rows, notice: notice, note: note))
670+ shell(title: title, viewer: Some(&viewer), runners_view(lang: lang, csrf: csrf, rows: rows, page: page as u64, pages: pages as u64, nav: nav, notice: notice, note: note))
622671 })
623672 }
624673
crates/forge-web/src/pages/admin_server.rsmodified+2 -2
@@ -232,7 +232,7 @@ async fn server_view(
232232 _ => "/admin/server/events".to_owned(),
233233 };
234234 Ok(view! {
235- <div data-live=(live.as_str())>
235+ <div data-live=(live.as_str()) class="srv-page">
236236 <section class="page-head">
237237 <h1>(g::t(lang, K::ServerSettings))</h1>
238238 <p class="muted">(g::t(lang, K::ServerSettingsIntro))</p>
@@ -257,7 +257,7 @@ async fn server_view(
257257 <p>(message.as_str())</p>
258258 </section>
259259 }
260- <section class="card">
260+ <section class="card fit-pane">
261261 <form method="post" action="/admin/server" class="srv-form">
262262 <input type="hidden" name="csrf" value=(csrf.as_str())>
263263 <input type="hidden" name="tab" value=(tab)>
crates/forge-web/src/pages/admin_user_detail.rsmodified+1 -1
@@ -157,7 +157,7 @@ async fn detail_body(
157157 let live = format!("{base}/events");
158158 let Notice { done, error, link } = notice;
159159 Ok(view! {
160- <div data-live=(live.as_str())>
160+ <div data-live=(live.as_str()) class="user-page">
161161 <section class="user-head">
162162 <a class="user-back small" href="/admin/users">"← "(g::t(lang, K::Users))</a>
163163 <div class="user-id">
crates/forge-web/src/pages/audit_log.rsmodified+18 -12
@@ -1,6 +1,7 @@
11 //! Pages: the admin audit log (`/admin/audit`, instance admins only, 404 otherwise) and a user's
22 //! own security log (`/settings/security/log`: entries the viewer acted in, or that targeted
3-//! them). Both list newest first, 50 per page, continued with a cursor.
3+//! them). Both list newest first, a page of rows at a time, continued with a cursor: 8 rows on the
4+//! admin page (its filter bar takes the room) and 10 in the own log, sized to fit the window.
45
56 use forge_core::{AuditAction, AuditCursor, AuditEntry, AuditFilter, Store};
67 use topcoat::Result;
@@ -18,8 +19,11 @@ use crate::pages::issues_list::list_href;
1819 use crate::state::AppState;
1920 use crate::views::{empty_state, rel_time, shell};
2021
21-/// Entries per page.
22-const PAGE_SIZE: usize = 50;
22+/// Entries per page of the admin audit log, under its filter bar.
23+const ADMIN_PAGE_SIZE: usize = 8;
24+
25+/// Entries per page of the own security log.
26+const OWN_PAGE_SIZE: usize = 10;
2327
2428 #[query_params(error = bad_request)]
2529 pub(crate) struct AuditQuery {
@@ -67,18 +71,19 @@ fn row_view(entry: &AuditEntry, lang: Lang) -> RowView {
6771 }
6872 }
6973
70-/// One page of entries, and the cursor for the page after it when there may be one.
74+/// One page of `size` entries, and the cursor for the page after it when there may be one.
7175 async fn fetch_page(
7276 store: &Store,
7377 filter: &AuditFilter,
7478 before: Option<&str>,
79+ size: usize,
7580 ) -> forge_core::Result<(Vec<AuditEntry>, Option<String>)> {
7681 let cursor = before.and_then(AuditCursor::decode);
7782 let mut entries = store
78- .list_audit(filter, cursor.as_ref(), (PAGE_SIZE + 1) as u32)
83+ .list_audit(filter, cursor.as_ref(), (size + 1) as u32)
7984 .await?;
80- let more = entries.len() > PAGE_SIZE;
81- entries.truncate(PAGE_SIZE);
85+ let more = entries.len() > size;
86+ entries.truncate(size);
8287 let next = if more {
8388 entries
8489 .last()
@@ -168,7 +173,7 @@ async fn admin_audit_view(
168173 <p>(message.as_str())</p>
169174 </section>
170175 }
171- <section class="card">
176+ <section class="card fit-pane fit-list">
172177 audit_table(lang: lang, rows: rows, show_actor: true)
173178 if let Some(href) = older_href {
174179 <nav class="pager">
@@ -191,7 +196,7 @@ async fn own_log_view(
191196 <h1>(g::t(lang, K::SecurityLogTitle))</h1>
192197 <p class="muted">(g::t(lang, K::OwnLogIntro))</p>
193198 </section>
194- <section class="card">
199+ <section class="card fit-pane fit-list">
195200 audit_table(lang: lang, rows: rows, show_actor: false)
196201 if let Some(href) = older_href {
197202 <nav class="pager">
@@ -229,7 +234,7 @@ async fn admin_audit_page(cx: &Cx) -> Result<impl View> {
229234 let (entries, next) = if notice.is_some() {
230235 (Vec::new(), None)
231236 } else {
232- fetch_page(store, &filter, query.before.as_deref()).await?
237+ fetch_page(store, &filter, query.before.as_deref(), ADMIN_PAGE_SIZE).await?
233238 };
234239
235240 let rows: Vec<RowView> = entries
@@ -272,7 +277,7 @@ async fn first_page_fingerprint(store: &Store, action: &str, actor: &str) -> Res
272277 None => return Ok(String::new()),
273278 }
274279 }
275- let (entries, _) = fetch_page(store, &filter, None).await?;
280+ let (entries, _) = fetch_page(store, &filter, None, ADMIN_PAGE_SIZE).await?;
276281 Ok(entries
277282 .iter()
278283 .map(|entry| entry.id.as_str())
@@ -307,7 +312,8 @@ async fn own_log_page(cx: &Cx) -> Result<impl View> {
307312 involving_user: Some(viewer.0.id.clone()),
308313 ..Default::default()
309314 };
310- let (entries, next) = fetch_page(store, &filter, query.before.as_deref()).await?;
315+ let (entries, next) =
316+ fetch_page(store, &filter, query.before.as_deref(), OWN_PAGE_SIZE).await?;
311317
312318 let rows: Vec<RowView> = entries
313319 .iter()
crates/forge-web/src/pages/blob.rsmodified+1 -1
@@ -280,7 +280,7 @@ async fn blob_page(cx: &Cx) -> Result<impl View> {
280280 breadcrumb(lang: lang, crumbs: crumbs)
281281 file_finder(lang: lang, owner: finder_owner, repo: finder_repo, ref_name: finder_ref)
282282 </div>
283- <section class="file" data-lines="" data-permalink=(permalink.as_str())>
283+ <section class="file fit-pane" data-lines="" data-permalink=(permalink.as_str())>
284284 <header class="file-head">
285285 <span class="muted small">(size)</span>
286286 <nav class="file-actions" aria-label=(g::t(lang, K::FileNav))>
crates/forge-web/src/pages/ci_badge.rsmodified+1 -1
@@ -138,7 +138,7 @@ pub fn render_badge(label: &str, status: BadgeStatus) -> String {
138138 let status_color = status.color();
139139 format!(
140140 concat!(
141- r##"<svg xmlns="http://www.w3.org/2000/svg" width="{total}" height="{h}" role="img" aria-label="{aria}">"##,
141+ r##"<svg xmlns="http://www.w3.org/2000/svg" width="{total}" height="{h}" role="img" data-status="{status_text}" aria-label="{aria}">"##,
142142 r##"<title>{aria}</title>"##,
143143 r##"<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>"##,
144144 r##"<clipPath id="r"><rect width="{total}" height="{h}" rx="3" fill="#fff"/></clipPath>"##,
crates/forge-web/src/pages/ci_job.rsmodified+3 -1
@@ -346,6 +346,7 @@ async fn job_body(
346346 repo_head(head: RepoHead { live: String::new(), ..head })
347347 <div data-live=(live.as_str()) data-live-state=(job.fingerprint.as_str())>
348348 <p class="muted small"><a href=(job.run_href.as_str())>(g::t(lang, K::RunNumber)) (job.run_number)</a></p>
349+ <div class="ci-job-grid fit-pane">
349350 <section class="card">
350351 <h2>(job.name.as_str())</h2>
351352 <p class="muted small">
@@ -381,7 +382,7 @@ async fn job_body(
381382 </div>
382383 }
383384 </section>
384- <section class="card">
385+ <section class="card ci-logcard">
385386 <h2>(g::t(lang, K::Log))</h2>
386387 <p class="muted small"><a href=(job.log_href.as_str())>(g::t(lang, K::FullLog))</a></p>
387388 if truncated {
@@ -411,6 +412,7 @@ async fn job_body(
411412 </section>
412413 }
413414 </div>
415+ </div>
414416 })
415417 }
416418
crates/forge-web/src/pages/commit.rsmodified+3 -1
@@ -314,7 +314,9 @@ async fn commit_page(cx: &Cx) -> Result<impl View> {
314314 if has_body {
315315 <pre class="code commit-message"><code>(message.as_str())</code></pre>
316316 }
317- 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)
317+ <div class="commit-diff fit-pane">
318+ 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)
319+ </div>
318320 )
319321 })
320322 }
crates/forge-web/src/pages/discussion_view.rsmodified+1 -1
@@ -421,7 +421,7 @@ async fn discussion_page(
421421 </p>
422422 </section>
423423 <div class="issue-layout">
424- <div class="issue-column">
424+ <div class="issue-column fit-pane">
425425 <article class="issue-item" id="discussion-body">
426426 <header class="issue-item-head">
427427 <a href=(author_profile.as_str())><img class="avatar avatar-sm" src=(author_avatar.as_str()) alt="" width="24" height="24"></a>
crates/forge-web/src/pages/import.rsmodified+26 -7
@@ -319,11 +319,10 @@ async fn import_form(
319319 let private = draft.private;
320320 let opts = draft.opts;
321321 Ok(view! {
322- newrepo_tabs(lang: lang, active: "import")
323322 if let Some(message) = error {
324323 alert(message: message.as_str())
325324 }
326- <form method="post" action="/new/import" class="newrepo-form">
325+ <form method="post" action="/new/import" class="newrepo-form fit-pane">
327326 csrf_field(token: csrf)
328327 <input type="hidden" name="source" value=(source_value)>
329328 <header class="newrepo-head">
@@ -401,7 +400,7 @@ async fn import_form(
401400 /// How many imports the Import tab lists under the form.
402401 const RECENT_IMPORTS: usize = 5;
403402
404-/// The GET import page: the form, then the recent imports.
403+/// The GET import page: the tabs, then the form and the recent imports side by side on wide windows.
405404 #[component]
406405 async fn import_home(
407406 lang: Lang,
@@ -412,8 +411,28 @@ async fn import_home(
412411 more: bool,
413412 ) -> Result<impl View> {
414413 Ok(view! {
415- import_form(lang: lang, csrf: csrf.as_str(), draft: draft, error: None, owners: owners)
416- recent_imports(lang: lang, jobs: jobs, more: more)
414+ newrepo_tabs(lang: lang, active: "import")
415+ <div class="import-home">
416+ import_form(lang: lang, csrf: csrf.as_str(), draft: draft, error: None, owners: owners)
417+ recent_imports(lang: lang, jobs: jobs, more: more)
418+ </div>
419+ })
420+}
421+
422+/// The import form again after a rejected submit: the tabs, then the form.
423+#[component]
424+async fn import_error_body(
425+ lang: Lang,
426+ csrf: String,
427+ draft: Draft,
428+ error: String,
429+ owners: Vec<String>,
430+) -> Result<impl View> {
431+ Ok(view! {
432+ newrepo_tabs(lang: lang, active: "import")
433+ <div class="import-home">
434+ import_form(lang: lang, csrf: csrf.as_str(), draft: draft, error: Some(error), owners: owners)
435+ </div>
417436 })
418437 }
419438
@@ -449,7 +468,7 @@ async fn import_submit(cx: &Cx, Form(form): Form<ImportForm>) -> Result<impl Vie
449468 let draft = Draft::from_form(&form, source);
450469 Ok(view! { cx =>
451470 shell(title: g::t(lang, K::ImportTitle), viewer: Some(&viewer),
452- import_form(lang: lang, csrf: csrf.as_str(), draft: draft, error: Some(message), owners: owners))
471+ import_error_body(lang: lang, csrf: csrf, draft: draft, error: message, owners: owners))
453472 })
454473 }
455474 }
@@ -1084,7 +1103,7 @@ async fn recent_imports(
10841103 let retry = jobs.iter().any(|(job, _)| job.state == ImportState::Failed);
10851104 Ok(view! {
10861105 if !empty {
1087- <section class="card import-recent">
1106+ <section class="card import-recent fit-pane">
10881107 <h2>(g::t(lang, K::RecentImports))</h2>
10891108 job_rows(lang: lang, jobs: jobs)
10901109 if more || retry {
crates/forge-web/src/pages/issue_view.rsmodified+2 -2
@@ -106,7 +106,7 @@ async fn issue_page(
106106 </p>
107107 </section>
108108 <div class="issue-layout">
109- <div class="issue-column">
109+ <div class="issue-column fit-pane">
110110 discussion_timeline(lang: lang, discussion: discussion)
111111 if can_comment {
112112 comment_form(lang: lang, action: comment_action.clone(), state_action: comment_action.clone(),
@@ -121,7 +121,7 @@ async fn issue_page(
121121 <p class="muted">(g::comment_login_lead(lang))<a href=(login_href.as_str())>(g::t(lang, K::LogInLink))</a>(g::t(lang, K::ToComment))</p>
122122 }
123123 </div>
124- <aside class="issue-sidebar">
124+ <aside class="issue-sidebar fit-pane">
125125 pin_box(lang: lang, write: write_meta, pinned: pinned, action: pin_action.clone(), csrf: csrf.clone())
126126 item_sidebar(lang: lang, write: write_meta, base: issue_href.clone(), csrf: csrf.clone(), sidebar: sidebar, notify: notify)
127127 </aside>
crates/forge-web/src/pages/issues_list.rsmodified+1 -1
@@ -704,7 +704,7 @@ async fn new_issue_body(
704704 let has_labels = !labels.is_empty();
705705 Ok(view! {
706706 repo_head(head: head)
707- <section class="card issue-new">
707+ <section class="card issue-new fit-pane">
708708 <h2>(g::t(lang, K::NewIssue))</h2>
709709 if chooser_mode {
710710 <p class="muted">(g::t(lang, K::ChooseTemplate))</p>
crates/forge-web/src/pages/labels_page.rsmodified+40 -5
@@ -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::see_other;
12-use topcoat::router::{page, path_param};
12+use topcoat::router::{page, path_param, query_params};
1313 use topcoat::view::{View, component, view};
1414
1515 use crate::i18n::issues::{self as g, K};
@@ -21,12 +21,22 @@ use crate::pages::issues_live::list_live_url;
2121 use crate::pages::repo::repo_head;
2222 use crate::pages::repo_ctx::load_repo;
2323 use crate::state::AppState;
24+use crate::views::repo_list::{PageLink, pager, pager_links};
2425 use crate::views::{empty_state, enc, shell};
2526
2627 path_param!(owner);
2728 path_param!(repo);
2829 path_param!(label_id);
2930
31+/// Labels per page. Twelve fill three or four rows of the list beside the create form.
32+const PER_PAGE: usize = 12;
33+
34+/// The list's query: only the page.
35+#[query_params(error = bad_request)]
36+struct LabelsQuery {
37+ page: Option<String>,
38+}
39+
3040 /// The create and edit form. Only the fields the form sends are read.
3141 #[derive(Deserialize)]
3242 struct LabelForm {
@@ -71,7 +81,11 @@ async fn labels_body(
7181 frame: RepoFrame,
7282 rows: Vec<LabelRow>,
7383 live: String,
84+ page: u64,
85+ pages: u64,
86+ nav: (Vec<PageLink>, Option<String>, Option<String>),
7487 ) -> Result<impl View> {
88+ let (links, prev, next) = nav;
7589 let labels_action = labels_href(&frame.title);
7690 let defaults_action = format!("{labels_action}/defaults");
7791 let empty = rows.is_empty();
@@ -85,7 +99,8 @@ async fn labels_body(
8599 if archived {
86100 <section class="card notice" role="status">(g::t(lang, K::LabelsArchived))</section>
87101 }
88- <section class="card" data-live=(live.as_str()) data-live-now="">
102+ <div class="fit-split">
103+ <section class="card fit-pane fit-card fit-main" data-live=(live.as_str()) data-live-now="">
89104 <h2>(g::t(lang, K::Labels))</h2>
90105 if empty {
91106 empty_state(title: g::t(lang, K::NoLabelsYet),
@@ -99,6 +114,7 @@ async fn labels_body(
99114 }
100115 )
101116 }
117+ <div class="fit-scroll">
102118 <ul class="label-list">
103119 for row in rows.iter() {
104120 <li class="label-row">
@@ -141,9 +157,11 @@ async fn labels_body(
141157 </li>
142158 }
143159 </ul>
160+ </div>
161+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
144162 </section>
145163 if can_triage {
146- <section class="card">
164+ <section class="card fit-side">
147165 <h2>(g::t(lang, K::NewLabel))</h2>
148166 <form method="post" action=(labels_action.as_str()) class="stack">
149167 <input type="hidden" name="csrf" value=(csrf.as_str())>
@@ -165,6 +183,7 @@ async fn labels_body(
165183 </form>
166184 </section>
167185 }
186+ </div>
168187 })
169188 }
170189
@@ -173,6 +192,7 @@ async fn labels_body(
173192 async fn labels_page(cx: &Cx) -> Result<impl View> {
174193 let owner = path_param::<Owner>(cx);
175194 let name = path_param::<Repo>(cx);
195+ let query = query_params::<LabelsQuery>(cx)?;
176196 let ctx = load_repo(cx, owner, name).await?;
177197 let lang = i18n::lang(cx, ctx.viewer.as_ref().map(|(u, _)| u));
178198 let store = &app_context::<AppState>(cx).store;
@@ -184,7 +204,7 @@ async fn labels_page(cx: &Cx) -> Result<impl View> {
184204 .collect();
185205 let frame = RepoFrame::new(&ctx, app_context::<AppState>(cx), "issues").await?;
186206 let title = frame.title.clone();
187- let rows: Vec<LabelRow> = labels
207+ let all: Vec<LabelRow> = labels
188208 .into_iter()
189209 .map(|label| {
190210 let open = counts.get(&label.id).copied().unwrap_or(0);
@@ -200,13 +220,28 @@ async fn labels_page(cx: &Cx) -> Result<impl View> {
200220 }
201221 })
202222 .collect();
223+ let pages = all.len().div_ceil(PER_PAGE).max(1);
224+ let page = query
225+ .page
226+ .as_deref()
227+ .and_then(|p| p.parse::<usize>().ok())
228+ .unwrap_or(1)
229+ .clamp(1, pages);
230+ let rows: Vec<LabelRow> = all
231+ .into_iter()
232+ .skip((page - 1) * PER_PAGE)
233+ .take(PER_PAGE)
234+ .collect();
235+ let nav = pager_links(page as u64, pages as u64, |n| {
236+ format!("{}?page={n}", labels_href(&title))
237+ });
203238 let live = list_live_url(&ctx.repo.owner_name, &ctx.repo.name);
204239 let css_href = format!("/{}/labels.css", frame.title);
205240 let page_title = g::labels_title(lang, &frame.title);
206241 Ok(view! {
207242 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
208243 extra_stylesheet: Some(css_href.as_str()),
209- labels_body(lang: lang, frame: frame, rows: rows, live: live))
244+ labels_body(lang: lang, frame: frame, rows: rows, live: live, page: page as u64, pages: pages as u64, nav: nav))
210245 })
211246 }
212247
crates/forge-web/src/pages/milestones_page.rsmodified+39 -5
@@ -25,15 +25,20 @@ use crate::pages::repo::repo_head;
2525 use crate::pages::repo_ctx::load_repo;
2626 use crate::render::markdown::render_markdown;
2727 use crate::state::AppState;
28+use crate::views::repo_list::{PageLink, pager, pager_links};
2829 use crate::views::{empty_state, enc, shell};
2930
3031 path_param!(owner);
3132 path_param!(repo);
3233 path_param!(milestone_id);
3334
35+/// Milestones per page. A milestone card is tall, so four fit the window beside the create form.
36+const PER_PAGE: usize = 4;
37+
3438 #[query_params(error = bad_request)]
3539 struct MilestoneQuery {
3640 state: Option<String>,
41+ page: Option<String>,
3742 }
3843
3944 /// The create form, and the edit form (which also sends `state`).
@@ -196,7 +201,8 @@ async fn milestones_page(cx: &Cx) -> Result<impl View> {
196201 let name = path_param::<Repo>(cx);
197202 let ctx = load_repo(cx, owner, name).await?;
198203 let lang = i18n::lang(cx, ctx.viewer.as_ref().map(|(u, _)| u));
199- let closed = query_params::<MilestoneQuery>(cx)?.state.as_deref() == Some("closed");
204+ let query = query_params::<MilestoneQuery>(cx)?;
205+ let closed = query.state.as_deref() == Some("closed");
200206 let state = if closed {
201207 IssueState::Closed
202208 } else {
@@ -209,7 +215,7 @@ async fn milestones_page(cx: &Cx) -> Result<impl View> {
209215 let frame = RepoFrame::new(&ctx, app_context::<AppState>(cx), "issues").await?;
210216 let today = today_in(ctx.viewer_tz());
211217 let title = frame.title.clone();
212- let rows: Vec<MilestoneRow> = milestones
218+ let all: Vec<MilestoneRow> = milestones
213219 .into_iter()
214220 .map(|m| {
215221 let overdue = m.state == IssueState::Open
@@ -228,6 +234,22 @@ async fn milestones_page(cx: &Cx) -> Result<impl View> {
228234 }
229235 })
230236 .collect();
237+ let pages = all.len().div_ceil(PER_PAGE).max(1);
238+ let page = query
239+ .page
240+ .as_deref()
241+ .and_then(|p| p.parse::<usize>().ok())
242+ .unwrap_or(1)
243+ .clamp(1, pages);
244+ let rows: Vec<MilestoneRow> = all
245+ .into_iter()
246+ .skip((page - 1) * PER_PAGE)
247+ .take(PER_PAGE)
248+ .collect();
249+ let state_name = if closed { "closed" } else { "open" };
250+ let nav = pager_links(page as u64, pages as u64, |n| {
251+ format!("{}?state={state_name}&page={n}", milestones_href(&title))
252+ });
231253 let empty = rows.is_empty();
232254 let page_title = g::milestones_title(lang, &frame.title);
233255 let csrf = frame.csrf.clone();
@@ -237,7 +259,8 @@ async fn milestones_page(cx: &Cx) -> Result<impl View> {
237259 Ok(view! {
238260 shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
239261 milestones_body(lang: lang, frame: frame, rows: rows, empty: empty, closed: closed,
240- csrf: csrf, can_create: can_create, create_action: create_action, live: live))
262+ csrf: csrf, can_create: can_create, create_action: create_action, live: live,
263+ page: page as u64, pages: pages as u64, nav: nav))
241264 })
242265 }
243266
@@ -253,7 +276,11 @@ async fn milestones_body(
253276 can_create: bool,
254277 create_action: String,
255278 live: String,
279+ page: u64,
280+ pages: u64,
281+ nav: (Vec<PageLink>, Option<String>, Option<String>),
256282 ) -> Result<impl View> {
283+ let (links, prev, next) = nav;
257284 let title = frame.title.clone();
258285 let can_triage = frame.can_triage;
259286 let row_csrf = csrf.clone();
@@ -270,19 +297,26 @@ async fn milestones_body(
270297 <section class="card notice" role="status">(g::t(lang, K::MilestonesArchived))</section>
271298 }
272299 state_tabs(lang: lang, title: title.clone(), closed: closed)
273- <section class="card" data-live=(live.as_str()) data-live-now="">
300+ <div class="fit-split">
301+ <section class="card fit-pane fit-card fit-main" data-live=(live.as_str()) data-live-now="">
274302 if empty {
275303 empty_state(title: empty_text)
276304 }
305+ <div class="fit-scroll">
277306 <ul class="milestone-list">
278307 for row in rows.into_iter() {
279308 milestone_row(lang: lang, row: row, csrf: row_csrf.clone(), can_triage: can_triage)
280309 }
281310 </ul>
311+ </div>
312+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
282313 </section>
283314 if can_create {
284- milestone_create_form(lang: lang, csrf: csrf.clone(), action: create_action)
315+ <div class="fit-side">
316+ milestone_create_form(lang: lang, csrf: csrf.clone(), action: create_action)
317+ </div>
285318 }
319+ </div>
286320 })
287321 }
288322
crates/forge-web/src/pages/notifications.rsmodified+47 -41
@@ -1,5 +1,5 @@
11 //! Notifications. The inbox at `GET /notifications` (Unread by default, `?all=1` for everything,
2-//! grouped by repo, 50 rows a page with a `?before=` cursor) and its routes: open a row, mark a
2+//! grouped by repo, 8 rows a page with a `?before=` cursor) and its routes: open a row, mark a
33 //! row or a whole repo or inbox read, toggle the subscription on an issue or pull, and set the
44 //! repo watch level. Rows for repos the viewer can no longer read are hidden and marked read.
55 //! The sidebar box and the watch form are shared with the issue, pull and repo header views.
@@ -37,8 +37,10 @@ use crate::pages::star::return_path;
3737 use crate::state::AppState;
3838 use crate::views::{csrf_field, display_name, empty_state, iso_time, now_unix, relative_time, repo_href, shell};
3939
40-/// Rows per inbox page.
41-const PAGE_SIZE: u32 = 50;
40+/// Rows per inbox page: a group head and its rows, with the older link, fit the window's height
41+/// (about 44px a row and 62px a group head at 1440×900). The list scrolls inside its pane when a page
42+/// of many small groups is taller still.
43+const PAGE_SIZE: u32 = 8;
4244
4345 path_param!(owner);
4446 path_param!(repo);
@@ -1135,44 +1137,48 @@ async fn inbox_list(
11351137 <a href="/notifications?all=1" class=(all_class)>(g::t(lang, K::AllTab))</a>
11361138 <a href="/review-requests">(crate::i18n::authoring::t(lang, crate::i18n::authoring::K::ReviewRequestsTab))</a>
11371139 </nav>
1138- if empty {
1139- empty_state(title: empty_text,
1140- if !all {
1141- <a class="button" href="/notifications?all=1">(g::t(lang, K::ViewAllNotifications))</a>
1142- })
1143- }
1144- for group in groups.into_iter() {
1145- <section class="card notif-group">
1146- <header class="notif-group-head">
1147- <a class="notif-repo" href=(group.href.as_str())>(group.heading.as_str())</a>
1148- <form method="post" action=(group.mark_action.as_str()) class="notif-inline-form">
1149- csrf_field(token: csrf.as_str())
1150- <button type="submit" class="link-button">(g::t(lang, K::MarkAllRead))</button>
1151- </form>
1152- </header>
1153- <ul class="notif-list">
1154- for row in group.rows.into_iter() {
1155- <li class=(row.item_class)>
1156- <span class=(row.icon_class) aria-hidden="true"></span>
1157- <span class="notif-sr">(row.kind_label)</span>
1158- <a class="notif-title" href=(row.open_href.as_str())>(row.title_line.as_str())</a>
1159- <span class="badge">(row.reason)</span>
1160- <span class="muted small">(row.activity.as_str())</span>
1161- <time class="muted small" data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
1162- if row.unread {
1163- <form method="post" action=(row.read_action.as_str()) class="notif-inline-form">
1164- csrf_field(token: csrf.as_str())
1165- <button type="submit" class="link-button">(g::t(lang, K::MarkRead))</button>
1166- </form>
1167- }
1168- </li>
1169- }
1170- </ul>
1171- </section>
1172- }
1173- if let Some(href) = more {
1174- <p class="notif-more"><a class="button" href=(href.as_str())>(g::t(lang, K::Older))</a></p>
1175- }
1140+ // The groups and the older link share one pane that fits the window, so the page itself does
1141+ // not scroll; the older link ends the pane.
1142+ <div class="notif-pane fit-pane">
1143+ if empty {
1144+ empty_state(title: empty_text,
1145+ if !all {
1146+ <a class="button" href="/notifications?all=1">(g::t(lang, K::ViewAllNotifications))</a>
1147+ })
1148+ }
1149+ for group in groups.into_iter() {
1150+ <section class="card notif-group">
1151+ <header class="notif-group-head">
1152+ <a class="notif-repo" href=(group.href.as_str())>(group.heading.as_str())</a>
1153+ <form method="post" action=(group.mark_action.as_str()) class="notif-inline-form">
1154+ csrf_field(token: csrf.as_str())
1155+ <button type="submit" class="link-button">(g::t(lang, K::MarkAllRead))</button>
1156+ </form>
1157+ </header>
1158+ <ul class="notif-list">
1159+ for row in group.rows.into_iter() {
1160+ <li class=(row.item_class)>
1161+ <span class=(row.icon_class) aria-hidden="true"></span>
1162+ <span class="notif-sr">(row.kind_label)</span>
1163+ <a class="notif-title" href=(row.open_href.as_str())>(row.title_line.as_str())</a>
1164+ <span class="badge">(row.reason)</span>
1165+ <span class="muted small">(row.activity.as_str())</span>
1166+ <time class="muted small" data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
1167+ if row.unread {
1168+ <form method="post" action=(row.read_action.as_str()) class="notif-inline-form">
1169+ csrf_field(token: csrf.as_str())
1170+ <button type="submit" class="link-button">(g::t(lang, K::MarkRead))</button>
1171+ </form>
1172+ }
1173+ </li>
1174+ }
1175+ </ul>
1176+ </section>
1177+ }
1178+ if let Some(href) = more {
1179+ <p class="notif-more"><a class="button" href=(href.as_str())>(g::t(lang, K::Older))</a></p>
1180+ }
1181+ </div>
11761182 })
11771183 }
11781184
crates/forge-web/src/pages/org_ctx.rsmodified+35 -0
@@ -6,6 +6,7 @@
66 //! membership is not revealed. A member who is not an owner gets 403 on the owner-only actions.
77
88 use forge_core::store::orgs::OrgMemberRole;
9+use forge_core::store::repo_listing::RepoScope;
910 use forge_core::{Role, Session, User};
1011 use topcoat::Result;
1112 use topcoat::context::{Cx, app_context};
@@ -16,7 +17,10 @@ use topcoat::view::{View, component, view};
1617 use crate::auth::{check_csrf, require_user};
1718 use crate::i18n::Lang;
1819 use crate::i18n::orgs::{self as g, K};
20+use crate::pages::packages;
21+use crate::pages::profile::profile_tabs;
1922 use crate::state::AppState;
23+use crate::views::profile_items;
2024
2125 /// The query key that carries a notice on an org page. Its value is one of the fixed words in
2226 /// `NOTICES`, never user text. The notice lives in the URL, not in a cookie: a live refresh of the
@@ -197,6 +201,37 @@ pub async fn org_head(name: String, description: String) -> Result<impl View> {
197201 })
198202 }
199203
204+/// The counts on an organization's tab labels: the repos the viewer may read and the packages the
205+/// viewer may see, as the profile counts them.
206+pub async fn org_tab_counts(state: &AppState, org: &User, viewer: &User) -> Result<(u64, usize)> {
207+ let repos = state
208+ .store
209+ .count_visible_repos(RepoScope::OwnedBy(&org.id), Some(viewer))
210+ .await?;
211+ let packages = packages::package_rows(state, Some(viewer), org).await?.len();
212+ Ok((repos, packages))
213+}
214+
215+/// The profile tab bar on an organization's member pages (members, teams). Only members reach
216+/// them, so the Members and Teams tabs are always listed, and `current` marks the page's own.
217+#[component]
218+pub async fn org_tabs(
219+ lang: Lang,
220+ name: String,
221+ current: String,
222+ repo_count: u64,
223+ package_count: usize,
224+) -> Result<impl View> {
225+ let items = profile_items(lang, &name, true, false, true);
226+ let counts = vec![
227+ ("repositories", repo_count.to_string()),
228+ ("packages", package_count.to_string()),
229+ ];
230+ Ok(view! {
231+ profile_tabs(username: name, items: items, current: current, counts: counts)
232+ })
233+}
234+
200235 /// The notice banner: an error alert, or a status line.
201236 #[component]
202237 pub async fn org_notice(notice: Option<(&'static str, bool)>) -> Result<impl View> {
crates/forge-web/src/pages/org_members.rsmodified+9 -4
@@ -19,8 +19,8 @@ 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, parse_member_role,
23- require_form_csrf, require_member, require_owner, take_notice,
22+ load_org, member_role_word, notice_href, org_head, org_notice, org_tab_counts, org_tabs,
23+ parse_member_role, require_form_csrf, require_member, require_owner, take_notice,
2424 };
2525 use crate::pages::passkeys;
2626 use crate::state::AppState;
@@ -79,13 +79,16 @@ async fn members_body(
7979 notice: Option<(&'static str, bool)>,
8080 lang: Lang,
8181 live: String,
82+ repo_count: u64,
83+ package_count: usize,
8284 ) -> Result<impl View> {
8385 let role_action = format!("{base}/members/role");
8486 let remove_action = format!("{base}/members/remove");
8587 let add_action = format!("{base}/members/add");
8688 Ok(view! {
8789 <div data-live=(live.as_str())>
88- org_head(name: name, description: description)
90+ org_head(name: name.clone(), description: description)
91+ org_tabs(lang: lang, name: name, current: "members".to_owned(), repo_count: repo_count, package_count: package_count)
8992 org_notice(notice: notice)
9093 <section class="card">
9194 <h2>(g::t(lang, K::Members))</h2>
@@ -196,10 +199,12 @@ async fn org_members_page(cx: &Cx) -> Result<impl View> {
196199 let base = ctx.href("");
197200 let csrf = ctx.viewer.1.csrf_token.clone();
198201 let live = ctx.href("/members/events");
202+ let (repo_count, package_count) = org_tab_counts(state, &ctx.org, &ctx.viewer.0).await?;
199203 Ok(view! { cx =>
200204 shell(title: title.as_str(), viewer: Some(&ctx.viewer),
201205 members_body(name: name, description: description, base: base, owner: owner,
202- rows: rows, csrf: csrf, notice: notice, lang: lang, live: live))
206+ rows: rows, csrf: csrf, notice: notice, lang: lang, live: live,
207+ repo_count: repo_count, package_count: package_count))
203208 })
204209 }
205210
crates/forge-web/src/pages/org_teams.rsmodified+17 -5
@@ -19,8 +19,8 @@ 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, require_form_csrf,
23- require_member, require_owner, take_notice,
22+ OrgCtx, TEAM_ROLES, load_org, notice_href, org_head, org_notice, org_tab_counts, org_tabs,
23+ require_form_csrf, require_member, require_owner, take_notice,
2424 };
2525 use crate::pages::passkeys;
2626 use crate::state::AppState;
@@ -122,6 +122,9 @@ struct TeamPage {
122122 members: Vec<TeamMemberRow>,
123123 repos: Vec<TeamRepoRow>,
124124 choices: Vec<RepoChoice>,
125+ /// The counts on the org's tab bar.
126+ repo_count: u64,
127+ package_count: usize,
125128 }
126129
127130 /// The role a form sent, if it is one a team may carry.
@@ -189,11 +192,14 @@ async fn teams_body(
189192 notice: Option<(&'static str, bool)>,
190193 lang: Lang,
191194 live: String,
195+ repo_count: u64,
196+ package_count: usize,
192197 ) -> Result<impl View> {
193198 let create_action = format!("{base}/teams/new");
194199 Ok(view! {
195- <div data-live=(live.as_str())>
196- org_head(name: name, description: description)
200+ <div data-live=(live.as_str()) class="teams-page">
201+ org_head(name: name.clone(), description: description)
202+ org_tabs(lang: lang, name: name, current: "teams".to_owned(), repo_count: repo_count, package_count: package_count)
197203 org_notice(notice: notice)
198204 <section class="card">
199205 <h2>(g::t(lang, K::Teams))</h2>
@@ -280,10 +286,12 @@ async fn org_teams_page(cx: &Cx) -> Result<impl View> {
280286 let base = ctx.href("");
281287 let csrf = ctx.viewer.1.csrf_token.clone();
282288 let live = ctx.href("/teams/events");
289+ let (repo_count, package_count) = org_tab_counts(state, &ctx.org, &ctx.viewer.0).await?;
283290 Ok(view! { cx =>
284291 shell(title: title.as_str(), viewer: Some(&ctx.viewer),
285292 teams_body(name: name, description: description, base: base, owner: owner,
286- csrf: csrf, rows: rows, notice: notice, lang: lang, live: live))
293+ csrf: csrf, rows: rows, notice: notice, lang: lang, live: live,
294+ repo_count: repo_count, package_count: package_count))
287295 })
288296 }
289297
@@ -307,6 +315,7 @@ async fn team_body(
307315 Ok(view! {
308316 <div data-live=(data.live.as_str())>
309317 org_head(name: data.org_name.clone(), description: data.org_description.clone())
318+ org_tabs(lang: lang, name: data.org_name.clone(), current: "teams".to_owned(), repo_count: data.repo_count, package_count: data.package_count)
310319 org_notice(notice: notice)
311320 <section class="card">
312321 <h2>(data.team_name.as_str())</h2>
@@ -468,7 +477,10 @@ async fn org_team_page(cx: &Cx) -> Result<impl View> {
468477 })
469478 .collect();
470479 let title = format!("{} \u{b7} {}", ctx.org.username, team.name);
480+ let (repo_count, package_count) = org_tab_counts(state, &ctx.org, &ctx.viewer.0).await?;
471481 let data = TeamPage {
482+ repo_count,
483+ package_count,
472484 org_name: ctx.org.username.clone(),
473485 org_description: ctx.org.about.clone(),
474486 base: ctx.href(&format!("/teams/{}", team.id)),
crates/forge-web/src/pages/palette.rsmodified+90 -16
@@ -1,8 +1,14 @@
1-//! The command palette's destinations: `GET /-/palette` lists what the signed-in viewer can jump to,
2-//! their repos, the orgs they belong to and the fixed pages (Explore, notifications, snippets, new
3-//! repository and settings, and for admins the admin pages). The palette itself, its filtering and keys live in
4-//! `assets/nav.js`.
1+//! The command palette's destinations: `GET /-/palette` lists what the signed-in viewer can jump to.
2+//! Their repos, the orgs they belong to with that org's members, teams and (for owners) settings,
3+//! and the pages the navigation links to: their own profile's tabs, the fixed site pages and the
4+//! settings and admin pages. Those pages come from the same lists the navigation is built from
5+//! (`views::profile_items`, `views::global_items`, `views::settings_items`, `views::admin_items`),
6+//! so a page the sidebar or a tab bar links to is found here too. Each href is listed once, the
7+//! first time it appears. The palette itself, its filtering and keys live in `assets/nav.js`.
58
9+use std::collections::HashSet;
10+
11+use forge_core::store::orgs::OrgMemberRole;
612 use http::header::{CACHE_CONTROL, CONTENT_TYPE, X_CONTENT_TYPE_OPTIONS};
713 use serde_json::{Value, json};
814 use topcoat::Result;
@@ -11,10 +17,13 @@ use topcoat::router::response::Response;
1117 use topcoat::router::{Body, HeaderValue, StatusCode, route};
1218
1319 use crate::auth::current_user;
14-use crate::i18n::community::{self as cm, K as CK};
15-use crate::i18n::{self, Key, t};
20+use crate::i18n::orgs::{self as g, K};
21+use crate::i18n;
22+use crate::pages::org_new::may_create_org;
1623 use crate::state::AppState;
17-use crate::views::{admin_items, repo_href, settings_items, user_href};
24+use crate::views::{
25+ admin_items, enc, global_items, profile_items, repo_href, settings_items, user_href,
26+};
1827
1928 /// Repos listed at most. The palette filters in the browser, so a longer list would only cost time.
2029 pub const MAX_REPOS: u64 = 500;
@@ -24,6 +33,13 @@ fn destination(label: &str, href: &str, kind: &str) -> Value {
2433 json!({ "label": label, "href": href, "kind": kind })
2534 }
2635
36+/// Adds a destination unless its href is already listed.
37+fn push(items: &mut Vec<Value>, seen: &mut HashSet<String>, label: &str, href: &str, kind: &str) {
38+ if seen.insert(href.to_owned()) {
39+ items.push(destination(label, href, kind));
40+ }
41+}
42+
2743 /// `{"items": [{"label", "href", "kind"}, ...]}` for the signed-in viewer. Anonymous visitors get
2844 /// 401, as the other signed-in-only JSON routes do.
2945 #[route(GET "/-/palette")]
@@ -37,25 +53,38 @@ async fn palette(cx: &Cx) -> Result<Response> {
3753 let lang = i18n::lang(cx, Some(&user));
3854
3955 let mut items = Vec::new();
56+ let mut seen = HashSet::new();
4057 for repo in state.store.list_viewer_repos(&user, MAX_REPOS).await? {
4158 let label = format!("{}/{}", repo.owner_name, repo.name);
4259 let href = repo_href(&repo.owner_name, &repo.name, "", "");
43- items.push(destination(&label, &href, "repo"));
60+ push(&mut items, &mut seen, &label, &href, "repo");
4461 }
45- for (org, _) in state.store.orgs_for_user(&user.id).await? {
46- items.push(destination(&org.username, &user_href(&org.username), "org"));
62+ for (org, role) in state.store.orgs_for_user(&user.id).await? {
63+ let name = &org.username;
64+ let base = format!("/org/{}", enc(name));
65+ push(&mut items, &mut seen, name, &user_href(name), "org");
66+ let members = format!("{name} \u{b7} {}", g::t(lang, K::Members));
67+ push(&mut items, &mut seen, &members, &format!("{base}/members"), "page");
68+ let teams = format!("{name} \u{b7} {}", g::t(lang, K::Teams));
69+ push(&mut items, &mut seen, &teams, &format!("{base}/teams"), "page");
70+ if role == OrgMemberRole::Owner {
71+ let settings = format!("{name} \u{b7} {}", g::t(lang, K::Settings));
72+ push(&mut items, &mut seen, &settings, &format!("{base}/settings"), "page");
73+ }
4774 }
4875
49- items.push(destination(t(lang, Key::Explore), "/explore", "page"));
50- items.push(destination(t(lang, Key::Notifications), "/notifications", "page"));
51- items.push(destination(cm::t(lang, CK::Snippets), "/snippets", "page"));
52- items.push(destination(t(lang, Key::NewRepository), "/new", "page"));
76+ for item in profile_items(lang, &user.username, false, true, false) {
77+ push(&mut items, &mut seen, item.label, &item.href, "page");
78+ }
79+ for item in global_items(lang, may_create_org(state, &user)) {
80+ push(&mut items, &mut seen, item.label, &item.href, "page");
81+ }
5382 for item in settings_items(lang) {
54- items.push(destination(item.label, &item.href, "page"));
83+ push(&mut items, &mut seen, item.label, &item.href, "page");
5584 }
5685 if user.is_admin {
5786 for item in admin_items(lang) {
58- items.push(destination(item.label, &item.href, "page"));
87+ push(&mut items, &mut seen, item.label, &item.href, "page");
5988 }
6089 }
6190
@@ -70,3 +99,48 @@ async fn palette(cx: &Cx) -> Result<Response> {
7099 headers.insert(X_CONTENT_TYPE_OPTIONS, HeaderValue::from_static("nosniff"));
71100 Ok(response)
72101 }
102+
103+#[cfg(test)]
104+mod tests {
105+ use topcoat::router::request::Request;
106+ use topcoat::router::{Body, to_bytes};
107+
108+ use crate::auth::SESSION_COOKIE;
109+ use crate::i18n::Lang;
110+ use crate::views::profile_items;
111+
112+ /// Every tab of the viewer's own profile is in the palette, so a tab is found by its name.
113+ #[tokio::test]
114+ async fn palette_lists_every_profile_tab() {
115+ let dir = tempfile::tempdir().expect("tempdir");
116+ let state = crate::test_support::test_state(dir.path()).await;
117+ let store = state.store.clone();
118+ let router = crate::test_support::app_router(state);
119+ let tahinli = store
120+ .create_user("tahinli", None, "not-a-real-hash", false)
121+ .await
122+ .unwrap();
123+ crate::test_support::create_session(&store, &tahinli.id, "palette-token", "palette-csrf")
124+ .await;
125+ let request = Request::builder()
126+ .method("GET")
127+ .uri("/-/palette")
128+ .header("cookie", format!("__Host-{SESSION_COOKIE}=palette-token"))
129+ .body(Body::empty())
130+ .unwrap();
131+ let res = router.handle(request).await;
132+ let bytes = to_bytes(res.into_body(), usize::MAX).await.unwrap();
133+ let body: serde_json::Value = serde_json::from_slice(&bytes).unwrap();
134+ let hrefs: Vec<&str> = body["items"]
135+ .as_array()
136+ .unwrap()
137+ .iter()
138+ .map(|item| item["href"].as_str().unwrap())
139+ .collect();
140+ let tabs = profile_items(Lang::En, "tahinli", false, true, false);
141+ assert!(!tabs.is_empty());
142+ for tab in tabs {
143+ assert!(hrefs.contains(&tab.href.as_str()), "palette lacks {}", tab.href);
144+ }
145+ }
146+}
crates/forge-web/src/pages/profile.rsmodified+148 -60
@@ -38,7 +38,9 @@ use crate::views::heatmap::{Calendar, DayDetail, contribution_calendar};
3838 use crate::views::repo_list::{
3939 PageLink, RepoRow, SortLink, badge_class, pager, pager_links, repo_rows, sort_chips,
4040 };
41-use crate::views::{avatar_url, empty_state, enc, now_unix, repo_href, shell};
41+use crate::views::{
42+ NavItem, avatar_url, empty_state, enc, now_unix, profile_items, repo_href, shell, user_href,
43+};
4244
4345 path_param!(username);
4446
@@ -46,6 +48,8 @@ path_param!(username);
4648 const PER_PAGE: u64 = 30;
4749 /// Repos the overview shows when the owner has no visible pins.
4850 const POPULAR_COUNT: usize = 6;
51+/// Members an organization's overview lists; a longer list links to the members page.
52+const ORG_MEMBERS_SHOWN: usize = 12;
4953 /// Longest name filter kept, in characters.
5054 const MAX_QUERY_CHARS: usize = 100;
5155
@@ -282,14 +286,20 @@ async fn profile_page(cx: &Cx) -> Result<impl View> {
282286 _ => Listing::default(),
283287 };
284288
285- // An organization shows its members and how many teams it has. Its `about` is its description.
289+ // An organization shows its members (the first few, with their avatars) and how many teams it
290+ // has. Its `about` is its description.
286291 let org = if user.is_org() {
287292 let members = state.store.org_members(&user.id).await?;
288293 let teams = state.store.teams_for_org(&user.id).await?.len();
289294 Some(OrgSummary {
295+ total: members.len(),
290296 members: members
291297 .into_iter()
292- .map(|(member, _)| member.username)
298+ .take(ORG_MEMBERS_SHOWN)
299+ .map(|(member, _)| OrgMember {
300+ avatar: avatar_url(&member.username, member.avatar_hash.as_deref()),
301+ username: member.username,
302+ })
293303 .collect(),
294304 teams,
295305 })
@@ -412,12 +422,20 @@ async fn profile_fingerprint(
412422 Ok(lines.join("\n"))
413423 }
414424
415-/// What an organization's profile adds: its member names and its team count.
425+/// What an organization's profile adds: its member count, the first members to list, and its team
426+/// count.
416427 struct OrgSummary {
417- members: Vec<String>,
428+ total: usize,
429+ members: Vec<OrgMember>,
418430 teams: usize,
419431 }
420432
433+/// A member on an organization's overview: the login name and the avatar URL.
434+struct OrgMember {
435+ username: String,
436+ avatar: String,
437+}
438+
421439 /// A repo card on the overview: the repo and its star count.
422440 struct PinCard {
423441 repo: Repo,
@@ -553,30 +571,41 @@ async fn profile_card(
553571 orgs: Vec<OrgCard>,
554572 org_create_allowed: bool,
555573 ) -> Result<impl View> {
556- let package_count_text = package_rows.len().to_string();
557- let snippet_count_text = snippets.len().to_string();
558574 let has_snippets = !snippets.is_empty();
559575 let snippets_on = tab == "snippets";
560- let snippets_href = profile_href(&user.username, "snippets", "", SORTS[0].0, 1);
561576 let orgs_on = tab == "organizations";
562- let organizations_href = profile_href(&user.username, "organizations", "", SORTS[0].0, 1);
563577 let has_orgs = !orgs.is_empty();
564- let packages_href = profile_href(&user.username, "packages", "", SORTS[0].0, 1);
565578 let packages_events = packages::events_href(&user.username);
566579 let has_packages = !package_rows.is_empty();
567580 let src = avatar_url(&user.username, avatar.as_deref());
568581 let has_about = !about_html.is_empty();
569582 let is_org = user.is_org();
583+ // An organization's header avatar is smaller. The tab bar comes from the shared list, with the
584+ // counts that go on its labels.
585+ let avatar_px = if is_org { "96" } else { "256" };
586+ let avatar_class = if is_org {
587+ "profile-avatar org-avatar"
588+ } else {
589+ "profile-avatar"
590+ };
591+ let tab_items: Vec<NavItem> =
592+ profile_items(lang, &user.username, is_org, own_profile, org_member);
593+ let tab_counts = vec![
594+ ("repositories", repo_total.to_string()),
595+ ("snippets", snippets.len().to_string()),
596+ ("stars", star_total.to_string()),
597+ ("packages", package_rows.len().to_string()),
598+ ];
570599 let base = format!("/{}", enc(&user.username));
571600 let overview_on = tab == "overview";
601+ let overview_class = if is_org {
602+ "org-overview"
603+ } else {
604+ "profile-overview"
605+ };
572606 let repos_on = tab == "repositories";
573607 let stars_on = tab == "stars";
574608 let list_on = repos_on || stars_on;
575- let overview_href = profile_href(&user.username, "overview", "", SORTS[0].0, 1);
576- let repositories_href = profile_href(&user.username, "repositories", "", SORTS[0].0, 1);
577- let stars_href = profile_href(&user.username, "stars", "", SORTS[0].0, 1);
578- let repo_count_text = repo_total.to_string();
579- let star_count_text = star_total.to_string();
580609 let pinned_heading = if from_pins {
581610 g::t(lang, K::Pinned)
582611 } else {
@@ -584,6 +613,7 @@ async fn profile_card(
584613 };
585614 let has_cards = !cards.is_empty();
586615 let edit_label = mi::t(lang, MK::EditProfile);
616+ let org_edit_label = mi::t(lang, MK::EditOrganization);
587617 // The display name is the heading when set; the username then moves under it.
588618 let has_name = user.display_name.is_some();
589619 let heading = user
@@ -604,11 +634,10 @@ async fn profile_card(
604634 let new_repo_href = format!("/new?owner={}", enc(&user.username));
605635 let settings_href = format!("/org/{}/settings", enc(&user.username));
606636 let members_href = format!("/org/{}/members", enc(&user.username));
607- let teams_href = format!("/org/{}/teams", enc(&user.username));
608637 Ok(view! {
609638 <article class="profile-page" data-live=(format!("/users/{}/events", user.username))>
610639 <header class="profile-head">
611- <img class="profile-avatar" src=(src) alt="" width="256" height="256">
640+ <img class=(avatar_class) src=(src) alt="" width=(avatar_px) height=(avatar_px)>
612641 <div class="profile-id">
613642 <h1>(heading)</h1>
614643 if has_name {
@@ -623,9 +652,14 @@ async fn profile_card(
623652 if edit_profile {
624653 <a class="button profile-edit" href="/settings/profile">(edit_label)</a>
625654 }
626- if is_org && org_can_create {
655+ if is_org && (org_owner || org_can_create) {
627656 <div class="profile-org-actions">
628- <a class="button primary" href=(new_repo_href.as_str())>(g::t(lang, K::NewRepository))</a>
657+ if org_owner {
658+ <a class="button profile-edit" href=(settings_href.as_str())>(org_edit_label)</a>
659+ }
660+ if org_can_create {
661+ <a class="button primary" href=(new_repo_href.as_str())>(g::t(lang, K::NewRepository))</a>
662+ }
629663 </div>
630664 }
631665 </div>
@@ -633,39 +667,12 @@ async fn profile_card(
633667 if has_about {
634668 <section class="profile-about markdown-body">(Unescaped::new_unchecked(about_html))</section>
635669 }
636- <nav class="profile-tabs" aria-label=(user.username.as_str())>
637- <a class=(tab_class(overview_on)) href=(overview_href.as_str())>(g::t(lang, K::TabOverview))</a>
638- <a class=(tab_class(repos_on)) href=(repositories_href.as_str())>
639- (g::t(lang, K::Repositories)) " " <span class="tab-count">(repo_count_text.as_str())</span>
640- </a>
641- if !is_org {
642- <a class=(tab_class(snippets_on)) href=(snippets_href.as_str())>
643- (cm::t(lang, CK::Snippets)) " " <span class="tab-count">(snippet_count_text.as_str())</span>
644- </a>
645- }
646- if !is_org {
647- <a class=(tab_class(stars_on)) href=(stars_href.as_str())>
648- (g::t(lang, K::TabStars)) " " <span class="tab-count">(star_count_text.as_str())</span>
649- </a>
650- }
651- <a class=(tab_class(packages_on)) href=(packages_href.as_str())>
652- (pk::t(lang, PK::TabPackages)) " " <span class="tab-count">(package_count_text.as_str())</span>
653- </a>
654- if own_profile {
655- <a class=(tab_class(orgs_on)) href=(organizations_href.as_str())>(g::t(lang, K::Organizations))</a>
656- }
657- if org_member {
658- <a class=(tab_class(false)) href=(members_href.as_str())>(g::t(lang, K::Members))</a>
659- <a class=(tab_class(false)) href=(teams_href.as_str())>(g::t(lang, K::Teams))</a>
660- }
661- if org_owner {
662- <a class=(tab_class(false)) href=(settings_href.as_str())>(g::t(lang, K::Settings))</a>
663- }
664- </nav>
670+ profile_tabs(username: user.username.clone(), items: tab_items, current: tab.clone(), counts: tab_counts)
665671 if overview_on {
666672 if let Some((calendar, selected)) = heat {
667673 contribution_calendar(calendar: calendar, selected: selected, lang: lang, base: base.clone())
668674 }
675+ <div class=(overview_class)>
669676 <section class="profile-pinned">
670677 <div class="profile-section-head">
671678 <h2>(pinned_heading)</h2>
@@ -695,20 +702,31 @@ async fn profile_card(
695702 }
696703 </section>
697704 if let Some(summary) = org {
698- <section class="profile-org">
699- <h2>(g::t(lang, K::Members))</h2>
700- <p class="muted small">(g::members_and_teams(lang, summary.members.len(), summary.teams))</p>
705+ <section class="card profile-org">
706+ <div class="profile-section-head">
707+ <h2>(g::t(lang, K::Members))</h2>
708+ if org_member && summary.total > summary.members.len() {
709+ <a class="small" href=(members_href.as_str())>(g::t(lang, K::ViewAllMembers))</a>
710+ }
711+ </div>
712+ <p class="muted small">(g::members_and_teams(lang, summary.total, summary.teams))</p>
701713 if summary.members.is_empty() {
702714 empty_state(title: g::t(lang, K::NoMembers))
703715 } else {
704- <ul class="item-list">
705- for name in summary.members.iter() {
706- <li><a href=(format!("/{}", name.as_str()))>(name.as_str())</a></li>
716+ <ul class="org-members">
717+ for member in summary.members.into_iter() {
718+ <li>
719+ <a href=(user_href(member.username.as_str()))>
720+ <img class="avatar org-member-avatar" src=(member.avatar.as_str()) alt="" width="32" height="32">
721+ <span>(member.username.as_str())</span>
722+ </a>
723+ </li>
707724 }
708725 </ul>
709726 }
710727 </section>
711728 }
729+ </div>
712730 }
713731 if list_on {
714732 <section class="repo-listing">
@@ -815,6 +833,48 @@ async fn profile_card(
815833 })
816834 }
817835
836+/// The profile tab bar: one link per item, the current tab marked, and a count after the label of
837+/// each tab that has one in `counts`, by the item's key. A person's, an organization's and an
838+/// organization's member pages all render it.
839+#[component]
840+pub async fn profile_tabs(
841+ username: String,
842+ items: Vec<NavItem>,
843+ current: String,
844+ counts: Vec<(&'static str, String)>,
845+) -> Result<impl View> {
846+ let rows: Vec<(String, String, &'static str, String, bool)> = items
847+ .into_iter()
848+ .map(|item| {
849+ let on = item.key == current;
850+ let count = counts
851+ .iter()
852+ .find(|(key, _)| *key == item.key)
853+ .map(|(_, count)| count.clone());
854+ let has_count = count.is_some();
855+ (
856+ item.href,
857+ item.label.to_owned(),
858+ tab_class(on),
859+ count.unwrap_or_default(),
860+ has_count,
861+ )
862+ })
863+ .collect();
864+ Ok(view! {
865+ <nav class="profile-tabs" aria-label=(username.as_str())>
866+ for (href, label, class, count, has_count) in rows.into_iter() {
867+ <a class=(class) href=(href.as_str())>
868+ (label.as_str())
869+ if has_count {
870+ " " <span class="tab-count">(count.as_str())</span>
871+ }
872+ </a>
873+ }
874+ </nav>
875+ })
876+}
877+
818878 #[cfg(test)]
819879 mod tests {
820880
@@ -1049,7 +1109,8 @@ mod tests {
10491109 "stars: private starred repo"
10501110 );
10511111
1052- // The org sidebar shows Settings to owners only.
1112+ // Members and teams pages have no sidebar; their tab bar leads to both, and a member gets no
1113+ // settings link. Owners edit the organization from its profile.
10531114 let kaan = site
10541115 .store
10551116 .create_user("kaan", None, "not-a-real-hash", false)
@@ -1068,16 +1129,42 @@ mod tests {
10681129 let member_cookie = sign_in(&site.store, &kaan.id, "org-member-token").await;
10691130 let href = "href=\"/org/forge-org/settings\"";
10701131 let (_, as_owner) = get(&site.router, "/org/forge-org/members", Some(&owner_cookie)).await;
1071- assert!(as_owner.contains(href), "org sidebar: owner sees Settings");
1132+ assert!(
1133+ !as_owner.contains("class=\"side-group\""),
1134+ "org members: no sidebar"
1135+ );
1136+ assert!(
1137+ as_owner.contains("href=\"/org/forge-org/teams\""),
1138+ "org members: owner sees Teams in the tab bar"
1139+ );
10721140 let (_, as_member) =
10731141 get(&site.router, "/org/forge-org/members", Some(&member_cookie)).await;
10741142 assert!(
10751143 as_member.contains("href=\"/org/forge-org/teams\""),
1076- "org sidebar: member sees Teams"
1144+ "org tabs: member sees Teams"
10771145 );
10781146 assert!(
10791147 !as_member.contains(href),
1080- "org sidebar: member does not see Settings"
1148+ "org tabs: member does not see Settings"
1149+ );
1150+ let (_, member_profile) = get(&site.router, "/forge-org", Some(&member_cookie)).await;
1151+ assert!(
1152+ !member_profile.contains("profile-edit"),
1153+ "org profile: member has no edit button"
1154+ );
1155+ // Settings keeps a sidebar of its own pages, and its back link goes to the profile.
1156+ let (_, settings) = get(&site.router, "/org/forge-org/settings", Some(&owner_cookie)).await;
1157+ assert!(
1158+ settings.contains("href=\"/org/forge-org/settings/pins\""),
1159+ "org settings: sidebar lists Customize pins"
1160+ );
1161+ assert!(
1162+ !settings.contains("href=\"/org/forge-org/members\""),
1163+ "org settings: sidebar has no members link"
1164+ );
1165+ assert!(
1166+ settings.contains("class=\"side-link\" href=\"/forge-org\""),
1167+ "org settings: back link goes to the profile"
10811168 );
10821169
10831170 // Org pins show on the org profile, with an edit link for owners only.
@@ -1104,8 +1191,9 @@ mod tests {
11041191 "org pins: anonymous has no edit link"
11051192 );
11061193 assert!(
1107- owner.contains("href=\"/org/acme/settings\"") && owner.contains("/new?owner=acme"),
1108- "org profile: owner sees Settings and New repository"
1194+ owner.contains("class=\"button profile-edit\" href=\"/org/acme/settings\"")
1195+ && owner.contains("/new?owner=acme"),
1196+ "org profile: owner sees Edit organization and New repository"
11091197 );
11101198 assert!(
11111199 !anon.contains("/org/acme/members"),
crates/forge-web/src/pages/pull_files.rsmodified+1 -1
@@ -227,7 +227,7 @@ async fn pull_files(cx: &Cx) -> Result<impl View> {
227227 if let Some(message) = error {
228228 alert(message: message.as_str())
229229 }
230- <div data-live=(live.as_str())>
230+ <div class="fit-pane" data-live=(live.as_str())>
231231 if can_review {
232232 review_bar(lang: lang, pr_href: href.clone(), csrf: csrf.clone(), pending: pending, is_author: is_author)
233233 }
crates/forge-web/src/pages/pull_view.rsmodified+2 -2
@@ -900,7 +900,7 @@ async fn pull_conversation(
900900 alert(message: message)
901901 }
902902 <div class="issue-layout" data-live=(live.as_str())>
903- <div class="issue-column">
903+ <div class="issue-column fit-pane">
904904 discussion_timeline(lang: lang, discussion: discussion)
905905 if review_box_shown {
906906 review_box(approved: approved, approved_before: approved_before, changes: changes, dismiss: dismiss,
@@ -932,7 +932,7 @@ async fn pull_conversation(
932932 <p class="muted">(login_before)<a href=(login_href.as_str())>(login_link)</a>(login_after)</p>
933933 }
934934 </div>
935- <aside class="issue-sidebar">
935+ <aside class="issue-sidebar fit-pane">
936936 item_sidebar(lang: lang, write: write_meta, base: href.clone(), csrf: csrf.clone(), sidebar: sidebar, notify: notify)
937937 reviewers_box(lang: lang, reviewers: reviewers)
938938 </aside>
crates/forge-web/src/pages/releases.rsmodified+65 -17
@@ -25,7 +25,7 @@ use topcoat::router::content::Form;
2525 use topcoat::router::error::{SeeOther, forbidden, not_found, see_other};
2626 use topcoat::router::request::headers;
2727 use topcoat::router::response::Response;
28-use topcoat::router::{Body, HeaderName, HeaderValue, StatusCode, page, path_param, route};
28+use topcoat::router::{Body, HeaderName, HeaderValue, StatusCode, page, path_param, query_params, route};
2929 use topcoat::view::{Unescaped, View, component, view};
3030
3131 use crate::auth::require_csrf;
@@ -42,6 +42,7 @@ use crate::pages::issue_parts::When;
4242 use crate::release_ops::{self, CreateRelease, EditRelease, ReleaseError};
4343 use crate::render::markdown::render_markdown;
4444 use crate::state::AppState;
45+use crate::views::repo_list::{PageLink, pager, pager_links};
4546 use crate::views::{alert, empty_state, enc, now_unix, shell, user_link};
4647
4748 path_param!(owner);
@@ -54,6 +55,16 @@ path_param!(name);
5455 /// Multipart framing allowed on top of the file itself when checking `Content-Length`.
5556 const MULTIPART_OVERHEAD: u64 = 64 * 1024;
5657
58+/// Releases per page. A release card is tall (its notes and assets), so three fit the window.
59+const PER_PAGE: usize = 3;
60+
61+/// The list's query: the page, and the notice word that a paging link keeps.
62+#[query_params(error = bad_request)]
63+struct ReleasesQuery {
64+ page: Option<String>,
65+ notice: Option<String>,
66+}
67+
5768 /// Notice words (the only text a `?notice=` query can show), their text and whether they are errors.
5869 const NOTICES: [(&str, K, bool); 12] = [
5970 ("saved", K::RelSaved, false),
@@ -356,19 +367,22 @@ async fn release_form(
356367 }
357368 <input type="hidden" name="csrf" value=(csrf.as_str())>
358369 if is_new {
359- <label>
360- <span>(g::t(lang, K::Tag))</span>
361- <input type="text" name="tag" value=(draft.tag.as_str()) required="required" maxlength="100" autocomplete="off" spellcheck="false">
362- </label>
363- <p class="muted small">(tag_hint)</p>
364- <label>
365- <span>(g::t(lang, K::TargetBranch))</span>
366- <select name="target">
367- for branch in branches.iter() {
368- <option value=(branch.as_str()) selected=(branch.as_str() == draft.target.as_str())>(branch.as_str())</option>
369- }
370- </select>
371- </label>
370+ // The tag and the target branch are short, so they share a row.
371+ <div class="release-pair">
372+ <label>
373+ <span>(g::t(lang, K::Tag))</span>
374+ <input type="text" name="tag" value=(draft.tag.as_str()) required="required" maxlength="100" autocomplete="off" spellcheck="false">
375+ </label>
376+ <label>
377+ <span>(g::t(lang, K::TargetBranch))</span>
378+ <select name="target">
379+ for branch in branches.iter() {
380+ <option value=(branch.as_str()) selected=(branch.as_str() == draft.target.as_str())>(branch.as_str())</option>
381+ }
382+ </select>
383+ </label>
384+ <p class="muted small">(tag_hint)</p>
385+ </div>
372386 } else {
373387 <label>
374388 <span>(g::t(lang, K::Tag))</span>
@@ -474,7 +488,11 @@ async fn list_body(
474488 new_href: Option<String>,
475489 cards: Vec<ReleaseCard>,
476490 live: String,
491+ page: u64,
492+ pages: u64,
493+ nav: (Vec<PageLink>, Option<String>, Option<String>),
477494 ) -> Result<impl View> {
495+ let (links, prev, next) = nav;
478496 Ok(view! {
479497 repo_head(head: head)
480498 if let Some((text, is_error)) = notice {
@@ -484,7 +502,7 @@ async fn list_body(
484502 <section class="card notice" role="status">(text)</section>
485503 }
486504 }
487- <section class="card" data-live=(live.as_str())>
505+ <section class="card fit-pane fit-card" data-live=(live.as_str())>
488506 <div class="release-list-head">
489507 <h2>(g::t(lang, K::Releases))</h2>
490508 if let Some(href) = &new_href {
@@ -498,6 +516,7 @@ async fn list_body(
498516 }
499517 )
500518 }
519+ <div class="fit-scroll">
501520 for card in cards.iter() {
502521 <article class="release-card">
503522 <h3>
@@ -532,6 +551,8 @@ async fn list_body(
532551 <p><a href=(card.edit_href.as_str())>(g::t(lang, K::Edit))</a></p>
533552 </article>
534553 }
554+ </div>
555+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
535556 </section>
536557 })
537558 }
@@ -541,6 +562,7 @@ async fn list_body(
541562 async fn releases_list_page(cx: &Cx) -> Result<impl View> {
542563 let owner = path_param::<Owner>(cx);
543564 let name = path_param::<Repo>(cx);
565+ let query = query_params::<ReleasesQuery>(cx)?;
544566 let ctx = load_repo(cx, owner, name).await?;
545567 let lang = i18n::lang(cx, viewer_user(&ctx));
546568 let state = app_context::<AppState>(cx);
@@ -561,11 +583,37 @@ async fn releases_list_page(cx: &Cx) -> Result<impl View> {
561583 let title = format!("{} \u{b7} {}", title_of(&ctx), g::t(lang, K::Releases));
562584 let new_href = writer.then(|| format!("{}/new", releases_href(&title_of(&ctx))));
563585 let notice = notice_from_query(cx, lang);
586+ let pages = cards.len().div_ceil(PER_PAGE).max(1);
587+ let page = query
588+ .page
589+ .as_deref()
590+ .and_then(|p| p.parse::<usize>().ok())
591+ .unwrap_or(1)
592+ .clamp(1, pages);
593+ let kept = if notice.is_some() {
594+ query.notice.clone().unwrap_or_default()
595+ } else {
596+ String::new()
597+ };
598+ let list_href = releases_href(&title_of(&ctx));
599+ let nav = pager_links(page as u64, pages as u64, |n| {
600+ if kept.is_empty() {
601+ format!("{list_href}?page={n}")
602+ } else {
603+ format!("{list_href}?page={n}&notice={}", enc(&kept))
604+ }
605+ });
606+ let cards: Vec<ReleaseCard> = cards
607+ .into_iter()
608+ .skip((page - 1) * PER_PAGE)
609+ .take(PER_PAGE)
610+ .collect();
564611 let head = ctx.head(state, "releases").await?;
565612 let live = releases_live::list_live_url(&title_of(&ctx));
566613 Ok(view! {
567614 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
568- list_body(head: head, lang: lang, notice: notice, new_href: new_href, cards: cards, live: live))
615+ list_body(head: head, lang: lang, notice: notice, new_href: new_href, cards: cards, live: live,
616+ page: page as u64, pages: pages as u64, nav: nav))
569617 })
570618 }
571619
@@ -589,7 +637,7 @@ async fn new_form_body(
589637 ) -> Result<impl View> {
590638 Ok(view! {
591639 repo_head(head: head)
592- <section class="card">
640+ <section class="card fit-pane">
593641 <h2>(g::t(lang, K::NewRelease))</h2>
594642 release_form(action: action, csrf: csrf, lang: lang, is_new: true, move_target: true, draft: draft, branches: branches, submit: g::t(lang, K::SaveRelease))
595643 </section>
crates/forge-web/src/pages/repo_collaborators.rsmodified+12 -8
@@ -314,14 +314,18 @@ async fn collaborators_body(
314314 <section class="card notice" role="status">(text)</section>
315315 }
316316 }
317- <section class="card">
318- <h2>(g::t(lang, K::Collaborators))</h2>
319- <p class="muted small">(g::t(lang, K::CollaboratorsHelp))</p>
320- collaborators_table(lang: lang, rows: rows, role_action: role_action,
321- remove_action: remove_action, csrf: csrf.clone())
322- add_form(lang: lang, add_action: add_action, csrf: csrf)
323- </section>
324- role_legend(lang: lang)
317+ <div class="fit-pane settings-split">
318+ <section class="card">
319+ <h2>(g::t(lang, K::Collaborators))</h2>
320+ <p class="muted small">(g::t(lang, K::CollaboratorsHelp))</p>
321+ collaborators_table(lang: lang, rows: rows, role_action: role_action,
322+ remove_action: remove_action, csrf: csrf.clone())
323+ </section>
324+ <section class="card">
325+ add_form(lang: lang, add_action: add_action, csrf: csrf)
326+ </section>
327+ role_legend(lang: lang)
328+ </div>
325329 })
326330 }
327331
crates/forge-web/src/pages/repo_mirrors.rsmodified+66 -64
@@ -507,74 +507,76 @@ async fn mirrors_list_body(
507507 let can_pull = pull_form.is_some();
508508 Ok(view! {
509509 frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang)
510- <section class="card">
511- <h2>(g::t(lang, K::Mirrors))</h2>
512- <p class="muted small">(g::t(lang, K::MirrorsIntro))</p>
513- if rows.is_empty() {
514- empty_state(title: g::t(lang, K::NoMirrors),
515- if !archived {
516- if can_pull {
517- <a class="button" href="#add-pull-mirror">(g::t(lang, K::AddPullMirror))</a>
518- }
519- <a class="button" href="#add-push-mirror">(g::t(lang, K::AddPushMirror))</a>
520- })
521- } else {
522- <ul class="runner-list mirror-list">
523- for row in rows.iter() {
524- <li class="runner-row">
525- <div class="runner-id">
526- <div class="runner-title">
527- <span class=(row.dot_class) role="img" aria-label=(row.status_text) title=(row.status_text)></span>
528- <a class="runner-name mirror-url" href=(row.href.as_str())>(row.url.as_str())</a>
529- </div>
530- <p class="runner-meta muted">
531- (row.direction)" · "(row.interval.as_str())
532- if !row.enabled {
533- " · "(adm::t(lang, adm::K::Disabled))
534- }
535- " · "
536- if row.last_sync_at.is_empty() {
537- (g::t(lang, K::StatusNotRun))
538- } else {
539- (row.sync_prefix)<time data-rel="true" datetime=(row.last_sync_at.as_str()) title=(row.last_sync.as_str())>(row.last_sync_rel.as_str())</time>(row.sync_suffix)
510+ <div class="fit-pane settings-split">
511+ <section class="card">
512+ <h2>(g::t(lang, K::Mirrors))</h2>
513+ <p class="muted small">(g::t(lang, K::MirrorsIntro))</p>
514+ if rows.is_empty() {
515+ empty_state(title: g::t(lang, K::NoMirrors),
516+ if !archived {
517+ if can_pull {
518+ <a class="button" href="#add-pull-mirror">(g::t(lang, K::AddPullMirror))</a>
519+ }
520+ <a class="button" href="#add-push-mirror">(g::t(lang, K::AddPushMirror))</a>
521+ })
522+ } else {
523+ <ul class="runner-list mirror-list">
524+ for row in rows.iter() {
525+ <li class="runner-row">
526+ <div class="runner-id">
527+ <div class="runner-title">
528+ <span class=(row.dot_class) role="img" aria-label=(row.status_text) title=(row.status_text)></span>
529+ <a class="runner-name mirror-url" href=(row.href.as_str())>(row.url.as_str())</a>
530+ </div>
531+ <p class="runner-meta muted">
532+ (row.direction)" · "(row.interval.as_str())
533+ if !row.enabled {
534+ " · "(adm::t(lang, adm::K::Disabled))
535+ }
536+ " · "
537+ if row.last_sync_at.is_empty() {
538+ (g::t(lang, K::StatusNotRun))
539+ } else {
540+ (row.sync_prefix)<time data-rel="true" datetime=(row.last_sync_at.as_str()) title=(row.last_sync.as_str())>(row.last_sync_rel.as_str())</time>(row.sync_suffix)
541+ }
542+ </p>
543+ if !row.error.is_empty() {
544+ <details class="mirror-failure">
545+ <summary>(g::t(lang, K::ErrorLabel))</summary>
546+ <pre class="mirror-error">(row.error.as_str())</pre>
547+ </details>
540548 }
541- </p>
542- if !row.error.is_empty() {
543- <details class="mirror-failure">
544- <summary>(g::t(lang, K::ErrorLabel))</summary>
545- <pre class="mirror-error">(row.error.as_str())</pre>
546- </details>
549+ </div>
550+ if !archived {
551+ <form method="post" action=(row.sync_action.as_str()) class="inline-form">
552+ <input type="hidden" name="csrf" value=(csrf.as_str())>
553+ <button type="submit" class="hook-sync">(g::t(lang, K::SyncNow))</button>
554+ </form>
547555 }
548- </div>
549- if !archived {
550- <form method="post" action=(row.sync_action.as_str()) class="inline-form">
551- <input type="hidden" name="csrf" value=(csrf.as_str())>
552- <button type="submit" class="hook-sync">(g::t(lang, K::SyncNow))</button>
553- </form>
554- }
555- </li>
556- }
557- </ul>
558- }
559- </section>
560- if !archived {
561- if let Some(pull) = pull_form {
562- <section class="card" id="add-pull-mirror">
563- <h2>(g::t(lang, K::AddPullMirror))</h2>
564- <p class="muted small">(g::t(lang, K::AddPullIntro))</p>
565- mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: true, current_url: String::new(),
566- url: pull.url, username: pull.username, has_secret: false, interval: pull.interval,
567- enabled: None, error: pull.error, submit: g::t(lang, K::AddPullMirror), direction: "pull", lang: lang)
556+ </li>
557+ }
558+ </ul>
559+ }
560+ </section>
561+ if !archived {
562+ if let Some(pull) = pull_form {
563+ <section class="card" id="add-pull-mirror">
564+ <h2>(g::t(lang, K::AddPullMirror))</h2>
565+ <p class="muted small">(g::t(lang, K::AddPullIntro))</p>
566+ mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: true, current_url: String::new(),
567+ url: pull.url, username: pull.username, has_secret: false, interval: pull.interval,
568+ enabled: None, error: pull.error, submit: g::t(lang, K::AddPullMirror), direction: "pull", lang: lang)
569+ </section>
570+ }
571+ <section class="card" id="add-push-mirror">
572+ <h2>(g::t(lang, K::AddPushMirror))</h2>
573+ <p class="muted small">(g::t(lang, K::AddPushIntro))</p>
574+ mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: false, current_url: String::new(),
575+ url: draft.url, username: draft.username, has_secret: false, interval: draft.interval,
576+ enabled: None, error: draft.error, submit: g::t(lang, K::AddPushMirror), direction: "", lang: lang)
568577 </section>
569578 }
570- <section class="card" id="add-push-mirror">
571- <h2>(g::t(lang, K::AddPushMirror))</h2>
572- <p class="muted small">(g::t(lang, K::AddPushIntro))</p>
573- mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: false, current_url: String::new(),
574- url: draft.url, username: draft.username, has_secret: false, interval: draft.interval,
575- enabled: None, error: draft.error, submit: g::t(lang, K::AddPushMirror), direction: "", lang: lang)
576- </section>
577- }
579+ </div>
578580 })
579581 }
580582
crates/forge-web/src/pages/repo_secrets.rsmodified+62 -60
@@ -191,70 +191,72 @@ async fn secrets_body(
191191 let delete_action = format!("{set_action}/delete");
192192 Ok(view! {
193193 frame_top(lang: lang, head: head, title: title.clone(), notice: notice, archived: archived)
194- <section class="card">
195- <h2>(g::t(lang, K::Secrets))</h2>
196- <p class="muted small">(g::t(lang, K::SecretsHelp))</p>
197- if rows.is_empty() {
198- empty_state(title: g::t(lang, K::NoSecrets),
199- if !archived {
200- <a class="button" href="#add-secret">(g::t(lang, K::AddOrUpdate))</a>
201- })
202- } else {
203- <div class="table-wrap">
204- <table class="table secrets">
205- <thead>
206- <tr>
207- <th>(g::t(lang, K::Name))</th>
208- <th>(g::t(lang, K::LastUpdated))</th>
209- <th></th>
210- </tr>
211- </thead>
212- <tbody>
213- for row in rows.iter() {
194+ <div class="fit-pane settings-split">
195+ <section class="card">
196+ <h2>(g::t(lang, K::Secrets))</h2>
197+ <p class="muted small">(g::t(lang, K::SecretsHelp))</p>
198+ if rows.is_empty() {
199+ empty_state(title: g::t(lang, K::NoSecrets),
200+ if !archived {
201+ <a class="button" href="#add-secret">(g::t(lang, K::AddOrUpdate))</a>
202+ })
203+ } else {
204+ <div class="table-wrap">
205+ <table class="table secrets">
206+ <thead>
214207 <tr>
215- <td><code>(row.name.as_str())</code></td>
216- <td class="small">rel_time(lang: lang, stamp: row.updated_at.as_str())</td>
217- <td>
218- if !archived {
219- <form method="post" action=(delete_action.as_str()) class="inline-form">
220- <input type="hidden" name="csrf" value=(csrf.as_str())>
221- <input type="hidden" name="name" value=(row.name.as_str())>
222- <button type="submit" class="danger">(g::t(lang, K::Delete))</button>
223- </form>
224- }
225- </td>
208+ <th>(g::t(lang, K::Name))</th>
209+ <th>(g::t(lang, K::LastUpdated))</th>
210+ <th></th>
226211 </tr>
227- }
228- </tbody>
229- </table>
230- </div>
231- }
232- </section>
233- if !archived {
234- <section class="card" id="add-secret">
235- <h2>(g::t(lang, K::AddOrUpdate))</h2>
236- if let Some(message) = error {
237- <p class="alert" role="alert">(message.as_str())</p>
238- }
239- <form method="post" action=(set_action.as_str()) class="stack">
240- <input type="hidden" name="csrf" value=(csrf.as_str())>
241- <label>
242- (g::t(lang, K::Name))
243- <input type="text" name="name" value=(draft_name.as_str()) required=(true) maxlength="64"
244- pattern="[A-Z_][A-Z0-9_]{0,63}" autocomplete="off" spellcheck="false"
245- placeholder="DEPLOY_TOKEN">
246- </label>
247- <label>
248- (g::t(lang, K::Value))
249- <textarea name="value" required=(true) rows="6" autocomplete="off" spellcheck="false"></textarea>
250- </label>
251- <p class="muted small">(g::t(lang, K::SecretLimits))</p>
252- <div class="actions">
253- <button type="submit" class="primary">(g::t(lang, K::SaveSecret))</button>
212+ </thead>
213+ <tbody>
214+ for row in rows.iter() {
215+ <tr>
216+ <td><code>(row.name.as_str())</code></td>
217+ <td class="small">rel_time(lang: lang, stamp: row.updated_at.as_str())</td>
218+ <td>
219+ if !archived {
220+ <form method="post" action=(delete_action.as_str()) class="inline-form">
221+ <input type="hidden" name="csrf" value=(csrf.as_str())>
222+ <input type="hidden" name="name" value=(row.name.as_str())>
223+ <button type="submit" class="danger">(g::t(lang, K::Delete))</button>
224+ </form>
225+ }
226+ </td>
227+ </tr>
228+ }
229+ </tbody>
230+ </table>
254231 </div>
255- </form>
232+ }
256233 </section>
257- }
234+ if !archived {
235+ <section class="card" id="add-secret">
236+ <h2>(g::t(lang, K::AddOrUpdate))</h2>
237+ if let Some(message) = error {
238+ <p class="alert" role="alert">(message.as_str())</p>
239+ }
240+ <form method="post" action=(set_action.as_str()) class="stack">
241+ <input type="hidden" name="csrf" value=(csrf.as_str())>
242+ <label>
243+ (g::t(lang, K::Name))
244+ <input type="text" name="name" value=(draft_name.as_str()) required=(true) maxlength="64"
245+ pattern="[A-Z_][A-Z0-9_]{0,63}" autocomplete="off" spellcheck="false"
246+ placeholder="DEPLOY_TOKEN">
247+ </label>
248+ <label>
249+ (g::t(lang, K::Value))
250+ <textarea name="value" required=(true) rows="6" autocomplete="off" spellcheck="false"></textarea>
251+ </label>
252+ <p class="muted small">(g::t(lang, K::SecretLimits))</p>
253+ <div class="actions">
254+ <button type="submit" class="primary">(g::t(lang, K::SaveSecret))</button>
255+ </div>
256+ </form>
257+ </section>
258+ }
259+ </div>
258260 })
259261 }
260262
crates/forge-web/src/pages/repo_settings.rsmodified+26 -15
@@ -830,10 +830,13 @@ async fn settings_body(
830830 });
831831 }
832832 let new_draft = draft.unwrap_or_else(|| RuleDraft::for_default_branch(&default_branch));
833- let new_open = cards.is_empty() || new_draft.error.is_some();
833+ // The New rule form stays collapsed unless its draft was rejected with an error.
834+ let new_open = new_draft.error.is_some();
834835 let (description, visibility) = (head.description.clone(), head.visibility);
835836 let discussions_on = head.discussions;
836837 let notice = notice.map(|(key, is_error)| (g::t(lang, key), is_error));
838+ // Three columns on a wide window: the General section, the branch rules, then discussions and the
839+ // danger zone. The pane holds them to one screen (see _fit_settings.scss).
837840 Ok(view! {
838841 repo_head(head: head)
839842 settings_nav_for(lang: lang, title: title.clone(), current: "general")
@@ -844,20 +847,28 @@ async fn settings_body(
844847 <section class="card notice" role="status">(text)</section>
845848 }
846849 }
847- general_section(lang: lang, title: title.clone(), csrf: csrf.clone(), description: description,
848- default_branch: default_branch.clone(), branches: branches,
849- visibility: visibility, archived: archived)
850- <section class="card">
851- <h2>(g::t(lang, K::BranchProtection))</h2>
852- <p class="muted small">(g::t(lang, K::BranchProtectionHelp))</p>
853- branch_rule_cards(lang: lang, cards: cards, builtin_row: builtin_row, default_branch: default_branch.clone(),
854- new_draft: new_draft, new_open: new_open, csrf: csrf.clone(), save_action: rules_action,
855- delete_action: delete_action, contexts: contexts)
856- </section>
857- discussions_card(lang: lang, action: format!("/{title}/settings/discussions"), csrf: csrf.clone(), enabled: discussions_on)
858- if can_delete {
859- danger_zone(lang: lang, csrf: csrf, title: title, error: delete_error)
860- }
850+ <div class="fit-pane settings-split">
851+ <div class="settings-col">
852+ general_section(lang: lang, title: title.clone(), csrf: csrf.clone(), description: description,
853+ default_branch: default_branch.clone(), branches: branches,
854+ visibility: visibility, archived: archived)
855+ </div>
856+ <div class="settings-col">
857+ <section class="card">
858+ <h2>(g::t(lang, K::BranchProtection))</h2>
859+ <p class="muted small">(g::t(lang, K::BranchProtectionHelp))</p>
860+ branch_rule_cards(lang: lang, cards: cards, builtin_row: builtin_row, default_branch: default_branch.clone(),
861+ new_draft: new_draft, new_open: new_open, csrf: csrf.clone(), save_action: rules_action,
862+ delete_action: delete_action, contexts: contexts)
863+ </section>
864+ </div>
865+ <div class="settings-col">
866+ discussions_card(lang: lang, action: format!("/{title}/settings/discussions"), csrf: csrf.clone(), enabled: discussions_on)
867+ if can_delete {
868+ danger_zone(lang: lang, csrf: csrf, title: title, error: delete_error)
869+ }
870+ </div>
871+ </div>
861872 })
862873 }
863874
crates/forge-web/src/pages/repo_webhooks.rsmodified+10 -8
@@ -812,14 +812,16 @@ async fn hook_new_body(
812812 let back = hooks_href(&title);
813813 Ok(view! {
814814 frame_top(head: head, title: title.clone(), notice: None, archived: archived, lang: lang)
815- <section class="card">
816- <h2>(g::t(lang, K::AddWebhook))</h2>
817- <p class="muted small">(g::t(lang, K::AddWebhookIntro))</p>
818- hook_form(action: action, csrf: csrf, url: draft.url, events: events,
819- active: draft.active, secret_hint: g::t(lang, K::SecretHintNew).to_owned(),
820- error: draft.error, submit: g::t(lang, K::CreateWebhook), lang: lang)
821- <p><a href=(back.as_str())>(g::t(lang, K::BackToWebhooks))</a></p>
822- </section>
815+ <div class="fit-pane settings-split">
816+ <section class="card">
817+ <h2>(g::t(lang, K::AddWebhook))</h2>
818+ <p class="muted small">(g::t(lang, K::AddWebhookIntro))</p>
819+ hook_form(action: action, csrf: csrf, url: draft.url, events: events,
820+ active: draft.active, secret_hint: g::t(lang, K::SecretHintNew).to_owned(),
821+ error: draft.error, submit: g::t(lang, K::CreateWebhook), lang: lang)
822+ <p><a href=(back.as_str())>(g::t(lang, K::BackToWebhooks))</a></p>
823+ </section>
824+ </div>
823825 })
824826 }
825827
crates/forge-web/src/pages/snippets.rsmodified+1 -1
@@ -420,7 +420,7 @@ async fn snippet_form(
420420 if let Some(message) = error {
421421 alert(message: message.as_str())
422422 }
423- <form method="post" action=(action) class="snippet-form">
423+ <form method="post" action=(action) class="snippet-form fit-pane">
424424 <input type="hidden" name="csrf" value=(csrf)>
425425 <header class="snippet-head">
426426 <h1>(heading)</h1>
crates/forge-web/src/pages/tree.rsmodified+21 -9
@@ -20,6 +20,7 @@ use crate::i18n::misc::{self as mi, K as MK};
2020 use crate::i18n::{self, Lang};
2121 use crate::pages::code_live::{follows_branch, live_url};
2222 use crate::pages::finder::file_finder;
23+use crate::pages::passkeys::s;
2324 use crate::pages::refs::{load_refs, ref_links};
2425 use crate::pages::repo::repo_head;
2526 use crate::pages::repo_ctx::load_repo;
@@ -565,19 +566,30 @@ async fn tree_page(cx: &Cx) -> Result<impl View> {
565566 if let Some(url) = &live {
566567 header.live = url.clone();
567568 }
569+ // The listing and the README sit side by side from 900px, as on the repo home, so the page fits
570+ // the window: each column scrolls on its own (the grid is the repo home's, see _repo.scss).
568571 Ok(view! {
569572 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
570573 repo_head(head: header)
571- <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))>
572- ref_selector(lang: lang, label: mi::t(lang, MK::RefLabel), current: ref_name.clone(), branches: branches, tags: tags,
573- branches_href: branches_href, tags_href: tags_href)
574- breadcrumb(lang: lang, crumbs: crumbs)
575- file_finder(lang: lang, owner: finder_owner, repo: finder_repo, ref_name: finder_ref)
574+ <div class="repo-grid repo-home">
575+ <div class="repo-main">
576+ <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))>
577+ ref_selector(lang: lang, label: mi::t(lang, MK::RefLabel), current: ref_name.clone(), branches: branches, tags: tags,
578+ branches_href: branches_href, tags_href: tags_href)
579+ breadcrumb(lang: lang, crumbs: crumbs)
580+ file_finder(lang: lang, owner: finder_owner, repo: finder_repo, ref_name: finder_ref)
581+ </div>
582+ tree_table(rows: rows, latest: bar, lang: lang)
583+ </div>
584+ <div class="repo-split" role="separator" aria-orientation="vertical"
585+ aria-label=(s(lang, "Resize file tree", "Dosya ağacını boyutlandır")) tabindex="0"
586+ data-repo-split=""></div>
587+ <div class="repo-readme">
588+ if let Some(readme) = readme {
589+ readme_card(name: readme.name, markdown: readme.markdown, body: readme.body)
590+ }
591+ </div>
576592 </div>
577- tree_table(rows: rows, latest: bar, lang: lang)
578- if let Some(readme) = readme {
579- readme_card(name: readme.name, markdown: readme.markdown, body: readme.body)
580- }
581593 )
582594 })
583595 }
crates/forge-web/src/pages/wiki.rsmodified+1 -1
@@ -296,7 +296,7 @@ async fn wiki_edit_body(
296296 error: Option<String>,
297297 ) -> Result<impl View> {
298298 Ok(view! {
299- <section class="card wiki-page">
299+ <section class="card wiki-page fit-pane">
300300 <form method="post" action=(action.as_str()) class="stack wiki-form">
301301 if let Some(message) = error {
302302 alert(message: message.as_str())
crates/forge-web/src/views/mod.rsmodified+110 -53
@@ -26,8 +26,11 @@ use topcoat::router::{Body, Next, layer};
2626 use topcoat::view::{Child, Unescaped, View, ViewExt, component, view};
2727
2828 use crate::i18n::admin::{self as ad, K as AK};
29+use crate::i18n::authoring::{self as au, K as AuK};
2930 use crate::i18n::browse as br;
3031 use crate::i18n::code::{self as g, K};
32+use crate::i18n::community::{self as cm, K as CK};
33+use crate::i18n::packages::{self as pk, K as PK};
3134 use crate::i18n::link::{self as lk, K as LinkKey};
3235 use crate::i18n::migrate::{self as mg, K as MGK};
3336 use crate::i18n::misc::{self as mi, K as MK};
@@ -295,7 +298,7 @@ struct ProfileCorner {
295298
296299 /// The floating account panel fixed at the bottom left of the window (signed in only). It opens
297300 /// upward: the avatar, the viewer's full name, the chips, the notifications bell with its unread count and popover, then
298-/// the Explore, profile, settings, admin and log out links and the theme choice.
301+/// the profile, settings, admin and log out links and the theme choice.
299302 #[component]
300303 async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> {
301304 let review_chip = (corner.reviews > 0).then(|| {
@@ -351,7 +354,6 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View>
351354 </span>
352355 </summary>
353356 <div class="corner-menu">
354- <a class="corner-link" href="/explore">(t(lang, Key::Explore))</a>
355357 <div class="corner-theme"><span>(theme_label)</span>
356358 <form method="post" action="/-/theme" class="corner-theme-set" data-no-tick="true">
357359 <input type="hidden" name="csrf" value=(corner.csrf.as_str())>
@@ -452,29 +454,11 @@ pub async fn shell(
452454 let banner_back = back.clone().unwrap_or_else(|| "/".to_owned());
453455 let dismiss_label = crate::i18n::accounts::t(lang, crate::i18n::accounts::A::Dismiss);
454456 // The admin area and the user settings swap the global links for their own list. Signed-in only.
455- let mut section = if signed_in {
457+ let section = if signed_in {
456458 section_for(lang, uri(__cx).path())
457459 } else {
458460 None
459461 };
460- // An org's Settings link is for its owners only.
461- if let (Some(sec), Some((user, _))) = (section.as_mut(), viewer)
462- && sec.items.iter().any(|item| item.key == "settings")
463- && sec.items.iter().any(|item| item.key == "teams")
464- && let Some(state) = try_app_context::<AppState>(__cx)
465- {
466- let owner = state
467- .store
468- .orgs_for_user(&user.id)
469- .await?
470- .iter()
471- .any(|(org, role)| {
472- org.username == sec.title && *role == forge_core::store::orgs::OrgMemberRole::Owner
473- });
474- if !owner {
475- sec.items.retain(|item| item.key != "settings");
476- }
477- }
478462 let section_menu = section.clone();
479463 let theme_attr = crate::theme::data_theme(__cx, viewer.map(|(user, _)| user));
480464 // The relative-time wording and the server's clock, for nav.js to keep `<time data-rel>` labels current.
@@ -641,7 +625,7 @@ pub async fn shell(
641625 <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h16"/></svg>
642626 </summary>
643627 <div class="nav-panel">
644- section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live)
628+ section_nav(title: section.title.as_str(), back: section.back, back_href: section.back_href.as_str(), items: section.items, current: section.current, live: section.live)
645629 </div>
646630 </details>
647631 }
@@ -676,6 +660,10 @@ pub async fn shell(
676660 }
677661 </nav>
678662 if signed_in {
663+ <a class="topbar-link topbar-explore" href="/explore">(t(lang, Key::Explore))</a>
664+ <a class="icon-btn top-search-link" href="/explore" aria-label=(search_label) title=(search_label)>
665+ <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>
666+ </a>
679667 <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))
680668 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())
681669 data-runs-label=(runs_label) aria-live="polite">
@@ -740,7 +728,7 @@ pub async fn shell(
740728 <div class="shell">
741729 if let Some(section) = section {
742730 <aside class="shell-sidebar">
743- section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live)
731+ section_nav(title: section.title.as_str(), back: section.back, back_href: section.back_href.as_str(), items: section.items, current: section.current, live: section.live)
744732 </aside>
745733 }
746734 <div class="shell-body">
@@ -792,6 +780,8 @@ pub struct NavItem {
792780 pub struct Section {
793781 pub title: String,
794782 pub back: &'static str,
783+ /// Where the back link goes: the site for admin and settings, an organization's profile for its settings.
784+ pub back_href: String,
795785 pub items: Vec<NavItem>,
796786 pub current: &'static str,
797787 /// The stream the section's pages follow, or empty when they follow none.
@@ -848,34 +838,95 @@ pub fn admin_items(lang: Lang) -> Vec<NavItem> {
848838 ]
849839 }
850840
841+/// The organization's settings sidebar: General and Customize pins. Its profile, repositories,
842+/// members and teams are reached from the profile tab bar, so they are not listed here.
851843 fn org_items(lang: Lang, org: &str) -> Vec<NavItem> {
852- let item = |key, label, icon| NavItem {
853- key,
854- href: format!("/org/{org}/{key}"),
855- label,
856- icon,
857- };
858- // Overview and Repositories go to the organization's profile, not to a page under `/org`.
859- let profile = user_href(org);
860844 vec![
861845 NavItem {
862- key: "overview",
863- href: profile.clone(),
864- label: o::t(lang, OK::Overview),
865- icon: "profile",
846+ key: "settings",
847+ href: format!("/org/{org}/settings"),
848+ label: o::t(lang, OK::General),
849+ icon: "appearance",
866850 },
867851 NavItem {
868- key: "repositories",
869- href: format!("{profile}?tab=repositories"),
870- label: o::t(lang, OK::Repositories),
871- icon: "teams",
852+ key: "pins",
853+ href: format!("/org/{org}/settings/pins"),
854+ label: o::t(lang, OK::CustomizePins),
855+ icon: "pins",
872856 },
873- item("members", o::t(lang, OK::Members), "users"),
874- item("teams", o::t(lang, OK::Teams), "teams"),
875- item("settings", o::t(lang, OK::Settings), "appearance"),
876857 ]
877858 }
878859
860+/// The profile tab bar in its order, for a person's or an organization's profile: overview,
861+/// repositories, snippets and stars (people only), packages, organizations (the viewer's own
862+/// profile only) and, for an organization the viewer belongs to, members and teams. The hrefs are
863+/// the ones the profile page links to. The count badges are the caller's to add.
864+pub fn profile_items(
865+ lang: Lang,
866+ username: &str,
867+ is_org: bool,
868+ own_profile: bool,
869+ org_member: bool,
870+) -> Vec<NavItem> {
871+ let profile = format!("/{}", enc(username));
872+ let tab = |key: &'static str, label: &'static str, icon: &'static str| NavItem {
873+ key,
874+ href: format!("{profile}?tab={key}"),
875+ label,
876+ icon,
877+ };
878+ let mut items = vec![
879+ tab("overview", o::t(lang, OK::TabOverview), "profile"),
880+ tab("repositories", o::t(lang, OK::Repositories), ""),
881+ ];
882+ if !is_org {
883+ items.push(tab("snippets", cm::t(lang, CK::Snippets), ""));
884+ items.push(tab("stars", o::t(lang, OK::TabStars), ""));
885+ }
886+ items.push(tab("packages", pk::t(lang, PK::TabPackages), ""));
887+ if own_profile {
888+ items.push(tab("organizations", o::t(lang, OK::Organizations), ""));
889+ }
890+ if is_org && org_member {
891+ let org = format!("/org/{}", enc(username));
892+ items.push(NavItem {
893+ key: "members",
894+ href: format!("{org}/members"),
895+ label: o::t(lang, OK::Members),
896+ icon: "users",
897+ });
898+ items.push(NavItem {
899+ key: "teams",
900+ href: format!("{org}/teams"),
901+ label: o::t(lang, OK::Teams),
902+ icon: "teams",
903+ });
904+ }
905+ items
906+}
907+
908+/// The fixed site pages, for the command palette: Explore, notifications, review requests, new
909+/// repository, import, and new organization when the viewer may create one.
910+pub fn global_items(lang: Lang, can_create_org: bool) -> Vec<NavItem> {
911+ let item = |key: &'static str, href: &'static str, label: &'static str| NavItem {
912+ key,
913+ href: href.to_owned(),
914+ label,
915+ icon: "",
916+ };
917+ let mut items = vec![
918+ item("explore", "/explore", t(lang, Key::Explore)),
919+ item("notifications", "/notifications", t(lang, Key::Notifications)),
920+ item("reviews", "/review-requests", au::t(lang, AuK::ReviewRequests)),
921+ item("new", "/new", t(lang, Key::NewRepository)),
922+ item("import", "/new/import", mg::t(lang, MGK::ImportTitle)),
923+ ];
924+ if can_create_org {
925+ items.push(item("new-org", "/org/new", o::t(lang, OK::NewOrganization)));
926+ }
927+ items
928+}
929+
879930 pub fn settings_items(lang: Lang) -> Vec<NavItem> {
880931 let item = |key, href: &'static str, label, icon| NavItem {
881932 key,
@@ -947,19 +998,23 @@ pub fn section_for(lang: Lang, path: &str) -> Option<Section> {
947998 let (title, items) = match first {
948999 "admin" => (ad::t(lang, AK::AdminArea).to_owned(), admin_items(lang)),
9491000 "settings" => (o::t(lang, OK::Settings).to_owned(), settings_items(lang)),
950- // An organization's own pages (`/org/{name}/members`, `teams`, `settings`); `/org/new` is
951- // the create form and keeps the global links.
1001+ // An organization's settings pages (`/org/{name}/settings` and `settings/pins`) keep a
1002+ // sidebar. Its profile, members and teams pages have none: the tab bar leads to them. `/org/new`
1003+ // is the create form and keeps the global links.
9521004 "org" if !second.is_empty() && second != "new" => {
953- let third = parts.next().unwrap_or("");
954- let items = org_items(lang, second);
955- let current = items
956- .iter()
957- .find(|item| item.key == third)
958- .map_or("", |item| item.key);
1005+ if parts.next() != Some("settings") {
1006+ return None;
1007+ }
1008+ let current = if parts.next() == Some("pins") {
1009+ "pins"
1010+ } else {
1011+ "settings"
1012+ };
9591013 return Some(Section {
9601014 title: second.to_owned(),
961- back: t(lang, Key::BackToSite),
962- items,
1015+ back: o::t(lang, OK::BackToOrganization),
1016+ back_href: user_href(second),
1017+ items: org_items(lang, second),
9631018 current,
9641019 live: "",
9651020 });
@@ -979,6 +1034,7 @@ pub fn section_for(lang: Lang, path: &str) -> Option<Section> {
9791034 Some(Section {
9801035 title,
9811036 back: t(lang, Key::BackToSite),
1037+ back_href: "/".to_owned(),
9821038 items,
9831039 current,
9841040 live,
@@ -991,6 +1047,7 @@ pub fn section_for(lang: Lang, path: &str) -> Option<Section> {
9911047 async fn section_nav(
9921048 title: &str,
9931049 back: &str,
1050+ back_href: &str,
9941051 items: Vec<NavItem>,
9951052 current: &str,
9961053 live: &str,
@@ -1006,7 +1063,7 @@ async fn section_nav(
10061063 .collect();
10071064 Ok(view! {
10081065 <nav class="side-links" aria-label=(back)>
1009- <a class="side-link" href="/">
1066+ <a class="side-link" href=(back_href)>
10101067 nav_icon(name: "back")
10111068 (back)
10121069 </a>
style/_dashboard.scssmodified+76 -0
@@ -177,3 +177,79 @@
177177 margin: 0;
178178 }
179179 }
180+
181+// Organization header: the avatar is 96px (the person's is larger), and the Edit organization and
182+// New repository buttons sit in one row under the description line.
183+.profile-avatar.org-avatar {
184+ width: 96px;
185+ height: 96px;
186+}
187+
188+.profile-org-actions .profile-edit {
189+ margin-top: 0;
190+}
191+
192+// Overview of an organization: the pinned repos fill the left column, two to a row, and the members
193+// card sits at the right, 320px wide. Below 900px the two stack, the repos first. A person's
194+// overview wrapper adds no box of its own.
195+.profile-overview {
196+ display: contents;
197+}
198+
199+.org-overview {
200+ display: grid;
201+ grid-template-columns: minmax(0, 1fr);
202+ gap: 16px;
203+ align-items: start;
204+
205+ .pin-grid {
206+ grid-template-columns: repeat(2, minmax(0, 1fr));
207+ }
208+}
209+
210+@media (min-width: 900px) {
211+ .org-overview {
212+ grid-template-columns: minmax(0, 1fr) 320px;
213+ }
214+}
215+
216+.profile-org {
217+ display: flex;
218+ flex-direction: column;
219+ gap: 10px;
220+
221+ p {
222+ margin: 0;
223+ }
224+}
225+
226+// Members: two avatars with names per row, each name cut short rather than wrapped.
227+.org-members {
228+ display: grid;
229+ grid-template-columns: repeat(2, minmax(0, 1fr));
230+ gap: 8px 12px;
231+ list-style: none;
232+ margin: 0;
233+ padding: 0;
234+
235+ a {
236+ display: flex;
237+ align-items: center;
238+ gap: 8px;
239+ min-width: 0;
240+ color: inherit;
241+ text-decoration: none;
242+ }
243+
244+ span {
245+ overflow: hidden;
246+ text-overflow: ellipsis;
247+ white-space: nowrap;
248+ }
249+}
250+
251+.org-member-avatar {
252+ width: 32px;
253+ height: 32px;
254+ flex: 0 0 auto;
255+}
style/_fit.scssadded+11 -0
@@ -0,0 +1,11 @@
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.scssadded+117 -0
@@ -0,0 +1,117 @@
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 alerts card pages four alerts at a time, so its pager sits
12+// close under the list.
13+.admin-alerts .pager {
14+ margin: 0 0 8px;
15+}
16+
17+// Instance health (/admin/health): the storage and services cards sit side by side, under the
18+// summary. The alerts and the footnote span both columns.
19+@media (min-width: 900px) {
20+ .health-page {
21+ display: grid;
22+ grid-template-columns: repeat(2, minmax(0, 1fr));
23+ column-gap: 16px;
24+
25+ > .page-head,
26+ > .admin-alerts,
27+ > .health-meta {
28+ grid-column: 1 / -1;
29+ }
30+
31+ .health-row {
32+ padding: 8px 0;
33+ }
34+ }
35+}
36+
37+// User detail (/admin/users/{id}): the actions and the danger zone side by side, under the header.
38+@media (min-width: 900px) {
39+ .user-page {
40+ display: grid;
41+ grid-template-columns: repeat(2, minmax(0, 1fr));
42+ column-gap: 16px;
43+
44+ > .user-head {
45+ grid-column: 1 / -1;
46+ }
47+
48+ .action-row {
49+ padding: 10px 0;
50+ }
51+ }
52+}
53+
54+// Org teams (/org/{org}/teams): the team list and the new-team form side by side.
55+@media (min-width: 900px) {
56+ .teams-page {
57+ display: grid;
58+ grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
59+ column-gap: 16px;
60+ align-items: start;
61+
62+ > :not(.card) {
63+ grid-column: 1 / -1;
64+ }
65+ }
66+}
67+
68+// Server settings (/admin/server): the settings card takes the left column and fills the window,
69+// and the restart card sits beside it. The settings card runs three across, and four from 1200px.
70+@media (min-width: 900px) {
71+ .srv-page {
72+ display: grid;
73+ grid-template-columns: minmax(0, 1fr) 260px;
74+ column-gap: 16px;
75+ align-items: start;
76+
77+ > .page-head,
78+ > .subnav,
79+ > .notice {
80+ grid-column: 1 / -1;
81+ }
82+ }
83+
84+ // Tighter cells: the field rows sit closer, and the help text lines are shorter.
85+ .srv-form .srv-grid {
86+ grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
87+ gap: 8px 16px;
88+ }
89+
90+ .srv-form .srv-field {
91+ gap: 4px;
92+ }
93+
94+ .srv-form .srv-field > p.small {
95+ line-height: 1.3;
96+ }
97+}
98+
99+// From 1200px the settings take four across, so the card has fewer rows and less hidden height.
100+@media (min-width: 1200px) {
101+ .srv-form .srv-grid {
102+ grid-template-columns: repeat(4, minmax(0, 1fr));
103+ }
104+}
105+
106+// Mail settings (/admin/mail): the SMTP form runs three fields across, the actions span the row.
107+@media (min-width: 900px) {
108+ form.stack[action="/admin/mail"] {
109+ display: grid;
110+ grid-template-columns: repeat(3, minmax(0, 1fr));
111+ gap: 14px 24px;
112+
113+ > .actions {
114+ grid-column: 1 / -1;
115+ }
116+ }
117+}
style/_fit_code.scssadded+91 -0
@@ -0,0 +1,91 @@
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+// Job page: the job card and the artifacts sit in a side column; the log card fills the right side,
34+// and its `pre` is the scroller (nav.js follows its scrollTop), so the log card itself never scrolls.
35+@media (min-width: 900px) {
36+ .ci-job-grid.fit-pane {
37+ display: grid;
38+ grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
39+ grid-template-rows: auto minmax(0, 1fr);
40+ gap: 16px;
41+
42+ > .card:not(.ci-logcard) {
43+ align-self: start;
44+ min-width: 0;
45+ margin: 0;
46+ }
47+
48+ > .ci-logcard {
49+ grid-column: 2;
50+ grid-row: 1 / span 2;
51+ display: flex;
52+ flex-direction: column;
53+ min-width: 0;
54+ min-height: 0;
55+ margin: 0;
56+ overflow: hidden;
57+
58+ > *:not(.ci-log) {
59+ flex: none;
60+ }
61+
62+ .ci-log {
63+ flex: 1 1 auto;
64+ min-height: 0;
65+ max-height: none;
66+ }
67+ }
68+ }
69+}
70+
71+// Run page and runs list: the selected run (the right column of the split) is the pane. The runs
72+// list beside it (.ci-side, main.scss) uses the same height.
73+@media (min-width: 761px) {
74+ .ci-main {
75+ max-height: max(320px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px)));
76+ overflow: auto;
77+ }
78+}
79+
80+// Profile overview: a little less air between the header, the tabs, the calendar and the pins, and
81+// a smaller avatar, so the calendar and the pinned repos fit one window.
82+@media (min-width: 900px) {
83+ .profile-page {
84+ gap: 16px;
85+ }
86+
87+ .profile-avatar {
88+ width: 144px;
89+ height: 144px;
90+ }
91+}
style/_fit_forms.scssadded+111 -0
@@ -0,0 +1,111 @@
1+// One-screen layout of editor forms. See _fit.scss. An editor form sits in a .fit-pane: its editor
2+// takes the rest of the height, so the buttons stay under it without a page scroll.
3+
4+// Short fields of the new-release form share a row; the hint goes under them.
5+.release-pair {
6+ display: flex;
7+ flex-wrap: wrap;
8+ align-items: flex-end;
9+ gap: 14px 16px;
10+
11+ > label {
12+ flex: 1 1 12rem;
13+ min-width: 0;
14+ }
15+
16+ > p {
17+ order: 1;
18+ flex: 1 0 100%;
19+ margin: 0;
20+ }
21+}
22+
23+@media (min-width: 900px) {
24+ // A card that is a pane with a form in it: no bottom margin (the pane fills the window), and the
25+ // form takes the rest of the card under the heading.
26+ .fit-pane.card {
27+ margin-bottom: 0;
28+
29+ &:has(> form) {
30+ display: flex;
31+ flex-direction: column;
32+
33+ > form {
34+ flex: 1 1 auto;
35+ min-height: 0;
36+ }
37+ }
38+ }
39+
40+ // The editor's label takes the rest of the form, and its textarea fills the label.
41+ .fit-pane > form > label:has(> textarea) {
42+ flex: 1 1 0;
43+ min-height: 0;
44+ }
45+
46+ .fit-pane > form > label > textarea {
47+ flex: 1 1 0;
48+ min-height: 6rem;
49+ height: auto;
50+ }
51+
52+ // The snippet form is the pane itself: its doc, its file card and the active file fill it.
53+ .snippet-form.fit-pane {
54+ // The pane clips its overflow, so the focus ring of the card edges gets a little room.
55+ padding: 4px;
56+
57+ .snippet-doc,
58+ .snippet-files {
59+ flex: 1 1 auto;
60+ min-height: 0;
61+ }
62+
63+ // The active file is shown by a :has() rule in main.scss (specificity 1,3,0). This one is one
64+ // class higher, so the file can be a flex column that its contents fill.
65+ @for $i from 0 through 9 {
66+ .snippet-files:has(#snippet-tab-#{$i}:checked) .snippet-panel-#{$i} {
67+ display: flex;
68+ flex-direction: column;
69+ flex: 1 1 auto;
70+ min-height: 0;
71+ }
72+ }
73+
74+ .snippet-content {
75+ flex: 1 1 0;
76+ min-height: 0;
77+ height: auto;
78+ }
79+ }
80+
81+ // The import page (pages/import.rs, import_home): the form and the recent imports side by side on
82+ // wide windows, each a pane that scrolls inside.
83+ .import-home {
84+ display: grid;
85+ grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
86+ align-items: start;
87+ gap: 16px;
88+
89+ > .newrepo-form.fit-pane {
90+ max-width: none;
91+ }
92+
93+ > .import-recent {
94+ max-width: none;
95+ margin: 0;
96+ }
97+ }
98+
99+ // The form's two cards share a row on the widest windows; the header and the notes span both.
100+ @media (min-width: 1200px) {
101+ .import-home > .newrepo-form {
102+ display: grid;
103+ grid-template-columns: repeat(2, minmax(0, 1fr));
104+ align-items: start;
105+
106+ > :not(.newrepo-card) {
107+ grid-column: 1 / -1;
108+ }
109+ }
110+ }
111+}
style/_fit_lists.scssadded+27 -0
@@ -0,0 +1,27 @@
1+// One-screen layout of notifications, security log and audit log. See _fit.scss.
2+@media (min-width: 900px) {
3+ // The notifications pane holds the groups and the older link: it scrolls only in a page of many
4+ // small groups. Its bottom margin would add to the page's height, so it has none.
5+ .notif-pane.fit-pane {
6+ margin-bottom: 0;
7+ }
8+
9+ // A table card (audit log, security log): the table scrolls inside the card and the pager stays
10+ // at its bottom, in the same column, so the paging is always in view.
11+ .fit-pane.fit-list {
12+ display: flex;
13+ flex-direction: column;
14+ overflow: hidden;
15+ margin-bottom: 0;
16+
17+ > .table-wrap {
18+ flex: 1 1 auto;
19+ min-height: 0;
20+ overflow: auto;
21+ }
22+
23+ > .pager {
24+ flex: none;
25+ }
26+ }
27+}
style/_fit_settings.scssadded+55 -0
@@ -0,0 +1,55 @@
1+// One-screen layout of repo and org settings. See _fit.scss.
2+
3+// A settings page that puts its cards side by side: the list and its add forms, or the general cards
4+// in columns. Below 900px the cards stack. From 900px the cards share the row, and a card that does
5+// not fit the pane's height scrolls inside it.
6+.settings-split {
7+ display: grid;
8+ grid-template-columns: minmax(0, 1fr);
9+ align-items: start;
10+ align-content: start;
11+ gap: 16px;
12+
13+ > .card {
14+ margin-bottom: 0;
15+ }
16+}
17+
18+@media (min-width: 900px) {
19+ .settings-split {
20+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
21+ }
22+}
23+
24+// A column of the general settings: its cards stack with the same gap as the row.
25+.settings-col {
26+ display: flex;
27+ flex-direction: column;
28+ gap: 16px;
29+ min-width: 0;
30+
31+ > .card {
32+ margin-bottom: 0;
33+ }
34+}
35+
36+// The branch rule form is narrower in a column, so its pushes and merging switches stack.
37+.settings-col .rule-pair {
38+ grid-template-columns: minmax(0, 1fr);
39+}
40+
41+// The new webhook form: the fields in the left column, the event list in the right one.
42+@media (min-width: 900px) {
43+ .settings-split .webhook-form {
44+ display: grid;
45+ grid-template-columns: repeat(2, minmax(0, 1fr));
46+ align-items: start;
47+ gap: 14px 32px;
48+ max-width: none;
49+
50+ > .event-choices {
51+ grid-column: 2;
52+ grid-row: 1 / span 6;
53+ }
54+ }
55+}
style/_fit_tables.scssadded+65 -0
@@ -0,0 +1,65 @@
1+// One-screen layout of runners, labels, milestones and releases. See _fit.scss.
2+//
3+// A list card fills the pane (`.fit-pane`): its header stays put, its rows scroll inside `.fit-scroll`,
4+// and the pager sits under them in the same column (`.fit-card`). Beside it, a narrow card (`.fit-side`)
5+// holds the create form, so the form is in reach without scrolling. Below 900px the row stacks and
6+// nothing has a fixed height.
7+
8+.fit-split {
9+ display: flex;
10+ align-items: stretch;
11+ gap: 20px;
12+
13+ > .fit-main {
14+ flex: 1 1 auto;
15+ min-width: 0;
16+ }
17+
18+ > .fit-side {
19+ flex: 0 0 300px;
20+ min-width: 0;
21+ }
22+}
23+
24+.fit-card {
25+ display: flex;
26+ flex-direction: column;
27+ min-height: 0;
28+
29+ > .fit-scroll {
30+ flex: 1 1 auto;
31+ min-height: 0;
32+ overflow: auto;
33+ overscroll-behavior: contain;
34+ }
35+
36+ > .pager {
37+ flex: none;
38+ margin-top: 8px;
39+ }
40+}
41+
42+// Runner rows reach 12px past the list on each side (see `.runner-row.is-linked`); the scroll box
43+// takes that room so the hover background is not cut off.
44+.fit-bleed {
45+ margin: 0 -12px;
46+ padding: 0 12px;
47+}
48+
49+// Labels fill the card in columns, so twelve of them take three or four rows, not twelve.
50+.fit-card .label-list {
51+ display: grid;
52+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
53+ column-gap: 24px;
54+}
55+
56+@media (max-width: 899px) {
57+ .fit-split {
58+ flex-direction: column;
59+
60+ > .fit-side {
61+ flex: none;
62+ width: 100%;
63+ }
64+ }
65+}
style/_fit_threads.scssadded+17 -0
@@ -0,0 +1,17 @@
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/_repo.scssmodified+49 -3
@@ -263,9 +263,9 @@
263263 }
264264
265265 .repo-home {
266- // The grid fills the viewport under the top bar and the repo header, so the page does not scroll;
267- // each column scrolls on its own.
268- --repo-home-h: max(480px, calc(100dvh - var(--topbar-h) - 236px));
266+ // The grid fills the window below the repo header and above the footer, so the page does not
267+ // scroll; each column scrolls on its own. nav.js measures both ends (syncShellTop).
268+ --repo-home-h: max(480px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px)));
269269
270270 // One row: the branch, Go to file and, at the right end, Clone (which also holds the downloads).
271271 .browse-bar {
@@ -1456,3 +1456,49 @@ html.tree-resizing .repo-split::before {
14561456 }
14571457 }
14581458 }
1459+
1460+// A CI badge on forge's own pages (syncBadges in nav.js): the two halves of the SVG, in theme colours.
1461+// The image stays hidden while its data is fetched, so it does not flash its own colours.
1462+img.badge-wait {
1463+ visibility: hidden;
1464+}
1465+
1466+.ci-chip {
1467+ --chip: var(--muted);
1468+ display: inline-flex;
1469+ overflow: hidden;
1470+ font-size: 11px;
1471+ font-weight: 600;
1472+ line-height: 18px;
1473+ vertical-align: middle;
1474+ border: 1px solid color-mix(in srgb, var(--chip) 45%, var(--border));
1475+ border-radius: 6px;
1476+
1477+ > span {
1478+ padding: 0 7px;
1479+ }
1480+
1481+ > :first-child {
1482+ color: var(--muted);
1483+ background: var(--surface);
1484+ }
1485+
1486+ > :last-child {
1487+ color: var(--chip);
1488+ background: color-mix(in srgb, var(--chip) 16%, var(--surface));
1489+ }
1490+
1491+ &[data-status="passing"] {
1492+ --chip: var(--ok);
1493+ }
1494+
1495+ &[data-status="failing"],
1496+ &[data-status="error"] {
1497+ --chip: var(--bad);
1498+ }
1499+
1500+ &[data-status="running"],
1501+ &[data-status="pending"] {
1502+ --chip: var(--heat-3);
1503+ }
1504+}
style/_shell.scssmodified+21 -1
@@ -484,6 +484,20 @@
484484 }
485485 }
486486
487+// Signed in, Explore sits right after the path bar, centred on the bar's line. It shows from 700px:
488+// below that there is no room for it, and signed-in phones reach Explore through no icon.
489+.topbar .topbar-explore {
490+ display: none;
491+ align-self: center;
492+ white-space: nowrap;
493+}
494+
495+@media (min-width: 640px) {
496+ .topbar .topbar-explore {
497+ display: inline-block;
498+ }
499+}
500+
487501 // The avatar menu: the avatar is the summary; the menu list keeps its links from main.scss.
488502 .topbar .menu {
489503 flex: none;
@@ -541,7 +555,7 @@
541555 .shell {
542556 display: grid;
543557 grid-template-columns: minmax(0, 1fr);
544- min-height: calc(100vh - var(--topbar-h));
558+ flex: 1 0 auto;
545559 }
546560
547561 .shell-sidebar {
@@ -758,6 +772,12 @@ a.chip {
758772 border: 1px solid var(--border);
759773 border-radius: var(--radius-md);
760774 box-shadow: var(--shadow);
775+ opacity: 0;
776+}
777+
778+// Hidden until its list is in (loadPeek in nav.js), so it opens at its final height.
779+.bell-pop.bell-ready {
780+ opacity: 1;
761781 }
762782
763783 .bell-box {
style/main.scssmodified+12 -1
@@ -192,6 +192,9 @@ html {
192192
193193 body {
194194 margin: 0;
195+ display: flex;
196+ flex-direction: column;
197+ min-height: 100dvh;
195198 background: var(--bg);
196199 color: var(--text);
197200 font-family: var(--font);
@@ -5852,7 +5855,7 @@ html.js form.runner-load[data-dirty-form][data-dirty] .runner-save {
58525855 top: calc(var(--topbar-h) + 16px);
58535856 display: flex;
58545857 flex-direction: column;
5855- max-height: calc(100dvh - max(var(--topbar-h), var(--shell-top, 0px)) - 104px);
5858+ max-height: max(320px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px)));
58565859 }
58575860
58585861 .ci-side-head,
@@ -7062,6 +7065,14 @@ button.ci-job-last {
70627065 @import "repo";
70637066 @import "pull";
70647067 @import "dashboard";
7068+@import "fit";
7069+@import "fit_lists";
7070+@import "fit_tables";
7071+@import "fit_admin";
7072+@import "fit_settings";
7073+@import "fit_forms";
7074+@import "fit_threads";
7075+@import "fit_code";
70657076 @import "wiki";
70667077 @import "browse";
70677078 @import "import";