fix: pluralise session and clip counts
This commit is contained in:
@@ -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" })
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user