Skip to content

Commit 20d89f3

Browse files
authored
Merge pull request #31904 from Joehuu/fix-profile-team-flag-layout
Fix team flag layout on user profile
2 parents 605979e + afc2c52 commit 20d89f3

File tree

2 files changed

+51
-17
lines changed

2 files changed

+51
-17
lines changed

osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs

+7
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,13 @@ public void TestCustomColourSchemeWithReload()
346346
Twitter = "test_user",
347347
Discord = "test_user",
348348
Website = "https://google.com",
349+
Team = new APITeam
350+
{
351+
Id = 1,
352+
Name = "Collective Wangs",
353+
ShortName = "WANG",
354+
FlagUrl = "https://assets.ppy.sh/teams/logo/1/wanglogo.jpg",
355+
}
349356
};
350357
}
351358
}

osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs

+44-17
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ public partial class TopHeaderContainer : CompositeDrawable
4242
private ExternalLinkButton openUserExternally = null!;
4343
private OsuSpriteText titleText = null!;
4444
private UpdateableFlag userFlag = null!;
45-
private UpdateableTeamFlag teamFlag = null!;
4645
private OsuHoverContainer userCountryContainer = null!;
4746
private OsuSpriteText userCountryText = null!;
47+
private UpdateableTeamFlag teamFlag = null!;
48+
private OsuSpriteText teamText = null!;
4849
private GroupBadgeFlow groupBadgeFlow = null!;
4950
private ToggleCoverButton coverToggle = null!;
5051
private PreviousUsernamesDisplay previousUsernamesDisplay = null!;
@@ -155,33 +156,58 @@ private void load(OverlayColourProvider colourProvider, OsuConfigManager configM
155156
titleText = new OsuSpriteText
156157
{
157158
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
158-
Margin = new MarginPadding { Bottom = 5 }
159+
Margin = new MarginPadding { Bottom = 3 },
159160
},
160161
new FillFlowContainer
161162
{
163+
Margin = new MarginPadding { Top = 3 },
162164
AutoSizeAxes = Axes.Both,
163165
Direction = FillDirection.Horizontal,
166+
Spacing = new Vector2(10, 0),
164167
Children = new Drawable[]
165168
{
166-
userFlag = new UpdateableFlag
167-
{
168-
Size = new Vector2(28, 20),
169-
},
170-
teamFlag = new UpdateableTeamFlag
169+
new FillFlowContainer
171170
{
172-
Size = new Vector2(40, 20),
171+
AutoSizeAxes = Axes.Both,
172+
Direction = FillDirection.Horizontal,
173+
Spacing = new Vector2(4, 0),
174+
Children = new Drawable[]
175+
{
176+
userFlag = new UpdateableFlag
177+
{
178+
Size = new Vector2(28, 20),
179+
},
180+
userCountryContainer = new OsuHoverContainer
181+
{
182+
AutoSizeAxes = Axes.Both,
183+
Anchor = Anchor.CentreLeft,
184+
Origin = Anchor.CentreLeft,
185+
Child = userCountryText = new OsuSpriteText
186+
{
187+
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
188+
},
189+
},
190+
}
173191
},
174-
userCountryContainer = new OsuHoverContainer
192+
new FillFlowContainer
175193
{
176194
AutoSizeAxes = Axes.Both,
177-
Anchor = Anchor.CentreLeft,
178-
Origin = Anchor.CentreLeft,
179-
Margin = new MarginPadding { Left = 5 },
180-
Child = userCountryText = new OsuSpriteText
195+
Direction = FillDirection.Horizontal,
196+
Spacing = new Vector2(4, 0),
197+
Children = new Drawable[]
181198
{
182-
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
183-
},
184-
},
199+
teamFlag = new UpdateableTeamFlag
200+
{
201+
Size = new Vector2(40, 20),
202+
},
203+
teamText = new OsuSpriteText
204+
{
205+
Anchor = Anchor.CentreLeft,
206+
Origin = Anchor.CentreLeft,
207+
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
208+
},
209+
}
210+
}
185211
}
186212
},
187213
}
@@ -220,9 +246,10 @@ private void updateUser(UserProfileData? data)
220246
usernameText.Text = user?.Username ?? string.Empty;
221247
openUserExternally.Link = $@"{api.Endpoints.WebsiteUrl}/users/{user?.Id ?? 0}";
222248
userFlag.CountryCode = user?.CountryCode ?? default;
223-
teamFlag.Team = user?.Team;
224249
userCountryText.Text = (user?.CountryCode ?? default).GetDescription();
225250
userCountryContainer.Action = () => rankingsOverlay?.ShowCountry(user?.CountryCode ?? default);
251+
teamFlag.Team = user?.Team;
252+
teamText.Text = user?.Team?.Name ?? string.Empty;
226253
supporterTag.SupportLevel = user?.SupportLevel ?? 0;
227254
titleText.Text = user?.Title ?? string.Empty;
228255
titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff");

0 commit comments

Comments
 (0)