From 3d6ee62b3d97ea481579ce72c9e946427ce67c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 27 Oct 2026 02:50:49 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20clicking=20a=20contribution?= =?UTF-8?q?=20calendar=20day=20lists=20that=20day's=20pushes,=20issues,=20?= =?UTF-8?q?pull=20requests=20and=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/forge-core/src/store/contributions.rs | 143 +++++++++++++++- crates/forge-core/src/time.rs | 8 + crates/forge-core/src/tz.rs | 15 ++ crates/forge-web/src/i18n/misc.rs | 45 ++++++ crates/forge-web/src/pages/dashboard.rs | 74 ++++++++- crates/forge-web/src/views/heatmap.rs | 161 ++++++++++++++++--- style/_heatmap.scss | 49 ++++++ 7 files changed, 465 insertions(+), 30 deletions(-) diff --git a/crates/forge-core/src/store/contributions.rs b/crates/forge-core/src/store/contributions.rs index 1540c5b..20737c7 100644 --- a/crates/forge-core/src/store/contributions.rs +++ b/crates/forge-core/src/store/contributions.rs @@ -3,13 +3,64 @@ use std::collections::BTreeMap; use jiff::Timestamp; -use turso::Value; +use turso::{Row, Value}; use super::push_recent::{ZERO_OID_SHA1, ZERO_OID_SHA256}; use super::{Store, col_int, col_text, fetch_all}; -use crate::error::Result; +use crate::error::{Error, Result}; use crate::tz::local_date; +/// Most contributions `contributions_between` returns for one day. +const DAY_LIMIT: u32 = 200; + +/// What a contribution was: a branch push, or an issue, pull request or comment the user wrote. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum ContributionKind { + Push, + Issue, + Pull, + Comment, +} + +/// One contribution, with the repo it landed in. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct ContributionItem { + pub kind: ContributionKind, + pub repo_owner: String, + pub repo_name: String, + /// When it happened, as an RFC 3339 UTC stamp. + pub created_at: String, + /// The pushed ref such as `refs/heads/main`; empty for everything else. + pub ref_name: String, + /// The issue or pull request number (a comment's is its issue's); 0 for a push. + pub number: i64, + /// The issue or pull request title; empty for a push. + pub title: String, +} + +fn map_item(row: &Row) -> Result { + let kind = match col_text(row, 0)?.as_str() { + "push" => ContributionKind::Push, + "issue" => ContributionKind::Issue, + "pull" => ContributionKind::Pull, + "comment" => ContributionKind::Comment, + other => { + return Err(Error::Database(format!( + "unknown contribution kind {other:?}" + ))); + } + }; + Ok(ContributionItem { + kind, + repo_owner: col_text(row, 1)?, + repo_name: col_text(row, 2)?, + created_at: col_text(row, 3)?, + ref_name: col_text(row, 4)?, + number: col_int(row, 5)?, + title: col_text(row, 6)?, + }) +} + impl Store { /// Contributions per day in `tz` by `user_id` at or after `since` (an RFC 3339 stamp), as /// `(YYYY-MM-DD, count)` sorted by day ascending; days with no activity are left out. @@ -59,6 +110,44 @@ impl Store { } Ok(days.into_iter().collect()) } + + /// The contributions by `user_id` with a stamp in `[from, to)`, both RFC 3339 stamps, newest + /// first and at most `DAY_LIMIT` of them. The same kinds as `contribution_counts` count. + pub async fn contributions_between( + &self, + user_id: &str, + from: &str, + to: &str, + ) -> Result> { + // Parameters: ?1 user, ?2 from, ?3 to, ?4 and ?5 zero oids. + let sql = "SELECT 'push' AS created_kind, o.username, r.name, p.created_at, p.ref_name, \ + 0, '' FROM push_events p \ + JOIN repos r ON r.id = p.repo_id JOIN users o ON o.id = r.owner_id \ + WHERE p.actor_id = ?1 AND p.created_at >= ?2 AND p.created_at < ?3 \ + AND p.new_oid NOT IN (?4, ?5) \ + UNION ALL \ + SELECT i.kind, o.username, r.name, i.created_at, '', i.number, i.title FROM issues i \ + JOIN repos r ON r.id = i.repo_id JOIN users o ON o.id = r.owner_id \ + WHERE i.author_id = ?1 AND i.created_at >= ?2 AND i.created_at < ?3 \ + AND i.kind IN ('issue', 'pull') \ + UNION ALL \ + SELECT 'comment', o.username, r.name, c.created_at, '', i.number, i.title \ + FROM comments c JOIN issues i ON i.id = c.issue_id \ + JOIN repos r ON r.id = i.repo_id JOIN users o ON o.id = r.owner_id \ + WHERE c.author_id = ?1 AND c.created_at >= ?2 AND c.created_at < ?3 \ + ORDER BY created_at DESC LIMIT ?6"; + let params = vec![ + Value::Text(user_id.to_string()), + Value::Text(from.to_string()), + Value::Text(to.to_string()), + Value::Text(ZERO_OID_SHA1.to_string()), + Value::Text(ZERO_OID_SHA256.to_string()), + Value::Integer(i64::from(DAY_LIMIT)), + ]; + + let conn = self.read_conn().await; + fetch_all(&conn, sql, params, map_item).await + } } #[cfg(test)] @@ -81,6 +170,56 @@ mod tests { .unwrap(); } + #[tokio::test] + async fn lists_one_day_newest_first() { + let dir = tempfile::tempdir().unwrap(); + let store = Store::open(&dir.path().join("forge.db")).await.unwrap(); + let tahinli = store + .create_user("tahinli", None, "x", false) + .await + .unwrap(); + let demo = store + .create_repo(&tahinli.id, "demo", "", Visibility::Public, "main") + .await + .unwrap(); + store + .record_push_event_at( + &demo.id, + &tahinli.id, + "refs/heads/main", + ZERO, + OID, + "2026-03-01T10:00:00.000000000Z", + ) + .await + .unwrap(); + let issue = store + .create_issue(&demo.id, &tahinli.id, "first", "") + .await + .unwrap(); + set_created_at( + &store, + "issues", + &issue.id, + "2026-03-01T12:00:00.000000000Z", + ) + .await; + + let items = store + .contributions_between( + &tahinli.id, + "2026-03-01T00:00:00.000000000Z", + "2026-03-02T00:00:00.000000000Z", + ) + .await + .unwrap(); + let kinds: Vec<_> = items.iter().map(|item| item.kind).collect(); + assert_eq!(kinds, vec![ContributionKind::Issue, ContributionKind::Push]); + assert_eq!(items[0].repo_owner, "tahinli"); + assert_eq!((items[0].number, items[0].title.as_str()), (1, "first")); + assert_eq!(items[1].ref_name, "refs/heads/main"); + } + #[tokio::test] async fn counts_pushes_issues_pulls_and_comments_per_day() { let dir = tempfile::tempdir().unwrap(); diff --git a/crates/forge-core/src/time.rs b/crates/forge-core/src/time.rs index 0eca2c3..3bc4ac1 100644 --- a/crates/forge-core/src/time.rs +++ b/crates/forge-core/src/time.rs @@ -40,6 +40,14 @@ pub fn stamp_ago(ago: Duration) -> String { format_stamp(OffsetDateTime::now_utc().saturating_sub(delta)) } +/// The stamp for Unix seconds `unix`, in the same format as [`now_stamp`]. `None` when the time is +/// out of the range the format covers. +pub fn stamp_from_unix(unix: i64) -> Option { + OffsetDateTime::from_unix_timestamp(unix) + .ok() + .map(format_stamp) +} + /// Unix seconds for a stamp written by [`now_stamp`]. `None` when the text is not a stamp. pub fn stamp_to_unix(stamp: &str) -> Option { OffsetDateTime::parse(stamp, &time::format_description::well_known::Rfc3339) diff --git a/crates/forge-core/src/tz.rs b/crates/forge-core/src/tz.rs index 6fc2101..cf4d67c 100644 --- a/crates/forge-core/src/tz.rs +++ b/crates/forge-core/src/tz.rs @@ -19,6 +19,21 @@ pub fn local_date(ts: Timestamp, tz: &str) -> civil::Date { local_datetime(ts, tz).date() } +/// Unix seconds for the start of the civil day `date` in `tz`, and for the start of the day after +/// it. `None` at the edge of the range jiff can represent. Unknown zones fall back to UTC. +pub fn day_span(date: civil::Date, tz: &str) -> Option<(i64, i64)> { + let zone = zone_or_utc(tz); + let start = date.at(0, 0, 0, 0).to_zoned(zone.clone()).ok()?.timestamp(); + let next = date + .tomorrow() + .ok()? + .at(0, 0, 0, 0) + .to_zoned(zone) + .ok()? + .timestamp(); + Some((start.as_second(), next.as_second())) +} + /// Accepts only names known to the bundled tzdb, such as "Europe/Istanbul" or "UTC". pub fn validate_timezone(name: &str) -> Result<()> { TimeZone::get(name) diff --git a/crates/forge-web/src/i18n/misc.rs b/crates/forge-web/src/i18n/misc.rs index 57ecb84..4963d34 100644 --- a/crates/forge-web/src/i18n/misc.rs +++ b/crates/forge-web/src/i18n/misc.rs @@ -6,6 +6,8 @@ use std::fmt::Display; +use forge_core::store::contributions::ContributionKind; + use super::Lang; #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -144,6 +146,7 @@ pub enum K { MonLabel, WedLabel, FriLabel, + NoContributionsDay, // Dashboard greeting and "Needs your attention" column. GoodMorning, GoodAfternoon, @@ -285,6 +288,7 @@ const ALL: &[K] = &[ K::MonLabel, K::WedLabel, K::FriLabel, + K::NoContributionsDay, K::GoodMorning, K::GoodAfternoon, K::GoodEvening, @@ -572,6 +576,8 @@ pub fn t(lang: Lang, key: K) -> &'static str { (WedLabel, Tr) => "Çar", (FriLabel, En) => "Fri", (FriLabel, Tr) => "Cum", + (NoContributionsDay, En) => "No contributions on this day.", + (NoContributionsDay, Tr) => "Bu günde katkı yok.", (GoodMorning, En) => "Good morning", (GoodMorning, Tr) => "Günaydın", (GoodAfternoon, En) => "Good afternoon", @@ -700,6 +706,45 @@ pub fn contributions_on(lang: Lang, n: u64, date: &str) -> String { } } +/// The heading above a selected calendar day's contributions, e.g. `Contributions on 16 Oct 2026`. +pub fn contributions_on_day(lang: Lang, date: &str) -> String { + match lang { + Lang::En => format!("Contributions on {date}"), + Lang::Tr => format!("{date} tarihindeki katkılar"), + } +} + +/// The words either side of a day item's link. The link is the repo for a push and `#N title` +/// otherwise, so `repo` (`owner/repo`) goes in the words only where the link is not the repo. +pub fn day_item_words( + lang: Lang, + kind: ContributionKind, + branch: &str, + repo: &str, +) -> (String, String) { + match (lang, kind) { + (Lang::En, ContributionKind::Push) => (format!("Pushed to {branch} in"), String::new()), + (Lang::En, ContributionKind::Issue) => ("Opened issue".to_owned(), format!("in {repo}")), + (Lang::En, ContributionKind::Pull) => { + ("Opened pull request".to_owned(), format!("in {repo}")) + } + (Lang::En, ContributionKind::Comment) => ("Commented on".to_owned(), format!("in {repo}")), + (Lang::Tr, ContributionKind::Push) => { + (String::new(), format!("deposunda {branch} dalına gönderim")) + } + (Lang::Tr, ContributionKind::Issue) => { + (String::new(), format!("sorunu {repo} deposunda açtı")) + } + (Lang::Tr, ContributionKind::Pull) => ( + String::new(), + format!("çekme isteğini {repo} deposunda açtı"), + ), + (Lang::Tr, ContributionKind::Comment) => { + (String::new(), format!("konusuna {repo} deposunda yorum yaptı")) + } + } +} + /// The activity line for an inbox row: the verb, then the actor when there is one. English reads /// "opened by tahinli"; Turkish reads "tahinli tarafından açıldı", or "Açıldı" with no actor. pub fn activity_line(lang: Lang, verb: K, actor: Option<&str>) -> String { diff --git a/crates/forge-web/src/pages/dashboard.rs b/crates/forge-web/src/pages/dashboard.rs index 2d8ae06..649d03b 100644 --- a/crates/forge-web/src/pages/dashboard.rs +++ b/crates/forge-web/src/pages/dashboard.rs @@ -7,12 +7,13 @@ use std::time::Duration; use forge_core::store::RepoSort; use forge_core::store::repo_listing::RepoScope; +use forge_core::time::stamp_from_unix; use forge_core::{Notification, Repo, Visibility}; -use jiff::Timestamp; +use jiff::{Timestamp, civil}; use topcoat::Result; use topcoat::context::{Cx, app_context}; use topcoat::router::response::Response; -use topcoat::router::{Body, StatusCode, page, route}; +use topcoat::router::{Body, StatusCode, page, query_params, route}; use topcoat::view::{View, component, view}; use crate::auth::{current_user, percent_encode}; @@ -23,7 +24,7 @@ use crate::live::{Topic, stream_changes}; use crate::pages::issue_parts::stamp_unix; use crate::pages::repo_settings::{notice_banner_for, take_notice}; use crate::state::AppState; -use crate::views::heatmap::{self, Calendar, contribution_calendar}; +use crate::views::heatmap::{self, Calendar, DayDetail, contribution_calendar}; use crate::views::{SIDE_REPOS, display_name, now_unix, relative_time, shell}; /// How far back the calendar reads contributions: 53 weeks plus the days of the current week. @@ -35,6 +36,12 @@ fn calendar_since() -> String { forge_core::time::stamp_ago(Duration::from_secs((CALENDAR_DAYS + 1) * 86_400)) } +/// The `day` query: a calendar day whose contributions to list under the calendar. +#[query_params(error = bad_request)] +struct DayQuery { + day: Option, +} + /// Unread inbox rows in the "Needs your attention" column. const ATTENTION_ROWS: u32 = 5; @@ -44,6 +51,7 @@ struct Dashboard { hour: u8, repos: Vec, calendar: Calendar, + selected: Option, attention: Vec, } @@ -63,8 +71,9 @@ async fn home(cx: &Cx) -> Result { let state = app_context::(cx); let viewer = current_user(cx).await?; let lang = i18n::lang(cx, viewer.as_ref().map(|(u, _)| u)); + let query = query_params::(cx)?; let dash = match &viewer { - Some((user, _)) => Some(load_dashboard(state, user, lang).await?), + Some((user, _)) => Some(load_dashboard(state, user, lang, query.day.as_deref()).await?), None => None, }; let has_users = viewer.is_none() && state.store.user_count().await? > 0; @@ -172,11 +181,59 @@ async fn dashboard_fingerprint(state: &AppState, user: &forge_core::User) -> Res Ok(lines.join("\n")) } -/// Reads the dashboard data for a signed-in user. +/// The day the `day` query asks for: a strict `YYYY-MM-DD` date from the calendar's first day to +/// today. Anything else (malformed, a future day, or before the calendar) is ignored. +fn selected_day( + day: Option<&str>, + first: (i64, i64, i64), + today: (i64, i64, i64), +) -> Option { + let text = day?; + let date: civil::Date = text.parse().ok()?; + // The parser takes more forms than the calendar link uses, so the date must print back as sent. + if date.to_string() != text { + return None; + } + let ymd = ( + i64::from(date.year()), + i64::from(date.month()), + i64::from(date.day()), + ); + (first..=today).contains(&ymd).then_some(date) +} + +/// The contributions the user made on their local day `date`, newest first. +async fn day_detail( + state: &AppState, + user: &forge_core::User, + date: civil::Date, +) -> Result> { + let Some((start, end)) = forge_core::tz::day_span(date, &user.timezone) else { + return Ok(None); + }; + let (Some(from), Some(to)) = (stamp_from_unix(start), stamp_from_unix(end)) else { + return Ok(None); + }; + let items = state + .store + .contributions_between(&user.id, &from, &to) + .await?; + Ok(Some(DayDetail { + date: ( + i64::from(date.year()), + i64::from(date.month()), + i64::from(date.day()), + ), + items, + })) +} + +/// Reads the dashboard data for a signed-in user. `day` is the raw `day` query value. async fn load_dashboard( state: &AppState, user: &forge_core::User, lang: Lang, + day: Option<&str>, ) -> Result { let repos = state.store.list_repos_by_owner(&user.id).await?; let local_now = forge_core::tz::local_datetime(Timestamp::now(), &user.timezone); @@ -190,6 +247,10 @@ async fn load_dashboard( .contribution_counts(&user.id, &calendar_since(), &user.timezone) .await?; let calendar = heatmap::build(&counts, today); + let selected = match selected_day(day, calendar.first_day, today) { + Some(date) => day_detail(state, user, date).await?, + None => None, + }; let now_secs = now_unix(); let attention = state .store @@ -203,6 +264,7 @@ async fn load_dashboard( hour: u8::try_from(local_now.hour()).unwrap_or_default(), repos, calendar, + selected, attention, }) } @@ -232,7 +294,7 @@ async fn dashboard(dash: Dashboard, lang: Lang) -> Result { Ok(view! {

