From bf0eb089bb9e835bbd32573d1c6fc6235fa16bdc Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Tue, 17 Feb 2026 23:57:41 +0330 Subject: [PATCH] fix: re-init scroll animations after data loads from DB - initScrollAnimations ran only on firstRender when data wasn't loaded yet - Items with fade-in-up class stayed invisible (opacity:0) after data render - Now tracks _dataLoaded/_animationsInitialized flags to re-init JS after data loads - Also fixes stat counter animations not running (stats were empty on firstRender) --- src/FrontOffice.Main/Pages/Index.razor.cs | 10 +++++++++- src/FrontOffice.Main/Shared/MainLayout.razor | 6 +++--- .../appsettings.Development.json | 18 ------------------ 3 files changed, 12 insertions(+), 22 deletions(-) delete mode 100644 src/FrontOffice.Main/appsettings.Development.json diff --git a/src/FrontOffice.Main/Pages/Index.razor.cs b/src/FrontOffice.Main/Pages/Index.razor.cs index 96875f8..88fb346 100644 --- a/src/FrontOffice.Main/Pages/Index.razor.cs +++ b/src/FrontOffice.Main/Pages/Index.razor.cs @@ -26,6 +26,10 @@ public partial class Index : IDisposable private List _testimonials = new(); private List _faqs = new(); + // Track whether animations need re-initialization after data load + private bool _dataLoaded; + private bool _animationsInitialized; + protected override async Task OnInitializedAsync() { MainService.OnChangeHandler += OnStateChanged; @@ -45,6 +49,7 @@ public partial class Index : IDisposable } PopulateFromSettings(); + _dataLoaded = true; // Load latest published blog posts try @@ -222,8 +227,11 @@ public partial class Index : IDisposable protected override async Task OnAfterRenderAsync(bool firstRender) { - if (firstRender) + // Init/re-init scroll animations after data is loaded and rendered + if ((firstRender || (_dataLoaded && !_animationsInitialized)) && _steps.Any()) { + _animationsInitialized = true; + // Init scroll-triggered fade-in animations await JS.InvokeVoidAsync("initScrollAnimations"); diff --git a/src/FrontOffice.Main/Shared/MainLayout.razor b/src/FrontOffice.Main/Shared/MainLayout.razor index 0f0f72d..0a9f4b2 100644 --- a/src/FrontOffice.Main/Shared/MainLayout.razor +++ b/src/FrontOffice.Main/Shared/MainLayout.razor @@ -19,7 +19,7 @@
- + + - خانه + @(_isAuthenticated ? "داشبورد" : "خانه") @if (_isAuthenticated) { diff --git a/src/FrontOffice.Main/appsettings.Development.json b/src/FrontOffice.Main/appsettings.Development.json deleted file mode 100644 index 36c36cb..0000000 --- a/src/FrontOffice.Main/appsettings.Development.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "GwUrl": "https://cms.kbs2.ir", - "DownloadUrl": "", - "EncryptionSettings": { - "Key": "kmcQ3XTmH4mrdh8VHziuscyf8LLYjG//Kyni81nH/0E=", - "IV": "1wyF3Tt142MOkCpIyCxh/g==" - }, - "SignalR": { - "HubPath": "/hubs/token-notification" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -}