Skip to content

Commit e503c6d

Browse files
committed
ux: add tooltips for buttons
Signed-off-by: leo <longshuang@msn.cn>
1 parent e5e767a commit e503c6d

4 files changed

Lines changed: 45 additions & 17 deletions

File tree

‎src/Resources/Locales/en_US.axaml‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@
509509
<x:String x:Key="Text.GitLFS.Track" xml:space="preserve">Track files named '{0}'</x:String>
510510
<x:String x:Key="Text.GitLFS.TrackByExtension" xml:space="preserve">Track all *{0} files</x:String>
511511
<x:String x:Key="Text.GotoRevisionSelector" xml:space="preserve">Select Commit</x:String>
512-
<x:String x:Key="Text.Histories" xml:space="preserve">HISTORY</x:String>
512+
<x:String x:Key="Text.Histories" xml:space="preserve">History</x:String>
513513
<x:String x:Key="Text.Histories.Header.Author" xml:space="preserve">AUTHOR</x:String>
514514
<x:String x:Key="Text.Histories.Header.AuthorTime" xml:space="preserve">AUTHOR TIME</x:String>
515515
<x:String x:Key="Text.Histories.Header.CommitTime" xml:space="preserve">COMMIT TIME</x:String>
@@ -554,10 +554,10 @@
554554
<x:String x:Key="Text.Hotkeys.Repo.Push" xml:space="preserve">Push, starts directly</x:String>
555555
<x:String x:Key="Text.Hotkeys.Repo.Refresh" xml:space="preserve">Force to reload this repository</x:String>
556556
<x:String x:Key="Text.Hotkeys.Repo.ToggleSearchCommits" xml:space="preserve">Toggle commit search panel</x:String>
557-
<x:String x:Key="Text.Hotkeys.Repo.ToggleHistoriesDetailPanel" xml:space="preserve">Expand/Collapse details panel in `HISTORY`</x:String>
558-
<x:String x:Key="Text.Hotkeys.Repo.ViewChanges" xml:space="preserve">Switch to 'LOCAL CHANGES'</x:String>
559-
<x:String x:Key="Text.Hotkeys.Repo.ViewHistories" xml:space="preserve">Switch to 'HISTORY'</x:String>
560-
<x:String x:Key="Text.Hotkeys.Repo.ViewStashes" xml:space="preserve">Switch to 'STASHES'</x:String>
557+
<x:String x:Key="Text.Hotkeys.Repo.ToggleHistoriesDetailPanel" xml:space="preserve">Expand/Collapse details panel in `History`</x:String>
558+
<x:String x:Key="Text.Hotkeys.Repo.ViewChanges" xml:space="preserve">Switch to 'Local Changes'</x:String>
559+
<x:String x:Key="Text.Hotkeys.Repo.ViewHistories" xml:space="preserve">Switch to 'History'</x:String>
560+
<x:String x:Key="Text.Hotkeys.Repo.ViewStashes" xml:space="preserve">Switch to 'Stashes'</x:String>
561561
<x:String x:Key="Text.Hunk.Discard" xml:space="preserve">Discard</x:String>
562562
<x:String x:Key="Text.Hunk.Stage" xml:space="preserve">Stage</x:String>
563563
<x:String x:Key="Text.Hunk.Unstage" xml:space="preserve">Unstage</x:String>
@@ -840,6 +840,7 @@
840840
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
841841
<x:String x:Key="Text.Repository.Search.InCurrentBranch" xml:space="preserve">Current Branch</x:String>
842842
<x:String x:Key="Text.Repository.Search.Method" xml:space="preserve">SEARCH BY</x:String>
843+
<x:String x:Key="Text.Repository.Search.ToolTip" xml:space="preserve">Search Commits</x:String>
843844
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">Decorated commits only</x:String>
844845
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">First-parent only</x:String>
845846
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">SHOW FLAGS</x:String>
@@ -857,7 +858,7 @@
857858
<x:String x:Key="Text.Repository.Tags.OrderByName" xml:space="preserve">By Name</x:String>
858859
<x:String x:Key="Text.Repository.Tags.Sort" xml:space="preserve">Sort</x:String>
859860
<x:String x:Key="Text.Repository.Terminal" xml:space="preserve">Open in Terminal</x:String>
860-
<x:String x:Key="Text.Repository.ToggleSidebar" xml:space="preserve">Toggle sidebar</x:String>
861+
<x:String x:Key="Text.Repository.ToggleSidebar" xml:space="preserve">Toggle Sidebar</x:String>
861862
<x:String x:Key="Text.Repository.ViewLogs" xml:space="preserve">View Logs</x:String>
862863
<x:String x:Key="Text.Repository.Visit" xml:space="preserve">Visit '{0}' in Browser</x:String>
863864
<x:String x:Key="Text.Repository.Worktrees" xml:space="preserve">WORKTREES</x:String>
@@ -941,7 +942,7 @@
941942
<x:String x:Key="Text.StashCM.SaveAsPatch" xml:space="preserve">Save as Patch...</x:String>
942943
<x:String x:Key="Text.StashDropConfirm" xml:space="preserve">Drop Stash</x:String>
943944
<x:String x:Key="Text.StashDropConfirm.Label" xml:space="preserve">Drop:</x:String>
944-
<x:String x:Key="Text.Stashes" xml:space="preserve">STASHES</x:String>
945+
<x:String x:Key="Text.Stashes" xml:space="preserve">Stashes</x:String>
945946
<x:String x:Key="Text.Stashes.Changes" xml:space="preserve">CHANGES</x:String>
946947
<x:String x:Key="Text.Stashes.Stashes" xml:space="preserve">STASHES</x:String>
947948
<x:String x:Key="Text.Statistics" xml:space="preserve">Statistics</x:String>
@@ -1017,7 +1018,7 @@
10171018
<x:String x:Key="Text.Welcome.OpenTerminal" xml:space="preserve">Open Terminal</x:String>
10181019
<x:String x:Key="Text.Welcome.ScanDefaultCloneDir" xml:space="preserve">Rescan Repositories in Default Clone Dir</x:String>
10191020
<x:String x:Key="Text.Welcome.Search" xml:space="preserve">Search Repositories...</x:String>
1020-
<x:String x:Key="Text.WorkingCopy" xml:space="preserve">LOCAL CHANGES</x:String>
1021+
<x:String x:Key="Text.WorkingCopy" xml:space="preserve">Local Changes</x:String>
10211022
<x:String x:Key="Text.WorkingCopy.AddToGitIgnore" xml:space="preserve">Git Ignore</x:String>
10221023
<x:String x:Key="Text.WorkingCopy.AddToGitIgnore.Extension" xml:space="preserve">Ignore all *{0} files</x:String>
10231024
<x:String x:Key="Text.WorkingCopy.AddToGitIgnore.ExtensionInSameFolder" xml:space="preserve">Ignore *{0} files in the same folder</x:String>