(greeting)

- contribution_calendar(calendar: dash.calendar, lang: lang) + contribution_calendar(calendar: dash.calendar, selected: dash.selected, lang: lang)
diff --git a/crates/forge-web/src/views/heatmap.rs b/crates/forge-web/src/views/heatmap.rs index 3757796..371ac68 100644 --- a/crates/forge-web/src/views/heatmap.rs +++ b/crates/forge-web/src/views/heatmap.rs @@ -4,13 +4,17 @@ //! `build` is pure date and streak maths over the counts from the store. `contribution_calendar` //! draws it with classes only (CSP): the grid placement comes from CSS (`grid-auto-flow: column` //! with seven rows), so every cell is an element and the blank slots keep the columns aligned. +//! Each day is a link to `?day=` (a plain link, no script): the page then lists that day's +//! contributions under the calendar, and clicking the selected day again clears it. use std::collections::HashMap; +use forge_core::store::contributions::{ContributionItem, ContributionKind}; +use forge_core::time::stamp_to_unix; use topcoat::Result; use topcoat::view::{View, component, view}; -use super::civil_from_days; +use super::{civil_from_days, now_unix, relative_time}; use crate::i18n::Lang; use crate::i18n::misc::{self as g, K}; @@ -28,6 +32,13 @@ pub struct Day { pub level: u8, } +/// The day picked in the calendar: its date and the contributions made on it, newest first. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct DayDetail { + pub date: (i64, i64, i64), + pub items: Vec, +} + /// The calendar as the component draws it. `weeks[c][r]` is the day in column `c` (a week, /// Monday first) and row `r` (0 = Monday, 6 = Sunday); `None` for the days after today. #[derive(Clone, Debug, PartialEq, Eq)] @@ -166,16 +177,80 @@ fn weekday(days: i64) -> u8 { (days + 3).rem_euclid(7) as u8 } -/// One grid slot as the view draws it. +/// One grid slot as the view draws it. Days link to their contributions; blank slots do not. struct CellView { - class: &'static str, + class: String, + href: Option, title: String, } +/// One line of the selected day's list, with its strings ready for the view. +struct DayRow { + before: String, + href: String, + link: String, + after: String, + updated: String, + relative: String, +} + +/// The selected day's heading and rows, ready for the view. +struct DayView { + heading: String, + rows: Vec, +} + +/// The link for a calendar day: the day's contributions below the calendar, or back to the +/// plain calendar when the day is the selected one. +fn day_href(date: (i64, i64, i64), selected: bool) -> String { + if selected { + "/#contributions-h".to_owned() + } else { + format!( + "/?day={:04}-{:02}-{:02}#contributions-h", + date.0, date.1, date.2 + ) + } +} + +/// The row for one contribution in the selected day's list. +fn day_row(lang: Lang, item: &ContributionItem, now: i64) -> DayRow { + let repo = format!("{}/{}", item.repo_owner, item.repo_name); + let branch = item + .ref_name + .strip_prefix("refs/heads/") + .unwrap_or(&item.ref_name); + let (before, after) = g::day_item_words(lang, item.kind, branch, &repo); + let (href, link) = match item.kind { + ContributionKind::Push => (format!("/{repo}"), repo.clone()), + ContributionKind::Issue | ContributionKind::Comment => ( + format!("/{repo}/issues/{}", item.number), + format!("#{} {}", item.number, item.title), + ), + ContributionKind::Pull => ( + format!("/{repo}/pulls/{}", item.number), + format!("#{} {}", item.number, item.title), + ), + }; + DayRow { + before, + href, + link, + after, + updated: item.created_at.clone(), + relative: relative_time(lang, stamp_to_unix(&item.created_at).unwrap_or(now), now), + } +} + /// The contribution card: heading and date range, the four stats, the month labels and the -/// 53-week grid, then the motivating line and the Less/More legend. +/// 53-week grid, then the motivating line and the Less/More legend, then the selected day's +/// contributions when a day is picked. #[component] -pub async fn contribution_calendar(calendar: Calendar, lang: Lang) -> Result { +pub async fn contribution_calendar( + calendar: Calendar, + selected: Option, + lang: Lang, +) -> Result { let range = { let from = g::date_text( lang, @@ -202,6 +277,20 @@ pub async fn contribution_calendar(calendar: Calendar, lang: Lang) -> Result Result CellView { - class: LEVEL_CLASS[usize::from(day.level)], - title: g::contributions_on( - lang, - day.count, - &g::date_text(lang, day.date.0, day.date.1, day.date.2), - ), - }, + Some(day) => { + let picked = selected_date == Some(day.date); + let level = LEVEL_CLASS[usize::from(day.level)]; + CellView { + class: if picked { + format!("{level} selected") + } else { + level.to_owned() + }, + href: Some(day_href(day.date, picked)), + title: g::contributions_on( + lang, + day.count, + &g::date_text(lang, day.date.0, day.date.1, day.date.2), + ), + } + } None => CellView { - class: "cell blank", + class: "cell blank".to_owned(), + href: None, title: String::new(), }, }) @@ -273,9 +372,13 @@ pub async fn contribution_calendar(calendar: Calendar, lang: Lang) -> Result(label.as_str()) }
- @@ -293,6 +396,25 @@ pub async fn contribution_calendar(calendar: Calendar, lang: Lang) -> Result(more)
+ if let Some(day) = day { +
+

(day.heading.as_str())

+ if day.rows.is_empty() { +

(empty_day)

+ } else { +
    + for row in day.rows.into_iter() { +
  • + (row.before.as_str()) + (row.link.as_str()) + (row.after.as_str()) + +
  • + } +
+ } +
+ } }) } @@ -356,12 +478,7 @@ mod tests { // (case, counts, current streak, longest streak) type Case<'a> = (&'a str, &'a [(&'a str, u32)], u64, u64); let cases: [Case<'_>; 2] = [ - ( - "old run", - &[("2026-10-01", 3), ("2026-10-02", 3)], - 0, - 2, - ), + ("old run", &[("2026-10-01", 3), ("2026-10-02", 3)], 0, 2), ( "gap then two days", &[ diff --git a/style/_heatmap.scss b/style/_heatmap.scss index fbab85f..1bb6233 100644 --- a/style/_heatmap.scss +++ b/style/_heatmap.scss @@ -194,6 +194,16 @@ $gap: 3px; outline-offset: 0; } +// A day is a link: it looks like its plain cell, and the picked day gets an accent outline. +a.cell { + text-decoration: none; +} + +.heat-grid .cell.selected { + outline: 2px solid var(--accent-ink); + outline-offset: 1px; +} + .cell.blank { visibility: hidden; } @@ -212,6 +222,45 @@ $gap: 3px; } } +.heat-day { + margin-top: 20px; + padding-top: 18px; + border-top: 1px solid var(--border); + + h3 { + margin: 0 0 12px; + font-size: 15px; + } + + p { + margin: 0; + } + + ul { + display: grid; + gap: 10px; + margin: 0; + padding: 0; + list-style: none; + } + + li { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 2px 6px; + font-size: 14px; + color: var(--text); + } + + time { + margin-left: auto; + font-size: 13px; + color: var(--muted); + white-space: nowrap; + } +} + .legend { display: flex; align-items: center;