Skip to content

Commit

Permalink
Feat: Rename the key of the view
Browse files Browse the repository at this point in the history
  • Loading branch information
whats2000 committed Sep 4, 2024
1 parent 687cdbf commit 6e09dda
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 28 deletions.
21 changes: 10 additions & 11 deletions Components/GeneralFTL.razor
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
@page "/GeneralFTL"

@using PearlCalculatorBlazor.Localizer

<div class="calculator-general-root-default">
<Card>
<CardTabs>
<Tabs @bind-ActiveKey="_activeKey">
<TabPane Key="GFTL_General" Tab="@TranslateText.GetTranslateText("GFTL_General")">
<TabPane Key="GeneralFtlGeneral" Tab="@TranslateText.GetTranslateText("GeneralFtlGeneral")">
<ChildContent>
<GeneralFTL_General/>
</ChildContent>
</TabPane>

<TabPane Key="GFTL_Advanced" Tab="@TranslateText.GetTranslateText("GFTL_Advanced")">
<TabPane Key="GeneralFtlAdvanced" Tab="@TranslateText.GetTranslateText("GeneralFtlAdvanced")">
<ChildContent>
<GeneralFTL_Advanced/>
</ChildContent>
</TabPane>

<TabPane Key="GFTL_Settings" Tab="@TranslateText.GetTranslateText("GFTL_Settings")">
<TabPane Key="GeneralFtlSettings" Tab="@TranslateText.GetTranslateText("GeneralFtlSettings")">
<ChildContent>
<GeneralFTL_Settings/>
</ChildContent>
Expand All @@ -32,7 +31,7 @@
<Space Direction="DirectionVHType.Vertical" Style="width: 100%">
<SpaceItem>
<Select DataSource="@_selectList"
DefaultValue="@("GFTL_General")"
DefaultValue="@("GeneralFtlGeneral")"
@bind-Value="_activeKey"
ValueName="@nameof(Array.ActiveKey)"
LabelName="@nameof(Array.DisplayName)"
Expand All @@ -41,20 +40,20 @@
</SpaceItem>
<Divider></Divider>
<SpaceItem>
@if (_activeKey == "GFTL_General")
@if (_activeKey == "GeneralFtlGeneral")
{
<GeneralFTL_General/>
<GeneralFTL_General/>
}
else if (_activeKey == "GFTL_Advanced")
else if (_activeKey == "GeneralFtlAdvanced")
{
<GeneralFTL_Advanced/>
<GeneralFTL_Advanced/>
}
else
{
<GeneralFTL_Settings/>
<GeneralFTL_Settings/>
}
</SpaceItem>
</Space>
</div>

@code { private string _activeKey = "GFTL_General"; }
@code { private string _activeKey = "GeneralFtlGeneral"; }
15 changes: 12 additions & 3 deletions Components/GeneralFTL.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@ protected override void OnInitialized()
{
_selectList = new List<Array>
{
new() { ActiveKey = "GFTL_General", DisplayName = TranslateText.GetTranslateText("GFTL_General") },
new() { ActiveKey = "GFTL_Advanced", DisplayName = TranslateText.GetTranslateText("GFTL_Advanced") },
new() { ActiveKey = "GFTL_Settings", DisplayName = TranslateText.GetTranslateText("GFTL_Settings") }
new()
{
ActiveKey = "GeneralFtlGeneral", DisplayName = TranslateText.GetTranslateText("GeneralFtlGeneral")
},
new()
{
ActiveKey = "GeneralFtlAdvanced", DisplayName = TranslateText.GetTranslateText("GeneralFtlAdvanced")
},
new()
{
ActiveKey = "GeneralFtlSettings", DisplayName = TranslateText.GetTranslateText("GeneralFtlSettings")
}
};

TranslateText.OnLanguageChange += RefreshPage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void ChangeTntWeight()
var isSortByWeightedDistance = SelectSortMode == SortMode.SortByWeightedDistance;
EventManager.Instance.PublishEvent(this,
isSortByWeightedDistance ? "sortByWeightedDistance" : "sortByWeightedTotal",
new ButtonClickArgs("GFTL_Advanced"));
new ButtonClickArgs("GeneralFtlAdvanced"));
}

[JSInvokable]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace PearlCalculatorBlazor.Components.GeneralFTLComponents;

public partial class GeneralFTL_General
{
private const string PublishKey = "GFTL_General";
private const string PublishKey = "GeneralFtlGeneral";

private static readonly SettingsJsonConverter JsonConverter = new();

Expand Down
6 changes: 3 additions & 3 deletions wwwroot/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"GeneralHeader": "General FTL",
"ManuallyHeader": "Manually",

"GFTL_General": "General",
"GFTL_Advanced": "Advanced",
"GFTL_Settings": "Settings",
"GeneralFtlGeneral": "General",
"GeneralFtlAdvanced": "Advanced",
"GeneralFtlSettings": "Settings",

"PearlPosX": "Pearl X :",
"PearlPosY": "Pearl Y :",
Expand Down
6 changes: 3 additions & 3 deletions wwwroot/assets/i18n/es_ES.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"GeneralHeader": "FTL General",
"ManuallyHeader": "Manual",
"GFTL_General": "General",
"GFTL_Advanced": "Avanzado",
"GFTL_Settings": "Configuración",
"GeneralFtlGeneral": "General",
"GeneralFtlAdvanced": "Avanzado",
"GeneralFtlSettings": "Configuración",
"PearlPosX": "X Perla :",
"PearlPosY": "Y Perla :",
"PearlPosZ": "Z Perla :",
Expand Down
6 changes: 3 additions & 3 deletions wwwroot/assets/i18n/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"GeneralHeader": "通用FTL",
"ManuallyHeader": "自定义FTL",

"GFTL_General": "一般选项",
"GFTL_Advanced": "进阶选项",
"GFTL_Settings": "更多基础选项",
"GeneralFtlGeneral": "一般选项",
"GeneralFtlAdvanced": "进阶选项",
"GeneralFtlSettings": "更多基础选项",

"PearlPosX": "珍珠X坐标 :",
"PearlPosY": "珍珠Y坐标 :",
Expand Down
6 changes: 3 additions & 3 deletions wwwroot/assets/i18n/zh_tw.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"GeneralHeader": "通用FTL",
"ManuallyHeader": "自訂義FTL",
"GFTL_General": "一般設定",
"GFTL_Advanced": "進階設定",
"GFTL_Settings": "更多基礎設定",
"GeneralFtlGeneral": "一般設定",
"GeneralFtlAdvanced": "進階設定",
"GeneralFtlSettings": "更多基礎設定",
"PearlPosX": "珍珠X座標 :",
"PearlPosY": "珍珠Y座標 :",
"PearlPosZ": "珍珠Z座標 :",
Expand Down

0 comments on commit 6e09dda

Please sign in to comment.