-
Notifications
You must be signed in to change notification settings - Fork 769
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
466 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/app/(dashboard)/dashboard/stores/[storeId]/analytics/_components/overview-card.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" | ||
import { Skeleton } from "@/components/ui/skeleton" | ||
import { Icons } from "@/components/icons" | ||
|
||
interface OverviewCardProps { | ||
title: string | ||
value: string | ||
description: string | ||
icon: keyof typeof Icons | ||
} | ||
|
||
export function OverviewCard({ | ||
title, | ||
value, | ||
description, | ||
icon, | ||
}: OverviewCardProps) { | ||
const Icon = Icons[icon] | ||
|
||
return ( | ||
<Card> | ||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2"> | ||
<CardTitle className="text-sm font-medium">{title}</CardTitle> | ||
<Icon className="size-4 text-muted-foreground" aria-hidden="true" /> | ||
</CardHeader> | ||
<CardContent className="space-y-1"> | ||
<div className="text-2xl font-bold">{value}</div> | ||
{description && ( | ||
<p className="text-xs text-muted-foreground">{description}</p> | ||
)} | ||
</CardContent> | ||
</Card> | ||
) | ||
} | ||
|
||
export function OverviewCardSkeleton() { | ||
return ( | ||
<Card> | ||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-4"> | ||
<Skeleton className="h-4 w-20" /> | ||
<Skeleton className="size-4" /> | ||
</CardHeader> | ||
<CardContent className="space-y-2"> | ||
<Skeleton className="h-6 w-12" /> | ||
<Skeleton className="h-4 w-40" /> | ||
</CardContent> | ||
</Card> | ||
) | ||
} |
28 changes: 28 additions & 0 deletions
28
src/app/(dashboard)/dashboard/stores/[storeId]/analytics/_components/sales-chart.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use client" | ||
|
||
import { LineChart, type LineChartProps } from "@tremor/react" | ||
|
||
import { cn, formatPrice } from "@/lib/utils" | ||
|
||
interface SalesChartProps | ||
extends Omit<LineChartProps, "data" | "index" | "categories"> { | ||
data: { | ||
name: string | ||
Total: number | ||
}[] | ||
} | ||
|
||
export function SalesChart({ data, className, ...props }: SalesChartProps) { | ||
return ( | ||
<LineChart | ||
className={cn(className)} | ||
data={data} | ||
index="name" | ||
categories={["Total"]} | ||
colors={["indigo"]} | ||
valueFormatter={(value) => formatPrice(value)} | ||
yAxisWidth={48} | ||
{...props} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.