Files
pawol.nu/pages/index.js
T

128 lines
3.6 KiB
JavaScript
Raw Normal View History

2020-12-17 22:36:27 +01:00
import PropTypes from 'prop-types'
import Image from 'next/image'
2022-01-20 18:01:52 +04:00
import {Container, Grid, Typography, Button, Box} from '@mui/material'
2022-01-19 07:06:26 +04:00
import GroupIcon from '@mui/icons-material/Group'
import MusicNoteIcon from '@mui/icons-material/MusicNote'
2021-10-02 13:45:14 +02:00
import {Pleroma, Peertube, Paypal} from '@icons-pack/react-simple-icons'
2022-01-19 07:06:26 +04:00
import TelegramIcon from '@mui/icons-material/Telegram'
import TwitterIcon from '@mui/icons-material/Twitter'
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'
2021-06-14 23:30:00 +02:00
import Footer from '../components/footer'
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-10-02 13:45:14 +02:00
const PAYPAL_DONATE_ID = process.env.NEXT_PUBLIC_PAYPAL_ADDRESS || '5Q3KPR79CAZVW'
2021-07-19 23:41:59 +02:00
const REZO = [
2021-09-26 20:57:30 +02:00
{
id: 'twitter',
tit: 'Twitter',
icon: <TwitterIcon />,
link: `https://twitter.com/${TWITTER_USERNAME}`
},
2021-09-23 21:21:46 +02:00
{
id: 'telegram',
tit: 'Telegram',
icon: <TelegramIcon />,
2021-09-26 20:57:06 +02:00
link: `https://t.me/${TELEGRAM_GROUP}`
2021-09-23 21:21:46 +02:00
},
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}) {
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-04 20:16:24 +01:00
return (
2020-12-15 23:46:05 +01:00
<HeadLayout tab={0}>
2022-01-20 18:01:52 +04:00
<Box sx={{display: 'flex', flexDirection: 'column', minHeight: '100vh'}}>
2022-01-21 07:56:15 +04:00
<Box sx={{flexGrow: 1, marginTop: 4}}>
2022-01-20 18:01:52 +04:00
<Container align='center'>
<Image
alt='Logo #OKi'
width={192}
height={110}
src={okiLogo}
placeholder='blur'
/>
<Typography variant='h6' component='h1'>
Organisation KA Internationale
</Typography>
</Container>
<Container style={{marginBlock: '1em'}}>
<Grid container align='center' spacing={2}>
<Grid item xs={12}>
<RezoMenu data={REZO} />
</Grid>
<Grid item xs={12}>
<Button
size='small'
variant='contained'
color='primary'
startIcon={<Paypal size={20} />}
onClick={() => window.open(`https://www.paypal.com/donate?hosted_button_id=${PAYPAL_DONATE_ID}`, '_blank')}
>
Don
</Button>
2021-10-02 13:45:14 +02:00
2022-01-20 18:01:52 +04:00
</Grid>
</Grid>
</Container>
<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} />)}
2021-10-02 13:45:14 +02:00
</Grid>
2022-01-20 18:01:52 +04:00
</Container>
</Box>
2021-06-14 23:30:00 +02:00
<Footer />
2022-01-20 18:01:52 +04:00
</Box>
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() {
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
}
}
}