Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up the chat commands view #419

Merged
merged 4 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions src/Sidekick.Common.Blazor/Settings/Chat/Chat.razor
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
@page "/settings/chat"
@using Sidekick.Common.Browser;
@layout SettingsLayout
@inherits Sidekick.Common.Ui.Views.SidekickView

<AppTitle Title="@Resources["Settings"]" />
<AppContainer>
<Fieldset Legend="@Resources["Common Commands"]">
<TextBase>@Resources["/hideout - Go to your hideout"]</TextBase>
<TextBase>@Resources["/leave - Leave the current party"]</TextBase>
<TextBase>@Resources["/exit - Exit to character screen"]</TextBase>
</Fieldset>
<Fieldset Legend="@Resources["Chat_Commands"]">
<ButtonLink OnClick="OpenWikiChatCommands">@WikiChatCommands.ToString()</ButtonLink>

<div class="my-3">
<TextBase>@Resources["Chat_Common_Commands"]</TextBase>
</div>

<div class="flex gap-3 mb-1"><code class="bg-stone-950 px-1 min-w-[8em]">/hideout</code>
<TextBase>@Resources["Chat_Commands_Hideout"]</TextBase>
</div>
<div class="flex gap-3 mb-1"><code class="bg-stone-950 px-1 min-w-[8em]">/leave</code>
<TextBase>@Resources["Chat_Commands_Leave"]</TextBase>
</div>
<div class="flex gap-3 mb-1"><code class="bg-stone-950 px-1 min-w-[8em]">/exit</code>
<TextBase>@Resources["Chat_Commands_Exit"]</TextBase>
</div>
<div class="flex gap-3 mb-1">
<code class="bg-stone-950 px-1 min-w-[8em]">/invite @@last</code>
<TextBase>@Resources["Chat_Commands_Invite"]</TextBase>
</div>
<div class="flex gap-3 mb-3">
<code class="bg-stone-950 px-1 min-w-[8em]">/kick @@last</code>
<TextBase>@Resources["Chat_Commands_Kick"]</TextBase>
</div>

<div class="flex gap-3"><code class="bg-stone-950 px-1 min-w-[8em]">@@last</code>
<TextBase>@Resources["Chat_Wildcard_LastWhisper_CharacterName"]</TextBase>
</div>

<Fieldset Legend="@Resources["Wildcards"]">
<TextBase>@Resources["@last - Character name of the last whisper message you received"]</TextBase>
</Fieldset>

<ChatCommandEditor />
</AppContainer>

@inject IStringLocalizer<SettingsResources> Resources
@inject IBrowserProvider Browser

@code {
private Uri WikiChatCommands => new Uri("https://www.poewiki.net/wiki/Chat#Commands");

private void OpenWikiChatCommands()
{
Browser.OpenUri(WikiChatCommands);
}
}
58 changes: 22 additions & 36 deletions src/Sidekick.Common.Blazor/Settings/Chat/ChatCommandEditor.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,46 @@
<div class="border border-solid dark:border-stone-800 p-3 mb-3">
<div class="grid grid-cols-12 gap-2">
<div class="col-span-6">
<FormInput Label="@Resources["Command"]"
Value="@chatSetting.Command"
ValueChanged="(v) => CommandChanged(chatSetting, v)" />
<FormInput Label="@Resources["Chat_Command"]" Value="@chatSetting.Command"
ValueChanged="(v) => CommandChanged(chatSetting, v)" />
</div>
<div class="col-span-6">
<KeybindEditor Value="@chatSetting.Key"
ValueChanged="(v) => KeyChanged(chatSetting, v)"
Label="@Resources["Keybind"]" />
<KeybindEditor Value="@chatSetting.Key" ValueChanged="(v) => KeyChanged(chatSetting, v)"
Label="@Resources["Keybind"]" />
</div>
</div>

<div class="flex items-center justify-between">
<FormCheckbox Value="chatSetting.Submit"
ValueChanged="() => ToggleSubmit(chatSetting)">
@Resources["Submit the command"]
<FormCheckbox Value="chatSetting.Submit" ValueChanged="() => ToggleSubmit(chatSetting)">
@Resources["Chat_Submit_The_Command"]
</FormCheckbox>
<ButtonPrimary OnClick="() => Remove(chatSetting)">
@Resources["Delete Command"]
@Resources["Chat_Commands_Remove"]
</ButtonPrimary>
</div>
</div>
}

