mirror of
https://github.com/luxfi/market.git
synced 2026-09-24 00:25:57 +00:00
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:
+3
-24
@@ -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} />
|
||||
|
||||
@@ -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
@@ -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}/>
|
||||
|
||||
Reference in New Issue
Block a user