Skip to content

Commit 768b324

Browse files
committed
ux: if there are no local changes, show different confirm message (#1143)
Signed-off-by: leo <[email protected]>
1 parent 8b5f491 commit 768b324

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

src/Resources/Locales/en_US.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@
177177
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">Workspaces</x:String>
178178
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">Color</x:String>
179179
<x:String x:Key="Text.ConfigureWorkspace.Restore" xml:space="preserve">Restore tabs on startup</x:String>
180-
<x:String x:Key="Text.ConfirmEmptyCommit.Message" xml:space="preserve">Empty commit detected! Do you want to continue (--allow-empty) or stage all then commit?</x:String>
180+
<x:String x:Key="Text.ConfirmEmptyCommit.WithLocalChanges" xml:space="preserve">Empty commit detected! Do you want to continue (--allow-empty) or stage all then commit?</x:String>
181+
<x:String x:Key="Text.ConfirmEmptyCommit.NoLocalChanges" xml:space="preserve">Empty commit detected! Do you want to continue (--allow-empty)?</x:String>
181182
<x:String x:Key="Text.ConfirmEmptyCommit.Continue" xml:space="preserve">CONTINUE</x:String>
182183
<x:String x:Key="Text.ConfirmEmptyCommit.StageAllThenCommit" xml:space="preserve">STAGE ALL &amp; COMMIT</x:String>
183184
<x:String x:Key="Text.ConventionalCommit" xml:space="preserve">Conventional Commit Helper</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@
181181
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">工作区</x:String>
182182
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">颜色</x:String>
183183
<x:String x:Key="Text.ConfigureWorkspace.Restore" xml:space="preserve">启动时恢复打开的仓库</x:String>
184-
<x:String x:Key="Text.ConfirmEmptyCommit.Message" xml:space="preserve">提交未包含变更文件!是否继续(--allow-empty)或是自动暂存所有变更并提交?</x:String>
184+
<x:String x:Key="Text.ConfirmEmptyCommit.WithLocalChanges" xml:space="preserve">提交未包含变更文件!是否继续(--allow-empty)或是自动暂存所有变更并提交?</x:String>
185+
<x:String x:Key="Text.ConfirmEmptyCommit.NoLocalChanges" xml:space="preserve">提交未包含变更文件!是否继续(--allow-empty)?</x:String>
185186
<x:String x:Key="Text.ConfirmEmptyCommit.Continue" xml:space="preserve">确认继续</x:String>
186187
<x:String x:Key="Text.ConfirmEmptyCommit.StageAllThenCommit" xml:space="preserve">自动暂存并提交</x:String>
187188
<x:String x:Key="Text.ConventionalCommit" xml:space="preserve">规范化提交信息生成</x:String>

src/Resources/Locales/zh_TW.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@
181181
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">工作區</x:String>
182182
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">顏色</x:String>
183183
<x:String x:Key="Text.ConfigureWorkspace.Restore" xml:space="preserve">啟動時還原上次開啟的存放庫</x:String>
184-
<x:String x:Key="Text.ConfirmEmptyCommit.Message" xml:space="preserve">未包含任何檔案變更! 您是否仍要提交 (--allow-empty)或者自動暫存全部變更並提交?</x:String>
184+
<x:String x:Key="Text.ConfirmEmptyCommit.WithLocalChanges" xml:space="preserve">未包含任何檔案變更! 您是否仍要提交 (--allow-empty)或者自動暫存全部變更並提交?</x:String>
185+
<x:String x:Key="Text.ConfirmEmptyCommit.NoLocalChanges" xml:space="preserve">未包含任何檔案變更! 您是否仍要提交 (--allow-empty)?</x:String>
185186
<x:String x:Key="Text.ConfirmEmptyCommit.Continue" xml:space="preserve">确认继续</x:String>
186187
<x:String x:Key="Text.ConfirmEmptyCommit.StageAllThenCommit" xml:space="preserve">自动暂存并提交</x:String>
187188
<x:String x:Key="Text.ConventionalCommit" xml:space="preserve">產生約定式提交訊息</x:String>

src/ViewModels/ConfirmEmptyCommit.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ public bool HasLocalChanges
1010
private set;
1111
}
1212

13+
public string Message
14+
{
15+
get;
16+
private set;
17+
}
18+
1319
public ConfirmEmptyCommit(bool hasLocalChanges, Action<bool> onSure)
1420
{
1521
HasLocalChanges = hasLocalChanges;
22+
Message = App.Text(hasLocalChanges ? "ConfirmEmptyCommit.WithLocalChanges" : "ConfirmEmptyCommit.NoLocalChanges");
1623
_onSure = onSure;
1724
}
1825

src/Views/ConfirmEmptyCommit.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
<!-- Body -->
4040
<Border Grid.Row="1" Margin="16">
41-
<TextBlock Text="{DynamicResource Text.ConfirmEmptyCommit.Message}" MaxWidth="520" TextWrapping="Wrap"/>
41+
<TextBlock Text="{Binding Message}" MaxWidth="520" TextWrapping="Wrap"/>
4242
</Border>
4343

4444
<!-- Buttons -->

0 commit comments

Comments
 (0)