style<Welcome>: optimize layouts when there's no data in tree or list

This commit is contained in:
leo 2021-09-15 10:23:21 +08:00
parent f190ce7927
commit b134876f8b
5 changed files with 51 additions and 16 deletions

View file

@ -72,4 +72,5 @@
<Geometry x:Key="Icon.Tag.Add">M683 537h-144v-142h-142V283H239a44 44 0 00-41 41v171a56 56 0 0014 34l321 321a41 41 0 0058 0l174-174a41 41 0 000-58zm-341-109a41 41 0 110-58a41 41 0 010 58zM649 284V142h-69v142h-142v68h142v142h69v-142h142v-68h-142z</Geometry> <Geometry x:Key="Icon.Tag.Add">M683 537h-144v-142h-142V283H239a44 44 0 00-41 41v171a56 56 0 0014 34l321 321a41 41 0 0058 0l174-174a41 41 0 000-58zm-341-109a41 41 0 110-58a41 41 0 010 58zM649 284V142h-69v142h-142v68h142v142h69v-142h142v-68h-142z</Geometry>
<Geometry x:Key="Icon.VSCode">M719 85 388 417l-209-165L87 299v427l92 47 210-164L720 939 939 850V171zM186 610V412l104 104zm526 55L514 512l198-153z</Geometry> <Geometry x:Key="Icon.VSCode">M719 85 388 417l-209-165L87 299v427l92 47 210-164L720 939 939 850V171zM186 610V412l104 104zm526 55L514 512l198-153z</Geometry>
<Geometry x:Key="Icon.DragDrop">M597 256h85v85h213a43 43 0 0143 43v320L683 555l2 344 95-92L855 939H384a43 43 0 01-43-43v-213H256v-85h85V384a43 43 0 0143-43h213V256zm341 484V896a43 43 0 01-2 13l-84-145L939 740zM171 597v85H85v-85h85zm0-171v85H85v-85h85zm0-171v85H85V256h85zm0-171v85H85V85h85zm171 0v85H256V85h85zm171 0v85h-85V85h85zm171 0v85h-85V85h85z</Geometry>
</ResourceDictionary> </ResourceDictionary>

View file

@ -296,11 +296,11 @@
<sys:String x:Key="Text.Merge.Into">Into :</sys:String> <sys:String x:Key="Text.Merge.Into">Into :</sys:String>
<sys:String x:Key="Text.Merge.Mode">Merge Option :</sys:String> <sys:String x:Key="Text.Merge.Mode">Merge Option :</sys:String>
<sys:String x:Key="Text.Welcome.Title">SourceGit</sys:String> <sys:String x:Key="Text.Welcome.Title">Free &amp; open source GUI for git users</sys:String>
<sys:String x:Key="Text.Welcome.OpenOrInit">Open local repository</sys:String> <sys:String x:Key="Text.Welcome.OpenOrInit">Open local repository</sys:String>
<sys:String x:Key="Text.Welcome.OpenTerminal">Open terminal</sys:String> <sys:String x:Key="Text.Welcome.OpenTerminal">Open terminal</sys:String>
<sys:String x:Key="Text.Welcome.Clone">Clone remote repository</sys:String> <sys:String x:Key="Text.Welcome.Clone">Clone remote repository</sys:String>
<sys:String x:Key="Text.Welcome.DragDrop">DRAG-DROP YOUR FOLDER</sys:String> <sys:String x:Key="Text.Welcome.DragDrop">DROP FOLDER HERE</sys:String>
<sys:String x:Key="Text.Welcome.Start">START</sys:String> <sys:String x:Key="Text.Welcome.Start">START</sys:String>
<sys:String x:Key="Text.Welcome.Recent">RECENT OPENED</sys:String> <sys:String x:Key="Text.Welcome.Recent">RECENT OPENED</sys:String>
<sys:String x:Key="Text.Welcome.Repositories">REPOSITORIES</sys:String> <sys:String x:Key="Text.Welcome.Repositories">REPOSITORIES</sys:String>

View file

@ -295,7 +295,7 @@
<sys:String x:Key="Text.Merge.Into">目标分支 </sys:String> <sys:String x:Key="Text.Merge.Into">目标分支 </sys:String>
<sys:String x:Key="Text.Merge.Mode">合并方式 </sys:String> <sys:String x:Key="Text.Merge.Mode">合并方式 </sys:String>
<sys:String x:Key="Text.Welcome.Title">欢迎使用本软件</sys:String> <sys:String x:Key="Text.Welcome.Title">开源的轻量级Git图形客户端</sys:String>
<sys:String x:Key="Text.Welcome.OpenOrInit">打开本地仓库</sys:String> <sys:String x:Key="Text.Welcome.OpenOrInit">打开本地仓库</sys:String>
<sys:String x:Key="Text.Welcome.OpenTerminal">打开GIT终端</sys:String> <sys:String x:Key="Text.Welcome.OpenTerminal">打开GIT终端</sys:String>
<sys:String x:Key="Text.Welcome.Clone">克隆远程仓库</sys:String> <sys:String x:Key="Text.Welcome.Clone">克隆远程仓库</sys:String>

