import dynamic from 'next/dynamic'; import { redirect } from 'next/navigation'; import urlJoin from 'url-join'; import StructuredData from '@/components/StructuredData'; import { Locales } from '@/locales/resources'; import { ldModule } from '@/server/ld'; import { metadataModule } from '@/server/metadata'; import { translation } from '@/server/translation'; import { isMobileDevice } from '@/utils/responsive'; import { ListLoadingWithoutBanner } from '../components/ListLoading'; const AssistantsResult = dynamic(() => import('./features/AssistantsResult'), { loading: () => , }); const PluginsResult = dynamic(() => import('./features/PluginsResult'), { loading: () => , }); const ModelsResult = dynamic(() => import('./features/ModelsResult'), { loading: () => , }); const ProvidersResult = dynamic(() => import('./features/ProvidersResult'), { loading: () => , }); type Props = { searchParams: { hl?: Locales; q?: string; type?: 'assistants' | 'plugins' | 'models' | 'providers'; }; }; export const generateMetadata = async ({ searchParams }: Props) => { const { t, locale } = await translation('metadata', searchParams?.hl); return metadataModule.generate({ alternate: true, description: t('discover.description'), locale, title: t('discover.search'), url: '/discover/search', }); }; const Page = async ({ searchParams }: Props) => { const { q, type = 'assistants',userid } = searchParams; if (!q) redirect(urlJoin(`/discover`, type)); const keywords = decodeURIComponent(q); const { t, locale } = await translation('metadata', searchParams?.hl); const mobile = isMobileDevice(); const ld = ldModule.generate({ description: t('discover.description'), title: t('discover.search'), url: '/discover/search', webpage: { enable: true, search: '/discover/search', }, }); return ( <> {type === 'assistants' && } {type === 'plugins' && } {type === 'models' && } {type === 'providers' && } ); }; Page.DisplayName = 'DiscoverSearch'; export default Page;