This repository has no description
1import type { Metadata } from 'next';
2import { getDomain } from '@/lib/utils/link';
3import { redirect } from 'next/navigation';
4import SemblePageClient from '@/features/semble/containers/sembleContainer/SemblePageClient';
5import SembleContainer from '@/features/semble/containers/sembleContainer/SembleContainer';
6import { Suspense } from 'react';
7import SembleContainerSkeleton from '@/features/semble/containers/sembleContainer/Skeleton.SembleContainer';
8
9interface Props {
10 searchParams: Promise<{ id: string | undefined; viaCardId?: string }>;
11}
12
13export async function generateMetadata({
14 searchParams,
15}: {
16 searchParams: Promise<{ id: string | undefined; viaCardId?: string }>;
17}): Promise<Metadata> {
18 const { id: url } = await searchParams;
19
20 if (!url) return {};
21
22 const domain = getDomain(url);
23
24 return {
25 title: `${domain}`,
26 description: `Semble page for ${domain}`,
27 openGraph: {
28 images: [
29 {
30 url: `${process.env.APP_URL}/api/opengraph/semble?url=${url}`,
31 width: 1200,
32 height: 630,
33 alt: `Semble page for ${domain}`,
34 },
35 ],
36 },
37 };
38}
39
40export default async function Page(props: Props) {
41 const searchParams = await props.searchParams;
42 const url = searchParams.id
43 ? decodeURIComponent(searchParams.id)
44 : searchParams.id;
45 const viaCardId = searchParams.viaCardId;
46
47 if (!url) {
48 redirect('/');
49 }
50
51 return (
52 <Suspense fallback={<SembleContainerSkeleton />} key={url + 'container'}>
53 <SemblePageClient viaCardId={viaCardId}>
54 <SembleContainer url={url} viaCardId={viaCardId} />
55 </SemblePageClient>
56 </Suspense>
57 );
58}