Searching.ton
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.8 KiB

2 years ago
import { Suspense } from "react"
import Image from "next/image"
import Link from "next/link"
import Layout from "app/core/layouts/Layout"
import { useCurrentUser } from "app/core/hooks/useCurrentUser"
import logout from "app/auth/mutations/logout"
import logo from "public/logo.png"
import { useMutation } from "@blitzjs/rpc"
import { Routes, BlitzPage } from "@blitzjs/next"
import Main from "app/core/pages/Main"
// import MainSearch from "app/core/pages/MainSearch/old"
import { ErrorBoundary } from "@blitzjs/next"
function ErrorFallback({ error, resetErrorBoundary }) {
return (
<div role="alert">
<p>Something went wrong:</p>
<pre>{error.message}</pre>
<button onClick={resetErrorBoundary}>Try again</button>
</div>
)
}
import {
serverSideProps,
ServerSidePropsContext,
} from "app/core/contextProviders/serverSidePropsProvider"
import { gSSP } from "app/blitz-server"
2 years ago
import ContextProviders from "app/core/components/ContextProviders"
import getLastWeekNewSites from "app/stateSites/queries/getLastWeekNewSites"
import { NftDomain } from "@prisma/client"
2 years ago
2 years ago
interface Props {
lastWeekNewSites: NftDomain[]
cookies: Record<string,string>
}
const Home: BlitzPage<Props> = (props) => {
2 years ago
return (
<ErrorBoundary
FallbackComponent={ErrorFallback}
onReset={() => {
// reset the state of your app so the error doesn't happen again
}}
>
2 years ago
<ContextProviders contextParamsServer={props}>
2 years ago
<Layout title="Searching" withoutPaddings>
2 years ago
<Suspense fallback="Loading...">
2 years ago
<Main lastWeekNewSites={props.lastWeekNewSites}/>
2 years ago
</Suspense>
</Layout>
2 years ago
</ContextProviders>
2 years ago
</ErrorBoundary>
)
}
2 years ago
export const getServerSideProps = gSSP(
serverSideProps(async () => {
return {
...(await getLastWeekNewSites()),
}
})
)
2 years ago
export default Home