Skip to content

Commit

Permalink
Add: Add information for sync
Browse files Browse the repository at this point in the history
  • Loading branch information
whats2000 committed Sep 4, 2024
1 parent 2d8f03e commit 740422e
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 66 deletions.
32 changes: 15 additions & 17 deletions Shared/SharedHeader.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,23 @@

<PageHeader>
<TitleTemplate>
<Flex Align="center" Gap="10">
<Image Preview="false" Height="40" src="Logo.png" alt="banner"/>
<Flex Align="center" Gap="10" Justify="center" Wrap="wrap">
<Image Class="hide-on-mobile" Preview="false" Height="40" src="Logo.png" alt="banner"/>
<Title Level="1" Style="margin-bottom: 0; font-size: 20px;">Pearl Calculator Blazor</Title>
<Tooltip Title="Check for updates">
<div @onclick="@CheckForUpdate">
@if (_currentVersion == "Loading...")
{
<Spin/>
}
else
{
<Text>@_currentVersion</Text>
}
</div>
<Tooltip Style="display: flex; justify-items: center;" Title="@TranslateText.GetTranslateText("CheckForUpdate")">
<Button
Size="@AntSizeLDSType.Small"
Shape="@ButtonShape.Round"
Icon="@IconType.Outline.Sync"
Loading="@(_currentVersion == "Loading...")"
@onclick="CheckForUpdate">
@_currentVersion
</Button>
</Tooltip>
</Flex>
</TitleTemplate>
<PageHeaderExtra>
<Flex Wrap="true" Gap="10">
<Flex Align="center" Gap="10" Justify="center" Wrap="wrap" Style="height: 100%;">
<Dropdown Placement="Placement.BottomRight">
<Overlay>
<Menu DefaultSelectedKeys=@(new[] { "en" })>
Expand Down Expand Up @@ -73,17 +71,17 @@
RenderFragment ModelFooterTemplate =
@<Template>
<Button OnClick="@HandleCancel" @key="@("back")">
Stay in this version
@TranslateText.GetTranslateText("StayVersion")
</Button>
<Button OnClick="@HandleOk"
@key="@("Refresh and Update")"
Type="@ButtonType.Primary">
Refresh and Update
@TranslateText.GetTranslateText("UpdateNow")
</Button>
</Template>;
}

<Modal Title="New version available"
<Modal Title="@TranslateText.GetTranslateText("NewVersionAvailable")"
Visible="@_visible"
OnOk="@HandleOk"
OnCancel="@HandleCancel"
Expand Down
5 changes: 4 additions & 1 deletion Shared/SharedHeader.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected Theme CurrentTheme

private void ShowVersionModal()
{
_modalContent = $"New version: {_latestVersion} found.";
_modalContent = TranslateText.GetTranslateText("NewVersionFound").Replace("{_latestVersion}", _latestVersion);
_visible = true;
StateHasChanged();
}
Expand Down Expand Up @@ -149,6 +149,9 @@ private async void CheckForUpdate()
_currentVersion = "Loading...";
_latestVersion = await JsRuntime.InvokeAsync<string>("FetchVersionFromServer");
_currentVersion = await JsRuntime.InvokeAsync<string>("localStorage.getItem", "PearlCalculatorBlazor_version");

await Task.Delay(1000);

