-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
... and queried data from supabase
- Loading branch information
Showing
4 changed files
with
95 additions
and
68 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 |
---|---|---|
@@ -1,16 +1,33 @@ | ||
import { createServerComponentClient } from "@supabase/auth-helpers-nextjs"; | ||
import { cookies } from "next/headers"; | ||
import RunningBarChart from "./running-bar-chart"; | ||
import { Footprints } from "lucide-react"; | ||
import ContentDisplay from "../layouts/content-display"; | ||
|
||
export const dynamic = "force-dynamic"; | ||
|
||
export default async function Running() { | ||
const supabase = createServerComponentClient<Database>({ cookies }); | ||
const { data: runs } = await supabase.from("running").select(); | ||
const { data } = await supabase | ||
.from("running_monthly") | ||
.select("year, month,total_distance") | ||
.order("year", { ascending: true }) | ||
.order("month"); | ||
|
||
const runData = | ||
data?.map((run) => ({ | ||
month: String(run.month), | ||
distance: run.total_distance, | ||
})) ?? []; | ||
|
||
return ( | ||
<div> | ||
<RunningBarChart /> | ||
</div> | ||
<ContentDisplay | ||
className="col-span-2 w-full min-[560px]:col-span-4" | ||
name="Running" | ||
description="I run a lot" | ||
symbol={<Footprints />} | ||
> | ||
<RunningBarChart runMonthData={runData} /> | ||
</ContentDisplay> | ||
); | ||
} |
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