fix: pluralise session and clip counts
Rust checks / windows-cross-check (push) Successful in 1m0s
Rust checks / linux (push) Failing after 5m34s

This commit is contained in:
2026-10-08 17:40:26 +02:00
parent c1cac1ba46
commit ec4a6ad74d
3 changed files with 11 additions and 6 deletions
+5
View File
@@ -222,3 +222,8 @@ pub fn meter(parts: &[(f32, Hsla)]) -> Div {
.bg(*colour)
}))
}
/// `1 session`, `3 sessions`.
pub fn count(n: usize, noun: &str) -> String {
format!("{n} {noun}{}", if n == 1 { "" } else { "s" })
}
+3 -3
View File
@@ -5,7 +5,7 @@ use gpui::{AnyElement, ClickEvent, Context, FontWeight, IntoElement, div, prelud
use crate::{
app::ClipbinApp,
components::{ButtonStyle, button, chip, empty_state, page_header},
components::{ButtonStyle, button, chip, count, empty_state, page_header},
screens::{corner, muted_line, thumbnail},
theme,
};
@@ -19,8 +19,8 @@ pub fn render(app: &ClipbinApp, cx: &mut Context<ClipbinApp>) -> AnyElement {
"Clips you save are kept until you delete them.".to_owned()
} else {
format!(
"{} clips · {} · kept until you delete them",
clips.len(),
"{} · {} · kept until you delete them",
count(clips.len(), "clip"),
format_bytes(total)
)
},
@@ -5,7 +5,7 @@ use gpui::{AnyElement, ClickEvent, Context, FontWeight, IntoElement, div, prelud
use crate::{
app::{ClipbinApp, Route},
components::{chip, empty_state, icon, page_header},
components::{chip, count, empty_state, icon, page_header},
screens::{corner, muted_line, thumbnail},
theme,
};
@@ -17,8 +17,8 @@ pub fn render(app: &ClipbinApp, cx: &mut Context<ClipbinApp>) -> AnyElement {
"Sessions start automatically when you launch a Steam game.".to_owned()
} else {
format!(
"{} sessions · {} of footage within your {} budget",
library.sessions.len(),
"{} · {} of footage within your {} budget",
count(library.sessions.len(), "session"),
format_bytes(library.storage.unprotected_bytes),
format_bytes(library.storage.budget_bytes)
)