|
|
|
@ -108,6 +108,19 @@ export default function Dashboard() {
|
|
|
|
|
|
|
|
|
|
|
|
const thisMonth = new Date().getMonth()
|
|
|
|
const thisMonth = new Date().getMonth()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getVisitorGrowth = (visitorData: VisitorData[]) => {
|
|
|
|
|
|
|
|
const growth = visitorData[thisMonth]?.total
|
|
|
|
|
|
|
|
? visitorData[thisMonth].total -
|
|
|
|
|
|
|
|
visitorData[thisMonth - 1]?.total ?? 0
|
|
|
|
|
|
|
|
: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (growth < 0) {
|
|
|
|
|
|
|
|
return `- ${Math.abs(growth)}`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return `+ ${growth}`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<ThemeProvider
|
|
|
|
<ThemeProvider
|
|
|
|
defaultTheme='dark'
|
|
|
|
defaultTheme='dark'
|
|
|
|
@ -153,13 +166,9 @@ export default function Dashboard() {
|
|
|
|
{visitorData[thisMonth]?.total ?? 0}
|
|
|
|
{visitorData[thisMonth]?.total ?? 0}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<p className='text-xs text-muted-foreground'>
|
|
|
|
<p className='text-xs text-muted-foreground'>
|
|
|
|
{`+ ${
|
|
|
|
{`${getVisitorGrowth(
|
|
|
|
visitorData[thisMonth]?.total ??
|
|
|
|
visitorData
|
|
|
|
0 -
|
|
|
|
)} since last month`}
|
|
|
|
visitorData[thisMonth - 1]
|
|
|
|
|
|
|
|
?.total ??
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
} since last month`}
|
|
|
|
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
</CardContent>
|
|
|
|
</CardContent>
|
|
|
|
</Card>
|
|
|
|
</Card>
|
|
|
|
|