-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
+feat: stats
1 parent
8c1902d
commit 5c6546b
Showing
5 changed files
with
257 additions
and
142 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"use client" | ||
|
||
import CountUp from "react-countup" | ||
|
||
type StatsResponse = { | ||
stats: | ||
| { | ||
clicks: number | ||
created_at: string | ||
id: string | ||
utm_source: string | ||
}[] | ||
| null | ||
} | ||
|
||
export function Stats({ stats }: StatsResponse) { | ||
return ( | ||
<ul> | ||
{stats?.map(stat => ( | ||
<li className="flex flex-row justify-center items-center" key={stat.id}> | ||
<p>{stat.utm_source} - </p> | ||
<CountUp | ||
className="font-bold text-secondary-foreground" | ||
end={stat.clicks} | ||
duration={4} | ||
delay={0.5} | ||
separator="" | ||
key={stat.id} | ||
/> | ||
</li> | ||
))} | ||
</ul> | ||
) | ||
} |
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,15 @@ | ||
import supabaseAdmin from "@/libs/supabase/supabaseAdmin" | ||
import CountUp from "react-countup" | ||
import { Stats } from "./components/Stats" | ||
|
||
export default async function StatsPage() { | ||
const { data: stats } = await supabaseAdmin.from("stats").select("*") | ||
|
||
return ( | ||
<div | ||
className="w-full py-12 h-[calc(100vh-64px)] overflow-x-hidden overflow-y-auto | ||
text-2xl text-title flex flex-col gap-y-8 justify-between items-center mx-auto"> | ||
<Stats stats={stats} /> | ||
</div> | ||
) | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.