fix: remove searchParams for static export compatibility

Removed searchParams usage that forces dynamic rendering. For static
export (GitHub Pages), server-side searchParams is not available.
Client components now use useSearchParams hook where needed.
This commit is contained in:
2025-12-15 06:42:08 -08:00
parent ffd532a888
commit 54058a9716
3 changed files with 12 additions and 43 deletions
+3 -24
View File
@@ -1,33 +1,12 @@
import React from 'react'
import { Desktop, TouchDevice } from './scroll-snap'
import { TouchDevice } from './scroll-snap'
import { Header } from '@luxfi/ui'
type PageProps = {
params: { slug: string };
searchParams?: { [key: string]: string | string[] | undefined };
}
import siteDef from '@/site-def'
const Page: React.FC<PageProps> = ({
searchParams
}) => {
// see src/middleware.ts
const agent = searchParams?.agent
if (agent === 'desktop') {
return (<>
<Header siteDef={siteDef}/>
<Desktop />
</>)
}
else if (agent === 'tablet') {
return (<>
<Header siteDef={siteDef}/>
<TouchDevice isTablet={true} />
</>)
}
const Page = () => {
// For static export, default to mobile-first responsive design
return (<>
<Header siteDef={siteDef}/>
<TouchDevice isTablet={false} />
+2 -8
View File
@@ -10,11 +10,9 @@ import siteDef from '../../site-def'
type Props = {
params: { slug: 'silver' | 'gold' | 'coin' | 'credit' | 'validator' | 'key' | 'uranium' }
searchParams?: { [key: string]: string | string[] | undefined }
}
export async function generateStaticParams() {
const products = [
'silver',
'gold',
@@ -36,21 +34,17 @@ export async function generateMetadata({ params}: Props) {
return { title: capitalized }
}
const ProductPage = ({ params, searchParams }: Props) => {
const ProductPage = ({ params }: Props) => {
const product = products[params.slug] as ProductDetailBlock
if (!product) {
notFound()
}
// see src/middleware.ts
const agent = searchParams?.agent
return (<>
<Header siteDef={siteDef}/>
<Main className='md:flex-row md:gap-4'>
<ProductDetailBlockComponent block={product} agent={agent as string}/>
<ProductDetailBlockComponent block={product} />
</Main>
<div className='border-t'></div>
<Footer siteDef={siteDef} className='w-full pt-16 lg:mx-auto ' />
+7 -11
View File
@@ -2,24 +2,20 @@
import React from 'react'
import {
Tabs,
TabsList,
TabsTrigger,
TabsContent
Tabs,
TabsList,
TabsTrigger,
TabsContent
} from '@hanzo/ui/primitives'
import { Header, Main } from '@luxfi/ui'
import siteDef from '@/site-def'
import AddPanel from './_page/add-panel'
import BuyPanel from './_page/buy-panel'
import AddPanel from './_page/add-panel'
import BuyPanel from './_page/buy-panel'
type Props = {
searchParams?: { [key: string]: string | string[] | undefined }
}
const Page = ({ searchParams }: Props ) => {
const Page = () => {
return (<>
<Header siteDef={siteDef}/>