Skip to content

fix(dashboard): show scraper center count as active sources#22

Merged
hdmGOAT merged 3 commits into
developmentfrom
fix/dashboard-sources-count
Jun 18, 2026
Merged

fix(dashboard): show scraper center count as active sources#22
hdmGOAT merged 3 commits into
developmentfrom
fix/dashboard-sources-count

Conversation

@potakaaa

@potakaaa potakaaa commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The Active Sources StatCard on the dashboard was showing data.stats.active_sources as the primary value and data.scrapers.length as the sub-label, which was inverted from the intended UX.
  • This fix swaps them: the card now prominently shows the total number of scrapers registered in Scraper Center (data.scrapers.length), with the sub-label reading "{N} with events" (data.stats.active_sources) for additional context.

Test plan

  • Load the dashboard and verify the Active Sources card displays the scraper count as the main value
  • Verify the sub-label shows the correct "N with events" count from active_sources
  • Confirm the card link still routes to /scrapers

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Dashboard charts now display animated skeleton placeholders while content is loading.
    • Statistics cards can now behave as clickable navigation links to related pages.
  • Improvements
    • Updated statistics card subtitle wording for clearer context, including “Active Sources,” “Organizers,” and “Venues.”

Active Sources StatCard now displays data.scrapers.length as the primary
value (number of scrapers registered in Scraper Center) and
data.stats.active_sources as the sub-label ("N with events"), replacing
the previous inversion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3eb47ce2-c37d-4cb0-9ede-15f07c9a5fcc

📥 Commits

Reviewing files that changed from the base of the PR and between 3ff8584 and fc289f7.

📒 Files selected for processing (1)
  • apps/frontend/src/routes/+page.svelte
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/frontend/src/routes/+page.svelte

📝 Walkthrough

Walkthrough

The dashboard page adds a ChartSkeleton import and a client-driven loading state (initialized to true, reset to false via $effect). Both chart panels now render skeleton placeholders while loading is true. StatCard components are enhanced with optional href navigation props, and dashboard instances receive navigation links with updated subtitle strings for "Active Sources", "Organizers", and "Venues".

Changes

Dashboard Loading State and StatCard Updates

Layer / File(s) Summary
StatCard navigation link support
apps/frontend/src/lib/components/StatCard.svelte
Component now accepts an optional href prop and conditionally renders as an anchor element via svelte:element, with hover/transition styling applied only when the link is present.
ChartSkeleton placeholder component
apps/frontend/src/lib/components/ChartSkeleton.svelte
New markup-only component renders animated skeleton bars as placeholders for chart content during loading.
Dashboard loading state setup
apps/frontend/src/routes/+page.svelte
Adds ChartSkeleton import and introduces a loading reactive state starting as true, flipped to false via $effect after the first client tick.
Dashboard StatCard links and chart skeleton rendering
apps/frontend/src/routes/+page.svelte
Updates three StatCard instances to include href navigation links and revised subtitle text; wraps both chart panels in {#if loading}…{:else} blocks that display ChartSkeleton until loading completes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 While the charts are loading slow,
A skeleton puts on quite a show!
With an $effect tick — poof! — they appear,
And nav links guide the way, my dear.
No blank flash, just smooth delight,
This little rabbit hops it right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(dashboard): show scraper center count as active sources' directly aligns with the main objective of fixing the Active Sources display by showing scraper center count, which is the primary change in this changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dashboard-sources-count

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/frontend/src/routes/+page.svelte (1)

12-17: ⚡ Quick win

loading here creates a one-tick skeleton flash instead of true loading behavior.

On Line 14 and Line 15, this state always flips to false on the first client tick, so charts are briefly hidden even when data is already ready. Consider removing the synthetic flag and rendering based on real data presence only.

Proposed simplification
-	// Data arrives via +page.ts load(); show chart skeletons until the first
-	// client tick confirms render (also covers slow-network navigation).
-	let loading = $state(true);
-	$effect(() => {
-		loading = false;
-	});
-			{`#if` loading}
-				<ChartSkeleton />
-			{:else if sourceData.length}
+			{`#if` sourceData.length}
 				<BarChart labels={sourceLabels} data={sourceData} />
 			{:else}
 				<p class="py-16 text-center text-sm text-muted">No events scraped yet.</p>
 			{/if}
-			{`#if` loading}
-				<ChartSkeleton />
-			{:else if catData.length}
+			{`#if` catData.length}
 				<DonutChart labels={catLabels} data={catData} />
 			{:else}
 				<p class="py-16 text-center text-sm text-muted">No categorized events yet.</p>
 			{/if}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/frontend/src/routes/`+page.svelte around lines 12 - 17, The loading
state variable and its associated $effect are causing unnecessary skeleton
flashing by unconditionally setting loading to false on the first tick
regardless of actual data readiness. Remove both the loading state declaration
and the $effect block that sets it to false, then update any conditional
rendering that checks for loading (likely using {`#if` loading} syntax) to instead
check for the actual presence of data from the +page.ts load function to achieve
true loading behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/frontend/src/routes/`+page.svelte:
- Line 35: The StatCard component for "Active Sources" passes the raw value of
data.scrapers.length without localized number formatting, while other stat cards
use toLocaleString() for consistency. Apply toLocaleString() to the value prop
in the StatCard on line 35 where data.scrapers.length is passed to format the
number according to the user's locale for consistent display across all stat
cards.

---

Nitpick comments:
In `@apps/frontend/src/routes/`+page.svelte:
- Around line 12-17: The loading state variable and its associated $effect are
causing unnecessary skeleton flashing by unconditionally setting loading to
false on the first tick regardless of actual data readiness. Remove both the
loading state declaration and the $effect block that sets it to false, then
update any conditional rendering that checks for loading (likely using {`#if`
loading} syntax) to instead check for the actual presence of data from the
+page.ts load function to achieve true loading behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0f93c5a-3b98-4735-aa28-9ddf0b2e53f6

📥 Commits

Reviewing files that changed from the base of the PR and between 00e70d0 and 4ce327e.

📒 Files selected for processing (1)
  • apps/frontend/src/routes/+page.svelte

Comment thread apps/frontend/src/routes/+page.svelte Outdated
hdmGOAT and others added 2 commits June 18, 2026 11:25
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hdmGOAT hdmGOAT merged commit 94b1556 into development Jun 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants