2022-06-26 21:42:42 +00:00
|
|
|
import { useState, useEffect } from 'react'
|
2022-05-09 13:04:36 +00:00
|
|
|
import { Col } from 'web/components/layout/col'
|
|
|
|
import { Spacer } from 'web/components/layout/spacer'
|
2022-06-26 21:42:42 +00:00
|
|
|
import { CustomAnalytics, FirebaseAnalytics } from '../stats'
|
|
|
|
import { getStats } from 'web/lib/firebase/stats'
|
|
|
|
import { Stats } from 'common/stats'
|
2022-03-20 22:21:28 +00:00
|
|
|
|
2022-06-26 21:42:42 +00:00
|
|
|
export default function AnalyticsEmbed() {
|
|
|
|
const [stats, setStats] = useState<Stats | undefined>(undefined)
|
|
|
|
useEffect(() => {
|
|
|
|
getStats().then(setStats)
|
|
|
|
}, [])
|
|
|
|
if (stats == null) {
|
|
|
|
return <></>
|
|
|
|
}
|
2022-03-20 22:21:28 +00:00
|
|
|
return (
|
2022-05-09 13:04:36 +00:00
|
|
|
<Col className="w-full bg-white px-2">
|
2022-06-26 21:42:42 +00:00
|
|
|
<CustomAnalytics {...stats} />
|
2022-03-20 22:21:28 +00:00
|
|
|
<Spacer h={8} />
|
|
|
|
<FirebaseAnalytics />
|
|
|
|
</Col>
|
|
|
|
)
|
|
|
|
}
|