From 5b57b12e0e483f864fa98b94e8e5de34deddcb31 Mon Sep 17 00:00:00 2001 From: Jared Schoeny Date: Fri, 19 Dec 2025 15:48:11 -1000 Subject: [PATCH] Add simple "More from @username" card to hack page --- src/app/hack/[slug]/page.tsx | 41 +++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/app/hack/[slug]/page.tsx b/src/app/hack/[slug]/page.tsx index 69e113e..6a70fd7 100644 --- a/src/app/hack/[slug]/page.tsx +++ b/src/app/hack/[slug]/page.tsx @@ -1,5 +1,6 @@ import { baseRoms, PLATFORM_NAMES } from "@/data/baseRoms"; import type { Metadata } from "next"; +import Link from "next/link"; import { notFound } from "next/navigation"; import Gallery from "@/components/Hack/Gallery"; import HackActions from "@/components/Hack/HackActions"; @@ -7,7 +8,7 @@ import ReactMarkdown from "react-markdown"; import remarkGfm from "remark-gfm"; import rehypeSlug from "rehype-slug"; import Image from "next/image"; -import { FaDiscord, FaTwitter, FaTriangleExclamation } from "react-icons/fa6"; +import { FaDiscord, FaTwitter, FaTriangleExclamation, FaArrowUpRightFromSquare } from "react-icons/fa6"; import PokeCommunityIcon from "@/components/Icons/PokeCommunityIcon"; import { createClient, createServiceClient } from "@/utils/supabase/server"; import HackOptionsMenu from "@/components/Hack/HackOptionsMenu"; @@ -154,6 +155,16 @@ export default async function HackDetail({ params }: HackDetailProps) { .maybeSingle(); const author = hack.original_author ? hack.original_author : (profile?.username ? `@${profile.username}` : "Unknown"); + // Get other approved hacks by the same author + const { data: otherHacks } = await supabase + .from("hacks") + .select("slug,title,summary") + .eq("created_by", hack.created_by) + .eq("approved", true) + .neq("slug", hack.slug) + .order("downloads", { ascending: false }) + .limit(10); + const { data: { user }, } = await supabase.auth.getUser(); @@ -463,6 +474,34 @@ export default async function HackDetail({ params }: HackDetailProps) { )} + {otherHacks && otherHacks.length > 0 && ( +
+

More from {author}

+ +
+ )} {isInformationalArchive ? (