From a5cfbc89a740b4f0077ec2a41b80097dcf24944b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 29 Nov 2026 08:19:15 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20Appearance=20=E2=80=BA=20Sh?= =?UTF-8?q?ow=20seconds=20(off=20by=20default)=20shows=20message=20times?= =?UTF-8?q?=20as=20HH:MM:SS;=20Settings::clock()=20picks=20the=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/lang/en/settings_page.txt | 1 + crates/client/lang/tr/settings_page.txt | 1 + crates/client/src/gui/chat.rs | 9 ++++++--- crates/client/src/gui/settings_page.rs | 20 +++++++++++++++++++- crates/client/src/settings.rs | 15 +++++++++++++++ 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/crates/client/lang/en/settings_page.txt b/crates/client/lang/en/settings_page.txt index f9d54e7..09602e6 100644 --- a/crates/client/lang/en/settings_page.txt +++ b/crates/client/lang/en/settings_page.txt @@ -25,3 +25,4 @@ frame_rate = Frame rate codec = Codec share_audio = Share audio back_esc = Back (esc) +clock_seconds = Show seconds diff --git a/crates/client/lang/tr/settings_page.txt b/crates/client/lang/tr/settings_page.txt index 15ae64b..4e22561 100644 --- a/crates/client/lang/tr/settings_page.txt +++ b/crates/client/lang/tr/settings_page.txt @@ -25,3 +25,4 @@ frame_rate = Kare hızı codec = Kodek share_audio = Sesi paylaş back_esc = Geri (esc) +clock_seconds = Saniyeleri göster diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index 95c1a91..c51d2fb 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -1,6 +1,5 @@ use super::style::{self, radius, size, space, stroke, text}; use super::text; -use crate::gui::CLOCK; use crate::gui::glyph::Fill as _; use crate::lang::w; use std::{ @@ -1945,6 +1944,7 @@ impl Yumush { run, &self.chat, self.user.as_ref(), + self.settings.clock(), entity, palette, ); @@ -3570,6 +3570,7 @@ fn render_message( run: CallRun, chat: &Chat, me: Option<&User>, + clock: &'static str, entity: &Entity, palette: Palette, ) -> AnyElement { @@ -3628,7 +3629,9 @@ fn render_message( .min_w_0() .hover(|style| style.bg(palette.hover)) .when(chat.engaged(message.id), |this| this.bg(palette.hover)) - .when(message.deleted, |this| this.text_color(palette.tokens.faint())) + .when(message.deleted, |this| { + this.text_color(palette.tokens.faint()) + }) .when(first && spaced && !selecting, |this| this.mt(px(space::LG))) .when(highlighted, |this| this.bg(palette.tokens.press())) .when(mentioned, |this| { @@ -3660,7 +3663,7 @@ fn render_message( div() .text_size(text(text::CAPTION)) .text_color(palette.muted) - .child(millis_time(message.created_at, CLOCK)), + .child(millis_time(message.created_at, clock)), ), ) }) diff --git a/crates/client/src/gui/settings_page.rs b/crates/client/src/gui/settings_page.rs index b8070b6..a6d05eb 100644 --- a/crates/client/src/gui/settings_page.rs +++ b/crates/client/src/gui/settings_page.rs @@ -36,7 +36,7 @@ pub(super) fn settings_titles() -> [&'static str; 4] { [w.profile, w.voice, w.camera_share, w.appearance] } -pub(super) fn setting_rows() -> [(usize, &'static str); 23] { +pub(super) fn setting_rows() -> [(usize, &'static str); 24] { let s = &w().settings_page; let v = &w().voice_settings; [ @@ -62,6 +62,7 @@ pub(super) fn setting_rows() -> [(usize, &'static str); 23] { (3, s.font_size), (3, s.language), (3, s.close_to_tray), + (3, s.clock_seconds), (3, s.your_hue), ] } @@ -203,6 +204,18 @@ impl Yumush { }, ), ), + row( + w().settings_page.clock_seconds, + super::parts::toggle( + "clock_seconds_switch", + self.settings.clock_seconds, + palette.tokens, + { + let entity = entity.clone(); + move |_, cx| entity.update(cx, |yumush, cx| yumush.toggle_clock_seconds(cx)) + }, + ), + ), ]; if let Some(user) = self.user.as_ref() { appearance.push(row( @@ -376,6 +389,11 @@ impl Yumush { self.commit_settings(cx); } + pub(super) fn toggle_clock_seconds(&mut self, cx: &mut Context) { + self.settings.clock_seconds = !self.settings.clock_seconds; + self.commit_settings(cx); + } + pub(super) fn commit_settings(&mut self, cx: &mut Context) { settings::save(&self.settings); self.network.set_voice_settings(&self.settings.voice); diff --git a/crates/client/src/settings.rs b/crates/client/src/settings.rs index 7a9cc05..461aa49 100644 --- a/crates/client/src/settings.rs +++ b/crates/client/src/settings.rs @@ -195,10 +195,21 @@ pub struct Settings { pub voice: VoiceSettings, pub share: ShareSettings, pub close_to_tray: bool, + pub clock_seconds: bool, pub jump_usage: BTreeMap, pub last_chats: BTreeMap, } +impl Settings { + pub fn clock(&self) -> &'static str { + if self.clock_seconds { + crate::gui::CLOCK_SECONDS + } else { + crate::gui::CLOCK + } + } +} + impl Default for Settings { fn default() -> Self { Self { @@ -208,6 +219,7 @@ impl Default for Settings { voice: VoiceSettings::default(), share: ShareSettings::default(), close_to_tray: true, + clock_seconds: false, jump_usage: BTreeMap::new(), last_chats: BTreeMap::new(), } @@ -321,6 +333,8 @@ pub fn load() -> Settings { share, close_to_tray: text("close_to_tray") .map_or(defaults.close_to_tray, |value| value != "false"), + clock_seconds: text("clock_seconds") + .map_or(defaults.clock_seconds, |value| value == "true"), jump_usage: text("jump.usage") .map(|value| { value @@ -360,6 +374,7 @@ pub fn save(settings: &Settings) { line("font_size", settings.font_size.as_str()), line("language", settings.language.as_str()), line("close_to_tray", settings.close_to_tray), + line("clock_seconds", settings.clock_seconds), line("voice.sensitivity", voice.sensitivity_db), line("voice.input_volume", voice.input_volume), line("voice.output_volume", voice.output_volume),