<div class="flex justify-between mb-3">
<ButtonSecondary OnClick="RestoreDefaults">
@Resources["Restore Defaults"]
</ButtonSecondary>
<ButtonPrimary OnClick="Add">
@Resources["Add a New Command"]
</ButtonPrimary>
</div>
<Fieldset>
<div class="flex justify-between">
<ButtonSecondary OnClick="RestoreDefaults">
@Resources["Chat_Restore_Defaults"]
</ButtonSecondary>
<ButtonPrimary OnClick="Add">
@Resources["Chat_Add_New_Command"]
</ButtonPrimary>
</div>
</Fieldset>

@inject IStringLocalizer<SettingsResources> Resources
@inject ISettingsService SettingsService

@code {

private List<ChatSetting> ChatSettings { get; set; } =
[
];

private List<ChatSetting> ChatSettings { get; set; } = [];
protected override async Task OnInitializedAsync()
{
ChatSettings = await SettingsService.GetObject<List<ChatSetting>>(SettingKeys.ChatCommands)
??
[
];
ChatSettings = await SettingsService.GetObject<List<ChatSetting>>(SettingKeys.ChatCommands) ?? [];
await base.OnInitializedAsync();
}

Expand All @@ -68,17 +61,13 @@
await Save();
}

private async Task KeyChanged(
ChatSetting chatSetting,
string? key)
private async Task KeyChanged(ChatSetting chatSetting, string? key)
{
chatSetting.Key = key;
await Save();
}