‎src/Resources/Locales/zh_CN.axaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@
844844
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">提交指纹</x:String>
845845
<x:String x:Key="Text.Repository.Search.InCurrentBranch" xml:space="preserve">仅在当前分支中查找</x:String>
846846
<x:String x:Key="Text.Repository.Search.Method" xml:space="preserve">搜索方式</x:String>
847+
<x:String x:Key="Text.Repository.Search.ToolTip" xml:space="preserve">查找提交</x:String>
847848
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">仅显示分支、标签所引用的提交</x:String>
848849
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">仅显示合并提交中的第一个提交</x:String>
849850
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">显示内容</x:String>

‎src/Views/Launcher.axaml.cs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,6 @@ protected override async void OnKeyDown(KeyEventArgs e)
267267
repo.SelectedViewIndex = 2;
268268
e.Handled = true;
269269
return;
270-
case Key.F when e.KeyModifiers.HasFlag(KeyModifiers.Shift):
271-
repo.IsSearchingCommits = !repo.IsSearchingCommits;
272-
e.Handled = true;
273-
return;
274270
case Key.P when e.KeyModifiers.HasFlag(KeyModifiers.Shift):
275271
vm.CommandPalette = new ViewModels.RepositoryCommandPalette(repo);
276272
e.Handled = true;

‎src/Views/Repository.axaml‎

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,25 @@
5454
</ItemsPanelTemplate>
5555
</ListBox.ItemsPanel>
5656

57-
<ListBoxItem ToolTip.Tip="{DynamicResource Text.Histories}">
57+
<ListBoxItem>
58+
<ToolTip.Tip>
59+
<TextBlock>
60+
<Run Text="{DynamicResource Text.Histories}" Foreground="{DynamicResource Brush.FG1}"/>
61+
<Run Text=" "/>
62+
<Run Text="{OnPlatform Ctrl+1, macOS=⌘+1}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
63+
</TextBlock>
64+
</ToolTip.Tip>
5865
<Path Classes="icon" Data="{StaticResource Icons.Histories}"/>
5966
</ListBoxItem>
6067

61-
<ListBoxItem IsVisible="{Binding !IsBare}" ToolTip.Tip="{DynamicResource Text.WorkingCopy}">
68+
<ListBoxItem IsVisible="{Binding !IsBare}">
69+
<ToolTip.Tip>
70+
<TextBlock>
71+
<Run Text="{DynamicResource Text.WorkingCopy}" Foreground="{DynamicResource Brush.FG1}"/>
72+
<Run Text=" "/>
73+
<Run Text="{OnPlatform Ctrl+2, macOS=⌘+2}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
74+
</TextBlock>
75+
</ToolTip.Tip>
6276
<Grid>
6377
<Path Classes="icon" Data="{StaticResource Icons.Changes}"/>
6478
<Border Height="14"
@@ -81,7 +95,14 @@
8195
</Grid>
8296
</ListBoxItem>
8397

84-
<ListBoxItem IsVisible="{Binding !IsBare}" ToolTip.Tip="{DynamicResource Text.Stashes}">
98+
<ListBoxItem IsVisible="{Binding !IsBare}">
99+
<ToolTip.Tip>
100+
<TextBlock>
101+
<Run Text="{DynamicResource Text.Stashes}" Foreground="{DynamicResource Brush.FG1}"/>
102+
<Run Text=" "/>
103+
<Run Text="{OnPlatform Ctrl+3, macOS=⌘+3}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
104+
</TextBlock>
105+
</ToolTip.Tip>
85106
<Grid>
86107
<Path Classes="icon" Data="{StaticResource Icons.Stashes}"/>
87108
<Border Height="14"
@@ -105,15 +126,24 @@
105126
Margin="4,0"
106127
IsChecked="{Binding IsDashboardVisible, Mode=TwoWay}"
107128
IsVisible="{Binding !IsSearchingCommits, Mode=OneWay}"
108-
ToolTip.Tip="{DynamicResource Text.Repository.ToggleSidebar}"/>
129+
HotKey="{OnPlatform Ctrl+Shift+D, macOS=⌘+Shift+D}">
130+
<ToolTip.Tip>
131+
<TextBlock>
132+
<Run Text="{DynamicResource Text.Repository.ToggleSidebar}" Foreground="{DynamicResource Brush.FG1}"/>
133+
<Run Text=" "/>
134+
<Run Text="{OnPlatform Ctrl+Shift+D, macOS=⌘+⇧+D}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
135+
</TextBlock>
136+
</ToolTip.Tip>
137+
</ToggleButton>
109138
<ToggleButton Grid.Row="3"
110139
Classes="line_path"
111140
Height="40"
112141
Margin="4,8"
142+
HotKey="{OnPlatform Ctrl+Shift+F, macOS=⌘+Shift+F}"
113143
IsChecked="{Binding IsSearchingCommits, Mode=TwoWay}">
114144
<ToolTip.Tip>
115145
<TextBlock>
116-
<Run Text="{DynamicResource Text.Repository.Search}" Foreground="{DynamicResource Brush.FG1}"/>
146+
<Run Text="{DynamicResource Text.Repository.Search.ToolTip}" Foreground="{DynamicResource Brush.FG1}"/>
117147
<Run Text=" "/>
118148
<Run Text="{OnPlatform Ctrl+Shift+F, macOS=⌘+⇧+F}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
119149
</TextBlock>

0 commit comments

Comments
 (0)