From b134876f8b3b0d9c5a09542b4b5c27ac6c130e25 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 15 Sep 2021 10:23:21 +0800 Subject: [PATCH] style: optimize layouts when there's no data in tree or list --- src/Resources/Icons.xaml | 1 + src/Resources/Locales/en_US.xaml | 4 +-- src/Resources/Locales/zh_CN.xaml | 2 +- src/Views/Widgets/Welcome.xaml | 48 ++++++++++++++++++++++--------- src/Views/Widgets/Welcome.xaml.cs | 12 ++++++++ 5 files changed, 51 insertions(+), 16 deletions(-) diff --git a/src/Resources/Icons.xaml b/src/Resources/Icons.xaml index bcb0857d..5528939c 100644 --- a/src/Resources/Icons.xaml +++ b/src/Resources/Icons.xaml @@ -72,4 +72,5 @@ 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 M719 85 388 417l-209-165L87 299v427l92 47 210-164L720 939 939 850V171zM186 610V412l104 104zm526 55L514 512l198-153z + 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 \ No newline at end of file diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index adc447c2..7d49337c 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -296,11 +296,11 @@ Into : Merge Option : - SourceGit + Free & open source GUI for git users Open local repository Open terminal Clone remote repository - DRAG-DROP YOUR FOLDER + DROP FOLDER HERE START RECENT OPENED REPOSITORIES diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index 5bc498af..22688414 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -295,7 +295,7 @@ 目标分支 : 合并方式 : - 欢迎使用本软件 + 开源的轻量级Git图形客户端 打开本地仓库 打开GIT终端 克隆远程仓库 diff --git a/src/Views/Widgets/Welcome.xaml b/src/Views/Widgets/Welcome.xaml index 2eca856f..b0cbb6b0 100644 --- a/src/Views/Widgets/Welcome.xaml +++ b/src/Views/Widgets/Welcome.xaml @@ -9,8 +9,9 @@ d:DesignHeight="800" d:DesignWidth="800"> - + + @@ -20,17 +21,27 @@ - + + + + - + @@ -75,8 +86,10 @@ + FontSize="13pt" + Visibility="Hidden"/> - - + + + + + - + - + diff --git a/src/Views/Widgets/Welcome.xaml.cs b/src/Views/Widgets/Welcome.xaml.cs index 0f5eab61..6c61ba31 100644 --- a/src/Views/Widgets/Welcome.xaml.cs +++ b/src/Views/Widgets/Welcome.xaml.cs @@ -360,6 +360,12 @@ namespace SourceGit.Views.Widgets { foreach (var path in dirty) Models.Preference.Instance.RemoveRecent(path); list.ItemsSource = repos; + + if (repos.Count == 0) { + lblRecent.Visibility = Visibility.Hidden; + } else { + lblRecent.Visibility = Visibility.Visible; + } } private void UpdateTree(string editingNodeId = null) { @@ -411,6 +417,12 @@ namespace SourceGit.Views.Widgets { } tree.ItemsSource = nodes; + + if (nodes.Count > 0) { + dropTip.Visibility = Visibility.Collapsed; + } else { + dropTip.Visibility = Visibility.Visible; + } } private void DeleteNode(Node node) {