Skip to content

Commit

Permalink
Merge pull request #24461 from Joehuu/changelog-entry-links
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy authored Aug 4, 2023
2 parents 270c032 + d179fe3 commit e13eb75
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
9 changes: 8 additions & 1 deletion osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,14 @@ public void ShowWithBuild(bool isSupporter)
Type = ChangelogEntryType.Misc,
Category = "Code quality",
Title = "Clean up another thing"
}
},
new APIChangelogEntry
{
Type = ChangelogEntryType.Add,
Category = "osu!",
Title = "Add entry with news url",
Url = "https://osu.ppy.sh/home/news/2023-07-27-summer-splash"
},
}
});

Expand Down
22 changes: 18 additions & 4 deletions osu.Game/Overlays/Changelog/ChangelogEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online;
using osu.Game.Online.API.Requests.Responses;
using osuTK;
using osuTK.Graphics;
Expand All @@ -29,6 +30,9 @@ public partial class ChangelogEntry : FillFlowContainer
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;

[Resolved]
private ILinkHandler? linkHandler { get; set; }

private FontUsage fontLarge;
private FontUsage fontMedium;

Expand Down Expand Up @@ -86,11 +90,21 @@ private Drawable createTitle()
}
};

title.AddText(entry.Title, t =>
if (string.IsNullOrEmpty(entry.Url))
{
t.Font = fontLarge;
t.Colour = entryColour;
});
title.AddText(entry.Title, t =>
{
t.Font = fontLarge;
t.Colour = entryColour;
});
}
else
{
title.AddLink(entry.Title, () => linkHandler?.HandleLink(entry.Url), entry.Url, t =>
{
t.Font = fontLarge;
});
}

if (!string.IsNullOrEmpty(entry.Repository) && !string.IsNullOrEmpty(entry.GithubUrl))
addRepositoryReference(title, entryColour);
Expand Down

0 comments on commit e13eb75

Please sign in to comment.