-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
e25f34e
commit 6cc04e5
Showing
11 changed files
with
1,128 additions
and
33 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
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,19 @@ | ||
export async function GET(req: Request) { | ||
const endPoint: (string | undefined) = `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/overview/get-all` | ||
|
||
if (endPoint) { | ||
try { | ||
const res = await fetch(endPoint, { | ||
headers: { | ||
'Content-Type': 'application/json', // Set the appropriate content type for your request | ||
'x-api-key': process.env.X_API_KEY!, | ||
}, | ||
cache: 'no-cache', | ||
}); | ||
const data = await res.json(); | ||
return Response.json({ data }) | ||
} catch (error) { | ||
console.error('Error during request:', error); | ||
} | ||
} | ||
} |
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
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
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,70 @@ | ||
"use client" | ||
|
||
import { Bar, BarChart, CartesianGrid, Rectangle, XAxis } from "recharts" | ||
|
||
import { | ||
Card, | ||
CardContent, | ||
CardHeader, | ||
CardTitle, | ||
} from "@/components/ui/card" | ||
import { | ||
ChartConfig, | ||
ChartContainer, | ||
ChartTooltip, | ||
ChartTooltipContent, | ||
} from "@/components/ui/chart" | ||
|
||
interface ChartPieProps { | ||
title: string; | ||
chartData: any; | ||
key: string; | ||
chartConfig: ChartConfig; | ||
} | ||
|
||
export function ChartBar({ title, chartData, key, chartConfig }: ChartPieProps) { | ||
return ( | ||
<Card> | ||
<CardHeader> | ||
<CardTitle>{title}</CardTitle> | ||
</CardHeader> | ||
<CardContent> | ||
<ChartContainer config={chartConfig}> | ||
<BarChart accessibilityLayer data={chartData}> | ||
<CartesianGrid vertical={false} /> | ||
<XAxis | ||
dataKey={key} | ||
tickLine={false} | ||
tickMargin={10} | ||
axisLine={false} | ||
tickFormatter={(value) => | ||
String(chartData[value]?.name) | ||
} | ||
/> | ||
<ChartTooltip | ||
cursor={false} | ||
content={<ChartTooltipContent hideLabel />} | ||
/> | ||
<Bar | ||
dataKey="count" | ||
strokeWidth={2} | ||
radius={8} | ||
activeIndex={2} | ||
activeBar={({ ...props }) => { | ||
return ( | ||
<Rectangle | ||
{...props} | ||
fillOpacity={0.8} | ||
stroke={props.payload.fill} | ||
strokeDasharray={4} | ||
strokeDashoffset={4} | ||
/> | ||
) | ||
}} | ||
/> | ||
</BarChart> | ||
</ChartContainer> | ||
</CardContent> | ||
</Card> | ||
) | ||
} |
Oops, something went wrong.