if (_currentVersion == _latestVersion)
{
StateHasChanged();
Expand Down
5 changes: 5 additions & 0 deletions wwwroot/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"CalculatePearlMomentum": "Calculate Pearl Momentum",
"CalculatePearlTrace": "Calculate Pearl Trace",
"CalculateTNTAmount": "Calculate TNT Amount",
"CheckForUpdate": "Check for Update",
"Coordinate": "Coordinate",
"DefaultBlueTNTPos": "Default Blue TNT Position",
"DefaultBlueTNTPosDesc": "Preset the position of the TNT duped from the blue array relative to the pearl without being changed by the slime block",
Expand Down Expand Up @@ -38,6 +39,8 @@
"MomentumX": "Momentum X:",
"MomentumY": "Momentum Y:",
"MomentumZ": "Momentum Z:",
"NewVersionAvailable": "New version available",
"NewVersionFound": "New version: {_latestVersion} found.",
"NormalProjection": "Normal Projection",
"North": "North",
"NorthEast": "NorthEast",
Expand Down Expand Up @@ -66,6 +69,7 @@
"South": "South",
"SouthEast": "SouthEast",
"SouthWest": "SouthWest",
"StayVersion": "Stay on this version",
"TNTCalculationResultTooltip": "Click this row to automatically input the values into the Blue TNT and Red TNT input fields.",
"TNTCalculationSetSuccessMessage": "TNT Calculation Set Successfully",
"TNTWeight": "TNT Weight",
Expand All @@ -76,6 +80,7 @@
"TNTZA": "TNT Z(A):",
"TNTZB": "TNT Z(B):",
"TableMode": "Table Mode",
"UpdateNow": "Update and Refresh the Page",
"West": "West",
"XCoor": "XCoor",
"YCoor": "YCoor",
Expand Down
5 changes: 5 additions & 0 deletions wwwroot/assets/i18n/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"CalculatePearlMomentum": "Simular Vel. Perla",
"CalculatePearlTrace": "Simular Pos. Perla",
"CalculateTNTAmount": "Calcular Cantidades de TNT",
"CheckForUpdate": "Buscar Actualizaciones",
"Coordinate": "Coordenada",
"DefaultBlueTNTPos": "Posición Predet. TNT Azul",
"DefaultBlueTNTPosDesc": "La Posición de la TNT Azul (Respecto a la perla) si el Slime Block no la mueve",
Expand Down Expand Up @@ -38,6 +39,8 @@
"MomentumX": "Velocidad X:",
"MomentumY": "Velocidad Y:",
"MomentumZ": "Velocidad Z:",
"NewVersionAvailable": "Nueva versión disponible",
"NewVersionFound": "Nueva versión: {_latestVersion} encontrada.",
"NormalProjection": "Proyección Normal",
"North": "Norte",
"NorthEast": "Noreste",
Expand Down Expand Up @@ -66,6 +69,7 @@
"South": "Sur",
"SouthEast": "Sudeste",
"SouthWest": "Sudoeste",
"StayVersion": "Mantener esta versión",
"TNTCalculationResultTooltip": "Haga clic en esta fila para ingresar automáticamente los valores en los campos de entrada de TNT Azul y TNT Rojo.",
"TNTCalculationSetSuccessMessage": "Valores de TNT calculados con éxito.",
"TNTWeight": "Peso TNT",
Expand All @@ -76,6 +80,7 @@
"TNTZA": "Z TNT(A):",
"TNTZB": "Z TNT(B):",
"TableMode": "Modo Tabla",
"UpdateNow": "Actualizar y refrescar la página",
"West": "Oeste",
"XCoor": "Pos. X",
"YCoor": "Pos. Y",
Expand Down
5 changes: 5 additions & 0 deletions wwwroot/assets/i18n/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"CalculatePearlMomentum": "计算珍珠动能",
"CalculatePearlTrace": "计算珍珠轨迹",
"CalculateTNTAmount": "计算TNT当量",
"CheckForUpdate": "检查更新",
"ConsoleHeader": "控制台",
"Coordinate": "坐标",
"DefaultBlueTNTPos": "预设蓝色TNT方位",
Expand Down Expand Up @@ -39,6 +40,8 @@
"MomentumX": "X矢量 :",
"MomentumY": "Y矢量 :",
"MomentumZ": "Z矢量 :",
"NewVersionAvailable": "有新版本可用",
"NewVersionFound": "发现新版本:{_latestVersion}。",
"NormalProjection": "正常抛射",
"Offset": "珍珠矫正偏移",
"PearlPosX": "珍珠X坐标 :",
Expand All @@ -61,6 +64,7 @@
"SettingsNorthWestTNT": "North West TNT",
"SettingsSouthEastTNT": "South East TNT",
"SettingsSouthWestTNT": "South West TNT",
"StayVersion": "保留当前版本",
"TNTCalculationResultTooltip": "点击此行可自动将数值输入到蓝色 TNT 和红色 TNT 的输入字段。",
"TNTCalculationSetSuccessMessage": "成功设置 TNT 数量。",
"TNTWeight": "TNT权重",
Expand All @@ -71,6 +75,7 @@
"TNTZA": "TNT(A)的Z坐标 :",
"TNTZB": "TNT(B)的Z坐标 :",
"TableMode": "表格模式",
"UpdateNow": "更新并刷新页面",
"XCoor": "X坐标",
"YCoor": "Y坐标",
"ZCoor": "Z坐标"
Expand Down
5 changes: 5 additions & 0 deletions wwwroot/assets/i18n/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"CalculatePearlMomentum": "計算珍珠動量",
"CalculatePearlTrace": "計算珍珠軌跡",
"CalculateTNTAmount": "計算TNT數量",
"CheckForUpdate": "檢查更新",
"ConsoleHeader": "控制台",
"Coordinate": "座標",
"DefaultBlueTNTPos": "預設藍色TNT方位",
Expand Down Expand Up @@ -39,6 +40,8 @@
"MomentumX": "X動量 :",
"MomentumY": "Y動量 :",
"MomentumZ": "Z動量 :",
"NewVersionAvailable": "有新版本可用",
"NewVersionFound": "發現新版本:{_latestVersion}。",
"NormalProjection": "正常抛射",
"Offset": "珍珠矯正偏移",
"PearlPosX": "珍珠X座標 :",
Expand All @@ -61,6 +64,7 @@
"SettingsNorthWestTNT": "North West TNT",
"SettingsSouthEastTNT": "South East TNT",
"SettingsSouthWestTNT": "South West TNT",
"StayVersion": "保留當前版本",
"TNTCalculationResultTooltip": "點擊此行可自動將數值輸入到藍色 TNT 和紅色 TNT 的輸入欄位。",
"TNTCalculationSetSuccessMessage": "成功設定 TNT 數量。",
"TNTWeight": "TNT最大數量",
Expand All @@ -71,6 +75,7 @@
"TNTZA": "TNT(A)的Z座標 :",
"TNTZB": "TNT(B)的Z座標 :",
"TableMode": "表格模式",
"UpdateNow": "更新並刷新頁面",
"XCoor": "X座標",
"YCoor": "Y座標",
"ZCoor": "Z座標"
Expand Down
100 changes: 53 additions & 47 deletions wwwroot/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,92 +2,98 @@
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html, body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
color: #0366d6;
color: #0366d6;
}

