Skip to content

Commit 52686f9

Browse files
committed
feat: dashboard search queries
1 parent 8635478 commit 52686f9

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

app/(protected)/dashboard/page.tsx

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,30 @@ export const metadata: Metadata = {
2020
title: `Dashboard · ${SITE_NAME}`,
2121
}
2222

23-
export default async function Dashboard() {
23+
export default async function Dashboard({
24+
searchParams,
25+
}: {
26+
searchParams: Promise<{
27+
library_id: string
28+
from: string
29+
to: string
30+
limit: number
31+
skip: number
32+
}>
33+
}) {
34+
const {
35+
library_id = 'a32af9bd-74b0-4ef2-8974-4570e2bfb4bb',
36+
from = '2024-01-05T17:00:47.680Z',
37+
to = new Date().toJSON(),
38+
limit = 5,
39+
skip,
40+
} = await searchParams
2441
const res = await getAnalysis({
25-
limit: 50,
26-
skip: 0,
27-
from: '2024-01-05T17:00:47.680Z',
28-
to: '2025-06-05T17:00:47.680Z',
29-
library_id: 'd7385c3e-05f7-4d0d-88c8-74fdc830ec87',
42+
limit,
43+
skip,
44+
from,
45+
to,
46+
library_id,
3047
})
3148
console.log(res)
3249

components/dashboard/MonthlyRevenueChart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { TrendingUp } from 'lucide-react'
3+
// import { TrendingUp } from 'lucide-react'
44
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
55

66
import {
@@ -107,11 +107,11 @@ export function MonthlyRevenueChart({ data }: { data: Analysis['revenue'] }) {
107107
<CardFooter>
108108
<div className="flex w-full items-start gap-2 text-sm">
109109
<div className="grid gap-2">
110-
<div className="flex items-center gap-2 font-medium leading-none">
110+
{/* <div className="flex items-center gap-2 font-medium leading-none">
111111
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
112-
</div>
112+
</div> */}
113113
<div className="flex items-center gap-2 leading-none text-muted-foreground">
114-
January - June 2024
114+
Showing total revenue from subscriptions and fines
115115
</div>
116116
</div>
117117
</div>

components/dashboard/MostBorrowedBookChart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { TrendingUp } from 'lucide-react'
3+
// import { TrendingUp } from 'lucide-react'
44
import { Bar, BarChart, XAxis, YAxis } from 'recharts'
55

66
import {
@@ -69,11 +69,11 @@ export function MostBorrowedBookChart({ data }: { data: Analysis['book'] }) {
6969
</ChartContainer>
7070
</CardContent>
7171
<CardFooter className="flex-col items-start gap-2 text-sm">
72-
<div className="flex gap-2 font-medium leading-none">
72+
{/* <div className="flex gap-2 font-medium leading-none">
7373
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
74-
</div>
74+
</div> */}
7575
<div className="leading-none text-muted-foreground">
76-
Showing total visitors for the last 6 months
76+
Showing top most borrowed books
7777
</div>
7878
</CardFooter>
7979
</Card>

components/dashboard/TopMembershipChart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { TrendingUp } from 'lucide-react'
3+
// import { TrendingUp } from 'lucide-react'
44
import { Pie, PieChart } from 'recharts'
55

66
import {
@@ -52,11 +52,11 @@ export function TopMembershipChart({ data }: { data: Analysis['membership'] }) {
5252
</ChartContainer>
5353
</CardContent>
5454
<CardFooter className="flex-col gap-2 text-sm">
55-
<div className="flex items-center gap-2 font-medium leading-none">
55+
{/* <div className="flex items-center gap-2 font-medium leading-none">
5656
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
57-
</div>
57+
</div> */}
5858
<div className="leading-none text-muted-foreground">
59-
Showing total visitors for the last 6 months
59+
Showing top most purchased membership
6060
</div>
6161
</CardFooter>
6262
</Card>

0 commit comments

Comments
 (0)