fix: re-init scroll animations after data loads from DB
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m55s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m55s
- 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)
This commit is contained in:
@@ -26,6 +26,10 @@ public partial class Index : IDisposable
|
|||||||
private List<TestimonialItem> _testimonials = new();
|
private List<TestimonialItem> _testimonials = new();
|
||||||
private List<QA> _faqs = new();
|
private List<QA> _faqs = new();
|
||||||
|
|
||||||
|
// Track whether animations need re-initialization after data load
|
||||||
|
private bool _dataLoaded;
|
||||||
|
private bool _animationsInitialized;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
MainService.OnChangeHandler += OnStateChanged;
|
MainService.OnChangeHandler += OnStateChanged;
|
||||||
@@ -45,6 +49,7 @@ public partial class Index : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
PopulateFromSettings();
|
PopulateFromSettings();
|
||||||
|
_dataLoaded = true;
|
||||||
|
|
||||||
// Load latest published blog posts
|
// Load latest published blog posts
|
||||||
try
|
try
|
||||||
@@ -222,8 +227,11 @@ public partial class Index : IDisposable
|
|||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
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
|
// Init scroll-triggered fade-in animations
|
||||||
await JS.InvokeVoidAsync("initScrollAnimations");
|
await JS.InvokeVoidAsync("initScrollAnimations");
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</MudHidden>
|
</MudHidden>
|
||||||
|
|
||||||
<div class="d-flex align-center gap-2">
|
<div class="d-flex align-center gap-2">
|
||||||
<MudLink Href="@(RouteConstants.Main.MainPage)" Underline="Underline.None">
|
<MudLink Href="@(_isAuthenticated ? RouteConstants.Profile.Index : RouteConstants.Main.MainPage)" Underline="Underline.None">
|
||||||
<MudStack Row="true" Spacing="3" AlignItems="AlignItems.Center">
|
<MudStack Row="true" Spacing="3" AlignItems="AlignItems.Center">
|
||||||
<MudHidden Breakpoint="Breakpoint.MdAndUp" Invert="true">
|
<MudHidden Breakpoint="Breakpoint.MdAndUp" Invert="true">
|
||||||
<MudImage ObjectFit="ObjectFit.Cover"
|
<MudImage ObjectFit="ObjectFit.Cover"
|
||||||
@@ -285,9 +285,9 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
@* ── Default bottom nav (outside stores) ── *@
|
@* ── Default bottom nav (outside stores) ── *@
|
||||||
<MudLink Href="@(RouteConstants.Profile.Index)" Class="bottom-nav-item">
|
<MudLink Href="@(_isAuthenticated ? RouteConstants.Profile.Index : RouteConstants.Main.MainPage)" Class="bottom-nav-item">
|
||||||
<MudIcon Icon="@Icons.Material.Outlined.Home" Size="Size.Medium" />
|
<MudIcon Icon="@Icons.Material.Outlined.Home" Size="Size.Medium" />
|
||||||
<MudText Typo="Typo.caption">خانه</MudText>
|
<MudText Typo="Typo.caption">@(_isAuthenticated ? "داشبورد" : "خانه")</MudText>
|
||||||
</MudLink>
|
</MudLink>
|
||||||
@if (_isAuthenticated)
|
@if (_isAuthenticated)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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": "*"
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user