import PropTypes from 'prop-types'
import {Container, Typography, Box, Divider, Chip, Grid} from '@mui/material'
import ArrowCircleDownIcon from '@mui/icons-material/ArrowCircleDown'
import HeadLayout from '../components/head-layout'
import Footer from '../components/footer'
import RezoDialog from '../components/rezo/rezo-dialog'
import {jwennStats} from '../lib/oki-api'
import KatKayLa from '../components/kat-kay-la'
import Custom500 from './500'
export default function Home({errorCode, errorMessage, stats}) {
if (errorCode) {
console.log('⚠️ error', errorMessage)
return
}
return (
#OKi
Organisation KA Internationale
Paroles, traductions et Fediverse
} label='Statistiques' variant='outlined' />
)
}
export async function getServerSideProps() {
let stats
let errorCode
let errorMessage
try {
stats = await jwennStats()
} catch (error) {
errorMessage = error.message
errorCode = true
}
return {
props: {
errorCode: errorCode || null,
errorMessage: errorMessage || null,
stats: stats || null
}
}
}
Home.defaultProps = {
errorCode: null,
errorMessage: null,
stats: null
}
Home.propTypes = {
errorCode: PropTypes.bool,
errorMessage: PropTypes.string,
stats: PropTypes.object
}