feat(index): add conditional rendering for testimonials section
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m31s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m31s
- Implemented a check to display the testimonials section only when there are testimonials available, enhancing the user experience by preventing empty sections. - Updated the logic for loading testimonials from settings to handle cases where the testimonials list may be null, ensuring robustness in data handling. These changes improve the layout and presentation of the Index page, providing users with relevant content based on available testimonials.
This commit is contained in:
@@ -429,6 +429,8 @@ else
|
|||||||
@* ═══════════════════════════════════════════════
|
@* ═══════════════════════════════════════════════
|
||||||
6. TESTIMONIALS
|
6. TESTIMONIALS
|
||||||
═══════════════════════════════════════════════ *@
|
═══════════════════════════════════════════════ *@
|
||||||
|
@if (_testimonials.Count > 0)
|
||||||
|
{
|
||||||
<section class="section-landing">
|
<section class="section-landing">
|
||||||
<MudContainer MaxWidth="MaxWidth.Large">
|
<MudContainer MaxWidth="MaxWidth.Large">
|
||||||
<div class="text-center mb-8 fade-in-up">
|
<div class="text-center mb-8 fade-in-up">
|
||||||
@@ -465,6 +467,7 @@ else
|
|||||||
</MudGrid>
|
</MudGrid>
|
||||||
</MudContainer>
|
</MudContainer>
|
||||||
</section>
|
</section>
|
||||||
|
}
|
||||||
|
|
||||||
@* ═══════════════════════════════════════════════
|
@* ═══════════════════════════════════════════════
|
||||||
7. FAQ
|
7. FAQ
|
||||||
|
|||||||
@@ -193,9 +193,10 @@ public partial class Index : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ── Testimonials ──
|
// ── Testimonials ──
|
||||||
if (_settings?.Testimonials?.Any() == true)
|
// اگر تنظیمات از CMS لود شده، لیست خالی یعنی ادمین عمداً حذف کرده — بدون fallback hardcode
|
||||||
|
if (_settings is not null)
|
||||||
{
|
{
|
||||||
_testimonials = _settings.Testimonials
|
_testimonials = (_settings.Testimonials ?? [])
|
||||||
.Select((t, i) => new TestimonialItem(t.Quote ?? "", t.Name ?? "", t.Role ?? "", i * 150))
|
.Select((t, i) => new TestimonialItem(t.Quote ?? "", t.Name ?? "", t.Role ?? "", i * 150))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user