Add website root URL and update most links to use it

For what it's worth, I intentionally didn't include news / changelog /
supporter, because these should never change.
This commit is contained in:
Dean Herbert
2020-12-24 18:11:40 +09:00
parent eb795a2127
commit 323da82477
15 changed files with 57 additions and 24 deletions

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
@ -27,6 +28,9 @@ namespace osu.Game.Overlays.Profile.Header
private Color4 iconColour;
[Resolved]
private IAPIProvider api { get; set; }
public BottomHeaderContainer()
{
AutoSizeAxes = Axes.Y;
@ -109,7 +113,7 @@ namespace osu.Game.Overlays.Profile.Header
}
topLinkContainer.AddText("Contributed ");
topLinkContainer.AddLink($@"{user.PostCount:#,##0} forum posts", $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: embolden);
topLinkContainer.AddLink($@"{user.PostCount:#,##0} forum posts", $"{api.WebsiteRootUrl}/users/{user.Id}/posts", creationParameters: embolden);
string websiteWithoutProtocol = user.Website;

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Users;
using osu.Game.Users.Drawables;
@ -23,6 +24,9 @@ namespace osu.Game.Overlays.Profile.Header
public readonly Bindable<User> User = new Bindable<User>();
[Resolved]
private IAPIProvider api { get; set; }
private SupporterIcon supporterTag;
private UpdateableAvatar avatar;
private OsuSpriteText usernameText;
@ -166,7 +170,7 @@ namespace osu.Game.Overlays.Profile.Header
{
avatar.User = user;
usernameText.Text = user?.Username ?? string.Empty;
openUserExternally.Link = $@"https://osu.ppy.sh/users/{user?.Id ?? 0}";
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
userFlag.Country = user?.Country;
userCountryText.Text = user?.Country?.FullName ?? "Alien";
supporterTag.SupportLevel = user?.SupportLevel ?? 0;