From d1cbb3ba34d5fa5dbb290eee87de040e4bbee8c5d608580de64071e6b93eda82 Mon Sep 17 00:00:00 2001 From: Evan Carroll Date: Sun, 18 Jan 2026 02:49:31 -0600 Subject: [PATCH] fix: case for emotions --- .../chattyness-user-ui/src/components/chat.rs | 3 ++- .../src/components/emotion_picker.rs | 22 +++++++++++++++---- .../src/components/keybindings_popup.rs | 1 - 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/crates/chattyness-user-ui/src/components/chat.rs b/crates/chattyness-user-ui/src/components/chat.rs index 198e73b..4084e98 100644 --- a/crates/chattyness-user-ui/src/components/chat.rs +++ b/crates/chattyness-user-ui/src/components/chat.rs @@ -5,7 +5,7 @@ use leptos::prelude::*; use chattyness_db::models::EmotionAvailability; use chattyness_db::ws_messages::ClientMessage; -use super::emotion_picker::{EmoteListPopup, EMOTIONS}; +use super::emotion_picker::{EmoteListPopup, LabelStyle, EMOTIONS}; use super::ws_client::WsSenderStorage; /// Command mode state for the chat input. @@ -423,6 +423,7 @@ pub fn ChatInput( on_close=on_popup_close emotion_filter=filter_signal selected_idx=Signal::derive(move || selected_index.get()) + label=LabelStyle::Command /> diff --git a/crates/chattyness-user-ui/src/components/emotion_picker.rs b/crates/chattyness-user-ui/src/components/emotion_picker.rs index f6fcfc0..1f1a231 100644 --- a/crates/chattyness-user-ui/src/components/emotion_picker.rs +++ b/crates/chattyness-user-ui/src/components/emotion_picker.rs @@ -7,6 +7,16 @@ use leptos::prelude::*; use chattyness_db::models::EmotionAvailability; +/// Controls how emotion labels are displayed in the EmoteListPopup. +#[derive(Clone, Copy, PartialEq, Eq, Default)] +pub enum LabelStyle { + /// Show as command format: `:e happy` (lowercase, no capitalization) + Command, + /// Show as name format: `Happy` (capitalized) + #[default] + Name, +} + /// Emotion names indexed by emotion slot (0-11). pub const EMOTIONS: &[&str] = &[ "neutral", // 0 @@ -38,7 +48,7 @@ pub const EMOTIONS: &[&str] = &[ /// - `show_all_emotions`: When true, show all 12 emotions (for keybindings); /// when false, only show available emotions (for chat `:l`) /// - `popup_style`: Positioning style - "above" (default, for chat input) or "static" (for modal wrapper) -/// - `show_command_prefix`: When true, show ":e " prefix before emotion names (default true for chat) +/// - `label`: How to display emotion labels - `Command` for `:e happy` or `Name` for `Happy` (default) #[component] pub fn EmoteListPopup( emotion_availability: Signal>, @@ -49,7 +59,7 @@ pub fn EmoteListPopup( #[prop(into)] selected_idx: Signal, #[prop(default = false)] show_all_emotions: bool, #[prop(default = "above")] popup_style: &'static str, - #[prop(default = true)] show_command_prefix: bool, + #[prop(default = LabelStyle::Name)] label: LabelStyle, ) -> impl IntoView { let _ = on_close; // Suppress unused warning @@ -167,8 +177,12 @@ pub fn EmoteListPopup( skin_path=skin_path.clone() emotion_path=emotion_path.clone() /> - - {if show_command_prefix { ":e " } else { "" }} + + {if label == LabelStyle::Command { ":e " } else { "" }} {emotion_name_display} diff --git a/crates/chattyness-user-ui/src/components/keybindings_popup.rs b/crates/chattyness-user-ui/src/components/keybindings_popup.rs index 346297f..b0d8c91 100644 --- a/crates/chattyness-user-ui/src/components/keybindings_popup.rs +++ b/crates/chattyness-user-ui/src/components/keybindings_popup.rs @@ -344,7 +344,6 @@ fn EmotionSlot( selected_idx=Signal::derive(move || selected_idx.get()) show_all_emotions=true popup_style="static" - show_command_prefix=false />