cg / hackerproducts
63 files · 5,740 lines · 159.1 KB — Next.js 15, React 19, TypeScript, PostgreSQL, Object Storage, plain CSS.
Quick jump: page.tsxpage.tsxglobals.cssschema.sqlpackage.json
root / src / app / makers / page.tsx
src/app/makers/page.tsx · 69 lines · 2.1 KB← back to folder
| 1 | import type { Metadata } from "next"; |
| 2 | import Link from "next/link"; |
| 3 | import { getFallbackIconColor } from "@/lib/format"; |
| 4 | import { listMakers } from "@/lib/products"; |
| 5 | |
| 6 | export const dynamic = "force-dynamic"; |
| 7 | |
| 8 | export const metadata: Metadata = { |
| 9 | title: "Makers", |
| 10 | description: "People building products on Hacker Products.", |
| 11 | alternates: { canonical: "/makers" }, |
| 12 | }; |
| 13 | |
| 14 | export default async function MakersPage() { |
| 15 | const makers = await listMakers(); |
| 16 | |
| 17 | return ( |
| 18 | <div> |
| 19 | <h1>Makers</h1> |
| 20 | <p className="subtitle">People who have published products here.</p> |
| 21 | |
| 22 | {makers.length === 0 ? ( |
| 23 | <p className="muted"> |
| 24 | No makers yet. <Link href="/submit">Submit a product</Link> to appear here. |
| 25 | </p> |
| 26 | ) : ( |
| 27 | <ul className="product-list"> |
| 28 | {makers.map((maker) => ( |
| 29 | <li key={maker.id} className="product-row"> |
| 30 | {maker.avatar_url ? ( |
| 31 | <img |
| 32 | src={maker.avatar_url} |
| 33 | alt="" |
| 34 | width={24} |
| 35 | height={24} |
| 36 | className="maker-avatar-sm" |
| 37 | loading="lazy" |
| 38 | /> |
| 39 | ) : ( |
| 40 | <span |
| 41 | className="maker-avatar-sm" |
| 42 | style={{ backgroundColor: getFallbackIconColor(maker.username) }} |
| 43 | aria-hidden="true" |
| 44 | > |
| 45 | {maker.username[0].toUpperCase()} |
| 46 | </span> |
| 47 | )} |
| 48 | <span className="product-row-body"> |
| 49 | <Link href={`/${maker.username}`} className="product-name-link"> |
| 50 | {maker.username} |
| 51 | </Link> |
| 52 | {maker.bio && ( |
| 53 | <> |
| 54 | <span className="product-sep"> · </span> |
| 55 | <span className="product-desc">{maker.bio}</span> |
| 56 | </> |
| 57 | )} |
| 58 | <span className="star-inline"> |
| 59 | {maker.product_count} {maker.product_count === 1 ? "product" : "products"} |
| 60 | </span> |
| 61 | </span> |
| 62 | </li> |
| 63 | ))} |
| 64 | </ul> |
| 65 | )} |
| 66 | </div> |
| 67 | ); |
| 68 | } |
| 69 |