Skip to content

Commit 7be6ad8

Browse files
mrautela365claude
andauthored
fix(dashboards): show no-data state in website visits drawer (#686)
* fix(dashboards): show no-data state in website visits drawer When website session data is zero the drawer skips both "Needs Your Attention" and "Performing Well" and shows a neutral blue info card guiding EDs to engage marketing ops to drive website traffic. LFXV2-1644 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Misha Rautela <mrautela@linuxfoundation.org> * fix(dashboards): handle all-zero dailyData in hasNoData Update hasNoData predicate to also treat dailyData arrays filled with zeros as no-data. Reuse the signal in early returns to avoid duplicating the condition. LFXV2-1644 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Misha Rautela <mrautela@linuxfoundation.org> * fix(dashboards): add a11y attrs and soften no-data copy Add role=status and aria-live=polite to no-data card. Remove actionable CTA language from description. LFXV2-1644 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Misha Rautela <mrautela@linuxfoundation.org> * fix(dashboards): extract hasNoData to initHasNoData, fix a11y - Extract inline hasNoData computed to private initHasNoData() per component organization rules - Drop redundant aria-live="polite" (implicit in role="status") - Use h3 for no-data card title to match heading outline - Use border-l-blue-600 to match design system -600 shade pattern LFXV2-1644 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Misha Rautela <mrautela@linuxfoundation.org> --------- Signed-off-by: Misha Rautela <mrautela@linuxfoundation.org> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a8621b2 commit 7be6ad8

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

apps/lfx-one/src/app/modules/dashboards/executive-director/components/website-visits-drawer/website-visits-drawer.component.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,21 @@ <h3 class="text-sm font-semibold text-green-700">Performing Well</h3>
116116
</div>
117117
}
118118

119+
@if (hasNoData()) {
120+
<div
121+
class="flex flex-col rounded-lg border border-gray-200 border-l-4 border-l-blue-600 bg-white overflow-hidden"
122+
role="status"
123+
data-testid="website-visits-drawer-no-data">
124+
<div class="flex items-start gap-4 px-4 py-4">
125+
<i class="fa-light fa-circle-info text-blue-500 mt-0.5" aria-hidden="true"></i>
126+
<div class="flex flex-col gap-1 flex-1 min-w-0">
127+
<h3 class="text-sm font-semibold text-gray-900">No website traffic data available</h3>
128+
<p class="text-sm text-gray-500">No web session data is currently available for this foundation</p>
129+
</div>
130+
</div>
131+
</div>
132+
}
133+
119134
<!-- Daily Trend Chart -->
120135
<div class="flex flex-col gap-4 p-4 border border-gray-200 rounded-lg" data-testid="website-visits-drawer-trend-section">
121136
<div class="flex flex-col gap-1">

apps/lfx-one/src/app/modules/dashboards/executive-director/components/website-visits-drawer/website-visits-drawer.component.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ export class WebsiteVisitsDrawerComponent {
5353
protected readonly performingActions: Signal<MarketingRecommendedAction[]> = computed(() => this.split().performingActions);
5454

5555
protected readonly performingInsights: Signal<MarketingKeyInsight[]> = computed(() => this.split().performingInsights);
56+
57+
protected readonly hasNoData: Signal<boolean> = this.initHasNoData();
58+
5659
protected readonly trendChartData: Signal<ChartData<'line'>> = this.initTrendChartData();
5760
protected readonly domainChartData: Signal<ChartData<'bar'>> = this.initDomainChartData();
5861

@@ -134,6 +137,13 @@ export class WebsiteVisitsDrawerComponent {
134137
}
135138

136139
// === Private Initializers ===
140+
private initHasNoData(): Signal<boolean> {
141+
return computed(() => {
142+
const { totalSessions, dailyData } = this.drawerData();
143+
return totalSessions === 0 && (dailyData.length === 0 || dailyData.every((v) => v === 0));
144+
});
145+
}
146+
137147
private initDrawerData(): Signal<WebActivitiesSummaryResponse> {
138148
const defaultValue: WebActivitiesSummaryResponse = {
139149
totalSessions: 0,
@@ -175,7 +185,7 @@ export class WebsiteVisitsDrawerComponent {
175185
const { totalSessions, totalPageViews, domainGroups, dailyData } = this.drawerData();
176186
const actions: MarketingRecommendedAction[] = [];
177187

178-
if (totalSessions === 0 && dailyData.length === 0) {
188+
if (this.hasNoData()) {
179189
return actions;
180190
}
181191

@@ -226,12 +236,11 @@ export class WebsiteVisitsDrawerComponent {
226236
}
227237
}
228238

229-
if (actions.length === 0) {
239+
if (actions.length === 0 && !this.hasNoData()) {
230240
actions.push({
231241
title: 'Continue current strategy',
232242
description: `${formatNumber(totalSessions)} sessions with healthy traffic distribution`,
233243
priority: 'low',
234-
235244
actionType: 'growth',
236245
});
237246
}
@@ -245,7 +254,7 @@ export class WebsiteVisitsDrawerComponent {
245254
const { totalSessions, totalPageViews, domainGroups, dailyData } = this.drawerData();
246255
const insights: MarketingKeyInsight[] = [];
247256

248-
if (totalSessions === 0 && dailyData.length === 0) {
257+
if (this.hasNoData()) {
249258
return insights;
250259
}
251260

0 commit comments

Comments
 (0)