From ad65469db6442dab13d94be3ae2e863251205eca Mon Sep 17 00:00:00 2001 From: RevIQ Date: Thu, 8 Jan 2026 08:15:57 +0800 Subject: [PATCH] Add DashboardCard component and redesign peak traffic chart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create reusable DashboardCard component with title and content slot - Redesign PeakTrafficChart to match Figma design: - Vertical bar chart showing peak hours by day of week - Y-axis: hours (0:00 to 21:00) - X-axis: days (Mon-Sun) - Two data series: "This month" (solid) and "Last month" (hatched) - Diagonal stripe pattern for last month bars using SVG - Legend at bottom 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../dashboard/dashboard-card.svelte | 27 +++ .../src/lib/components/dashboard/index.ts | 1 + .../dashboard/peak-traffic-chart.svelte | 165 +++++++++++------- 3 files changed, 128 insertions(+), 65 deletions(-) create mode 100644 apps/publisher-dashboard/src/lib/components/dashboard/dashboard-card.svelte diff --git a/apps/publisher-dashboard/src/lib/components/dashboard/dashboard-card.svelte b/apps/publisher-dashboard/src/lib/components/dashboard/dashboard-card.svelte new file mode 100644 index 0000000..7964f38 --- /dev/null +++ b/apps/publisher-dashboard/src/lib/components/dashboard/dashboard-card.svelte @@ -0,0 +1,27 @@ + + +
+
+

{title}

+
+ +
+ {@render children()} +
+
diff --git a/apps/publisher-dashboard/src/lib/components/dashboard/index.ts b/apps/publisher-dashboard/src/lib/components/dashboard/index.ts index adcfec0..070e611 100644 --- a/apps/publisher-dashboard/src/lib/components/dashboard/index.ts +++ b/apps/publisher-dashboard/src/lib/components/dashboard/index.ts @@ -1,3 +1,4 @@ +export { default as DashboardCard } from "./dashboard-card.svelte"; export { default as FrequentFilters } from "./frequent-filters.svelte"; export { default as MetricCard } from "./metric-card.svelte"; export { default as PeakTrafficChart } from "./peak-traffic-chart.svelte"; diff --git a/apps/publisher-dashboard/src/lib/components/dashboard/peak-traffic-chart.svelte b/apps/publisher-dashboard/src/lib/components/dashboard/peak-traffic-chart.svelte index ab172de..ddd1963 100644 --- a/apps/publisher-dashboard/src/lib/components/dashboard/peak-traffic-chart.svelte +++ b/apps/publisher-dashboard/src/lib/components/dashboard/peak-traffic-chart.svelte @@ -1,5 +1,6 @@ -
-
-

Peak Traffic Hours

-
- -
-
+ +
+ +
-
+
{#each hours as hour} -
- {hour} -
+ {hour} {/each}
- -
-
- {#each hours as _, hourIndex} - {#each days as _, dayIndex} - {@const value = heatmapData[hourIndex][dayIndex]} + +
+ +
+ {#each hours as _} +
+ {/each} +
+ + +
+ {#each days as _, dayIndex} + {@const thisMonth = thisMonthData[dayIndex]} + {@const lastMonth = lastMonthData[dayIndex]} +
+
+ + +
- -
- {value}% -
+ + + + + + + +
- {/each} +
{/each}
-
+
{#each days as day}
{day}
{/each} @@ -89,18 +112,30 @@ function getCellOpacity(value: number): number {
-
+
-
- {#each [0.2, 0.4, 0.6, 0.8, 1] as opacity} -
- {/each} +
+ This month +
+
+
+ + + + + + + +
- Traffic intensity + Last month
-
+