From ec4a6ad74d9eb2f96bceaf5706cb9f215ab7ca04 Mon Sep 17 00:00:00 2001 From: Harry Date: Thu, 8 Oct 2026 17:40:26 +0200 Subject: [PATCH] fix: pluralise session and clip counts --- crates/clipbin-desktop/src/components.rs | 5 +++++ crates/clipbin-desktop/src/screens/clips.rs | 6 +++--- crates/clipbin-desktop/src/screens/sessions.rs | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/clipbin-desktop/src/components.rs b/crates/clipbin-desktop/src/components.rs index 3cc4442..2ef2f9f 100644 --- a/crates/clipbin-desktop/src/components.rs +++ b/crates/clipbin-desktop/src/components.rs @@ -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" }) +} diff --git a/crates/clipbin-desktop/src/screens/clips.rs b/crates/clipbin-desktop/src/screens/clips.rs index 506d299..c9e4dc6 100644 --- a/crates/clipbin-desktop/src/screens/clips.rs +++ b/crates/clipbin-desktop/src/screens/clips.rs @@ -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) -> 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) ) }, diff --git a/crates/clipbin-desktop/src/screens/sessions.rs b/crates/clipbin-desktop/src/screens/sessions.rs index 6499c6a..46343d2 100644 --- a/crates/clipbin-desktop/src/screens/sessions.rs +++ b/crates/clipbin-desktop/src/screens/sessions.rs @@ -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) -> 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) )