From 7cb786184b43953a0a959cc80b670ccc963da63e Mon Sep 17 00:00:00 2001 From: Denis Titovets Date: Tue, 9 Jun 2026 14:39:19 +0300 Subject: [PATCH] Hide user tags section on beatmap overlay if beatmap doesn't have user tags (#37476) this empty section constantly caught my eye, now it matches web | master | `osu-web` | PR | |-|-|-| | image | image | image | | image | image | image | also slightly reordered some local variables for convenience, can be reverted if you want to keep previous order --- osu.Game/Overlays/BeatmapSet/Info.cs | 17 ++++++----------- .../BeatmapSet/MetadataSectionUserTags.cs | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index e25c1370c5..e5dfd03e27 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -23,18 +23,19 @@ namespace osu.Game.Overlays.BeatmapSet private readonly Box successRateBackground; private readonly Box background; - private readonly MetadataSection userTags; public readonly Bindable BeatmapSet = new Bindable(); public readonly Bindable Beatmap = new Bindable(); public Info() { - SuccessRate successRate; MetadataSectionNominators nominators; - MetadataSection source, mapperTags; + MetadataSectionSource source; MetadataSectionGenre genre; MetadataSectionLanguage language; + MetadataSectionUserTags userTags; + MetadataSectionMapperTags mapperTags; + SuccessRate successRate; RelativeSizeAxes = Axes.X; Height = base_height; @@ -115,23 +116,17 @@ namespace osu.Game.Overlays.BeatmapSet { nominators.Metadata = (b.NewValue?.CurrentNominations ?? Array.Empty(), b.NewValue?.RelatedUsers ?? Array.Empty()); source.Metadata = b.NewValue?.Source ?? string.Empty; - mapperTags.Metadata = b.NewValue?.Tags ?? string.Empty; - updateUserTags(); genre.Metadata = b.NewValue?.Genre ?? new BeatmapSetOnlineGenre { Id = (int)SearchGenre.Unspecified }; language.Metadata = b.NewValue?.Language ?? new BeatmapSetOnlineLanguage { Id = (int)SearchLanguage.Unspecified }; + mapperTags.Metadata = b.NewValue?.Tags ?? string.Empty; }); Beatmap.BindValueChanged(b => { + userTags.Metadata = b.NewValue?.GetTopUserTags().Select(t => t.Tag.Name).ToArray() ?? Array.Empty(); successRate.Beatmap = b.NewValue; - updateUserTags(); }); } - private void updateUserTags() - { - userTags.Metadata = Beatmap.Value?.GetTopUserTags().Select(t => t.Tag.Name).ToArray(); - } - [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { diff --git a/osu.Game/Overlays/BeatmapSet/MetadataSectionUserTags.cs b/osu.Game/Overlays/BeatmapSet/MetadataSectionUserTags.cs index 3a9fe8d33f..c44c5fb994 100644 --- a/osu.Game/Overlays/BeatmapSet/MetadataSectionUserTags.cs +++ b/osu.Game/Overlays/BeatmapSet/MetadataSectionUserTags.cs @@ -2,17 +2,32 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Framework.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.Chat; namespace osu.Game.Overlays.BeatmapSet { - public partial class MetadataSectionUserTags : MetadataSection + public partial class MetadataSectionUserTags : MetadataSection { private readonly Action? searchAction; + public override string[] Metadata + { + set + { + if (value.Length == 0) + { + this.FadeOut(TRANSITION_DURATION); + return; + } + + base.Metadata = value; + } + } + public MetadataSectionUserTags(Action? searchAction = null) - : base(MetadataType.UserTags, null) + : base(MetadataType.UserTags) { this.searchAction = searchAction; }