using Microsoft.AspNetCore.Components; using Microsoft.Extensions.Localization; using Microsoft.JSInterop; namespace WebClientTpos.Client.Pages.Auth; /// /// EN: Base class for all auth pages — handles Lucide icon initialization and localization. /// VI: Lớp cơ sở cho tất cả trang auth — xử lý khởi tạo Lucide icons và đa ngôn ngữ. /// public abstract class AuthBase : ComponentBase { [Inject] protected IJSRuntime JS { get; set; } = default!; [Inject] protected NavigationManager Navigation { get; set; } = default!; [Inject] protected IStringLocalizer L { get; set; } = default!; /// /// EN: Initialize Lucide icons after each render (SPA navigation creates new DOM). /// VI: Khởi tạo Lucide icons sau mỗi lần render (SPA navigation tạo DOM mới). /// protected override async Task OnAfterRenderAsync(bool firstRender) { try { await JS.InvokeVoidAsync("lucide.createIcons"); } catch { // EN: Lucide script may not be loaded yet during prerender or JS interop unavailable. // VI: Script Lucide có thể chưa load xong khi prerender hoặc JS interop chưa sẵn sàng. } } }