2020-12-17 09:08:18 +01:00
|
|
|
import {useState} from 'react'
|
2020-12-17 22:36:27 +01:00
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
|
import Image from 'next/image'
|
2021-09-17 07:53:43 +02:00
|
|
|
import {Box, Container, Grid, Typography, useMediaQuery} from '@material-ui/core'
|
2021-07-19 23:41:59 +02:00
|
|
|
import {makeStyles} from '@material-ui/core/styles'
|
|
|
|
|
import GroupIcon from '@material-ui/icons/Group'
|
|
|
|
|
import MusicNoteIcon from '@material-ui/icons/MusicNote'
|
2021-08-23 19:16:04 +02:00
|
|
|
import {Pleroma, Peertube} from '@icons-pack/react-simple-icons'
|
2021-09-23 21:21:46 +02:00
|
|
|
import TelegramIcon from '@material-ui/icons/Telegram'
|
2020-12-17 09:08:18 +01:00
|
|
|
|
2020-12-17 22:36:27 +01:00
|
|
|
import KatKayLa from '../components/kat-kay-la'
|
2020-12-15 23:46:05 +01:00
|
|
|
import HeadLayout from '../components/head-layout'
|
2020-12-17 09:08:18 +01:00
|
|
|
import Carousel from '../components/carousel'
|
2021-06-14 23:30:00 +02:00
|
|
|
import Footer from '../components/footer'
|
2020-12-23 20:31:15 +01:00
|
|
|
import {jwennTeksKantite, jwennAwtisKantite} from '../lib/oki-api'
|
2021-07-19 23:41:59 +02:00
|
|
|
import RezoMenu from '../components/rezo-menu'
|
|
|
|
|
|
2021-07-22 21:21:01 +02:00
|
|
|
import okiLogo from '../public/logo-192x110.png'
|
|
|
|
|
|
2021-09-26 20:55:26 +02:00
|
|
|
const TELEGRAM_GROUP = process.env.NEXT_PUBLIC_TELEGRAM_GROUP || 'OrganisationKA'
|
|
|
|
|
const TWITTER_USERNAME = process.env.NEXT_PUBLIC_TWITTER_USERNAME || 'OrganisationKA'
|
|
|
|
|
|
2021-07-19 23:41:59 +02:00
|
|
|
const useStyles = makeStyles(theme => ({
|
|
|
|
|
root: {
|
|
|
|
|
'& > *': {
|
2021-07-22 01:00:17 +02:00
|
|
|
margin: theme.spacing(1.2)
|
2021-07-19 23:41:59 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
const REZO = [
|
2021-09-23 21:21:46 +02:00
|
|
|
{
|
|
|
|
|
id: 'telegram',
|
|
|
|
|
tit: 'Telegram',
|
|
|
|
|
icon: <TelegramIcon />,
|
|
|
|
|
link: 'https://t.me/OrganisationKA'
|
|
|
|
|
},
|
2021-07-19 23:41:59 +02:00
|
|
|
{
|
|
|
|
|
id: 'mizik',
|
|
|
|
|
tit: 'Mizik',
|
|
|
|
|
icon: <MusicNoteIcon />
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'pale',
|
|
|
|
|
tit: 'Palé',
|
|
|
|
|
icon: <Pleroma />
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'gade',
|
|
|
|
|
tit: 'Gadé',
|
|
|
|
|
icon: <Peertube />
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'mobilize',
|
|
|
|
|
tit: 'Mobilizé',
|
|
|
|
|
icon: <GroupIcon />
|
|
|
|
|
}
|
|
|
|
|
]
|
2020-12-04 20:16:24 +01:00
|
|
|
|
2020-12-18 22:01:47 +01:00
|
|
|
export default function Home({kantiteAwtis, kantiteTeks}) {
|
2021-07-19 23:41:59 +02:00
|
|
|
const classes = useStyles()
|
2020-12-17 09:08:18 +01:00
|
|
|
const [handleOpen, setHandleOpen] = useState(false)
|
|
|
|
|
|
2020-12-18 22:01:47 +01:00
|
|
|
const kantite = [
|
2021-08-21 21:37:09 +02:00
|
|
|
{id: 1, tit: 'Tèks', soutit: 'Texte', kantite: kantiteTeks, route: '/teks'},
|
|
|
|
|
{id: 2, tit: 'Awtis', soutit: 'Artiste', kantite: kantiteAwtis, route: '/awtis?paj&paj=1'}
|
2020-12-17 22:36:27 +01:00
|
|
|
]
|
|
|
|
|
|
2020-12-17 09:08:18 +01:00
|
|
|
const matches = useMediaQuery('(max-width:600px)')
|
|
|
|
|
|
2020-12-04 20:16:24 +01:00
|
|
|
return (
|
2020-12-15 23:46:05 +01:00
|
|
|
<HeadLayout tab={0}>
|
2021-06-14 23:30:00 +02:00
|
|
|
<div style={{display: 'flex', flexDirection: 'column', minHeight: '100vh'}}>
|
|
|
|
|
<Container align='center'>
|
|
|
|
|
<Image
|
|
|
|
|
alt='Logo #OKi'
|
|
|
|
|
width={192}
|
|
|
|
|
height={110}
|
2021-07-22 21:21:01 +02:00
|
|
|
src={okiLogo}
|
|
|
|
|
placeholder='blur'
|
2021-06-14 23:30:00 +02:00
|
|
|
/>
|
|
|
|
|
<Typography variant='h6' component='h1'>
|
|
|
|
|
Organisation KA Internationale
|
|
|
|
|
</Typography>
|
|
|
|
|
</Container>
|
2021-07-22 20:29:25 +02:00
|
|
|
<Container className={classes.root} style={{display: 'flex', justifyContent: 'center'}} align='center'>
|
|
|
|
|
<Box style={{display: 'flex', flexDirection: 'column'}}>
|
|
|
|
|
<RezoMenu data={REZO} />
|
|
|
|
|
</Box>
|
2021-07-22 01:00:17 +02:00
|
|
|
</Container>
|
2021-09-17 07:57:44 +02:00
|
|
|
<Container style={{marginBlock: '1em'}}>
|
|
|
|
|
<Grid container spacing={3}>
|
|
|
|
|
{kantite.map(k => <KatKayLa key={k.id} tit={k.tit} soutit={k.soutit} kantite={k.kantite} route={k.route} />)}
|
|
|
|
|
</Grid>
|
|
|
|
|
</Container>
|
2021-06-14 23:30:00 +02:00
|
|
|
<Carousel
|
|
|
|
|
isMobile={matches}
|
|
|
|
|
handleOpen={handleOpen}
|
|
|
|
|
setHandleOpen={setHandleOpen}
|
|
|
|
|
/>
|
|
|
|
|
<Footer />
|
|
|
|
|
</div>
|
2020-12-15 23:46:05 +01:00
|
|
|
</HeadLayout>
|
2020-12-04 20:16:24 +01:00
|
|
|
)
|
|
|
|
|
}
|
2020-12-11 01:38:05 +01:00
|
|
|
|
2020-12-17 22:36:27 +01:00
|
|
|
Home.propTypes = {
|
2020-12-18 22:01:47 +01:00
|
|
|
kantiteAwtis: PropTypes.number.isRequired,
|
|
|
|
|
kantiteTeks: PropTypes.number.isRequired
|
2020-12-17 22:36:27 +01:00
|
|
|
}
|
|
|
|
|
|
2020-12-11 01:38:05 +01:00
|
|
|
export async function getServerSideProps() {
|
2020-12-23 20:31:15 +01:00
|
|
|
const awtisResponse = await jwennAwtisKantite()
|
|
|
|
|
const teksResponse = await jwennTeksKantite()
|
|
|
|
|
const kantiteAwtis = awtisResponse
|
|
|
|
|
const kantiteTeks = teksResponse
|
2020-12-11 01:38:05 +01:00
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
props: {
|
2020-12-18 22:01:47 +01:00
|
|
|
kantiteAwtis,
|
|
|
|
|
kantiteTeks
|
2020-12-11 01:38:05 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|