feat(index): add conditional rendering for testimonials section
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:
masoodafar-web
2026-08-07 18:39:49 +03:30
parent c7e6d01c11
commit acad1a719f
2 changed files with 6 additions and 2 deletions
+3
View File
@@ -429,6 +429,8 @@ else
@* ═══════════════════════════════════════════════
6. TESTIMONIALS
═══════════════════════════════════════════════ *@
@if (_testimonials.Count > 0)
{
<section class="section-landing">
<MudContainer MaxWidth="MaxWidth.Large">
<div class="text-center mb-8 fade-in-up">
@@ -465,6 +467,7 @@ else
</MudGrid>
</MudContainer>
</section>
}
@* ═══════════════════════════════════════════════
7. FAQ
+3 -2
View File
@@ -193,9 +193,10 @@ public partial class Index : IDisposable
}
// ── 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))
.ToList();
}