From 62319a541e4ab32271d77f8b37e7724e2d4c289c Mon Sep 17 00:00:00 2001 From: Tom Brewer Date: Sun, 6 Sep 2026 18:31:33 -0600 Subject: [PATCH 1/3] chore: upgrade Mythetech.Framework to 0.18.1 Apollo was on Mythetech.Framework 0.3.3 / WebAssembly 0.3.0. The jump to 0.18.1 brings MudBlazor 8.14 -> 9.3 transitively, which is where all the breaking changes came from. - Bump Microsoft.AspNetCore.Components.WebAssembly (and DevServer) plus Microsoft.Extensions.Configuration.FileExtensions to 10.0.5 to match the framework's floor and avoid an NU1605 downgrade error - Migrate the event viewer timeline off the removed MudTimeSeriesChart to the unified MudChart with ChartType.Timeseries. TimeSeriesChartSeries is now ChartSeries, AxisChartOptions folded into TimeSeriesChartOptions and the MatchBoundsToSize component parameter, and per-series line/area selection moved to SeriesDisplayOverrides - IDialogService.ShowMessageBox is now ShowMessageBoxAsync - MudBlazor's ToDescriptionString() enum extension is gone in v9 --- Apollo.Components/Code/TypeTab.razor | 2 +- .../Shared/ApolloSwitch/ApolloSwitch.razor | 2 +- .../Shared/ApolloSwitch/ApolloSwitch.razor.cs | 12 ++-- .../Consumers/DeleteSolutionPrompter.cs | 2 +- .../Tools/EventViewerDialog.razor | 60 ++++++++----------- Directory.Packages.props | 10 ++-- 6 files changed, 40 insertions(+), 48 deletions(-) diff --git a/Apollo.Components/Code/TypeTab.razor b/Apollo.Components/Code/TypeTab.razor index ac3ea1e..d398328 100644 --- a/Apollo.Components/Code/TypeTab.razor +++ b/Apollo.Components/Code/TypeTab.razor @@ -166,7 +166,7 @@ } catch (Exception ex) { - await DialogService.ShowMessageBox("Error", $"Failed to create instance: {ex.Message}"); + await DialogService.ShowMessageBoxAsync("Error", $"Failed to create instance: {ex.Message}"); } } diff --git a/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor b/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor index 8abbb96..4c18412 100644 --- a/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor +++ b/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor @@ -7,7 +7,7 @@ - + @if (!string.IsNullOrEmpty(ThumbIcon) && BoolValue == true) { diff --git a/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor.cs b/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor.cs index fa762f2..86ccb95 100644 --- a/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor.cs +++ b/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor.cs @@ -20,8 +20,8 @@ public partial class ApolloSwitch : MudBooleanInput new CssBuilder("mud-switch-m3") .AddClass($"mud-disabled", GetDisabledState()) .AddClass($"mud-readonly", GetReadOnlyState()) - .AddClass($"mud-switch-label-{Size.ToDescriptionString()}") - .AddClass($"mud-input-content-placement-{ConvertPlacement(LabelPlacement).ToDescriptionString()}") + .AddClass($"mud-switch-label-{Size.ToString().ToLowerInvariant()}") + .AddClass($"mud-input-content-placement-{ConvertPlacement(LabelPlacement).ToString().ToLowerInvariant()}") .AddClass("mud-width-full") .AddClass(Class) .Build(); @@ -40,8 +40,8 @@ public partial class ApolloSwitch : MudBooleanInput protected string? SwitchClassname => new CssBuilder("mud-button-root mud-icon-button mud-switch-base-m3") .AddClass($"mud-ripple mud-ripple-switch", Ripple && !GetReadOnlyState() && !GetDisabledState()) - .AddClass($"mud-{Color.ToDescriptionString()}-text hover:mud-{Color.ToDescriptionString()}-hover", BoolValue == true) - //.AddClass($"mud-{UnCheckedColor.ToDescriptionString()}-text hover:mud-{UnCheckedColor.ToDescriptionString()}-hover", BoolValue == false) + .AddClass($"mud-{Color.ToString().ToLowerInvariant()}-text hover:mud-{Color.ToString().ToLowerInvariant()}-hover", BoolValue == true) + //.AddClass($"mud-{UnCheckedColor.ToString().ToLowerInvariant()}-text hover:mud-{UnCheckedColor.ToString().ToLowerInvariant()}-hover", BoolValue == false) .AddClass($"mud-switch-disabled", GetDisabledState()) .AddClass($"mud-readonly", GetReadOnlyState()) .AddClass($"mud-checked", BoolValue) @@ -53,8 +53,8 @@ public partial class ApolloSwitch : MudBooleanInput /// protected string? TrackClassname => new CssBuilder("mud-switch-track-m3") - .AddClass($"mud-{Color.ToDescriptionString()}", BoolValue == true) - .AddClass($"mud-switch-track-{Color.ToDescriptionString()}-m3") + .AddClass($"mud-{Color.ToString().ToLowerInvariant()}", BoolValue == true) + .AddClass($"mud-switch-track-{Color.ToString().ToLowerInvariant()}-m3") .Build(); /// diff --git a/Apollo.Components/Solutions/Consumers/DeleteSolutionPrompter.cs b/Apollo.Components/Solutions/Consumers/DeleteSolutionPrompter.cs index 7fb1d3d..53ba2ed 100644 --- a/Apollo.Components/Solutions/Consumers/DeleteSolutionPrompter.cs +++ b/Apollo.Components/Solutions/Consumers/DeleteSolutionPrompter.cs @@ -30,7 +30,7 @@ public async Task Consume(PromptDeleteSolution message) if (!_state.HasActiveSolution) return; - var result = await _dialogService.ShowMessageBox( + var result = await _dialogService.ShowMessageBoxAsync( "Delete Solution", $"Are you sure you want to delete solution '{_state.Project.Name}'? This cannot be undone.", yesText: "Delete", diff --git a/Apollo.Components/Tools/EventViewerDialog.razor b/Apollo.Components/Tools/EventViewerDialog.razor index fa4db81..725c78f 100644 --- a/Apollo.Components/Tools/EventViewerDialog.razor +++ b/Apollo.Components/Tools/EventViewerDialog.razor @@ -89,15 +89,15 @@ - + Selected: @(_timelineSelectedIndex < 0 || _timelineSelectedIndex >= _timelineSeries.Count ? "None" : _timelineSeries[_timelineSelectedIndex].Name) @@ -116,26 +116,23 @@ private IReadOnlyList _events = Array.Empty(); private IReadOnlyList _aggregate = Array.Empty(); - private readonly ChartOptions _timelineOptions = new() + private readonly TimeSeriesChartOptions _timelineOptions = new() { YAxisLines = false, XAxisLines = false, YAxisRequireZeroPoint = true, LineStrokeWidth = 2, MaxNumYAxisTicks = 6, - }; - - private readonly AxisChartOptions _timelineAxisOptions = new() - { - MatchBoundsToSize = true, XAxisLabelRotation = 0, + LineDisplayType = LineDisplayType.Area, + TimeLabelSpacing = TimeSpan.FromMinutes(1), + TooltipTimeLabelFormat = "yyyy MMM dd HH:mm:ss", }; - private readonly List _timelineSeries = new(); + private readonly List> _timelineSeries = new(); private int _timelineSelectedIndex = -1; private readonly string _timelineWidth = "100%"; private readonly string _timelineHeight = "220px"; - private TimeSpan _timelineLabelSpacing = TimeSpan.FromMinutes(1); private const int _timelineTopTypesCount = 5; protected override void OnInitialized() @@ -164,6 +161,7 @@ private void RebuildTimeline() { _timelineSeries.Clear(); + _timelineOptions.SeriesDisplayOverrides.Clear(); _timelineSelectedIndex = -1; if (_events.Count == 0) @@ -173,7 +171,7 @@ var max = _events.Max(x => x.Timestamp.UtcDateTime); var bucketSize = ChooseBucketSize(max - min); - _timelineLabelSpacing = bucketSize >= TimeSpan.FromMinutes(5) ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(1); + _timelineOptions.TimeLabelSpacing = bucketSize >= TimeSpan.FromMinutes(5) ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(1); var topTypes = _aggregate .Take(_timelineTopTypesCount) @@ -206,36 +204,30 @@ var orderedBuckets = buckets.ToList(); orderedBuckets.Sort(); - var index = 0; - _timelineSeries.Add(new TimeSeriesChartSeries + var totalSeries = new ChartSeries { - Index = index++, Name = "All", Data = orderedBuckets - .Select(b => new TimeSeriesChartSeries.TimeValue(b, totalByBucket.TryGetValue(b, out var c) ? c : 0)) + .Select(b => (b, totalByBucket.TryGetValue(b, out var c) ? c : 0)) .ToList(), - IsVisible = true, - LineDisplayType = LineDisplayType.Line, - DataMarkerTooltipTitleFormat = "{{X_VALUE}}", - DataMarkerTooltipSubtitleFormat = "{{Y_VALUE}}" - }); + Visible = true, + }; + + _timelineSeries.Add(totalSeries); + _timelineOptions.SeriesDisplayOverrides[totalSeries] = new SeriesDisplayOverride { LineDisplayType = LineDisplayType.Line }; foreach (var type in _aggregate.Take(_timelineTopTypesCount).Select(x => x.EventType)) { if (!byTypeByBucket.TryGetValue(type, out var typeBuckets)) typeBuckets = new Dictionary(); - _timelineSeries.Add(new TimeSeriesChartSeries + _timelineSeries.Add(new ChartSeries { - Index = index++, Name = ShortTypeName(type), Data = orderedBuckets - .Select(b => new TimeSeriesChartSeries.TimeValue(b, typeBuckets.TryGetValue(b, out var c) ? c : 0)) + .Select(b => (b, typeBuckets.TryGetValue(b, out var c) ? c : 0)) .ToList(), - IsVisible = true, - LineDisplayType = LineDisplayType.Area, - DataMarkerTooltipTitleFormat = "{{X_VALUE}}", - DataMarkerTooltipSubtitleFormat = "{{Y_VALUE}}" + Visible = true, }); } } diff --git a/Directory.Packages.props b/Directory.Packages.props index ba590f7..2896bd6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,11 +7,11 @@ - - + + - - + + @@ -34,7 +34,7 @@ - + From 151f069e64cad1d0d014e16f35832dd1ece1cee4 Mon Sep 17 00:00:00 2001 From: Tom Brewer Date: Sun, 6 Sep 2026 18:31:33 -0600 Subject: [PATCH 2/3] ci: add PR test workflow and dependabot config Dependabot needs a check on PRs it opens. static.yml already ran tests on pull_request, but it is the deploy pipeline and its test job is entangled with the Pages concurrency group, so give PRs their own workflow matching the one in Aion, Iris, and Siren. Also corrects setup-dotnet in static.yml, which asked for 9.0 while global.json pins SDK 10.0.100 with allowPrerelease false. That only worked because the runner image happened to ship a 10.x SDK. --- .github/dependabot.yml | 15 +++++++++++++++ .github/workflows/pr.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/static.yml | 4 ++-- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/pr.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..dec201e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +version: 2 +updates: + - package-ecosystem: "nuget" + directory: "/" + schedule: + interval: "daily" + allow: + - dependency-name: "Mythetech.*" + groups: + mythetech: + patterns: + - "Mythetech.*" + open-pull-requests-limit: 3 + commit-message: + prefix: "chore" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..b03ca7c --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,31 @@ +name: PR Tests + +on: + pull_request: + branches: [ "main" ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Install .NET WASM workload + run: dotnet workload install wasm-tools + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore --configuration Release + + - name: Unit tests + run: dotnet test Apollo.Test/Apollo.Test.csproj --no-build --configuration Release --verbosity normal diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 588f64f..e3dcd67 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -40,7 +40,7 @@ jobs: - name: Get latest .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: "9.0" + dotnet-version: "10.0.x" - name: Install .Net WASM workload run: dotnet workload install wasm-tools @@ -70,7 +70,7 @@ jobs: - name: Get latest .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: "9.0" + dotnet-version: "10.0.x" - name: Install .Net WASM workload run: dotnet workload install wasm-tools From 88a190d21f4a1dd1db6a8d9d0c17aebbe0220d8a Mon Sep 17 00:00:00 2001 From: Tom Brewer Date: Sun, 6 Sep 2026 18:31:33 -0600 Subject: [PATCH 3/3] refactor: drop Apollo copies of code the framework now owns Several Apollo types were upstreamed into Mythetech.Framework after Apollo pinned 0.3.3, and the framework versions have since gained fixes Apollo's forks never got. Now that Apollo is on 0.18.1, delete the local copies. - IRuntimeEnvironment and WebAssemblyRuntimeEnvironment: the framework ships both, plus AddRuntimeEnvironment(). Its interface adds a Platform member, and IsDevelopment/IsProduction compare case-insensitively rather than against lowercase literals - PlatformInfo: framework version adds IsWindows, IsLinux and GetMetaKeyName - ApolloNotificationBar and AddApolloNotification: framework's MythetechNotificationBar configures per-severity action and icon colors, a longer error duration, and a blurred background - ProgressCountdown (only used by the notification bar): framework version fixes truncation from integer division and marshals StateHasChanged - ApolloSwitch: identical to MtSwitch apart from MtSwitch honoring disabled and readonly state on the input element. This also removes 236 lines of M3 switch CSS from app.css that duplicated MtSwitch's scoped stylesheet; the settings-switch class keeps the full-width label/control spread that ApolloSwitch got from mud-width-full plus a MudSpacer --- .../WebAssemblyRuntimeEnvironment.cs | 21 -- Apollo.Client/Program.cs | 5 +- .../Editor/AboutApolloDialog.razor | 2 +- Apollo.Components/Editor/TabViewState.cs | 2 +- Apollo.Components/Editor/ToolsMenu.razor | 2 +- .../Hosting/WebApiRouteTab.razor | 4 +- .../Environment/IRuntimeEnvironment.cs | 22 -- .../Keyboard/KeyboardIconButton.razor | 2 +- .../Infrastructure/Platform/PlatformInfo.cs | 15 -- .../Settings/SettingsDialog.razor | 12 +- .../ApolloNotificationBar.razor | 29 --- .../SnackbarExtensions.cs | 17 -- .../Shared/ApolloSwitch/ApolloSwitch.razor | 35 --- .../Shared/ApolloSwitch/ApolloSwitch.razor.cs | 169 ------------ .../Shared/Loaders/ProgressCountdown.razor | 45 ---- .../Solutions/Base64OpenDialog.razor | 8 +- .../Commands/PromptOpenBase64Solution.cs | 2 +- .../Solutions/Commands/ShareSolution.cs | 6 +- .../Solutions/Consumers/Base64Exporter.cs | 4 +- .../Consumers/DeleteSolutionPrompter.cs | 4 +- .../Solutions/Consumers/DocumentFormatter.cs | 4 +- .../Solutions/Consumers/FileOpener.cs | 4 +- .../Solutions/Consumers/FolderOpener.cs | 8 +- .../Consumers/OpenBase64SolutionPrompter.cs | 2 +- .../Solutions/GitHubOpenDialog.razor | 6 +- .../CommandServices/VersionCommand.cs | 2 +- .../Tools/Consumers/GuidGenerator.cs | 4 +- .../Tools/Consumers/GuidV7Generator.cs | 4 +- .../Tools/JsonFormatterDialog.razor | 6 +- .../Tools/JsonToCSharpDialog.razor | 6 +- .../Tools/RegexTesterDialog.razor | 6 +- Apollo.Components/wwwroot/app.css | 244 +----------------- .../Components/Code/ActiveTypeStateTests.cs | 3 +- .../TestingRuntimeEnvironment.cs | 4 +- 34 files changed, 64 insertions(+), 645 deletions(-) delete mode 100644 Apollo.Client/Infrastructure/WebAssemblyRuntimeEnvironment.cs delete mode 100644 Apollo.Components/Infrastructure/Environment/IRuntimeEnvironment.cs delete mode 100644 Apollo.Components/Infrastructure/Platform/PlatformInfo.cs delete mode 100644 Apollo.Components/Shared/ApolloNotificationBar/ApolloNotificationBar.razor delete mode 100644 Apollo.Components/Shared/ApolloNotificationBar/SnackbarExtensions.cs delete mode 100644 Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor delete mode 100644 Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor.cs delete mode 100644 Apollo.Components/Shared/Loaders/ProgressCountdown.razor diff --git a/Apollo.Client/Infrastructure/WebAssemblyRuntimeEnvironment.cs b/Apollo.Client/Infrastructure/WebAssemblyRuntimeEnvironment.cs deleted file mode 100644 index 3553f74..0000000 --- a/Apollo.Client/Infrastructure/WebAssemblyRuntimeEnvironment.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Reflection; -using Apollo.Components.Infrastructure.Environment; -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; - -namespace Apollo.Client.Infrastructure; - -public class WebAssemblyRuntimeEnvironment : IRuntimeEnvironment -{ - private readonly IWebAssemblyHostEnvironment _host; - - public WebAssemblyRuntimeEnvironment(IWebAssemblyHostEnvironment host) - { - _host = host; - } - - public string Name => _host.Environment; - - public Version Version => Assembly.GetEntryAssembly()?.GetName().Version ?? new Version(0, 0); - - public string BaseAddress => _host.BaseAddress; -} \ No newline at end of file diff --git a/Apollo.Client/Program.cs b/Apollo.Client/Program.cs index fd74e07..40cd4b6 100644 --- a/Apollo.Client/Program.cs +++ b/Apollo.Client/Program.cs @@ -4,13 +4,12 @@ using Apollo.Client.Analysis; using Apollo.Client.Code; using Apollo.Client.Hosting; -using Apollo.Client.Infrastructure; using Apollo.Components; using Apollo.Components.Analysis; using Apollo.Components.Code; using Apollo.Components.Hosting; using Apollo.Components.Infrastructure; -using Apollo.Components.Infrastructure.Environment; +using Mythetech.Framework.WebAssembly; using Mythetech.Framework.Infrastructure.MessageBus; using Apollo.Infrastructure.Resources; using Mythetech.Framework.Infrastructure.Mcp; @@ -23,7 +22,7 @@ builder.Services.AddMessageBus(typeof(Program).Assembly, typeof(AppState).Assembly, typeof(IConsumer<>).Assembly); -builder.Services.AddSingleton(); +builder.Services.AddRuntimeEnvironment(); builder.Services.AddComponentsAndServices(); builder.Services.AddMcp(); //ToDO - fix in framework, shouldn't be required diff --git a/Apollo.Components/Editor/AboutApolloDialog.razor b/Apollo.Components/Editor/AboutApolloDialog.razor index d1257e3..2a5f193 100644 --- a/Apollo.Components/Editor/AboutApolloDialog.razor +++ b/Apollo.Components/Editor/AboutApolloDialog.razor @@ -1,5 +1,5 @@ @using System.Reflection -@using Apollo.Components.Infrastructure.Environment +@using Mythetech.Framework.Infrastructure.Environment @using Apollo.Components.Shared diff --git a/Apollo.Components/Editor/TabViewState.cs b/Apollo.Components/Editor/TabViewState.cs index a035c67..45f1497 100644 --- a/Apollo.Components/Editor/TabViewState.cs +++ b/Apollo.Components/Editor/TabViewState.cs @@ -2,7 +2,7 @@ using Apollo.Components.Code; using Apollo.Components.DynamicTabs; using Apollo.Components.Hosting; -using Apollo.Components.Infrastructure.Environment; +using Mythetech.Framework.Infrastructure.Environment; using Apollo.Components.Infrastructure.Logging; using Apollo.Components.Library; using Apollo.Components.Preview; diff --git a/Apollo.Components/Editor/ToolsMenu.razor b/Apollo.Components/Editor/ToolsMenu.razor index 0810915..4690eb2 100644 --- a/Apollo.Components/Editor/ToolsMenu.razor +++ b/Apollo.Components/Editor/ToolsMenu.razor @@ -1,5 +1,5 @@ @using Mythetech.Framework.Infrastructure.MessageBus -@using Apollo.Components.Infrastructure.Environment +@using Mythetech.Framework.Infrastructure.Environment @using Apollo.Components.NuGet.Commands @using Apollo.Components.Tools.Commands @using Apollo.Components.Theme diff --git a/Apollo.Components/Hosting/WebApiRouteTab.razor b/Apollo.Components/Hosting/WebApiRouteTab.razor index c63ebe8..9dbeb64 100644 --- a/Apollo.Components/Hosting/WebApiRouteTab.razor +++ b/Apollo.Components/Hosting/WebApiRouteTab.razor @@ -4,7 +4,7 @@ @using Apollo.Components.Hosting.Commands @using Mythetech.Framework.Infrastructure.MessageBus @using Apollo.Components.Shared -@using Apollo.Components.Shared.ApolloNotificationBar +@using Mythetech.Framework.Components.Snackbar @using Apollo.Components.Solutions @using Apollo.Components.Solutions.Commands @using Apollo.Components.Theme @@ -126,7 +126,7 @@ } catch (Exception ex) { - Snackbar.AddApolloNotification(ex.Message, Severity.Error); + Snackbar.AddMythetechNotification(ex.Message, Severity.Error); } } diff --git a/Apollo.Components/Infrastructure/Environment/IRuntimeEnvironment.cs b/Apollo.Components/Infrastructure/Environment/IRuntimeEnvironment.cs deleted file mode 100644 index ad74974..0000000 --- a/Apollo.Components/Infrastructure/Environment/IRuntimeEnvironment.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Apollo.Components.Infrastructure.Environment; - -public interface IRuntimeEnvironment -{ - public string Name { get; } - - public Version Version { get; } - - public string BaseAddress { get; } -} - -public static class IRuntimeEnvironmentExtensions -{ - public static bool IsEnvironment(this IRuntimeEnvironment runtime, string environment) - => string.Equals(environment, runtime.Name, StringComparison.OrdinalIgnoreCase); - - public static bool IsDevelopment(this IRuntimeEnvironment runtime) - => runtime.IsEnvironment("development"); - - public static bool IsProduction(this IRuntimeEnvironment runtime) - => runtime.IsEnvironment("production"); -} \ No newline at end of file diff --git a/Apollo.Components/Infrastructure/Keyboard/KeyboardIconButton.razor b/Apollo.Components/Infrastructure/Keyboard/KeyboardIconButton.razor index 9c8917a..5fe1de0 100644 --- a/Apollo.Components/Infrastructure/Keyboard/KeyboardIconButton.razor +++ b/Apollo.Components/Infrastructure/Keyboard/KeyboardIconButton.razor @@ -1,4 +1,4 @@ -@using Apollo.Components.Infrastructure.Platform +@using Mythetech.Framework.Infrastructure.Platform @using Microsoft.FluentUI.AspNetCore.Components.Extensions @using Microsoft.JSInterop @inherits Apollo.Components.Infrastructure.ApolloBaseComponent diff --git a/Apollo.Components/Infrastructure/Platform/PlatformInfo.cs b/Apollo.Components/Infrastructure/Platform/PlatformInfo.cs deleted file mode 100644 index 8515546..0000000 --- a/Apollo.Components/Infrastructure/Platform/PlatformInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Apollo.Components.Infrastructure.Platform; - -public static class PlatformInfo -{ - public static bool IsMac(string? userAgent) - { - if (string.IsNullOrEmpty(userAgent)) return false; - return userAgent.Contains("Mac", StringComparison.OrdinalIgnoreCase); - } - - public static string GetMetaKeySymbol(string? userAgent) - { - return IsMac(userAgent) ? "⌘" : "\u229e"; - } -} \ No newline at end of file diff --git a/Apollo.Components/Settings/SettingsDialog.razor b/Apollo.Components/Settings/SettingsDialog.razor index 4dc0014..7184e24 100644 --- a/Apollo.Components/Settings/SettingsDialog.razor +++ b/Apollo.Components/Settings/SettingsDialog.razor @@ -9,7 +9,7 @@ @using Apollo.Components.Settings.Events @using Apollo.Components.Shared @using Apollo.Components.Theme -@using Apollo.Components.Shared.ApolloSwitch +@using Mythetech.Framework.Components.Switch @using Microsoft.JSInterop @using Apollo.Components.Shared @implements IDisposable @@ -152,16 +152,16 @@ - + - - - - @foreach (string message in Message.Split(Environment.NewLine)) - { - @message - } - - - -@code { - [Inject] protected ISnackbar Snackbar { get; set; } = default!; - - [Parameter] public string Message { get; set; } = ""; - - [Parameter] public Severity Severity { get; set; } = Severity.Info; - - private Color GetColor(Severity severity) - { - return severity switch - { - Severity.Success => Color.Success, - Severity.Error => Color.Error, - Severity.Warning => Color.Warning, - Severity.Info => Color.Info, - _ => Color.Primary - }; - } -} \ No newline at end of file diff --git a/Apollo.Components/Shared/ApolloNotificationBar/SnackbarExtensions.cs b/Apollo.Components/Shared/ApolloNotificationBar/SnackbarExtensions.cs deleted file mode 100644 index 56f3e11..0000000 --- a/Apollo.Components/Shared/ApolloNotificationBar/SnackbarExtensions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using MudBlazor; - -namespace Apollo.Components.Shared.ApolloNotificationBar; - -public static class SnackbarExtensions -{ - public static void AddApolloNotification(this ISnackbar snackbar, string message, Severity severity = Severity.Info) - { - var parameters = new Dictionary - { - { "Message", message }, - {"Severity", severity} - }; - - snackbar.Add(parameters, severity); - } -} \ No newline at end of file diff --git a/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor b/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor deleted file mode 100644 index 4c18412..0000000 --- a/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor +++ /dev/null @@ -1,35 +0,0 @@ -@inherits MudBooleanInput -@typeparam T -@namespace Apollo.Components.Shared.ApolloSwitch - - \ No newline at end of file diff --git a/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor.cs b/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor.cs deleted file mode 100644 index 86ccb95..0000000 --- a/Apollo.Components/Shared/ApolloSwitch/ApolloSwitch.razor.cs +++ /dev/null @@ -1,169 +0,0 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; -using MudBlazor; -using MudBlazor.Extensions; -using MudBlazor.Services; -using MudBlazor.Utilities; - -namespace Apollo.Components.Shared.ApolloSwitch -{ - /// - /// Switch component with M3 specifications. - /// - /// - public partial class ApolloSwitch : MudBooleanInput - { - /// - /// - /// - protected override string? Classname => - new CssBuilder("mud-switch-m3") - .AddClass($"mud-disabled", GetDisabledState()) - .AddClass($"mud-readonly", GetReadOnlyState()) - .AddClass($"mud-switch-label-{Size.ToString().ToLowerInvariant()}") - .AddClass($"mud-input-content-placement-{ConvertPlacement(LabelPlacement).ToString().ToLowerInvariant()}") - .AddClass("mud-width-full") - .AddClass(Class) - .Build(); - - /// - /// - /// - protected string? SwitchSpanClassname => - new CssBuilder("mud-switch-span-m3 mud-flip-x-rtl") - .AddClass("mud-switch-child-content-m3", ChildContent != null || !string.IsNullOrEmpty(Label)) - .Build(); - - /// - /// - /// - protected string? SwitchClassname => - new CssBuilder("mud-button-root mud-icon-button mud-switch-base-m3") - .AddClass($"mud-ripple mud-ripple-switch", Ripple && !GetReadOnlyState() && !GetDisabledState()) - .AddClass($"mud-{Color.ToString().ToLowerInvariant()}-text hover:mud-{Color.ToString().ToLowerInvariant()}-hover", BoolValue == true) - //.AddClass($"mud-{UnCheckedColor.ToString().ToLowerInvariant()}-text hover:mud-{UnCheckedColor.ToString().ToLowerInvariant()}-hover", BoolValue == false) - .AddClass($"mud-switch-disabled", GetDisabledState()) - .AddClass($"mud-readonly", GetReadOnlyState()) - .AddClass($"mud-checked", BoolValue) - .AddClass("mud-switch-base-dense-m3", !string.IsNullOrEmpty(ThumbOffIcon)) - .Build(); - - /// - /// - /// - protected string? TrackClassname => - new CssBuilder("mud-switch-track-m3") - .AddClass($"mud-{Color.ToString().ToLowerInvariant()}", BoolValue == true) - .AddClass($"mud-switch-track-{Color.ToString().ToLowerInvariant()}-m3") - .Build(); - - /// - /// - /// - protected string? IconStylename => - new StyleBuilder() - .AddStyle("width: 16px; height: 16px;") - .AddStyle("color", "var(--mud-palette-background)", !string.IsNullOrEmpty(ThumbOffIcon)) - .Build(); - - [Inject] private IKeyInterceptorService KeyInterceptorService { get; set; } = null!; - - /// - /// Shows an icon on Switch's thumb. - /// - [Parameter] - [MudBlazor.Category(CategoryTypes.FormComponent.Appearance)] - public string? ThumbIcon { get; set; } - - /// - /// Shows an icon on Switch's thumb (off state). - /// - [Parameter] - [MudBlazor.Category(CategoryTypes.FormComponent.Appearance)] - public string? ThumbOffIcon { get; set; } - - /// - /// Keydown event. - /// - /// - protected internal async Task HandleKeyDownAsync(KeyboardEventArgs obj) - { - if (Disabled || ReadOnly) - return; - switch (obj.Key) - { - case "ArrowLeft": - case "Delete": - await SetBoolValueAsync(false); - break; - case "ArrowRight": - case "Enter": - case "NumpadEnter": - await SetBoolValueAsync(true); - break; - case " ": - if (BoolValue == true) - { - await SetBoolValueAsync(false); - } - else - { - await SetBoolValueAsync(true); - } - break; - } - } - - private string _elementId = "switchm3_" + Guid.NewGuid().ToString().Substring(0, 8); - - /// - /// - /// - protected override void OnInitialized() - { - base.OnInitialized(); - - if (Label == null && For != null) - Label = For.GetLabelString(); - } - - /// - /// - /// - /// - /// - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - var options = new KeyInterceptorOptions( - "mud-switch-base", - [ - // prevent scrolling page, instead increment - new("ArrowUp", preventDown: "key+none"), - // prevent scrolling page, instead decrement - new("ArrowDown", preventDown: "key+none"), - new(" ", preventDown: "key+none", preventUp: "key+none") - ]); - - await KeyInterceptorService.SubscribeAsync(_elementId, options, keyDown: HandleKeyDownAsync); - } - await base.OnAfterRenderAsync(firstRender); - } - - /// - /// - /// - /// - protected override async ValueTask DisposeAsyncCore() - { - await base.DisposeAsyncCore(); - - if (IsJSRuntimeAvailable) - { - await KeyInterceptorService.UnsubscribeAsync(_elementId); - } - } - - } -} \ No newline at end of file diff --git a/Apollo.Components/Shared/Loaders/ProgressCountdown.razor b/Apollo.Components/Shared/Loaders/ProgressCountdown.razor deleted file mode 100644 index 09dfd32..0000000 --- a/Apollo.Components/Shared/Loaders/ProgressCountdown.razor +++ /dev/null @@ -1,45 +0,0 @@ -@implements IDisposable - - -@code { - private bool _disposed; - - [Parameter] public int Duration { get; set; } = 5000; - - [Parameter] public Color Color { get; set; } = Color.Primary; - - [Parameter] public bool Rounded { get; set; } = true; - - [Parameter] public bool Striped { get; set; } = false; - - private int Value { get; set; } = 100; - - protected override async Task OnInitializedAsync() - { - await base.OnInitializedAsync(); - await StartCountdownAsync(Duration); - } - - private async Task StartCountdownAsync(int durationInSeconds) - { - var interval = 100; - var totalIntervals = durationInSeconds / interval; - - for (int i = 0; i < totalIntervals; i++) - { - if (_disposed) - { - return; - } - - Value = 100 - (int)((i / (float)totalIntervals) * 100); - StateHasChanged(); - await Task.Delay(interval); - } - - Value = 0; - StateHasChanged(); - } - - public void Dispose() => _disposed = true; -} \ No newline at end of file diff --git a/Apollo.Components/Solutions/Base64OpenDialog.razor b/Apollo.Components/Solutions/Base64OpenDialog.razor index afde427..cb14a85 100644 --- a/Apollo.Components/Solutions/Base64OpenDialog.razor +++ b/Apollo.Components/Solutions/Base64OpenDialog.razor @@ -1,5 +1,5 @@ @using Apollo.Components.Shared -@using Apollo.Components.Shared.ApolloNotificationBar +@using Mythetech.Framework.Components.Snackbar @using Apollo.Components.Solutions.Services @inject ISnackbar Snackbar @inject Base64Service Base64Service @@ -68,12 +68,12 @@ var solution = Base64Service.DecodeSolution(base64); if (solution == null) { - Snackbar.AddApolloNotification("Invalid solution data", Severity.Error); + Snackbar.AddMythetechNotification("Invalid solution data", Severity.Error); return; } await State.LoadSolutionAsync(solution); - Snackbar.AddApolloNotification($"Opened solution: {solution.Name}", Severity.Success); + Snackbar.AddMythetechNotification($"Opened solution: {solution.Name}", Severity.Success); MudDialog.Close(DialogResult.Ok(true)); } @@ -91,7 +91,7 @@ } catch (Exception ex) { - Snackbar.AddApolloNotification($"Failed to open solution: {ex.Message}", Severity.Error); + Snackbar.AddMythetechNotification($"Failed to open solution: {ex.Message}", Severity.Error); } finally { diff --git a/Apollo.Components/Solutions/Commands/PromptOpenBase64Solution.cs b/Apollo.Components/Solutions/Commands/PromptOpenBase64Solution.cs index 6aec161..ab84586 100644 --- a/Apollo.Components/Solutions/Commands/PromptOpenBase64Solution.cs +++ b/Apollo.Components/Solutions/Commands/PromptOpenBase64Solution.cs @@ -1,5 +1,5 @@ using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Solutions.Services; using MudBlazor; diff --git a/Apollo.Components/Solutions/Commands/ShareSolution.cs b/Apollo.Components/Solutions/Commands/ShareSolution.cs index 3ab8cf7..baddba3 100644 --- a/Apollo.Components/Solutions/Commands/ShareSolution.cs +++ b/Apollo.Components/Solutions/Commands/ShareSolution.cs @@ -1,5 +1,5 @@ using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Solutions.Services; using Microsoft.AspNetCore.Components; using MudBlazor; @@ -34,7 +34,7 @@ public async Task Consume(ShareSolution message) { if (_state.Project == null) { - _snackbar.AddApolloNotification("No solution is currently open", Severity.Warning); + _snackbar.AddMythetechNotification("No solution is currently open", Severity.Warning); return; } @@ -43,6 +43,6 @@ public async Task Consume(ShareSolution message) var url = $"{_navigationManager.BaseUri}?solution={base64}"; await _jsApiService.CopyToClipboardAsync(url); - _snackbar.AddApolloNotification("Solution sharing link copied to clipboard!", Severity.Success); + _snackbar.AddMythetechNotification("Solution sharing link copied to clipboard!", Severity.Success); } } \ No newline at end of file diff --git a/Apollo.Components/Solutions/Consumers/Base64Exporter.cs b/Apollo.Components/Solutions/Consumers/Base64Exporter.cs index 57770ad..f438505 100644 --- a/Apollo.Components/Solutions/Consumers/Base64Exporter.cs +++ b/Apollo.Components/Solutions/Consumers/Base64Exporter.cs @@ -1,5 +1,5 @@ using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Solutions.Commands; using Apollo.Components.Solutions.Services; using MudBlazor; @@ -28,6 +28,6 @@ public async Task Consume(ExportBase64String message) var encoded = _base64Service.EncodeSolution(_state.Project); await _jsApiService.CopyToClipboardAsync(encoded); - _snackbar.AddApolloNotification("Base64 exported to clipboard"); + _snackbar.AddMythetechNotification("Base64 exported to clipboard"); } } \ No newline at end of file diff --git a/Apollo.Components/Solutions/Consumers/DeleteSolutionPrompter.cs b/Apollo.Components/Solutions/Consumers/DeleteSolutionPrompter.cs index 53ba2ed..c5c1d65 100644 --- a/Apollo.Components/Solutions/Consumers/DeleteSolutionPrompter.cs +++ b/Apollo.Components/Solutions/Consumers/DeleteSolutionPrompter.cs @@ -1,5 +1,5 @@ using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Solutions.Commands; using Apollo.Components.Solutions.Events; using MudBlazor; @@ -60,7 +60,7 @@ public async Task Consume(PromptDeleteSolution message) // Notify that solution was deleted await _bus.PublishAsync(new SolutionDeleted(solutionName)); - _snackbar.AddApolloNotification($"Solution '{solutionName}' was deleted", Severity.Success); + _snackbar.AddMythetechNotification($"Solution '{solutionName}' was deleted", Severity.Success); } } } \ No newline at end of file diff --git a/Apollo.Components/Solutions/Consumers/DocumentFormatter.cs b/Apollo.Components/Solutions/Consumers/DocumentFormatter.cs index 3c1201b..a1ebea1 100644 --- a/Apollo.Components/Solutions/Consumers/DocumentFormatter.cs +++ b/Apollo.Components/Solutions/Consumers/DocumentFormatter.cs @@ -1,6 +1,6 @@ using Apollo.Components.Infrastructure; using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Solutions.Commands; using Microsoft.Extensions.Logging; using Microsoft.JSInterop; @@ -58,7 +58,7 @@ public async Task Consume(FormatAllDocuments message) if (reformattedFiles > 0) { - _snackbar.AddApolloNotification($"Reformated {reformattedFiles} files", Severity.Success); + _snackbar.AddMythetechNotification($"Reformated {reformattedFiles} files", Severity.Success); } } diff --git a/Apollo.Components/Solutions/Consumers/FileOpener.cs b/Apollo.Components/Solutions/Consumers/FileOpener.cs index 4d1680c..1fc92de 100644 --- a/Apollo.Components/Solutions/Consumers/FileOpener.cs +++ b/Apollo.Components/Solutions/Consumers/FileOpener.cs @@ -1,5 +1,5 @@ using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Solutions.Commands; using KristofferStrube.Blazor.FileSystem; using KristofferStrube.Blazor.FileSystemAccess; @@ -36,7 +36,7 @@ public async Task Consume(PromptOpenFile message) } catch (JSException ex) { - _snackbar.AddApolloNotification("File system api not supported by current browser", Severity.Error); + _snackbar.AddMythetechNotification("File system api not supported by current browser", Severity.Error); } finally { diff --git a/Apollo.Components/Solutions/Consumers/FolderOpener.cs b/Apollo.Components/Solutions/Consumers/FolderOpener.cs index aab2283..5e53940 100644 --- a/Apollo.Components/Solutions/Consumers/FolderOpener.cs +++ b/Apollo.Components/Solutions/Consumers/FolderOpener.cs @@ -1,5 +1,5 @@ using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Solutions.Commands; using KristofferStrube.Blazor.FileSystem; using KristofferStrube.Blazor.FileSystemAccess; @@ -34,7 +34,7 @@ public async Task Consume(PromptOpenFolder message) } catch (JSException) { - _snackbar.AddApolloNotification("File system api not supported by current browser", Severity.Error); + _snackbar.AddMythetechNotification("File system api not supported by current browser", Severity.Error); return; } @@ -56,12 +56,12 @@ public async Task Consume(PromptOpenFolder message) } else { - _snackbar.AddApolloNotification("No files found in the selected folder", Severity.Warning); + _snackbar.AddMythetechNotification("No files found in the selected folder", Severity.Warning); } } catch (Exception ex) { - _snackbar.AddApolloNotification($"Error reading folder: {ex.Message}", Severity.Error); + _snackbar.AddMythetechNotification($"Error reading folder: {ex.Message}", Severity.Error); } } diff --git a/Apollo.Components/Solutions/Consumers/OpenBase64SolutionPrompter.cs b/Apollo.Components/Solutions/Consumers/OpenBase64SolutionPrompter.cs index cdafbc8..16766c9 100644 --- a/Apollo.Components/Solutions/Consumers/OpenBase64SolutionPrompter.cs +++ b/Apollo.Components/Solutions/Consumers/OpenBase64SolutionPrompter.cs @@ -1,5 +1,5 @@ using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Solutions.Commands; using Apollo.Components.Solutions.Services; using Apollo.Contracts.Solutions; diff --git a/Apollo.Components/Solutions/GitHubOpenDialog.razor b/Apollo.Components/Solutions/GitHubOpenDialog.razor index f923d4f..9918d65 100644 --- a/Apollo.Components/Solutions/GitHubOpenDialog.razor +++ b/Apollo.Components/Solutions/GitHubOpenDialog.razor @@ -1,5 +1,5 @@ @using Apollo.Components.Shared -@using Apollo.Components.Shared.ApolloNotificationBar +@using Mythetech.Framework.Components.Snackbar @using Apollo.Components.Solutions.Services @inject ISnackbar Snackbar @inject IGitHubService GitHubService @@ -72,12 +72,12 @@ } } - Snackbar.AddApolloNotification($"Opened repository {repo}", Severity.Success); + Snackbar.AddMythetechNotification($"Opened repository {repo}", Severity.Success); MudDialog.Close(DialogResult.Ok(true)); } catch (Exception ex) { - Snackbar.AddApolloNotification($"Failed to open repository: {ex.Message}", Severity.Error); + Snackbar.AddMythetechNotification($"Failed to open repository: {ex.Message}", Severity.Error); } finally { diff --git a/Apollo.Components/Terminal/CommandServices/VersionCommand.cs b/Apollo.Components/Terminal/CommandServices/VersionCommand.cs index 1feb881..718b8fd 100644 --- a/Apollo.Components/Terminal/CommandServices/VersionCommand.cs +++ b/Apollo.Components/Terminal/CommandServices/VersionCommand.cs @@ -1,5 +1,5 @@ using System.Reflection; -using Apollo.Components.Infrastructure.Environment; +using Mythetech.Framework.Infrastructure.Environment; namespace Apollo.Components.Terminal.CommandServices; diff --git a/Apollo.Components/Tools/Consumers/GuidGenerator.cs b/Apollo.Components/Tools/Consumers/GuidGenerator.cs index 214ecc9..93789e1 100644 --- a/Apollo.Components/Tools/Consumers/GuidGenerator.cs +++ b/Apollo.Components/Tools/Consumers/GuidGenerator.cs @@ -1,5 +1,5 @@ using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Tools.Commands; using MudBlazor; @@ -20,7 +20,7 @@ public async Task Consume(GenerateGuid message) { var guid = Guid.NewGuid().ToString(); await _jsApiService.CopyToClipboardAsync(guid); - _snackbar.AddApolloNotification($"Copied {guid} to clipboard!", Severity.Success); + _snackbar.AddMythetechNotification($"Copied {guid} to clipboard!", Severity.Success); } } diff --git a/Apollo.Components/Tools/Consumers/GuidV7Generator.cs b/Apollo.Components/Tools/Consumers/GuidV7Generator.cs index 264990c..21dbb48 100644 --- a/Apollo.Components/Tools/Consumers/GuidV7Generator.cs +++ b/Apollo.Components/Tools/Consumers/GuidV7Generator.cs @@ -1,5 +1,5 @@ using Mythetech.Framework.Infrastructure.MessageBus; -using Apollo.Components.Shared.ApolloNotificationBar; +using Mythetech.Framework.Components.Snackbar; using Apollo.Components.Tools.Commands; using MudBlazor; @@ -20,7 +20,7 @@ public async Task Consume(GenerateGuidV7 message) { var guid = Guid.CreateVersion7().ToString(); await _jsApiService.CopyToClipboardAsync(guid); - _snackbar.AddApolloNotification($"Copied {guid} to clipboard!", Severity.Success); + _snackbar.AddMythetechNotification($"Copied {guid} to clipboard!", Severity.Success); } } diff --git a/Apollo.Components/Tools/JsonFormatterDialog.razor b/Apollo.Components/Tools/JsonFormatterDialog.razor index 67c7553..62ad006 100644 --- a/Apollo.Components/Tools/JsonFormatterDialog.razor +++ b/Apollo.Components/Tools/JsonFormatterDialog.razor @@ -1,7 +1,7 @@ @using Apollo.Components.Theme @using Apollo.Components.Solutions @using Apollo.Components.Shared -@using Apollo.Components.Shared.ApolloNotificationBar +@using Mythetech.Framework.Components.Snackbar @using BlazorMonaco @using BlazorMonaco.Editor @using MudBlazor @@ -188,7 +188,7 @@ return; await JsApiService.CopyToClipboardAsync(_formattedJson); - Snackbar.AddApolloNotification("Copied formatted JSON to clipboard!", Severity.Success); + Snackbar.AddMythetechNotification("Copied formatted JSON to clipboard!", Severity.Success); } private async Task SaveToSolution() @@ -214,7 +214,7 @@ { var jsonFileName = fileName.EndsWith(".json", StringComparison.OrdinalIgnoreCase) ? fileName : $"{fileName}.json"; SolutionsState.AddFile(jsonFileName, _formattedJson); - Snackbar.AddApolloNotification($"Saved {jsonFileName} to solution!", Severity.Success); + Snackbar.AddMythetechNotification($"Saved {jsonFileName} to solution!", Severity.Success); } } diff --git a/Apollo.Components/Tools/JsonToCSharpDialog.razor b/Apollo.Components/Tools/JsonToCSharpDialog.razor index 7851234..66a61f6 100644 --- a/Apollo.Components/Tools/JsonToCSharpDialog.razor +++ b/Apollo.Components/Tools/JsonToCSharpDialog.razor @@ -1,7 +1,7 @@ @using Apollo.Components.Theme @using Apollo.Components.Solutions @using Apollo.Components.Shared -@using Apollo.Components.Shared.ApolloNotificationBar +@using Mythetech.Framework.Components.Snackbar @using BlazorMonaco @using BlazorMonaco.Editor @using MudBlazor @@ -187,7 +187,7 @@ return; await JsApiService.CopyToClipboardAsync(_csharpOutput); - Snackbar.AddApolloNotification("Copied C# classes to clipboard!", Severity.Success); + Snackbar.AddMythetechNotification("Copied C# classes to clipboard!", Severity.Success); } private async Task SaveToSolution() @@ -213,7 +213,7 @@ { var csFileName = fileName.EndsWith(".cs", StringComparison.OrdinalIgnoreCase) ? fileName : $"{fileName}.cs"; SolutionsState.AddFile(csFileName, _csharpOutput); - Snackbar.AddApolloNotification($"Saved {csFileName} to solution!", Severity.Success); + Snackbar.AddMythetechNotification($"Saved {csFileName} to solution!", Severity.Success); } } diff --git a/Apollo.Components/Tools/RegexTesterDialog.razor b/Apollo.Components/Tools/RegexTesterDialog.razor index 61e5ae1..41629ba 100644 --- a/Apollo.Components/Tools/RegexTesterDialog.razor +++ b/Apollo.Components/Tools/RegexTesterDialog.razor @@ -1,7 +1,7 @@ @using System.Net @using System.Text @using System.Text.RegularExpressions -@using Apollo.Components.Shared.ApolloNotificationBar +@using Mythetech.Framework.Components.Snackbar @using Apollo.Components.Theme @using MudBlazor @@ -407,7 +407,7 @@ private async Task CopyPatternAsync() { await JsApiService.CopyToClipboardAsync(_pattern); - Snackbar.AddApolloNotification("Copied pattern to clipboard!", Severity.Success); + Snackbar.AddMythetechNotification("Copied pattern to clipboard!", Severity.Success); } private async Task CopyMatchesAsync() @@ -417,7 +417,7 @@ : string.Join(System.Environment.NewLine, _matches.Select(m => m.Value)); await JsApiService.CopyToClipboardAsync(text); - Snackbar.AddApolloNotification("Copied matches to clipboard!", Severity.Success); + Snackbar.AddMythetechNotification("Copied matches to clipboard!", Severity.Success); } private void Close() => MudDialog.Close(); diff --git a/Apollo.Components/wwwroot/app.css b/Apollo.Components/wwwroot/app.css index d98f3d1..9b227cc 100644 --- a/Apollo.Components/wwwroot/app.css +++ b/Apollo.Components/wwwroot/app.css @@ -95,242 +95,6 @@ apollo-active-tab::after { .bg-transparent { background-color: transparent; } -.mud-switch-m3 { - cursor: pointer; - display: inline-flex; - align-items: center; - vertical-align: middle; - margin-top: 4px; - margin-bottom: 4px; - -webkit-tap-highlight-color: transparent; -} - -.mud-switch-m3.mud-disabled { - color: var(--mud-palette-text-disabled) !important; - cursor: default; -} - -.mud-switch-m3.mud-readonly, -.mud-switch-m3 .mud-readonly:hover { - cursor: default; - background-color: transparent !important; -} - -.mud-switch-span-m3 { - width: 52px; - height: 32px; - display: inline-flex; - z-index: 0; - position: relative; - box-sizing: border-box; - flex-shrink: 0; - vertical-align: middle; -} - -.mud-switch-span-m3.mud-switch-child-content-m3 { - margin-inline-end: 12px; -} - -.mud-switch-span-m3 .mud-switch-track-m3 { - width: 52px; - height: 32px; - z-index: -1; - transition: opacity 150ms cubic-bezier(.4, 0, .2, 1) 0ms, background-color 150ms cubic-bezier(.4, 0, .2, 1) 0ms; - border-radius: 30px; - background-color: var(--mud-palette-background); - border: 2px solid; -} - -.mud-switch-span-m3 .mud-switch-track-m3.mud-switch-track-default-m3 { - border-color: var(--mud-palette-text-primary); -} - -.mud-switch-span-m3 .mud-switch-track-m3.mud-switch-track-primary-m3 { - border-color: var(--mud-palette-primary); -} - -.mud-switch-span-m3 .mud-switch-track-m3.mud-switch-track-secondary-m3 { - border-color: var(--mud-palette-secondary); -} - -.mud-switch-span-m3 .mud-switch-track-m3.mud-switch-track-tertiary-m3 { - border-color: var(--mud-palette-tertiary); -} - -.mud-switch-span-m3 .mud-switch-track-m3.mud-switch-track-info-m3 { - border-color: var(--mud-palette-info); -} - -.mud-switch-span-m3 .mud-switch-track-m3.mud-switch-track-success-m3 { - border-color: var(--mud-palette-success); -} - -.mud-switch-span-m3 .mud-switch-track-m3.mud-switch-track-warning-m3 { - border-color: var(--mud-palette-warning); -} - -.mud-switch-span-m3 .mud-switch-track-m3.mud-switch-track-error-m3 { - border-color: var(--mud-palette-error); -} - -.mud-switch-span-m3 .mud-switch-track-m3.mud-switch-track-dark-m3 { - border-color: var(--mud-palette-dark); -} - -.mud-switch-base-m3 { - padding-top: 4px; - padding-bottom: 4px; - padding-inline-start: 8px; - top: 0; - left: 0; - bottom: 0; - color: #fafafa; - z-index: 1; - position: absolute; - transition: left 150ms cubic-bezier(.4, 0, .2, 1) 0ms, transform 150ms cubic-bezier(.4, 0, .2, 1) 0ms, background-color 250ms cubic-bezier(.4, 0, .2, 1) 0ms, box-shadow 250ms cubic-bezier(.4, 0, .2, 1) 0ms; -} - -.mud-switch-base-m3.mud-switch-base-dense-m3 { - padding-inline-start: 4px; -} - -.mud-switch-base-m3.mud-checked { - transform: translateX(20px); - padding: 4px; -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3 { - opacity: 1; -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3.mud-default { - background-color: var(--mud-palette-text-primary); -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3.mud-primary { - background-color: var(--mud-palette-primary); -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3.mud-secondary { - background-color: var(--mud-palette-secondary); -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3.mud-tertiary { - background-color: var(--mud-palette-tertiary); -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3.mud-info { - background-color: var(--mud-palette-info); -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3.mud-success { - background-color: var(--mud-palette-success); -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3.mud-warning { - background-color: var(--mud-palette-warning); -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3.mud-error { - background-color: var(--mud-palette-error); -} - -.mud-switch-base-m3.mud-checked+.mud-switch-track-m3.mud-dark { - background-color: var(--mud-palette-dark); -} - -.mud-switch-base-m3.mud-checked .mud-switch-thumb-m3 { - width: 24px; - height: 24px; - box-shadow: 0 2px 1px -1px rgba(0, 0, 0, .2), 0 1px 1px 0 rgba(0, 0, 0, .14), 0 1px 3px 0 rgba(0, 0, 0, .12); - border-radius: 50%; - background-color: var(--mud-palette-background); -} - -.mud-switch-base-m3:hover { - background-color: var(--mud-palette-action-default-hover); -} - -.mud-switch-base-m3.mud-switch-disabled { - color: var(--mud-palette-gray-default) !important; -} - -.mud-switch-base-m3.mud-switch-disabled+.mud-switch-track-m3 { - opacity: .12 !important; -} - -.mud-switch-base-m3.mud-switch-disabled:hover, -.mud-switch-base-m3.mud-switch-disabled:focus-visible { - cursor: default; - background-color: transparent !important; -} - -.mud-switch-button-m3 { - display: flex; - align-items: inherit; - justify-content: inherit; -} - -.mud-switch-button-m3 .mud-switch-input-m3 { - top: 0; - left: 0; - width: 100%; - cursor: inherit; - height: 100%; - margin: 0; - opacity: 0; - padding: 0; - z-index: 1; - position: absolute; -} - -.mud-switch-button-m3 .mud-switch-thumb-m3 { - width: 16px; - height: 16px; - box-shadow: 0 2px 1px -1px rgba(0, 0, 0, .2), 0 1px 1px 0 rgba(0, 0, 0, .14), 0 1px 3px 0 rgba(0, 0, 0, .12); - border-radius: 50%; -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-default-m3 { - background-color: var(--mud-palette-text-primary); -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-primary-m3 { - background-color: var(--mud-palette-primary); -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-secondary-m3 { - background-color: var(--mud-palette-secondary); -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-tertiary-m3 { - background-color: var(--mud-palette-tertiary); -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-info-m3 { - background-color: var(--mud-palette-info); -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-success-m3 { - background-color: var(--mud-palette-success); -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-warning-m3 { - background-color: var(--mud-palette-warning); -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-error-m3 { - background-color: var(--mud-palette-error); -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-dark-m3 { - background-color: var(--mud-palette-dark); -} - -.mud-switch-button-m3 .mud-switch-thumb-m3.mud-switch-thumb-off-icon-m3 { - width: 24px; - height: 24px; -} .mud-button-text { padding: 0px!important; @@ -477,4 +241,10 @@ kbd:not(:has(kbd)) { kbd:not(:has(kbd)):hover { box-shadow: 0 1px 0 0.5px var(--mud-palette-lines-default); top: 1px; -} \ No newline at end of file +} + +/* MtSwitch renders label and control adjacent; settings rows spread them across the row. */ +.settings-switch { + width: 100%; + justify-content: space-between; +} diff --git a/Apollo.Test/Components/Code/ActiveTypeStateTests.cs b/Apollo.Test/Components/Code/ActiveTypeStateTests.cs index ba0d96b..56dac29 100644 --- a/Apollo.Test/Components/Code/ActiveTypeStateTests.cs +++ b/Apollo.Test/Components/Code/ActiveTypeStateTests.cs @@ -1,6 +1,6 @@ using System.Reflection; using Apollo.Components.Code; -using Apollo.Components.Infrastructure.Environment; +using Mythetech.Framework.Infrastructure.Environment; using Mythetech.Framework.Infrastructure.MessageBus; using Apollo.Components.Library.SampleProjects; using Apollo.Components.Solutions.Events; @@ -52,5 +52,6 @@ private sealed class TestRuntimeEnvironment : IRuntimeEnvironment public string Name => "production"; public Version Version => new(0, 0); public string BaseAddress => string.Empty; + public Mythetech.Framework.Infrastructure.Plugins.Platform Platform => Mythetech.Framework.Infrastructure.Plugins.Platform.WebAssembly; } } \ No newline at end of file diff --git a/Apollo.Test/Components/Infrastructure/TestingRuntimeEnvironment.cs b/Apollo.Test/Components/Infrastructure/TestingRuntimeEnvironment.cs index fe19573..4064035 100644 --- a/Apollo.Test/Components/Infrastructure/TestingRuntimeEnvironment.cs +++ b/Apollo.Test/Components/Infrastructure/TestingRuntimeEnvironment.cs @@ -1,5 +1,6 @@ using System.Reflection; -using Apollo.Components.Infrastructure.Environment; +using Mythetech.Framework.Infrastructure.Environment; +using Mythetech.Framework.Infrastructure.Plugins; using Assembly = System.Reflection.Assembly; namespace Apollo.Test.Components.Infrastructure; @@ -9,6 +10,7 @@ public class TestingRuntimeEnvironment : IRuntimeEnvironment public string Name => "Testing"; public Version Version => Assembly.GetExecutingAssembly().GetName().Version; public string BaseAddress => "localhost"; + public Platform Platform => Platform.WebAssembly; public static TestingRuntimeEnvironment Instance => new(); } \ No newline at end of file