diff --git a/app/(public)/flex/page.tsx b/app/(public)/flex/page.tsx new file mode 100644 index 0000000..8937260 --- /dev/null +++ b/app/(public)/flex/page.tsx @@ -0,0 +1,104 @@ +import { createClient } from "../../lib/supabase/server"; +import Footer from "@/app/components/layout/Footer"; +import CTA from "@/app/components/layout/CTA"; +import BackButton from "@/app/components/leaderboard/BackButton"; +import Image from "next/image"; +import { timeAgo } from "@/app/utils/time"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faExternalLink } from "@fortawesome/free-solid-svg-icons"; + +export default async function Flexs() { + const supabase = await createClient(); + + const [userFlexes, userResult] = await Promise.all([ + supabase + .from("user_flexes") + .select("*") + .order("created_at", { ascending: false }), + supabase.auth.getUser(), + ]); + + const { data, error } = userFlexes; + const { data: user } = userResult; + + return ( +
+ Please come back later to see the latest flexes from our + community. +
+{flex.project_description}
+ {flex.is_open_source && ( + <> + + Open Source: + + + {flex.open_source_url} + + > + )} ++ Posted by {flex.user_email.split("@")[0]} +
+ ++ + + Share your flexes with the community + +
+Loading your flexes...
++ You have no flexes yet. Start by sharing your first project! +
+{f.project_description}
+ ++ You have no projects to flex yet. +
+ )} + + {flexes + .filter((u) => + u.name.toLowerCase().includes(search.toLowerCase()), + ) + .map((u, idx) => ( +