This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

semble / src / webapp / app / (dashboard) / url / page.tsx
1.7 kB 66 lines
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<{ 11 id: string | undefined; 12 viaCardId?: string; 13 sembleTab?: string; 14 }>; 15} 16 17export async function generateMetadata({ 18 searchParams, 19}: { 20 searchParams: Promise<{ 21 id: string | undefined; 22 viaCardId?: string; 23 sembleTab?: string; 24 }>; 25}): Promise<Metadata> { 26 const { id: url } = await searchParams; 27 28 if (!url) return {}; 29 30 const domain = getDomain(url); 31 32 return { 33 title: `${domain}`, 34 description: `Semble page for ${domain}`, 35 openGraph: { 36 images: [ 37 { 38 url: `${process.env.APP_URL}/api/opengraph/semble?url=${url}`, 39 width: 1200, 40 height: 630, 41 alt: `Semble page for ${domain}`, 42 }, 43 ], 44 }, 45 }; 46} 47 48export default async function Page(props: Props) { 49 const searchParams = await props.searchParams; 50 const url = searchParams.id 51 ? decodeURIComponent(searchParams.id) 52 : searchParams.id; 53 const viaCardId = searchParams.viaCardId; 54 55 if (!url) { 56 redirect('/'); 57 } 58 59 return ( 60 <Suspense fallback={<SembleContainerSkeleton />} key={url + 'container'}> 61 <SemblePageClient viaCardId={viaCardId}> 62 <SembleContainer url={url} viaCardId={viaCardId} /> 63 </SemblePageClient> 64 </Suspense> 65 ); 66}