Switch /analytics to propz

This commit is contained in:
Austin Chen 2022-03-07 14:20:15 -08:00
parent 0fcfee6d77
commit 95e24e9b87

View File

@ -5,11 +5,13 @@ import { Col } from '../components/layout/col'
import { Spacer } from '../components/layout/spacer'
import { Page } from '../components/page'
import { Title } from '../components/title'
import { usePropz } from '../hooks/use-propz'
import { getDailyBets } from '../lib/firebase/bets'
import { getDailyComments } from '../lib/firebase/comments'
import { getDailyContracts } from '../lib/firebase/contracts'
import { IS_PRIVATE_MANIFOLD } from '../lib/firebase/init'
export async function getStaticProps() {
export async function getStaticPropz() {
const numberOfDays = 80
const today = dayjs(dayjs().format('YYYY-MM-DD'))
const startDate = today.subtract(numberOfDays, 'day')
@ -54,11 +56,18 @@ export default function Analytics(props: {
dailyContractCounts: number[]
dailyCommentCounts: number[]
}) {
props = usePropz(getStaticPropz) ?? {
startDate: 0,
dailyActiveUsers: [],
dailyBetCounts: [],
dailyContractCounts: [],
dailyCommentCounts: [],
}
return (
<Page>
<CustomAnalytics {...props} />
<Spacer h={8} />
<FirebaseAnalytics />
{!IS_PRIVATE_MANIFOLD && <FirebaseAnalytics />}
</Page>
)
}