View file

@ -9,8 +9,9 @@
d:DesignHeight="800" d:DesignWidth="800"> d:DesignHeight="800" d:DesignWidth="800">
<Grid Background="Transparent" AllowDrop="True" DragEnter="OnPageDragEnter" DragLeave="OnPageDragLeave" Drop="OnPageDrop"> <Grid Background="Transparent" AllowDrop="True" DragEnter="OnPageDragEnter" DragLeave="OnPageDragLeave" Drop="OnPageDrop">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="80"/> <RowDefinition Height="80"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
@ -20,17 +21,27 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- Page Title --> <!-- App Name -->
<TextBlock <TextBlock
Grid.Row="1" Grid.Row="1"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Text="{DynamicResource Text.Welcome.Title}" Text="SourceGit"
FontSize="28pt" FontSize="28pt"
TextOptions.TextFormattingMode="Ideal" TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="ClearType"/> TextOptions.TextRenderingMode="ClearType"/>
<Grid x:Name="body" Grid.Row="2" Grid.Column="1" Margin="0,32" FocusManager.IsFocusScope="True"> <!-- App Desc -->
<TextBlock
Grid.Row="2"
Grid.Column="1"
HorizontalAlignment="Left"
Text="{DynamicResource Text.Welcome.Title}"
Foreground="{DynamicResource Brush.FG2}"
FontSize="20pt"
Margin="0,8"/>
<Grid x:Name="body" Grid.Row="3" Grid.Column="1" Margin="0,40,0,80" FocusManager.IsFocusScope="True">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="16"/> <ColumnDefinition Width="16"/>
@ -75,8 +86,10 @@
<!-- Recents --> <!-- Recents -->
<TextBlock <TextBlock
Grid.Row="2" Margin="0,32,0,0" Grid.Row="2" Margin="0,32,0,0"
x:Name="lblRecent"
Text="{DynamicResource Text.Welcome.Recent}" Text="{DynamicResource Text.Welcome.Recent}"
FontSize="13pt"/> FontSize="13pt"
Visibility="Hidden"/>
<DataGrid <DataGrid
Grid.Row="3" Grid.Row="3"
x:Name="list" x:Name="list"
@ -132,18 +145,27 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- Repositories Label --> <!-- Repositories Label -->
<Grid Grid.Row="0">
<TextBlock <TextBlock
Grid.Row="0"
Text="{DynamicResource Text.Welcome.Repositories}" Text="{DynamicResource Text.Welcome.Repositories}"
FontSize="13pt" FontSize="13pt"
HorizontalAlignment="Left" VerticalAlignment="Center"/> HorizontalAlignment="Left" VerticalAlignment="Center"/>
<!-- Repositories Tree DragDrop tip -->
<StackPanel Grid.Row="1" x:Name="dropTip" Margin="4,16,0,0" HorizontalAlignment="Left" Orientation="Vertical">
<Path
Data="{DynamicResource Icon.DragDrop}"
Fill="{DynamicResource Brush.FG2}"
Width="48" Height="48"
VerticalAlignment="Top"/>
<TextBlock <TextBlock
Text="{DynamicResource Text.Welcome.DragDrop}" Text="{DynamicResource Text.Welcome.DragDrop}"
FontSize="10pt" FontSize="10pt"
HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,8,0,0"
HorizontalAlignment="Center" VerticalAlignment="Top"
Foreground="{DynamicResource Brush.FG2}"/> Foreground="{DynamicResource Brush.FG2}"/>
</Grid> </StackPanel>
<!-- Repositories Tree --> <!-- Repositories Tree -->
<controls:Tree <controls:Tree
@ -245,6 +267,6 @@
</Grid> </Grid>
<!-- Popup --> <!-- Popup -->
<widgets:PopupPanel x:Name="popup" Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="3"/> <widgets:PopupPanel x:Name="popup" Grid.Row="0" Grid.RowSpan="4" Grid.Column="0" Grid.ColumnSpan="3"/>
</Grid> </Grid>
</UserControl> </UserControl>

View file

@ -360,6 +360,12 @@ namespace SourceGit.Views.Widgets {
foreach (var path in dirty) Models.Preference.Instance.RemoveRecent(path); foreach (var path in dirty) Models.Preference.Instance.RemoveRecent(path);
list.ItemsSource = repos; list.ItemsSource = repos;
if (repos.Count == 0) {
lblRecent.Visibility = Visibility.Hidden;
} else {
lblRecent.Visibility = Visibility.Visible;
}
} }
private void UpdateTree(string editingNodeId = null) { private void UpdateTree(string editingNodeId = null) {
@ -411,6 +417,12 @@ namespace SourceGit.Views.Widgets {
} }
tree.ItemsSource = nodes; tree.ItemsSource = nodes;
if (nodes.Count > 0) {
dropTip.Visibility = Visibility.Collapsed;
} else {
dropTip.Visibility = Visibility.Visible;
}
} }
private void DeleteNode(Node node) { private void DeleteNode(Node node) {