forge
Explore
Log in

Don't you dare go Hollow

The repo home uses the whole page width as two columns, the tree and the README, with no About column: license, size and a language bar sit in a line under the header with the latest release and the packages as chips, and the newest CI run sits over the tree

Browse files at this commit

910da97483a5ade65de67724a7506258c244b8eeAhmet Kaan GümüşParent: ff4a499
All checks have passed
Show checks
  • style
    • the repo home uses the whole page width as two columns, the tree and the README, with no About column: license, size and a language bar sit in a line under the header with the latest release and the packages as chips, and the newest CI run sits over the tree
    • the README frame scrolls only its text under a fixed file name strip, the branch bar is one row with the downloads moved into the Clone popover, the latest commit shows its subject on its own line, and folders take the accent colour
Show full message
💄 style: the repo home uses the whole page width as two columns, the tree and the README, with no About column: license, size and a language bar sit in a line under the header with the latest release and the packages as chips, and the newest CI run sits over the tree; the README frame scrolls only its text under a fixed file name strip, the branch bar is one row with the downloads moved into the Clone popover, the latest commit shows its subject on its own line, and folders take the accent colour
crates/forge-web/assets/nav.jsmodified+3 -9
@@ -819,17 +819,11 @@
819 } catch (err) { }819 } catch (err) { }
820 }820 }
821 821
822- // The widest the tree can be: the grid less the splitter, the two gaps, the README's minimum and,822+ // The widest the tree can be: the grid less the splitter, the two gaps and the README's minimum.
823- // at 1200px and up, the aside's column with its gap.
824 function treeMax(grid) {823 function treeMax(grid) {
825 var split = grid.querySelector('[data-repo-split]');824 var split = grid.querySelector('[data-repo-split]');
826- var side = grid.querySelector(':scope > .repo-meta');825+ var gap = parseFloat(getComputedStyle(grid).columnGap) || 0;
827- var readme = grid.querySelector('.repo-readme');826+ var max = grid.getBoundingClientRect().width - split.getBoundingClientRect().width - 2 * gap - README_MIN;
828- var cs = getComputedStyle(grid);
829- var gap = parseFloat(cs.columnGap) || 0;
830- var inRow = side && readme && side.getBoundingClientRect().left > readme.getBoundingClientRect().left;
831- var aside = inRow ? side.getBoundingClientRect().width + gap + (parseFloat(getComputedStyle(side).marginLeft) || 0) : 0;
832- var max = grid.getBoundingClientRect().width - split.getBoundingClientRect().width - 2 * gap - aside - README_MIN;
833 return Math.max(TREE_MIN, Math.floor(max));827 return Math.max(TREE_MIN, Math.floor(max));
834 }828 }
835 829
crates/forge-web/src/pages/repo.rsmodified+24 -34
@@ -24,10 +24,10 @@ use crate::pages::passkeys::s;
24 use crate::pages::code_live::{follows_branch, home_live_url};24 use crate::pages::code_live::{follows_branch, home_live_url};
25 use crate::pages::dashboard::badge_class;25 use crate::pages::dashboard::badge_class;
26 use crate::pages::finder::file_finder;26 use crate::pages::finder::file_finder;
27-use crate::pages::repo_side::{repo_side, run_rows, tree_facts};27+use crate::pages::repo_side::{repo_ci_line, repo_strip, run_rows, tree_facts};
28 use crate::pages::issue_parts::stamp_unix;28 use crate::pages::issue_parts::stamp_unix;
29 use crate::pages::notifications::watch_form;29 use crate::pages::notifications::watch_form;
30-use crate::pages::packages::{self, repo_packages_card};30+use crate::pages::packages;
31 use crate::pages::refs::{load_refs, ref_links};31 use crate::pages::refs::{load_refs, ref_links};
32 use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo};32 use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo};
33 use crate::pages::tree::{33 use crate::pages::tree::{
@@ -213,9 +213,15 @@ pub async fn repo_head(head: RepoHead) -> Result<impl View> {
213 })213 })
214 }214 }
215 215
216-/// Clone button that opens a popover with both clone URLs as selectable read-only fields.216+/// Clone button that opens a popover with both clone URLs as selectable read-only fields and, when
217+/// the branch has a commit, links to its archive (`downloads`: the zip and tar.gz hrefs).
217 #[component]218 #[component]
218-async fn clone_popover(https: String, ssh: String, lang: Lang) -> Result<impl View> {219+async fn clone_popover(
220+ https: String,
221+ ssh: String,
222+ downloads: Option<(String, String)>,
223+ lang: Lang,
224+) -> Result<impl View> {
219 Ok(view! {225 Ok(view! {
220 <details class="clone pop">226 <details class="clone pop">
221 <summary class="button primary">227 <summary class="button primary">
@@ -228,6 +234,12 @@ async fn clone_popover(https: String, ssh: String, lang: Lang) -> Result<impl Vi
228 <label for="clone-ssh">"SSH"</label>234 <label for="clone-ssh">"SSH"</label>
229 <input id="clone-ssh" class="mono" type="text" readonly=(true) value=(ssh.as_str())>235 <input id="clone-ssh" class="mono" type="text" readonly=(true) value=(ssh.as_str())>
230 <p class="muted small">(g::t(lang, K::SshRequiresKey))</p>236 <p class="muted small">(g::t(lang, K::SshRequiresKey))</p>
237+ if let Some((zip, tar)) = downloads {
238+ <nav class="archive-links" aria-label=(g::t(lang, K::DownloadNav))>
239+ <a href=(zip)>(g::t(lang, K::DownloadZip))</a>
240+ <a href=(tar)>(g::t(lang, K::DownloadTarGz))</a>
241+ </nav>
242+ }
231 </div>243 </div>
232 </details>244 </details>
233 })245 })
@@ -263,24 +275,6 @@ async fn branches_card(
263 })275 })
264 }276 }
265 277
266-/// Download links for the archive of `ref_name`.
267-#[component]
268-async fn archive_links(
269- owner: String,
270- repo: String,
271- ref_name: String,
272- lang: Lang,
273-) -> Result<impl View> {
274- let tar = repo_href(&owner, &repo, "archive", &format!("{ref_name}.tar.gz"));
275- let zip = repo_href(&owner, &repo, "archive", &format!("{ref_name}.zip"));
276- Ok(view! {
277- <nav class="archive-links" aria-label=(g::t(lang, K::DownloadNav))>
278- <a href=(zip)>(g::t(lang, K::DownloadZip))</a>
279- <a href=(tar)>(g::t(lang, K::DownloadTarGz))</a>
280- </nav>
281- })
282-}
283-
284 async fn default_commit(path: PathBuf, branch: String) -> Result<Option<String>> {278 async fn default_commit(path: PathBuf, branch: String) -> Result<Option<String>> {
285 Ok(279 Ok(
286 tokio::task::spawn_blocking(move || browse::default_branch_commit(&path, &branch))280 tokio::task::spawn_blocking(move || browse::default_branch_commit(&path, &branch))
@@ -488,14 +482,18 @@ async fn repo_page(cx: &Cx) -> Result<impl View> {
488 let latest = crate::pages::releases::latest_release_for_home(state, &ctx).await?;482 let latest = crate::pages::releases::latest_release_for_home(state, &ctx).await?;
489 let runs = run_rows(state, lang, repo).await?;483 let runs = run_rows(state, lang, repo).await?;
490 let ci_href = repo_href(&owner_name, &repo_name, "ci", "");484 let ci_href = repo_href(&owner_name, &repo_name, "ci", "");
491- let visibility = repo.visibility;
492 let banners = recent_push_banners(state, &ctx, header.forked_from.clone()).await?;485 let banners = recent_push_banners(state, &ctx, header.forked_from.clone()).await?;
493 let viewer_user = ctx.viewer.as_ref().map(|(user, _)| user);486 let viewer_user = ctx.viewer.as_ref().map(|(user, _)| user);
494 let packages = packages::repo_package_links(state, viewer_user, &repo.id).await?;487 let packages = packages::repo_package_links(state, viewer_user, &repo.id).await?;
495 let now = now_unix();488 let now = now_unix();
489+ let downloads = (
490+ repo_href(&owner_name, &repo_name, "archive", &format!("{branch}.zip")),
491+ repo_href(&owner_name, &repo_name, "archive", &format!("{branch}.tar.gz")),
492+ );
496 Ok(view! {493 Ok(view! {
497 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),494 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
498 repo_head(head: header)495 repo_head(head: header)
496+ repo_strip(lang: lang, facts: facts, release: latest, packages: packages)
499 if !banners.is_empty() {497 if !banners.is_empty() {
500 recent_pushes(banners: banners, now: now, lang: lang)498 recent_pushes(banners: banners, now: now, lang: lang)
501 }499 }
@@ -507,10 +505,9 @@ async fn repo_page(cx: &Cx) -> Result<impl View> {
507 branches_href: branches_href, tags_href: tags_href)505 branches_href: branches_href, tags_href: tags_href)
508 file_finder(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(),506 file_finder(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(),
509 ref_name: branch.clone())507 ref_name: branch.clone())
510- archive_links(owner: owner_name, repo: repo_name,508+ clone_popover(https: https, ssh: ssh, downloads: Some(downloads), lang: lang)
511- ref_name: branch.clone(), lang: lang)
512- clone_popover(https: https, ssh: ssh, lang: lang)
513 </div>509 </div>
510+ repo_ci_line(lang: lang, runs: runs, ci_href: ci_href)
514 tree_table(rows: rows, latest: bar, lang: lang)511 tree_table(rows: rows, latest: bar, lang: lang)
515 </div>512 </div>
516 <div class="repo-split" role="separator" aria-orientation="vertical"513 <div class="repo-split" role="separator" aria-orientation="vertical"
@@ -521,17 +518,10 @@ async fn repo_page(cx: &Cx) -> Result<impl View> {
521 readme_card(name: readme.name, markdown: readme.markdown, body: readme.body)518 readme_card(name: readme.name, markdown: readme.markdown, body: readme.body)
522 }519 }
523 </div>520 </div>
524- <aside class="repo-meta" aria-label=(s(lang, "About", "Hakkında"))>
525- repo_side(lang: lang, visibility: visibility, default_branch: branch.clone(),
526- facts: facts, runs: runs, ci_href: ci_href, release: latest)
527- if !packages.is_empty() {
528- repo_packages_card(links: packages, lang: lang)
529- }
530- </aside>
531 </div>521 </div>
532 } else {522 } else {
533 <div class="browse-bar">523 <div class="browse-bar">
534- clone_popover(https: https, ssh: ssh, lang: lang)524+ clone_popover(https: https, ssh: ssh, downloads: None, lang: lang)
535 </div>525 </div>
536 branches_card(branches: branch_names, push_https: push_https, push_ssh: push_ssh, lang: lang)526 branches_card(branches: branch_names, push_https: push_https, push_ssh: push_ssh, lang: lang)
537 }527 }
crates/forge-web/src/pages/repo_side.rsmodified+111 -109
@@ -1,5 +1,5 @@
1-//! The repo home's side column: About (visibility, default branch, license, size), the newest CI1+//! The repo home's facts: the line under its header (license, size, languages, the latest release
2-//! runs, the latest release and the languages of the default branch. Languages, license and size2+//! and the packages) and the newest CI run over the tree. Languages, license and size
3 //! are worked out from the tree once per head commit and kept in memory, since they only change3 //! are worked out from the tree once per head commit and kept in memory, since they only change
4 //! with a push.4 //! with a push.
5 5
@@ -8,7 +8,7 @@ use std::path::{Path, PathBuf};
8 use std::sync::{Mutex, OnceLock};8 use std::sync::{Mutex, OnceLock};
9 9
10 use forge_core::ci::{JobState, RunState};10 use forge_core::ci::{JobState, RunState};
11-use forge_core::{Repo, Visibility};11+use forge_core::Repo;
12 use forge_git::{browse, history};12 use forge_git::{browse, history};
13 use time::OffsetDateTime;13 use time::OffsetDateTime;
14 use time::format_description::well_known::Rfc3339;14 use time::format_description::well_known::Rfc3339;
@@ -18,14 +18,15 @@ use topcoat::view::{View, component, view};
18 use crate::i18n::Lang;18 use crate::i18n::Lang;
19 use crate::i18n::releases_ci as rc;19 use crate::i18n::releases_ci as rc;
20 use crate::pages::ci_runs::{duration_templates, duration_text, run_href, state_text};20 use crate::pages::ci_runs::{duration_templates, duration_text, run_href, state_text};
21+use crate::pages::packages::PackageLink;
21 use crate::pages::passkeys::s;22 use crate::pages::passkeys::s;
22 use crate::pages::releases::LatestRelease;23 use crate::pages::releases::LatestRelease;
23 use crate::repo_stats::{LangShare, languages, license_file, license_id};24 use crate::repo_stats::{LangShare, languages, license_file, license_id};
24 use crate::state::AppState;25 use crate::state::AppState;
25 use crate::views::{human_size, now_unix, rel_time, short_oid};26 use crate::views::{human_size, now_unix, rel_time, short_oid};
26 27
27-/// CI runs the column lists.28+/// CI runs the home page shows: the newest.
28-const RUNS_SHOWN: u32 = 3;29+const RUNS_SHOWN: u32 = 1;
29 /// Languages listed before the rest fold into "Other".30 /// Languages listed before the rest fold into "Other".
30 const TOP_LANGUAGES: usize = 4;31 const TOP_LANGUAGES: usize = 4;
31 /// Files the language count reads at most.32 /// Files the language count reads at most.
@@ -248,123 +249,124 @@ pub async fn runs_fingerprint(state: &AppState, repo_id: &str) -> Result<String>
248 Ok(out.join("\n"))249 Ok(out.join("\n"))
249 }250 }
250 251
251-/// The side column. `facts` is None for a repo with no commit yet.252+/// One language's slice of the header's language bar: where it starts and how wide it is, in
253+/// percent of the bar, and its shade (0 the biggest).
254+pub struct LangSlice {
255+ pub x: String,
256+ pub width: String,
257+ pub class: &'static str,
258+}
259+
260+/// The bar's slices in order. Each shade is a class (the page's CSP allows no inline styles), and
261+/// the SVG takes its geometry from attributes.
262+fn lang_slices(langs: &[LangShare]) -> Vec<LangSlice> {
263+ const SHADES: [&str; 5] = ["lang-0", "lang-1", "lang-2", "lang-3", "lang-4"];
264+ let mut at = 0u32;
265+ langs
266+ .iter()
267+ .enumerate()
268+ .map(|(i, share)| {
269+ let slice = LangSlice {
270+ x: format!("{at}%"),
271+ width: format!("{}%", share.percent),
272+ class: if share.others.is_empty() { SHADES[i.min(3)] } else { SHADES[4] },
273+ };
274+ at += share.percent;
275+ slice
276+ })
277+ .collect()
278+}
279+
280+/// The facts line under the repo header, in place of a side column: license, size and a bar of
281+/// the languages on the left; the latest release and the packages as chips on the right. `facts`
282+/// is None for a repo with no commit yet.
252 #[component]283 #[component]
253-pub async fn repo_side(284+pub async fn repo_strip(
254 lang: Lang,285 lang: Lang,
255- visibility: Visibility,
256- default_branch: String,
257 facts: Option<TreeFacts>,286 facts: Option<TreeFacts>,
258- runs: Vec<RunRow>,
259- ci_href: String,
260 release: Option<LatestRelease>,287 release: Option<LatestRelease>,
288+ packages: Vec<PackageLink>,
261 ) -> Result<impl View> {289 ) -> Result<impl View> {
262- let public = visibility == Visibility::Public;
263- let visibility_word = if public {
264- s(lang, "public", "herkese açık")
265- } else {
266- s(lang, "private", "özel")
267- };
268 let size = facts.as_ref().map(|f| human_size(lang, f.size));290 let size = facts.as_ref().map(|f| human_size(lang, f.size));
269 let license = facts.as_ref().and_then(|f| f.license.clone());291 let license = facts.as_ref().and_then(|f| f.license.clone());
270 let langs = facts.map(|f| f.languages).unwrap_or_default();292 let langs = facts.map(|f| f.languages).unwrap_or_default();
271- // The CI rows' clock: the server's time and the duration words the page's ticker rewrites with.293+ let slices = lang_slices(&langs);
272- let now = now_unix();294+ let bar_label = langs
273- let (fm, fs) = duration_templates(lang);295+ .iter()
296+ .map(|share| format!("{} {}%", lang_name(lang, share), share.percent))
297+ .collect::<Vec<_>>()
298+ .join(", ");
274 Ok(view! {299 Ok(view! {
275- <section class="side-sec">300+ <div class="repo-strip">
276- <h2>(s(lang, "About", "Hakkında"))</h2>301+ if let Some((file, id)) = license.as_ref() {
277- <dl class="side-facts">302+ <span class="strip-fact" title=(s(lang, "License", "Lisans"))>
278- <div>303+ <svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v18M5 7h14M7 7l-3 7a3 3 0 0 0 6 0zM17 7l-3 7a3 3 0 0 0 6 0z"/></svg>
279- <dt>(s(lang, "Visibility", "Görünürlük"))</dt>304+ if id.is_empty() { (file.as_str()) } else { (id.as_str()) }
280- <dd><span class=(if public { "badge public" } else { "badge private" })>(visibility_word)</span></dd>305+ </span>
281- </div>306+ }
282- <div>307+ if let Some(size) = size.as_ref() {
283- <dt>(s(lang, "Default branch", "Varsayılan dal"))</dt>308+ <span class="strip-fact" title=(s(lang, "Size", "Boyut"))>(size.as_str())</span>
284- <dd><code>(default_branch.as_str())</code></dd>309+ }
285- </div>310+ if !langs.is_empty() {
286- if let Some((file, id)) = license.as_ref() {311+ <div class="strip-langs">
287- <div>312+ <svg class="lang-bar" viewBox="0 0 100 6" preserveAspectRatio="none" role="img" aria-label=(bar_label.as_str())>
288- <dt>(s(lang, "License", "Lisans"))</dt>313+ for slice in slices.iter() {
289- if id.is_empty() {314+ <rect class=(slice.class) x=(slice.x.as_str()) y="0" width=(slice.width.as_str()) height="100%"></rect>
290- <dd>(file.as_str())</dd>315+ }
291- } else {316+ </svg>
292- <dd>(id.as_str())</dd>317+ <ul class="lang-legend">
318+ for (share, slice) in langs.iter().zip(slices.iter()) {
319+ <li title=(lang_meta(lang, share))><span class=(format!("lang-dot {}", slice.class)) aria-hidden="true"></span>(lang_name(lang, share))" "<span class="muted">(format!("{}%", share.percent))</span></li>
293 }320 }
294- </div>321+ </ul>
322+ </div>
323+ }
324+ <div class="strip-chips">
325+ if let Some(release) = release.as_ref() {
326+ <a class="strip-chip" href=(release.href.as_str()) title=(format!("{}{}", release.title, release_counts(lang, release)))>
327+ <span class="sr-only">(rc::t(lang, rc::K::LatestReleaseHeading))" "</span>
328+ <svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8z"/><circle cx="7.5" cy="7.5" r="1.5"/></svg>
329+ (release.tag.as_str())
330+ <span class="muted">rel_time(lang: lang, stamp: release.when.iso.as_str())</span>
331+ </a>
295 }332 }
296- if let Some(size) = size.as_ref() {333+ for link in packages.iter() {
297- <div>334+ <a class="strip-chip" href=(link.href.as_str()) title=(link.latest.as_str())>
298- <dt>(s(lang, "Size", "Boyut"))</dt>335+ <svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M21 8 12 3 3 8v8l9 5 9-5zM3 8l9 5 9-5M12 13v8"/></svg>
299- <dd>(size.as_str())</dd>336+ (link.name.as_str())
300- </div>337+ </a>
301 }338 }
302- </dl>339+ </div>
303- </section>340+ </div>
304- if !runs.is_empty() {341+ })
305- <section class="side-sec" data-now=(now.to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())>342+}
306- <div class="side-h">343+
307- <h2>"CI"</h2>344+/// The newest CI run as one line over the tree, with a link to all runs. A run still going has
308- <a class="small" href=(ci_href.as_str())>(s(lang, "All runs", "Tüm çalıştırmalar"))</a>345+/// its bar of jobs done and a ticking clock, as the CI pages do.
309- </div>346+#[component]
310- <ul class="side-rows">347+pub async fn repo_ci_line(lang: Lang, runs: Vec<RunRow>, ci_href: String) -> Result<impl View> {
311- for run in runs.iter() {348+ // The clock: the server's time and the duration words the page's ticker rewrites with.
312- <li class="side-run">349+ let now = now_unix();
313- <a class="side-run-link" href=(run.href.as_str()) title=(run.title.as_str())>350+ let (fm, fs) = duration_templates(lang);
314- <span class=(run.dot)></span>351+ Ok(view! {
315- <span class="side-run-name">(format!("#{}", run.number))</span>352+ if let Some(run) = runs.first() {
316- if let Some((value, max)) = run.bar.as_ref() {353+ <div class="repo-ci" data-now=(now.to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())>
317- <progress class="side-run-bar" value=(value.as_str()) max=(max.as_str())></progress>354+ <a class="side-run-link" href=(run.href.as_str()) title=(run.title.as_str())>
318- }355+ <span class=(run.dot)></span>
319- <span class="side-run-text muted">356+ <span class="side-run-name">(format!("CI #{}", run.number))</span>
320- if let Some(since) = run.since.as_deref() {357+ if let Some((value, max)) = run.bar.as_ref() {
321- <span data-since=(since) data-pre=(run.pre.as_deref())>(run.label.as_str())</span>358+ <progress class="side-run-bar" value=(value.as_str()) max=(max.as_str())></progress>
322- } else {
323- (run.label.as_str())
324- }
325- </span>
326- </a>
327- </li>
328- }
329- </ul>
330- </section>
331- }
332- if let Some(release) = release.as_ref() {
333- <section class="side-sec">
334- <h2>(rc::t(lang, rc::K::LatestReleaseHeading))</h2>
335- <ul class="side-rows">
336- <li class="side-row">
337- <div class="side-row-main">
338- <div class="side-row-title">
339- <span class="health-dot accent"></span>
340- <a class="side-row-name" href=(release.href.as_str()) title=(release.title.as_str())>(release.tag.as_str())</a>
341- </div>
342- <div class="side-row-meta muted">
343- rel_time(lang: lang, stamp: release.when.iso.as_str())
344- (release_counts(lang, release))
345- </div>
346- </div>
347- <a class="button small" href=(release.href.as_str())>(s(lang, "Notes", "Notlar"))</a>
348- </li>
349- </ul>
350- </section>
351- }
352- if !langs.is_empty() {
353- <section class="side-sec">
354- <h2>(s(lang, "Languages", "Diller"))</h2>
355- <ul class="side-rows">
356- for share in langs.iter() {
357- <li class=(if share.others.is_empty() { "side-lang" } else { "side-lang is-other" })>
358- <div class="side-row-main">
359- <div class="side-lang-name">(lang_name(lang, share))</div>
360- <div class="side-row-meta muted">(lang_meta(lang, share))</div>
361- </div>
362- <progress class="side-meter" max="100" value=(share.percent.max(1).to_string())>(format!("{}%", share.percent))</progress>
363- <span class="side-pct">(format!("{}%", share.percent))</span>
364- </li>
365 }359 }
366- </ul>360+ <span class="side-run-text muted">
367- </section>361+ if let Some(since) = run.since.as_deref() {
362+ <span data-since=(since) data-pre=(run.pre.as_deref())>(run.label.as_str())</span>
363+ } else {
364+ (run.label.as_str())
365+ }
366+ </span>
367+ </a>
368+ <a class="small" href=(ci_href.as_str())>(s(lang, "All runs", "Tüm çalıştırmalar"))</a>
369+ </div>
368 }370 }
369 })371 })
370 }372 }
crates/forge-web/src/pages/tree.rsmodified+1 -1
@@ -459,7 +459,7 @@ pub async fn tree_table(
459 <td class="tree-name">459 <td class="tree-name">
460 <span class="kind">460 <span class="kind">
461 if row.kind == "dir" {461 if row.kind == "dir" {
462- <svg class="kind-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>462+ <svg class="kind-icon is-dir" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>
463 } else {463 } else {
464 <svg class="kind-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>464 <svg class="kind-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>
465 }465 }
style/_repo.scssmodified+215 -61
@@ -1,5 +1,5 @@
1 // repo: sage redesign. Repo home header, browse bar with the Clone popover, directory table,1 // repo: sage redesign. Repo home header, browse bar with the Clone popover, directory table,
2-// README card, commit list and the repo-meta aside. Colours come from tokens only so both themes2+// README card and commit list. Colours come from tokens only so both themes
3 // follow main.scss.3 // follow main.scss.
4 4
5 // Header: name with the visibility pill on the left, outline actions on the right.5 // Header: name with the visibility pill on the left, outline actions on the right.
@@ -242,7 +242,8 @@
242 }242 }
243 }243 }
244 244
245-// Grid of the repo-meta aside and the main column. Below 900px the columns stack in normal flow.245+// The repo home: the browse bar and the tree in a left column, the README beside it. Below 900px
246+// the columns stack in normal flow.
246 .repo-grid {247 .repo-grid {
247 display: grid;248 display: grid;
248 grid-template-columns: minmax(0, 1fr);249 grid-template-columns: minmax(0, 1fr);
@@ -254,30 +255,33 @@
254 min-width: 0;255 min-width: 0;
255 }256 }
256 257
257-.repo-meta {
258- display: grid;
259- gap: 28px;
260- align-content: start;
261- min-width: 0;
262 258
263- h2 {259+// The repo home takes the whole width of the page column instead of the 1280px other pages keep:
264- margin: 0 0 10px;260+// the README gets the room the tree column leaves.
265- font-size: 13px;261+.shell-body > main:has(.repo-home) {
266- font-weight: 600;262+ max-width: none;
267- color: var(--muted);
268- }
269 }263 }
270 264
271-// Repo home: the browse bar and the tree form a left column, the README fills the middle and the
272-// repo-meta aside sits on the right. The columns scroll inside the grid so the page fits the
273-// viewport; the height is the viewport less the top bar and the page header.
274 .repo-home {265 .repo-home {
275- --repo-home-h: max(480px, calc(100dvh - var(--topbar-h) - 200px));266+ // The grid fills the viewport under the top bar and the repo header, so the page does not scroll;
276- margin-top: 20px;267+ // each column scrolls on its own.
268+ --repo-home-h: max(480px, calc(100dvh - var(--topbar-h) - 236px));
277 269
278- // The grid's own margin carries the space above the browse bar.270+ // One row: the branch, Go to file and, at the right end, Clone (which also holds the downloads).
279 .browse-bar {271 .browse-bar {
280- margin: 0 0 12px;272+ flex-wrap: nowrap;
273+ margin: 0;
274+ padding: 0 0 12px;
275+ border-top: 0;
276+
277+ // Go to file sits beside the branch here; only Clone is pushed to the right end.
278+ .finder-open {
279+ margin-left: 0;
280+ }
281+
282+ .clone {
283+ margin-left: auto;
284+ }
281 }285 }
282 286
283 .repo-main {287 .repo-main {
@@ -294,14 +298,66 @@
294 overflow-y: auto;298 overflow-y: auto;
295 }299 }
296 300
301+ // The newest commit as a two-line header over the tree: its subject on the first line, then the
302+ // author, hash, age and commit count, so the narrow column does not cut both down to a few letters.
303+ .latest-commit {
304+ gap: 6px 12px;
305+
306+ .latest-subject {
307+ order: -1;
308+ flex: 1 1 100%;
309+ font-weight: 500;
310+ }
311+
312+ .latest-author {
313+ max-width: 12rem;
314+ }
315+ }
316+
317+ // The README column is the frame: the card inside loses its own border and fills it, the file
318+ // name strip stays at the top and only the text under it scrolls, so the scrollbar sits inside
319+ // the frame. (A sticky strip in a rounded scroller leaves its corners unclipped in Chrome.)
297 .repo-readme {320 .repo-readme {
321+ display: flex;
322+ flex-direction: column;
298 min-width: 0;323 min-width: 0;
299 min-height: 0;324 min-height: 0;
300- overflow-y: auto;325+ overflow: hidden;
326+ background: var(--surface);
327+ border: 1px solid var(--border);
328+ border-radius: var(--radius-lg);
329+
330+ &:empty {
331+ display: none;
332+ }
301 }333 }
302 334
303 .readme {335 .readme {
304- margin-top: 0;336+ display: flex;
337+ flex: 1 1 auto;
338+ flex-direction: column;
339+ min-height: 0;
340+ margin: 0;
341+ background: transparent;
342+ border: 0;
343+ border-radius: 0;
344+ box-shadow: none;
345+
346+ .readme-name {
347+ flex: none;
348+ }
349+
350+ .markdown-body,
351+ .readme-text {
352+ flex: 1 1 auto;
353+ min-height: 0;
354+ overflow-y: auto;
355+ }
356+
357+ // Lines stay a readable length however wide the column gets; the scroll area keeps the width.
358+ .markdown-body > * {
359+ max-width: 900px;
360+ }
305 }361 }
306 362
307 // The drag handle between the tree and the README (nav.js drives it): a 1px rule centred in the363 // The drag handle between the tree and the README (nav.js drives it): a 1px rule centred in the
@@ -322,7 +378,7 @@
322 left: 50%;378 left: 50%;
323 width: 1px;379 width: 1px;
324 transform: translateX(-50%);380 transform: translateX(-50%);
325- background: var(--border);381+ background: transparent;
326 }382 }
327 383
328 &:hover::before,384 &:hover::before,
@@ -347,16 +403,18 @@ html.tree-resizing .repo-split::before {
347 background: var(--accent);403 background: var(--accent);
348 }404 }
349 405
350-// 900px to 1199px: the tree and README sit side by side and the aside drops under them at full406+// The downloads in the Clone popover, under the clone URLs.
351-// width, so the columns keep their own height and the aside flows with the page.407+.clone .archive-links {
352-@media (min-width: 900px) {408+ margin: 14px 0 0;
353- .repo-grid {409+ padding-top: 12px;
354- gap: 40px 16px;410+ border-top: 1px solid var(--border);
355- }411+}
356 412
413+// From 900px: the tree and README side by side, filling the viewport.
414+@media (min-width: 900px) {
357 .repo-home {415 .repo-home {
358- grid-template-columns: var(--tree-w, 380px) 8px minmax(0, 1fr);416+ grid-template-columns: var(--tree-w, 380px) 12px minmax(0, 1fr);
359- align-items: start;417+ gap: 32px 8px;
360 418
361 .repo-split {419 .repo-split {
362 display: block;420 display: block;
@@ -364,14 +422,10 @@ html.tree-resizing .repo-split::before {
364 422
365 .repo-main,423 .repo-main,
366 .repo-readme {424 .repo-readme {
367- max-height: var(--repo-home-h);425+ height: var(--repo-home-h);
368 }426 }
369 427
370- .repo-meta {428+ // In the narrow column the name keeps up to half the row and the message ellipsizes.
371- grid-column: 1 / -1;
372- }
373-
374- // The name keeps half the narrow column and the last-commit message takes the rest.
375 .tree-table {429 .tree-table {
376 th,430 th,
377 td {431 td {
@@ -386,37 +440,131 @@ html.tree-resizing .repo-split::before {
386 font-size: 13px;440 font-size: 13px;
387 }441 }
388 }442 }
443+ }
444+}
389 445
390- .latest-commit {446+// The facts line under the repo header: license and size, a bar of the languages with its legend,
391- gap: 8px;447+// then the latest release and the packages as chips at the right end.
448+.repo-strip {
449+ display: flex;
450+ flex-wrap: wrap;
451+ align-items: center;
452+ gap: 8px 20px;
453+ margin: 4px 0 16px;
454+ font-size: 13px;
455+ color: var(--text-2);
392 456
393- .latest-author {457+ .i {
394- max-width: 8rem;458+ width: 14px;
395- }459+ height: 14px;
396- }460+ fill: none;
461+ stroke: currentColor;
462+ stroke-width: 1.8;
463+ stroke-linecap: round;
464+ stroke-linejoin: round;
397 }465 }
398 }466 }
399 467
400-// 1200px and up: browse bar and tree | README | aside, all filling the viewport height.468+.strip-fact {
401-@media (min-width: 1200px) {469+ display: inline-flex;
402- .repo-home {470+ align-items: center;
403- grid-template-columns: var(--tree-w, 420px) 8px minmax(0, 1fr) 260px;471+ gap: 6px;
404- column-gap: 12px;472+ white-space: nowrap;
405- align-items: stretch;473+}
406- height: var(--repo-home-h);
407 474
408- .repo-main,475+.strip-langs {
409- .repo-readme {476+ display: flex;
410- max-height: none;477+ flex: 0 1 auto;
411- }478+ align-items: center;
479+ gap: 12px;
480+ min-width: 0;
481+}
412 482
413- // With the splitter's 12px gaps this keeps the README and aside 32px apart, as before.483+.lang-bar {
414- .repo-meta {484+ flex: none;
415- grid-column: auto;485+ width: 160px;
416- min-height: 0;486+ height: 6px;
417- overflow-y: auto;487+ overflow: hidden;
418- margin-left: 20px;488+ border-radius: var(--radius-full);
419- }489+ background: var(--surface-2);
490+}
491+
492+.lang-legend {
493+ display: flex;
494+ flex-wrap: wrap;
495+ gap: 4px 14px;
496+ margin: 0;
497+ padding: 0;
498+ list-style: none;
499+
500+ li {
501+ display: inline-flex;
502+ align-items: center;
503+ gap: 6px;
504+ white-space: nowrap;
505+ }
506+}
507+
508+// The languages' shades: the biggest takes the accent, the next ones fainter mixes of it, the
509+// folded remainder the muted colour. Classes, not inline styles, since the CSP allows none.
510+.lang-0 { --lang: var(--accent); }
511+.lang-1 { --lang: color-mix(in srgb, var(--accent) 65%, var(--surface)); }
512+.lang-2 { --lang: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
513+.lang-3 { --lang: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
514+.lang-4 { --lang: var(--muted); }
515+
516+.lang-bar rect {
517+ fill: var(--lang);
518+}
519+
520+.lang-dot {
521+ width: 8px;
522+ height: 8px;
523+ border-radius: 50%;
524+ background: var(--lang);
525+}
526+
527+.strip-chips {
528+ display: flex;
529+ flex-wrap: wrap;
530+ gap: 8px;
531+ margin-left: auto;
532+
533+ &:empty {
534+ display: none;
535+ }
536+}
537+
538+.strip-chip {
539+ display: inline-flex;
540+ align-items: center;
541+ gap: 6px;
542+ height: 26px;
543+ padding: 0 10px;
544+ color: var(--text);
545+ white-space: nowrap;
546+ border: 1px solid var(--border);
547+ border-radius: var(--radius-full);
548+
549+ &:hover {
550+ text-decoration: none;
551+ background: var(--surface-2);
552+ }
553+}
554+
555+// The newest CI run over the tree: its dot, number and words, and All runs at the right.
556+.repo-ci {
557+ display: flex;
558+ align-items: center;
559+ gap: 12px;
560+ padding: 8px 0;
561+ font-size: 13px;
562+ border-bottom: 1px solid var(--border);
563+
564+ .side-run-link {
565+ flex: 1 1 auto;
566+ min-width: 0;
567+ padding: 0;
420 }568 }
421 }569 }
422 570
@@ -451,6 +599,12 @@ html.tree-resizing .repo-split::before {
451 stroke-width: 1.8;599 stroke-width: 1.8;
452 stroke-linecap: round;600 stroke-linecap: round;
453 stroke-linejoin: round;601 stroke-linejoin: round;
602+
603+ // Folders take the accent, with a light fill, so they stand apart from files at a glance.
604+ &.is-dir {
605+ color: var(--accent);
606+ fill: color-mix(in srgb, var(--accent) 35%, transparent);
607+ }
454 }608 }
455 609
456 th {610 th {
style/_repo_side.scssmodified+4 -162
@@ -1,17 +1,7 @@
1-// The repo home's side column (pages/repo_side.rs), in the runners' row language: a quiet heading1+// The repo home's newest CI run (pages/repo_side.rs) and the shared side-heading style. The dots
2-// over a hairline, then rows on hairlines with a status dot, a bold name, a muted line under it and2+// are `.health-dot` (_account_admin.scss).
3-// one compact thing on the right. The dots are `.health-dot` (_account_admin.scss).
4 3
5-.health-dot.accent {4+.side-h {
6- background: var(--accent);
7-}
8-
9-.repo-meta .side-sec h2 {
10- margin: 0;
11-}
12-
13-.side-h,
14-.side-sec > h2 {
15 display: flex;5 display: flex;
16 align-items: baseline;6 align-items: baseline;
17 justify-content: space-between;7 justify-content: space-between;
@@ -20,95 +10,9 @@
20 border-bottom: 1px solid var(--border-strong);10 border-bottom: 1px solid var(--border-strong);
21 }11 }
22 12
23-.side-facts {13+// The run is one link: an ember dot that glows while the run goes, the number,
24- margin: 0;
25-
26- > div {
27- display: flex;
28- align-items: center;
29- justify-content: space-between;
30- gap: 12px;
31- padding: 9px 0;
32- font-size: 13px;
33- }
34-
35- > div + div {
36- border-top: 1px solid var(--border);
37- }
38-
39- dt {
40- color: var(--muted);
41- }
42-
43- dd {
44- min-width: 0;
45- margin: 0;
46- overflow: hidden;
47- text-overflow: ellipsis;
48- white-space: nowrap;
49- }
50-
51- code {
52- font-family: var(--mono);
53- font-size: 12.5px;
54- }
55-}
56-
57-.side-rows {
58- margin: 0;
59- padding: 0;
60- list-style: none;
61-}
62-
63-.side-row,
64-.side-lang {
65- display: grid;
66- align-items: center;
67- column-gap: 12px;
68- padding: 11px 0;
69-
70- & + & {
71- border-top: 1px solid var(--border);
72- }
73-}
74-
75-.side-row {
76- grid-template-columns: minmax(0, 1fr) auto;
77-}
78-
79-.side-row-main {
80- min-width: 0;
81-}
82-
83-.side-row-title {
84- display: flex;
85- align-items: center;
86- gap: 8px;
87- min-width: 0;
88-}
89-
90-.side-row-name {
91- color: var(--text);
92- font-size: 14px;
93- font-weight: 600;
94-}
95-
96-// The muted line lines up under the name, past the dot.
97-.side-row-meta {
98- margin: 2px 0 0 16px;
99- overflow: hidden;
100- font-size: 12px;
101- text-overflow: ellipsis;
102- white-space: nowrap;
103-}
104-
105-// One row per CI run, the whole row a link: an ember dot that glows while the run goes, the number,
106 // a slim heat bar of the jobs done (while it goes), and one muted line on the right: the current14 // a slim heat bar of the jobs done (while it goes), and one muted line on the right: the current
107 // job and its clock, or the result and the total time.15 // job and its clock, or the result and the total time.
108-.side-run + .side-run {
109- border-top: 1px solid var(--border);
110-}
111-
112 .side-run-link {16 .side-run-link {
113 display: flex;17 display: flex;
114 align-items: center;18 align-items: center;
@@ -185,65 +89,3 @@ progress.side-run-bar {
185 text-overflow: ellipsis;89 text-overflow: ellipsis;
186 white-space: nowrap;90 white-space: nowrap;
187 }91 }
188-
189-// Languages: the name and what it is made of, a thin meter in the accent, the share on the right.
190-// One colour for every language; the remainder row is muted.
191-.side-lang {
192- grid-template-columns: minmax(0, 1fr) 64px 34px;
193-
194- .side-row-meta {
195- margin-left: 0;
196- }
197-}
198-
199-.side-lang-name {
200- color: var(--text);
201- font-size: 13.5px;
202- font-weight: 600;
203-}
204-
205-progress.side-meter {
206- -webkit-appearance: none;
207- appearance: none;
208- display: block;
209- box-sizing: border-box;
210- width: 100%;
211- height: 4px;
212- margin: 0;
213- border: 0;
214- border-radius: 2px;
215- overflow: hidden;
216- background: var(--surface-2);
217- color: var(--accent);
218-
219- &::-webkit-progress-bar {
220- background: var(--surface-2);
221- }
222-
223- &::-webkit-progress-value {
224- background: var(--accent);
225- }
226-
227- &::-moz-progress-bar {
228- background: var(--accent);
229- }
230-}
231-
232-.side-lang.is-other progress.side-meter {
233- color: var(--muted);
234-
235- &::-webkit-progress-value {
236- background: var(--muted);
237- }
238-
239- &::-moz-progress-bar {
240- background: var(--muted);
241- }
242-}
243-
244-.side-pct {
245- color: var(--text-2);
246- font-size: 12.5px;
247- font-variant-numeric: tabular-nums;
248- text-align: right;
249-}