.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}

.content {
padding-top: 1.1rem;
padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
outline: 1px solid #26b050;
outline: 1px solid #26b050;
}

.invalid {
outline: 1px solid red;
outline: 1px solid red;
}

.validation-message {
color: red;
color: red;
}

#blazor-error-ui {
background: lightyellow;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
display: none;
left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed;
width: 100%;
z-index: 1000;
background: lightyellow;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
display: none;
left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed;
width: 100%;
z-index: 1000;
}

#blazor-error-ui .dismiss {
cursor: pointer;
position: absolute;
right: 0.75rem;
top: 0.5rem;
cursor: pointer;
position: absolute;
right: 0.75rem;
top: 0.5rem;
}

#start-up-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
position: absolute;
width: 100%;
background-color: white;
z-index: 1000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
position: absolute;
width: 100%;
background-color: white;
z-index: 1000;
}

#start-up-loading-circle {
border: 4px solid #f3f3f3;
border-top: 6px solid #3498db;
border-radius: 50%;
width: 60px;
height: 60px;
animation: spin 2s linear infinite;
margin-bottom: 20px;
border: 4px solid #f3f3f3;
border-top: 6px solid #3498db;
border-radius: 50%;
width: 60px;
height: 60px;
animation: spin 2s linear infinite;
margin-bottom: 20px;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
100% {
transform: rotate(360deg);
}
}

p {
font-size: 1.5em;
color: #3498db;
font-size: 1.5em;
color: #3498db;
}

/* Button Block */
.button-block > * {
margin-bottom: 12px;
margin-bottom: 12px;
}

.hide-on-mobile {
@media (max-width: 576px) {
display: none;
}
}
2 changes: 1 addition & 1 deletion wwwroot/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "2.71"
"version": "2.71.1"
}

0 comments on commit 740422e

Please sign in to comment.