diff --git a/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml b/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml index ad3161af..0ebf3f79 100644 --- a/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml +++ b/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml @@ -1,4 +1,4 @@ - + - + @@ -258,16 +258,16 @@ Text="NuGet package" /> - + - + diff --git a/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml.cs b/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml.cs index ced27848..ddbcd721 100644 --- a/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml.cs +++ b/CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml.cs @@ -216,11 +216,35 @@ private async void MarkdownTextBlock_LinkClicked(object sender, LinkClickedEvent public static Uri? ToGitHubUri(string path, int id) => IsProjectPathValid() ? new Uri($"{ProjectUrl}/{path}/{id}") : null; - public static Uri? ToComponentUri(string name) => IsProjectPathValid() ? new Uri($"{ProjectUrl}/tree/main/components/{name}") : null; + public static Uri? ToComponentUri(string name, bool? isExperimental = null) + { + if (IsProjectPathValid() is not true) + { + return null; + } - public static Uri? ToPackageUri(string platform, string projectFileName) => new Uri($"https://www.nuget.org/packages/{RemoveFileExtension(projectFileName).Replace("WinUI", platform)}"); + string? url = (isExperimental is null || isExperimental is false) + ? ProjectUrl + : ProjectUrl?.Replace("Windows", "Labs-Windows"); - public static string ToPackageName(string platform, string projectFileName) => RemoveFileExtension(projectFileName).Replace("WinUI", platform); + return new Uri($"{url}/tree/main/components/{name}"); + } + + public static Uri? ToPackageUri(string platform, string projectFileName, bool? isExperimental = null) + { + if (isExperimental is null || isExperimental is false) + { + return new Uri($"https://www.nuget.org/packages/{ToPackageName(platform, projectFileName, isExperimental)}"); + } + else + { + // Labs feed for experimental packages (currently) + // See inconsistency for Labs package names/project names https://github.com/CommunityToolkit/Windows/issues/587#issuecomment-2738529086 + return new Uri($"https://dev.azure.com/dotnet/CommunityToolkit/_artifacts/feed/CommunityToolkit-Labs/NuGet/{ToPackageName(platform, projectFileName, isExperimental)}"); + } + } + + public static string ToPackageName(string platform, string projectFileName, bool? isExperimental) => RemoveFileExtension(projectFileName).Replace("CommunityToolkit.WinUI", isExperimental == true ? "CommunityToolkit.Labs.WinUI" : "CommunityToolkit.WinUI").Replace("WinUI", platform); // TODO: Think this is most of the special cases with Controls and the Extensions/Triggers using the base namespace // See: https://github.com/CommunityToolkit/Tooling-Windows-Submodule/issues/105#issuecomment-1698306420