Skip to content

Commit 9a8dcff

Browse files
committed
Charts fix
1 parent 8101b5a commit 9a8dcff

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

RELEASE_NOTES.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
### ✨ Features
22

3-
- Added subscriber growth chart to the dashboard
4-
- Can send emails without selecting a template
3+
- Chart updated
54
- New features and improvements.
65

76
### 🐛 Bug Fixes

apps/web/src/pages/dashboard/dashboard/subscriber-growth-chart.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import {
1515
} from "@repo/ui"
1616
import dayjs from "dayjs"
1717
import { ArrowDown, TrendingUp } from "lucide-react"
18-
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"
18+
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts"
1919

2020
const chartConfig = {
21-
totalSubscribers: {
21+
count: {
2222
label: "Total Subscribers",
2323
color: "hsl(var(--chart-1))",
2424
},
@@ -49,6 +49,10 @@ export const SubscriberGrowthChart = () => {
4949

5050
const isLoading = analyticsLoading || dashboardLoading
5151

52+
const maxCount = Math.max(
53+
...(dashboard?.subscriberGrowth.map((item) => item.count) || [])
54+
)
55+
5256
return (
5357
<Card hoverEffect className="col-span-4">
5458
<CardHeader>
@@ -79,16 +83,23 @@ export const SubscriberGrowthChart = () => {
7983
tickMargin={8}
8084
tickFormatter={(value) => dayjs(value).format("DD MMM")}
8185
/>
86+
<YAxis
87+
tickFormatter={(value) => value.toLocaleString()}
88+
tickLine={false}
89+
axisLine={false}
90+
tickMargin={8}
91+
tickCount={Math.min(maxCount, 10)}
92+
/>
8293
<ChartTooltip
8394
cursor={false}
8495
content={<ChartTooltipContent indicator="dot" />}
8596
/>
8697
<Area
8798
dataKey="count"
8899
type="natural"
89-
fill="var(--color-totalSubscribers)"
100+
fill="var(--color-count)"
90101
fillOpacity={0.4}
91-
stroke="var(--color-totalSubscribers)"
102+
stroke="var(--color-count)"
92103
stackId="a"
93104
/>
94105
</AreaChart>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.4.10",
2+
"version": "0.4.11",
33
"name": "letterspace",
44
"private": true,
55
"scripts": {

0 commit comments

Comments
 (0)