-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish latest package page, wip versioned display
- Loading branch information
Showing
7 changed files
with
177 additions
and
24 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/PackageRegistryService/Pages/Components/PackageAvailableVersion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using PackageRegistryService.Models; | ||
|
||
namespace PackageRegistryService.Pages.Components | ||
{ | ||
public class PackageAvailableVersion | ||
{ | ||
public static string Render(string packageName, string version) => $@"<a href=""/package/{packageName}/{version}"">{version}</a>"; | ||
|
||
public static string RenderVersionTable(ValidationPackage[] packages) | ||
{ | ||
|
||
var content = $@"<table> | ||
<thead> | ||
<tr> | ||
<th scope=""col"">Version</th> | ||
<th scope=""col"">Released on</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{string.Join( | ||
System.Environment.NewLine, | ||
packages | ||
.OrderByDescending(p => p.MajorVersion) | ||
.ThenByDescending(p => p.MinorVersion) | ||
.ThenByDescending(p => p.PatchVersion) | ||
.Select(p => $@" <tr> | ||
<td>{Render(p.Name, p.GetSemanticVersionString())}</td> | ||
<td>{p.ReleaseDate}</td> | ||
</tr>"))} | ||
</tbody> | ||
"; | ||
return content; | ||
|
||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/PackageRegistryService/Pages/Components/PackageDescription.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace PackageRegistryService.Pages.Components | ||
{ | ||
public class PackageDescription | ||
{ | ||
public static string Render(string description) | ||
{ | ||
return String.Join( | ||
System.Environment.NewLine, | ||
description | ||
.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None) | ||
.Select(l => $@"<p style=""display:block"">{l}</p>") | ||
); | ||
|
||
} | ||
public static string RenderSmall(string description) | ||
{ | ||
return String.Join( | ||
System.Environment.NewLine, | ||
description | ||
.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None) | ||
.Select(l => $@"<small style=""display:block"">{l}</small>") | ||
); | ||
|
||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/PackageRegistryService/Pages/Components/PackageReleaseNotes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace PackageRegistryService.Pages.Components | ||
{ | ||
public class PackageReleaseNotes | ||
{ | ||
public static string Render(string? releaseNotes) | ||
{ | ||
if (releaseNotes == null) | ||
{ | ||
return "<p>No release notes available for this version</p>"; | ||
} | ||
else | ||
{ | ||
return String.Join( | ||
System.Environment.NewLine, | ||
releaseNotes | ||
.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None) | ||
.Select(l => $@"<p style=""display:block"">{l}</p>") | ||
); | ||
} | ||
} | ||
public static string RenderSmall(string? releaseNotes) | ||
{ | ||
if (releaseNotes == null) | ||
{ | ||
return "<p>No release notes available for this version</p>"; | ||
} | ||
else | ||
{ | ||
return String.Join( | ||
System.Environment.NewLine, | ||
releaseNotes | ||
.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None) | ||
.Select(l => $@"<small style=""display:block"">{l}</small>") | ||
); | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace PackageRegistryService.Pages.Components | ||
{ | ||
public class PackageTag | ||
{ | ||
public static string Render(string tagName) => $@"<a href=""/packages?tag={tagName}"">{tagName}</a>"; | ||
|
||
public static string RenderAllInline(string[]? tags) | ||
{ | ||
if (tags == null) | ||
{ | ||
return ""; | ||
} | ||
else | ||
{ | ||
return String.Join("; ", tags.Select(t => Render(t))); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters