import { getTranslations, setRequestLocale } from 'next-intl/server' import { Link } from '@/i18n/navigation' import { searchTopics, countSearchTopics } from '@/lib/forum' import { ForumSearchBox } from '@/components/ForumSearchBox' export const dynamic = 'force-dynamic' export default async function ForumSearchPage({ params, searchParams, }: { params: Promise<{ locale: string }> searchParams: Promise<{ q?: string }> }) { const { locale } = await params setRequestLocale(locale) const { q } = await searchParams const query = (q ?? '').trim() const t = await getTranslations('Forum') const valid = query.length >= 2 const results = valid ? await searchTopics(query, 0, 30) : [] const total = valid ? await countSearchTopics(query) : 0 return (

← {t('backToForum')}

{t('search')}

{!valid ? (

{t('searchHint')}

) : results.length === 0 ? (

{t('noResults', { query })}

) : ( <>

{t('resultsCount', { count: total, query })}

)}
) }