refactor: remove Stripe webhook controller, optimize MainLayout rendering, and update DI registration in Program.cs
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
@using NexusReader.UI.Shared.Services
|
||||
@using NexusReader.UI.Shared.Components.Molecules
|
||||
@using NexusReader.UI.Shared.Components.Organisms
|
||||
@using Microsoft.Extensions.Logging
|
||||
@inject IPlatformService PlatformService
|
||||
@inject IFocusModeService FocusMode
|
||||
@inject IQuizStateService QuizService
|
||||
@inject IJSRuntime JS
|
||||
@inject IIdentityService IdentityService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject Microsoft.Extensions.Logging.ILogger<MainLayout> Logger
|
||||
@implements IDisposable
|
||||
|
||||
<AuthorizeView>
|
||||
@@ -28,10 +30,11 @@
|
||||
<div class="intelligence-content">
|
||||
<div class="intelligence-header">
|
||||
<div class="ai-title">
|
||||
<NexusIcon Name="robot" Size="20" Class="@($"neon-glow {(QuizService.HasNewQuiz ? "quiz-available" : "")}")" />
|
||||
<NexusIcon Name="robot" Size="20"
|
||||
Class="@($"neon-glow {(QuizService.HasNewQuiz ? "quiz-available" : "")}")" />
|
||||
<span>Asystent AI</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="user-profile">
|
||||
<span class="user-email">@context.User.Identity?.Name</span>
|
||||
<button class="logout-btn" @onclick="HandleLogout">Logout</button>
|
||||
@@ -39,9 +42,12 @@
|
||||
|
||||
<button class="close-btn">×</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="intelligence-scroll-area">
|
||||
<KnowledgeGraph />
|
||||
@if (!_isMobile)
|
||||
{
|
||||
<KnowledgeGraph />
|
||||
}
|
||||
<KnowledgeCheck />
|
||||
</div>
|
||||
</div>
|
||||
@@ -67,20 +73,23 @@
|
||||
|
||||
@code {
|
||||
private string _platformClass = "platform-desktop";
|
||||
private bool _isMobile = false;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
FocusMode.OnFocusModeChanged += StateHasChanged;
|
||||
QuizService.OnQuizUpdated += StateHasChanged;
|
||||
|
||||
|
||||
var context = PlatformService.GetDeviceContext();
|
||||
if (context.IsSuccess)
|
||||
{
|
||||
_platformClass = context.Value.DeviceType switch
|
||||
_isMobile = context.Value.DeviceType switch
|
||||
{
|
||||
DeviceType.Phone or DeviceType.Tablet => "platform-mobile",
|
||||
_ => "platform-desktop"
|
||||
DeviceType.Phone or DeviceType.Tablet => true,
|
||||
_ => false
|
||||
};
|
||||
|
||||
_platformClass = _isMobile ? "platform-mobile" : "platform-desktop";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +108,10 @@
|
||||
var module = await JS.InvokeAsync<IJSObjectReference>("import", "./_content/NexusReader.UI.Shared/js/layoutResizer.js");
|
||||
await module.InvokeVoidAsync("initResizer", ".app-container", "#sidebar-resizer", "--sidebar-width");
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Failed to initialize layout resizer JS module.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,4 +121,3 @@
|
||||
QuizService.OnQuizUpdated -= StateHasChanged;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user