feat: add /mod teleport
This commit is contained in:
parent
45a7e44b3a
commit
3da420fe59
3 changed files with 113 additions and 13 deletions
|
|
@ -17,9 +17,9 @@ enum CommandMode {
|
|||
None,
|
||||
/// Showing command hint for colon commands (`:e[mote], :l[ist]`).
|
||||
ShowingColonHint,
|
||||
/// Showing command hint for slash commands (`/setting`).
|
||||
/// Showing command hint for slash commands (`/setting`, `/mod` for mods).
|
||||
ShowingSlashHint,
|
||||
/// Showing mod command hint (`/mod summon [nick|*]`).
|
||||
/// Showing mod command hints only (`/mod summon [nick|*]`).
|
||||
ShowingModHint,
|
||||
/// Showing emotion list popup.
|
||||
ShowingList,
|
||||
|
|
@ -361,15 +361,21 @@ pub fn ChatInput(
|
|||
}
|
||||
};
|
||||
|
||||
// Check if mod command (only for moderators)
|
||||
let is_mod_command = is_moderator.get_untracked()
|
||||
&& (cmd.starts_with("mod") || "mod".starts_with(&cmd));
|
||||
// Check if typing mod command (only for moderators)
|
||||
// Show mod hint when typing "/mod" or "/mod ..."
|
||||
let is_typing_mod = is_moderator.get_untracked()
|
||||
&& (cmd == "mod" || cmd.starts_with("mod "));
|
||||
// Show /mod in slash hints when just starting to type it
|
||||
let is_partial_mod = is_moderator.get_untracked()
|
||||
&& !cmd.is_empty()
|
||||
&& "mod".starts_with(&cmd)
|
||||
&& cmd != "mod";
|
||||
|
||||
if is_complete_whisper || is_complete_teleport {
|
||||
// User is typing the argument part, no hint needed
|
||||
set_command_mode.set(CommandMode::None);
|
||||
} else if is_mod_command {
|
||||
// Show mod command hint
|
||||
} else if is_typing_mod {
|
||||
// Show mod-specific hint bar
|
||||
set_command_mode.set(CommandMode::ShowingModHint);
|
||||
} else if cmd.is_empty()
|
||||
|| "setting".starts_with(&cmd)
|
||||
|
|
@ -385,6 +391,7 @@ pub fn ChatInput(
|
|||
|| cmd.starts_with("whisper ")
|
||||
|| cmd.starts_with("t ")
|
||||
|| cmd.starts_with("teleport ")
|
||||
|| is_partial_mod
|
||||
{
|
||||
set_command_mode.set(CommandMode::ShowingSlashHint);
|
||||
} else {
|
||||
|
|
@ -826,17 +833,25 @@ pub fn ChatInput(
|
|||
<span class="text-blue-400">"t"</span>
|
||||
<span class="text-gray-500">"[eleport]"</span>
|
||||
</Show>
|
||||
// Show /mod hint for moderators (details shown when typing /mod)
|
||||
<Show when=move || is_moderator.get()>
|
||||
<span class="text-gray-600 mx-2">"|"</span>
|
||||
<span class="text-purple-400">"/"</span>
|
||||
<span class="text-purple-400">"mod"</span>
|
||||
</Show>
|
||||
</div>
|
||||
</Show>
|
||||
|
||||
// Mod command hint bar (/mod summon [nick|*])
|
||||
// Mod command hint bar (shown when typing /mod)
|
||||
<Show when=move || command_mode.get() == CommandMode::ShowingModHint>
|
||||
<div class="absolute bottom-full left-0 mb-1 px-3 py-1 bg-purple-800/90 backdrop-blur-sm rounded text-sm">
|
||||
<span class="text-purple-300 font-medium">"[MOD] "</span>
|
||||
<span class="text-gray-400">"/"</span>
|
||||
<div class="absolute bottom-full left-0 mb-1 px-3 py-1 bg-purple-900/90 backdrop-blur-sm rounded text-sm">
|
||||
<span class="text-purple-400">"/"</span>
|
||||
<span class="text-purple-400">"mod"</span>
|
||||
<span class="text-gray-300">" summon"</span>
|
||||
<span class="text-gray-500">" [nick|*]"</span>
|
||||
<span class="text-purple-300">" summon"</span>
|
||||
<span class="text-purple-500">" [nick|*]"</span>
|
||||
<span class="text-purple-600">" | "</span>
|
||||
<span class="text-purple-300">"teleport"</span>
|
||||
<span class="text-purple-500">" [nick] [slug]"</span>
|
||||
</div>
|
||||
</Show>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue