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.

64 lines
1.8 KiB

import { Suspense } from "react"
import Layout from "app/core/layouts/Layout"
import getActualSitesState from "app/stateSites/queries/getActualSitesState"
import getHistoryOfSitesState from "app/stateSites/queries/getHistoryOfSitesState"
import { BlitzPage } from "@blitzjs/next"
import State from "app/core/pages/State"
2 years ago
import { gSSP } from "app/blitz-server"
import {
2 years ago
serverSideProps,
ServerSidePropsContext,
} from "app/core/contextProviders/serverSidePropsProvider"
2 years ago
import { ErrorBoundary } from "@blitzjs/next"
import { StatePageProps } from "app/core/pages/State/State"
import { StaticPageProps } from "app/core/commonTypes"
2 years ago
import ContextProviders from "app/core/components/ContextProviders"
import getLastWeekNewSites from "app/stateSites/queries/getLastWeekNewSites"
function ErrorFallback({ error, resetErrorBoundary }) {
return (
<div role="alert">
<p>Something went wrong:</p>
<pre>{error.message}</pre>
<button onClick={resetErrorBoundary}>Try again</button>
</div>
)
}
2 years ago
const StatePage: BlitzPage = (props) => {
return (
<ErrorBoundary
FallbackComponent={ErrorFallback}
onReset={() => {
// reset the state of your app so the error doesn't happen again
}}
>
2 years ago
<ContextProviders contextParamsServer={props}>
<Layout title="State of TON Sites" withoutPaddings>
<Suspense fallback="Loading....">
<State {...props} />
</Suspense>
</Layout>
2 years ago
</ContextProviders>
</ErrorBoundary>
)
}
2 years ago
export const getServerSideProps = gSSP(
serverSideProps(async (): Promise<StatePageProps> => {
const actualState = await getActualSitesState()
const historyOfState = await getHistoryOfSitesState()
return {
actualState,
2 years ago
historyOfState,
...(await getLastWeekNewSites()),
}
})
)
export default StatePage