fix: case for emotions
This commit is contained in:
parent
8201092703
commit
d1cbb3ba34
3 changed files with 20 additions and 6 deletions
|
|
@ -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
|
||||
/>
|
||||
</Show>
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Option<EmotionAvailability>>,
|
||||
|
|
@ -49,7 +59,7 @@ pub fn EmoteListPopup(
|
|||
#[prop(into)] selected_idx: Signal<usize>,
|
||||
#[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()
|
||||
/>
|
||||
<span class="text-white text-sm capitalize">
|
||||
{if show_command_prefix { ":e " } else { "" }}
|
||||
<span class=if label == LabelStyle::Name {
|
||||
"text-white text-sm capitalize"
|
||||
} else {
|
||||
"text-white text-sm"
|
||||
}>
|
||||
{if label == LabelStyle::Command { ":e " } else { "" }}
|
||||
{emotion_name_display}
|
||||
</span>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue