-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
294e1da
commit ec15a54
Showing
12 changed files
with
384 additions
and
22 deletions.
There are no files selected for viewing
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
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,18 @@ | ||
// Copyright (c) David Pine. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
namespace Azure.OpenAI.Client.Extensions; | ||
|
||
public static class StringExtensions | ||
{ | ||
private static readonly MarkdownPipeline s_pipeline = new MarkdownPipelineBuilder() | ||
.ConfigureNewLine("\n") | ||
.UseAdvancedExtensions() | ||
.UseEmojiAndSmiley() | ||
.UseSoftlineBreakAsHardlineBreak() | ||
.Build(); | ||
|
||
public static string ToHtml(this string markdown) => string.IsNullOrWhiteSpace(markdown) is false | ||
? Markdown.ToHtml(markdown, s_pipeline) | ||
: ""; | ||
} |
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,14 @@ | ||
// Copyright (c) David Pine. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
namespace Azure.OpenAI.Client.Models; | ||
|
||
public record class TimelineItem( | ||
DateOnly Date, | ||
string Label, | ||
string Reference, | ||
Detail[] Details); | ||
|
||
public record class Detail( | ||
string Feature, | ||
string? Reference = null); |
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,50 @@ | ||
@page "/history" | ||
|
||
<MudTimeline TimelineAlign="TimelineAlign.Start"> | ||
@foreach (var (index, item) in Items.OrderBy(_ => _.Date).Select((item, i) => (i, item))) | ||
{ | ||
var (date, label, reference, details) = item; | ||
var color = Colors[index % Colors.Length]; | ||
var isEven = index % 2 is 0; | ||
var dateClass = isEven ? "text-align-end" : ""; | ||
var labelClass = !isEven ? "text-align-end" : ""; | ||
|
||
<MudTimelineItem Color="@color" Size="Size.Medium" Variant="Variant.Filled"> | ||
<ItemOpposite> | ||
<MudText Color="@color" Typo="Typo.h4" Class="@dateClass" Style="font-family: monospace;"> | ||
@($"{date:MMMM yyyy}") | ||
</MudText> | ||
</ItemOpposite> | ||
<ItemDot> | ||
<MudIcon Icon="@Icons.Material.Filled.Code" /> | ||
</ItemDot> | ||
<ItemContent> | ||
<MudText GutterBottom="true" Class="@labelClass"> | ||
<MudLink Href="@reference" Target="_blank" Typo="Typo.h4" | ||
Style="font-family: monospace;" Color="@color"> | ||
@label | ||
<MudIcon Icon="@Icons.Material.Filled.OpenInNew" Size="Size.Small" Color="@color" /> | ||
</MudLink> | ||
</MudText> | ||
<MudPaper Class="pa-4 rounded" Width="100%" Outlined="true"> | ||
<MudList Dense="true" Clickable="true" Color="@color"> | ||
@foreach (var (feature, reference) in details.OrderBy(d => d.Feature)) | ||
{ | ||
<MudListItem Icon="@Icons.Material.Filled.CheckCircle" IconSize="Size.Small" | ||
IconColor="@color" Disabled=@(reference is null)> | ||
<MudLink Typo="Typo.body1" Color="Color.Default" Target="_blank" | ||
Style="font-family: monospace;" Href="@(reference ?? "#")"> | ||
@((MarkupString)feature.ToHtml()) | ||
</MudLink> | ||
</MudListItem> | ||
} | ||
</MudList> | ||
</MudPaper> | ||
</ItemContent> | ||
</MudTimelineItem> | ||
} | ||
<MudScrollToTop VisibleCssClass="visible absolute" | ||
HiddenCssClass="invisible"> | ||
<MudFab Color="Color.Primary" IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ArrowUpward" /> | ||
</MudScrollToTop> | ||
</MudTimeline> |
Oops, something went wrong.