private async Task CommandChanged(
ChatSetting chatSetting,
string? command)
private async Task CommandChanged(ChatSetting chatSetting, string? command)
{
chatSetting.Command = command;
await Save();
Expand All @@ -92,10 +81,7 @@

private async Task RestoreDefaults()
{
ChatSettings =
[
..DefaultSettings.ChatCommands,
];
ChatSettings = [.. DefaultSettings.ChatCommands];
await Save();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
{
if (Active)
{
return "<" + Resources["Press a Key"] + ">";
return Resources["Key_Active"];
}

return string.IsNullOrEmpty(Value) ? "<" + Resources["Unset"] + ">" : Value;
return string.IsNullOrEmpty(Value) ? Resources["Key_Unset"]: Value;
}
}

Expand Down
47 changes: 28 additions & 19 deletions src/Sidekick.Common.Blazor/Settings/SettingsResources.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,17 @@
<data name="Character_League" xml:space="preserve">
<value>Ligue</value>
</data>
<data name="Chat_Add" xml:space="preserve">
<value>Ajouter une nouvelle commande</value>
</data>
<data name="Chat_Commands" xml:space="preserve">
<value>Commandes de chat</value>
</data>
<data name="Chat_Common_Commands" xml:space="preserve">
<value>Commandes communes</value>
</data>
<data name="Chat_Commands_Exit" xml:space="preserve">
<value>/exit - Quitter vers la sélection du personnage</value>
<value>Quitter vers la sélection du personnage</value>
</data>
<data name="Chat_Commands_Hideout" xml:space="preserve">
<value>/hideout - Aller au repaire</value>
</data>
<data name="Chat_Custom" xml:space="preserve">
<value>Commandes personalisées</value>
<value>Aller au repaire</value>
</data>
<data name="Chat_Exit" xml:space="preserve">
<value>Quitter</value>
Expand All @@ -153,17 +147,8 @@
<data name="Chat_Kick" xml:space="preserve">
<value>Expulser du groupe</value>
</data>
<data name="Chat_Submit" xml:space="preserve">
<value>Soumettre la commande</value>
</data>
<data name="Chat_Whisper" xml:space="preserve">
<value>Message privé</value>
</data>
<data name="Chat_Wildcard" xml:space="preserve">
<value>Wildcards</value>
</data>
<data name="Chat_Wildcard_LastWhisper_CharacterName" xml:space="preserve">
<value>@last - Nom de la personne du dernier échange</value>
<value>Nom de la personne du dernier échange</value>
</data>
<data name="General_Settings" xml:space="preserve">
<value>Configurations générales</value>
Expand Down Expand Up @@ -262,7 +247,7 @@
<value>Wealth Tracker</value>
</data>
<data name="Chat_Commands_Leave" xml:space="preserve">
<value>/leave - Quitter le groupe</value>
<value>Quitter le groupe</value>
</data>
<data name="Chat_Commands_Remove" xml:space="preserve">
<value>Retirer cette commande</value>
Expand Down Expand Up @@ -330,4 +315,28 @@
<data name="SaveWindowPositions" xml:space="preserve">
<value>Conserver la position des fenêtres. Si désactivé, les fenêtres seront centrées.</value>
</data>
<data name="Chat_Add_New_Command" xml:space="preserve">
<value>Ajouter une nouvelle commande</value>
</data>
<data name="Chat_Submit_The_Command" xml:space="preserve">
<value>Soumettre la commande</value>
</data>
<data name="Chat_Command" xml:space="preserve">
<value>Commande</value>
</data>
<data name="Keybind" xml:space="preserve">
<value>Raccourci</value>
</data>
<data name="Submit_The_Command" xml:space="preserve">
<value>Soumettre la commande</value>
</data>
<data name="Chat_Restore_Defaults" xml:space="preserve">
<value>Restaurer les commandes par défaut</value>
</data>
<data name="Chat_Commands_Invite" xml:space="preserve">
<value>Inviter un joueur</value>
</data>
<data name="Chat_Commands_Kick" xml:space="preserve">
<value>Expulser un joueur</value>
</data>
</root>
21 changes: 6 additions & 15 deletions src/Sidekick.Common.Blazor/Settings/SettingsResources.ko.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<data name="Character_League" xml:space="preserve">
<value>리그</value>
</data>
<data name="Chat_Add" xml:space="preserve">
<data name="Chat_Add_New_Command" xml:space="preserve">
<value>새로운 명령어 추가</value>
</data>
<data name="Chat_Commands" xml:space="preserve">
Expand All @@ -133,13 +133,10 @@
<value>자주 사용되는 명령어</value>
</data>
<data name="Chat_Commands_Exit" xml:space="preserve">
<value>/exit - 캐릭터 선택창으로 이동</value>
<value>캐릭터 선택창으로 이동</value>
</data>
<data name="Chat_Commands_Hideout" xml:space="preserve">
<value>/hideout - 플레이어의 은신처로 이동</value>
</data>
<data name="Chat_Custom" xml:space="preserve">
<value>사용자 지정 명령어</value>
<value>플레이어의 은신처로 이동</value>
</data>
<data name="Chat_Exit" xml:space="preserve">
<value>캐릭터 선택창으로 이동</value>
Expand All @@ -153,17 +150,11 @@
<data name="Chat_Kick" xml:space="preserve">
<value>파티 탈퇴</value>
</data>
<data name="Chat_Submit" xml:space="preserve">
<data name="Chat_Submit_The_Command" xml:space="preserve">
<value>명령어 제출</value>
</data>
<data name="Chat_Whisper" xml:space="preserve">
<value>귓속말</value>
</data>
<data name="Chat_Wildcard" xml:space="preserve">
<value>특수 명령어</value>
</data>
<data name="Chat_Wildcard_LastWhisper_CharacterName" xml:space="preserve">
<value>@last - 마지막에 귓말을 받은 사람에게 답장할 수 있는 명령어입니다</value>
<value>마지막에 귓말을 받은 사람에게 답장할 수 있는 명령어입니다</value>
</data>
<data name="General_Settings" xml:space="preserve">
<value>일반 세팅</value>
Expand Down Expand Up @@ -262,7 +253,7 @@
<value>Wealth Tracker</value>
</data>
<data name="Chat_Commands_Leave" xml:space="preserve">
<value>/leave - 현재 파티 탈퇴.</value>
<value>현재 파티 탈퇴</value>
</data>
<data name="Chat_Commands_Remove" xml:space="preserve">
<value>명령어 삭제</value>
Expand Down
Loading
Loading