manifold/web/pages/embed/analytics.tsx

24 lines
668 B
TypeScript
Raw Normal View History

import { useState, useEffect } from 'react'
import { Col } from 'web/components/layout/col'
import { Spacer } from 'web/components/layout/spacer'
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
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 (
<Col className="w-full bg-white px-2">
<CustomAnalytics {...stats} />
2022-03-20 22:21:28 +00:00
<Spacer h={8} />
<FirebaseAnalytics />
</Col>
)
}