Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
266fdb9
WIP: implemented a static function to determine if pandoc is installe…
Apr 8, 2025
e578796
Included expressive Error Messages if pandoc is not installed or the …
Apr 8, 2025
62a4549
Removed patch level from version requirements and included more expre…
Apr 8, 2025
ca98c55
Added a success event to the message bus for better ux
Apr 10, 2025
f7771d9
added temporary buttons for debugging purposes TODO: Delete
Apr 10, 2025
8a890d2
WIP: included function to download pandoc' latest zip into our data dir
Apr 10, 2025
844e305
added warning messages to the message bus
Apr 14, 2025
b60d23a
Added functions to parse the current latest version from gh latest pa…
Apr 14, 2025
331c6ca
WIP: Change pandocs download function to account for different cpu ar…
Apr 14, 2025
09c9834
WIP: Included a pandoc dialog to check for the availability and to in…
Apr 15, 2025
08c1a54
WIP: Included expressive dialog for automatic and manual installation
Apr 15, 2025
d9fb0de
Introduced a flexible code block that enables to show code examples i…
nilskruthoff May 19, 2025
8031e1b
WIP: Extending dialog content to be very descriptive and beginner fri…
nilskruthoff May 19, 2025
49dc848
WIP: finished manual installation guide
May 26, 2025
cecf777
WIP: Adjusted styling for user experience and added installation with…
May 26, 2025
012b28d
Finished dialog and download of installers and archives
nilskruthoff May 26, 2025
81b276b
Finished dialog; installation and availability check logic
nilskruthoff May 27, 2025
b3108fd
finished pandoc logic; removed warnings
nilskruthoff May 27, 2025
647bc00
removed debugging from about page
nilskruthoff May 27, 2025
11ddaf7
Refactor message types for clarity and consistency
SommerEngineering May 29, 2025
175a3e0
Removed unused imports
SommerEngineering May 29, 2025
314a787
Applied optimizations
SommerEngineering May 29, 2025
18a00c6
Formatting
SommerEngineering May 29, 2025
4239243
Merge branch 'main' into pandoc-ui
SommerEngineering May 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Introduced a flexible code block that enables to show code examples i…
…n a tab menu, single blocks or inline code blocks
  • Loading branch information
nilskruthoff committed May 19, 2025
commit d9fb0dedafe8eed0690ca1786bfd22df7ad63bcd
15 changes: 15 additions & 0 deletions app/MindWork AI Studio/Components/CodeBlock.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

@if (!this.IsInline)
{
@if (this.ParentTabs is null)
{
<MudPaper Class="code-block no-elevation" Style="@this.BlockPadding()">
<pre><code>@this.ChildContent</code></pre>
</MudPaper>
}
}
else
{
<span class="inline-code-block"><kbd>@this.ChildContent</kbd></span>
}

42 changes: 42 additions & 0 deletions app/MindWork AI Studio/Components/CodeBlock.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Microsoft.AspNetCore.Components;
using MudBlazor.Utilities;

namespace AIStudio.Components;

public partial class CodeBlock : ComponentBase
{
[Parameter]
public RenderFragment? ChildContent { get; set; }

[Parameter]
public string? Title { get; set; } = string.Empty;

[Parameter]
public bool IsInline { get; set; } = false;

[CascadingParameter]
public CodeTabs? ParentTabs { get; set; }

private static readonly string DARK_BACKGROUND_COLOR = "#2d2d2d";
private static readonly string DARK_FOREGROUND_COLOR = "#f8f8f2";

protected override void OnInitialized()
{
if (this.ParentTabs is not null && this.Title is not null)
{
RenderFragment blockSelf = builder =>
{
builder.OpenComponent<CodeBlock>(0);
builder.AddAttribute(1, "Title", this.Title);
builder.AddAttribute(2, "ChildContent", this.ChildContent);
builder.CloseComponent();
};
this.ParentTabs.RegisterBlock(this.Title, blockSelf);
}
}

private string BlockPadding()
{
return this.ParentTabs is null ? "padding: 16px !important;" : "padding: 8px !important";
}
}
11 changes: 11 additions & 0 deletions app/MindWork AI Studio/Components/CodeTabs.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<MudTabs @bind-ActivePanelIndex="selectedIndex" PanelClass="code-block">
@foreach (var block in blocks)
{
<MudTabPanel Text="@block.Title">
@block.Fragment
</MudTabPanel>
}
</MudTabs>
<CascadingValue Value="this">
@this.ChildContent
</CascadingValue>
28 changes: 28 additions & 0 deletions app/MindWork AI Studio/Components/CodeTabs.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Components;

namespace AIStudio.Components;

public partial class CodeTabs : ComponentBase
{
[Parameter]
public RenderFragment? ChildContent { get; set; }

private List<CodeTabItem> blocks = new();
private int selectedIndex = 0;

internal void RegisterBlock(string title, RenderFragment fragment)
{
this.blocks.Add(new CodeTabItem
{
Title = title,
Fragment = fragment,
});
this.StateHasChanged();
}

private class CodeTabItem
{
public string Title { get; init; } = string.Empty;
public RenderFragment Fragment { get; init; }
}
}