fix: pluralise session and clip counts
This commit is contained in:
@@ -222,3 +222,8 @@ pub fn meter(parts: &[(f32, Hsla)]) -> Div {
|
|||||||
.bg(*colour)
|
.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::{
|
use crate::{
|
||||||
app::ClipbinApp,
|
app::ClipbinApp,
|
||||||
components::{ButtonStyle, button, chip, empty_state, page_header},
|
components::{ButtonStyle, button, chip, count, empty_state, page_header},
|
||||||
screens::{corner, muted_line, thumbnail},
|
screens::{corner, muted_line, thumbnail},
|
||||||
theme,
|
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()
|
"Clips you save are kept until you delete them.".to_owned()
|
||||||
} else {
|
} else {
|
||||||
format!(
|
format!(
|
||||||
"{} clips · {} · kept until you delete them",
|
"{} · {} · kept until you delete them",
|
||||||
clips.len(),
|
count(clips.len(), "clip"),
|
||||||
format_bytes(total)
|
format_bytes(total)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use gpui::{AnyElement, ClickEvent, Context, FontWeight, IntoElement, div, prelud
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app::{ClipbinApp, Route},
|
app::{ClipbinApp, Route},
|
||||||
components::{chip, empty_state, icon, page_header},
|
components::{chip, count, empty_state, icon, page_header},
|
||||||
screens::{corner, muted_line, thumbnail},
|
screens::{corner, muted_line, thumbnail},
|
||||||
theme,
|
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()
|
"Sessions start automatically when you launch a Steam game.".to_owned()
|
||||||
} else {
|
} else {
|
||||||
format!(
|
format!(
|
||||||
"{} sessions · {} of footage within your {} budget",
|
"{} · {} of footage within your {} budget",
|
||||||
library.sessions.len(),
|
count(library.sessions.len(), "session"),
|
||||||
format_bytes(library.storage.unprotected_bytes),
|
format_bytes(library.storage.unprotected_bytes),
|
||||||
format_bytes(library.storage.budget_bytes)
|
format_bytes(library.storage.budget_bytes)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user