diff --git a/app/affiliation/[identifier]/page.tsx b/app/affiliation/[identifier]/page.tsx new file mode 100644 index 0000000..cfe93fa --- /dev/null +++ b/app/affiliation/[identifier]/page.tsx @@ -0,0 +1,124 @@ +import Grid from "@/components/Grid"; +import Header from "@/components/Header"; +import { REGISTRY } from "@/lib/affiliations/registry"; +import { db } from "@/lib/db/connection"; +import * as Dialog from "@radix-ui/react-dialog"; + +const PAGE_SIZE = 101; + +const SHOVEL_PRO_URL = process.env.SHOVEL_PRO_URL; + +import { Metadata, ResolvingMetadata } from "next"; + +type Props = { + params: { identifier: string }; +}; + +export async function generateMetadata( + { params }: Props, + parent: ResolvingMetadata +): Promise { + const service = REGISTRY[params.identifier]; + + return { + title: `${service.name} - shovel.report`, + description: `Information about domains affiliated with ${service.name}.`, + alternates: { + canonical: `/affiliation/${params.identifier}`, + }, + }; +} + +export default async function AffiliationPage({ + params, +}: { + params: { identifier: string }; +}) { + const service = REGISTRY[params.identifier]; + const data = process.env.DISABLE_DATABASE + ? { data: [], moreCount: 0 } + : await db + .selectFrom("affiliations") + .where("affiliations.identifier", "=", params.identifier) + .selectAll() + .distinctOn("domain") + .execute() + .then((results) => { + if (results.length > PAGE_SIZE) { + const moreCount = results.length - PAGE_SIZE; + return { + data: results.slice(0, PAGE_SIZE), + moreCount, + }; + } + return { + data: results, + moreCount: 0, + }; + }); + + return ( +
+ {service ? ( + <> +
+ {service.name} +
+
+ + {service.domain} + +
+ + ) : ( +
Unknown technology
+ )} + + + {data.data.map((item) => ( + +
{item.domain}
+
+ ))} + {data.moreCount > 0 && ( + +
+ {/* Note: This component should be moved to a client-side component */} + + + + + + + + Upgrade to Pro + + Get the full list for just $299. + + + + + +
+
+ )} +
+
+ ); +} diff --git a/components/DomainIcon.tsx b/components/DomainIcon.tsx index c9e1dd3..b8940cb 100644 --- a/components/DomainIcon.tsx +++ b/components/DomainIcon.tsx @@ -4,7 +4,7 @@ const DomainIcon = ({ domain }: { domain: string }) => { if (DISABLE_ICONHORSE) { return null; } - return ; + return {`Icon; }; export default DomainIcon;