1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 21:52:54 +08:00

Centralise INDEX_PATH to WikiOverlay

This commit is contained in:
Joseph Madamba 2024-01-08 14:24:56 -08:00
parent 58619f1684
commit d6ba7a9c6e
2 changed files with 6 additions and 8 deletions

View File

@ -17,8 +17,6 @@ namespace osu.Game.Overlays.Wiki
{ {
public partial class WikiHeader : BreadcrumbControlOverlayHeader public partial class WikiHeader : BreadcrumbControlOverlayHeader
{ {
private const string index_path = "Main_page";
public static LocalisableString IndexPageString => LayoutStrings.HeaderHelpIndex; public static LocalisableString IndexPageString => LayoutStrings.HeaderHelpIndex;
public readonly Bindable<APIWikiPage> WikiPageData = new Bindable<APIWikiPage>(); public readonly Bindable<APIWikiPage> WikiPageData = new Bindable<APIWikiPage>();
@ -45,7 +43,7 @@ namespace osu.Game.Overlays.Wiki
TabControl.AddItem(IndexPageString); TabControl.AddItem(IndexPageString);
if (e.NewValue.Path == index_path) if (e.NewValue.Path == WikiOverlay.INDEX_PATH)
{ {
Current.Value = IndexPageString; Current.Value = IndexPageString;
return; return;

View File

@ -19,11 +19,11 @@ namespace osu.Game.Overlays
{ {
public partial class WikiOverlay : OnlineOverlay<WikiHeader> public partial class WikiOverlay : OnlineOverlay<WikiHeader>
{ {
private const string index_path = "Main_page"; public const string INDEX_PATH = @"Main_page";
public string CurrentPath => path.Value; public string CurrentPath => path.Value;
private readonly Bindable<string> path = new Bindable<string>(index_path); private readonly Bindable<string> path = new Bindable<string>(INDEX_PATH);
private readonly Bindable<APIWikiPage> wikiData = new Bindable<APIWikiPage>(); private readonly Bindable<APIWikiPage> wikiData = new Bindable<APIWikiPage>();
@ -43,7 +43,7 @@ namespace osu.Game.Overlays
{ {
} }
public void ShowPage(string pagePath = index_path) public void ShowPage(string pagePath = INDEX_PATH)
{ {
path.Value = pagePath.Trim('/'); path.Value = pagePath.Trim('/');
Show(); Show();
@ -137,7 +137,7 @@ namespace osu.Game.Overlays
wikiData.Value = response; wikiData.Value = response;
path.Value = response.Path; path.Value = response.Path;
if (response.Layout == index_path.ToLowerInvariant()) if (response.Layout == INDEX_PATH.ToLowerInvariant())
{ {
LoadDisplay(new WikiMainPage LoadDisplay(new WikiMainPage
{ {
@ -161,7 +161,7 @@ namespace osu.Game.Overlays
path.Value = "error"; path.Value = "error";
LoadDisplay(articlePage = new WikiArticlePage($@"{api.WebsiteRootUrl}/wiki/", LoadDisplay(articlePage = new WikiArticlePage($@"{api.WebsiteRootUrl}/wiki/",
$"Something went wrong when trying to fetch page \"{originalPath}\".\n\n[Return to the main page](Main_page).")); $"Something went wrong when trying to fetch page \"{originalPath}\".\n\n[Return to the main page]({INDEX_PATH})."));
} }
private void showParentPage() private void showParentPage()