ux: if there are no local changes, show different confirm message (#1143)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-04-08 20:05:44 +08:00
parent 8b5f491e34
commit 768b324356
No known key found for this signature in database
5 changed files with 14 additions and 4 deletions

View file

@ -177,7 +177,8 @@
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">Workspaces</x:String> <x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">Workspaces</x:String>
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">Color</x:String> <x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">Color</x:String>
<x:String x:Key="Text.ConfigureWorkspace.Restore" xml:space="preserve">Restore tabs on startup</x:String> <x:String x:Key="Text.ConfigureWorkspace.Restore" xml:space="preserve">Restore tabs on startup</x:String>
<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> <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>
<x:String x:Key="Text.ConfirmEmptyCommit.NoLocalChanges" xml:space="preserve">Empty commit detected! Do you want to continue (--allow-empty)?</x:String>
<x:String x:Key="Text.ConfirmEmptyCommit.Continue" xml:space="preserve">CONTINUE</x:String> <x:String x:Key="Text.ConfirmEmptyCommit.Continue" xml:space="preserve">CONTINUE</x:String>
<x:String x:Key="Text.ConfirmEmptyCommit.StageAllThenCommit" xml:space="preserve">STAGE ALL &amp; COMMIT</x:String> <x:String x:Key="Text.ConfirmEmptyCommit.StageAllThenCommit" xml:space="preserve">STAGE ALL &amp; COMMIT</x:String>
<x:String x:Key="Text.ConventionalCommit" xml:space="preserve">Conventional Commit Helper</x:String> <x:String x:Key="Text.ConventionalCommit" xml:space="preserve">Conventional Commit Helper</x:String>

View file

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

View file

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

View file

@ -10,9 +10,16 @@ namespace SourceGit.ViewModels
private set; private set;
} }
public string Message
{
get;
private set;
}
public ConfirmEmptyCommit(bool hasLocalChanges, Action<bool> onSure) public ConfirmEmptyCommit(bool hasLocalChanges, Action<bool> onSure)
{ {
HasLocalChanges = hasLocalChanges; HasLocalChanges = hasLocalChanges;
Message = App.Text(hasLocalChanges ? "ConfirmEmptyCommit.WithLocalChanges" : "ConfirmEmptyCommit.NoLocalChanges");
_onSure = onSure; _onSure = onSure;
} }

View file

@ -38,7 +38,7 @@
<!-- Body --> <!-- Body -->
<Border Grid.Row="1" Margin="16"> <Border Grid.Row="1" Margin="16">
<TextBlock Text="{DynamicResource Text.ConfirmEmptyCommit.Message}" MaxWidth="520" TextWrapping="Wrap"/> <TextBlock Text="{Binding Message}" MaxWidth="520" TextWrapping="Wrap"/>
</Border> </Border>
<!-- Buttons --> <!-- Buttons -->