From a9e97d9b35154baa157f386f7f825c475a5ad208 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Mon, 5 Oct 2026 12:09:52 +0800 Subject: [PATCH] feat(ui): show the tag count beside the add-tag button --- YKanBan/Assets/Locales/Resources.resx | 3 +++ YKanBan/Assets/Locales/Resources.zh-Hans.resx | 3 +++ YKanBan/ViewModels/Tags/TagsViewModel.cs | 8 ++++++++ YKanBan/Views/Tags/TagsView.axaml | 17 ++++++++++------- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/YKanBan/Assets/Locales/Resources.resx b/YKanBan/Assets/Locales/Resources.resx index 8c8dc9c..b980deb 100644 --- a/YKanBan/Assets/Locales/Resources.resx +++ b/YKanBan/Assets/Locales/Resources.resx @@ -184,6 +184,9 @@ Add Tag + + {0} tags + No tags yet. diff --git a/YKanBan/Assets/Locales/Resources.zh-Hans.resx b/YKanBan/Assets/Locales/Resources.zh-Hans.resx index e51531e..834db91 100644 --- a/YKanBan/Assets/Locales/Resources.zh-Hans.resx +++ b/YKanBan/Assets/Locales/Resources.zh-Hans.resx @@ -184,6 +184,9 @@ 添加标签 + + {0} 个标签 + 还没有标签。 diff --git a/YKanBan/ViewModels/Tags/TagsViewModel.cs b/YKanBan/ViewModels/Tags/TagsViewModel.cs index ce70928..38db902 100644 --- a/YKanBan/ViewModels/Tags/TagsViewModel.cs +++ b/YKanBan/ViewModels/Tags/TagsViewModel.cs @@ -1,4 +1,5 @@ using System.Collections.ObjectModel; +using System.Globalization; using CommunityToolkit.Mvvm.Input; @@ -47,6 +48,12 @@ public sealed partial class TagsViewModel : ViewModelBase { /// public bool HasNoTags => Tags.Count == 0; + /// + /// Gets the localized total number of tags shown next to the add button. + /// + public string TagCountText => string.Format( + Resources.Culture ?? CultureInfo.CurrentCulture, Resources.Tags_Count, Tags.Count); + /// /// Gets the interaction that opens the new-tag editor. /// @@ -93,6 +100,7 @@ public sealed partial class TagsViewModel : ViewModelBase { OnPropertyChanged(nameof(HasTags)); OnPropertyChanged(nameof(HasNoTags)); + OnPropertyChanged(nameof(TagCountText)); } /// diff --git a/YKanBan/Views/Tags/TagsView.axaml b/YKanBan/Views/Tags/TagsView.axaml index ab28f70..7038478 100644 --- a/YKanBan/Views/Tags/TagsView.axaml +++ b/YKanBan/Views/Tags/TagsView.axaml @@ -11,13 +11,16 @@ - + + + +