Skip to content

Commit 73d38c4

Browse files
committed
ux: init repo popup tips (#2182)
Signed-off-by: leo <longshuang@msn.cn>
1 parent 6a13c1d commit 73d38c4

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

src/Resources/Locales/en_US.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@
524524
<x:String x:Key="Text.Hunk.Stage" xml:space="preserve">Stage</x:String>
525525
<x:String x:Key="Text.Hunk.Unstage" xml:space="preserve">Unstage</x:String>
526526
<x:String x:Key="Text.Init" xml:space="preserve">Initialize Repository</x:String>
527+
<x:String x:Key="Text.Init.CommandTip" xml:space="preserve">Do you want to run `git init` command under this path?</x:String>
528+
<x:String x:Key="Text.Init.ErrorMessageTip" xml:space="preserve">Open repository failed. Reason: </x:String>
527529
<x:String x:Key="Text.Init.Path" xml:space="preserve">Path:</x:String>
528530
<x:String x:Key="Text.InProgress.CherryPick" xml:space="preserve">Cherry-Pick in progress.</x:String>
529531
<x:String x:Key="Text.InProgress.CherryPick.Head" xml:space="preserve">Processing commit</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@
528528
<x:String x:Key="Text.Hunk.Stage" xml:space="preserve">暂存</x:String>
529529
<x:String x:Key="Text.Hunk.Unstage" xml:space="preserve">移出暂存区</x:String>
530530
<x:String x:Key="Text.Init" xml:space="preserve">初始化新仓库</x:String>
531+
<x:String x:Key="Text.Init.CommandTip" xml:space="preserve">是否在该路径下执行 `git init` 命令(初始化仓库)?</x:String>
532+
<x:String x:Key="Text.Init.ErrorMessageTip" xml:space="preserve">打开本地仓库失败,原因:</x:String>
531533
<x:String x:Key="Text.Init.Path" xml:space="preserve">路径 :</x:String>
532534
<x:String x:Key="Text.InProgress.CherryPick" xml:space="preserve">挑选(Cherry-Pick)操作进行中。</x:String>
533535
<x:String x:Key="Text.InProgress.CherryPick.Head" xml:space="preserve">正在处理提交</x:String>

src/Resources/Locales/zh_TW.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@
528528
<x:String x:Key="Text.Hunk.Stage" xml:space="preserve">暫存</x:String>
529529
<x:String x:Key="Text.Hunk.Unstage" xml:space="preserve">取消暫存</x:String>
530530
<x:String x:Key="Text.Init" xml:space="preserve">初始化存放庫</x:String>
531+
<x:String x:Key="Text.Init.CommandTip" xml:space="preserve">在該路徑執行 git init 以初始化 git 倉庫?</x:String>
532+
<x:String x:Key="Text.Init.ErrorMessageTip" xml:space="preserve">無法在指定路徑開啟本機儲存庫。原因:</x:String>
531533
<x:String x:Key="Text.Init.Path" xml:space="preserve">路徑:</x:String>
532534
<x:String x:Key="Text.InProgress.CherryPick" xml:space="preserve">揀選 (cherry-pick) 操作進行中。</x:String>
533535
<x:String x:Key="Text.InProgress.CherryPick.Head" xml:space="preserve">正在處理提交</x:String>

src/ViewModels/Init.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public Init(string pageId, string path, RepositoryNode parent, string reason)
2121
_pageId = pageId;
2222
_targetPath = path;
2323
_parentNode = parent;
24-
Reason = string.IsNullOrEmpty(reason) ? "Invalid repository detected!" : reason;
24+
25+
Reason = string.IsNullOrEmpty(reason) ? "unknown error" : reason;
26+
Reason = Reason.Trim();
2527
}
2628

2729
public override async Task<bool> Sure()

src/Views/Init.axaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
Classes="bold"
1717
Text="{DynamicResource Text.Init}"/>
1818
</StackPanel>
19-
19+
2020
<Grid Margin="0,16,8,0" ColumnDefinitions="100,*">
2121
<Grid.RowDefinitions>
2222
<RowDefinition Height="32"/>
2323
<RowDefinition Height="Auto" MinHeight="32"/>
24+
<RowDefinition Height="Auto" MinHeight="32"/>
2425
</Grid.RowDefinitions>
2526

2627
<TextBlock Grid.Row="0" Grid.Column="0"
@@ -29,9 +30,17 @@
2930
Margin="0,0,8,0"/>
3031
<TextBlock Grid.Row="0" Grid.Column="1"
3132
Text="{Binding TargetPath}"/>
33+
3234
<TextBlock Grid.Row="1" Grid.Column="1"
3335
Foreground="{DynamicResource Brush.FG2}"
34-
Text="{Binding Reason}"
36+
TextWrapping="Wrap">
37+
<Run Text="{DynamicResource Text.Init.ErrorMessageTip}"/>
38+
<Run Text="{Binding Reason, Mode=OneWay}" />
39+
</TextBlock>
40+
41+
<TextBlock Grid.Row="2" Grid.Column="1"
42+
Margin="0,8,0,0"
43+
Text="{DynamicResource Text.Init.CommandTip}"
3544
TextWrapping="Wrap"/>
3645
</Grid>
3746
</StackPanel>

0 commit comments

Comments
 (0)