diff --git a/app/[installer-slug]/[install-id]/page.tsx b/app/[installer-slug]/[install-id]/page.tsx index 30864dc..cc25099 100644 --- a/app/[installer-slug]/[install-id]/page.tsx +++ b/app/[installer-slug]/[install-id]/page.tsx @@ -1,3 +1,5 @@ +import type { Metadata } from "next"; + import { createInstall, getInstall, @@ -5,16 +7,66 @@ import { } from "@/app/[installer-slug]/actions"; import { getAppBySlug, getInstaller } from "@/common"; import { Link } from "@/components"; + +import { Footer } from "@/components/Footer"; + import InstallStepper from "@/components/InstallStepper"; import { getCloudPlatformRegions } from "@/common"; +type Props = { + searchParams: { [key: string]: string | string[] | undefined }; +}; + +export async function generateMetadata({ + searchParams, +}: Props): Promise { + const { metadata } = await getInstaller( + searchParams ? searchParams.installerId : null, + ); + console.debug("[install] Generating Metdata"); + + // TODO(fd): we need to address this. + if (!!!metadata) { + console.debug("[install] No Metdata Found"); + return {}; + } + + return { + title: `Install Details | ${metadata.name}`, + description: metadata.description, + icons: { + icon: metadata.favicon_url, + shortcut: metadata.favicon_url, + }, + openGraph: { + title: metadata.name, + description: metadata.description, + type: "website", + images: [ + { + url: metadata.og_image_url, + }, + ], + }, + twitter: { + title: metadata.name, + description: metadata.description, + images: [ + { + url: metadata.logo_url, + }, + ], + }, + }; +} + export default async function Installer({ params, searchParams }) { const slug = params?.["installer-slug"]; const installId = params?.["install-id"]; const [app, installer, install] = await Promise.all([ getAppBySlug(slug), - getInstaller(), + getInstaller(searchParams ? searchParams.installerId : null), getInstall(installId), ]); const regions = await getCloudPlatformRegions(app.cloud_platform); @@ -55,6 +107,7 @@ export default async function Installer({ params, searchParams }) { regions={regions} /> +