Change 'kont' page to 'soumet' page & change EkriTeks title

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2021-05-24 13:05:46 +02:00
parent 350d49b9a7
commit 456c40c153
6 changed files with 26 additions and 16 deletions
+4 -4
View File
@@ -9,7 +9,7 @@ import Tab from '@material-ui/core/Tab'
import HomeIcon from '@material-ui/icons/Home' import HomeIcon from '@material-ui/icons/Home'
import MenuBookIcon from '@material-ui/icons/MenuBook' import MenuBookIcon from '@material-ui/icons/MenuBook'
import RecordVoiceOverIcon from '@material-ui/icons/RecordVoiceOver' import RecordVoiceOverIcon from '@material-ui/icons/RecordVoiceOver'
import AccountCircleIcon from '@material-ui/icons/AccountCircle' import PlaylistAddIcon from '@material-ui/icons/PlaylistAdd'
import Typography from '@material-ui/core/Typography' import Typography from '@material-ui/core/Typography'
import Box from '@material-ui/core/Box' import Box from '@material-ui/core/Box'
@@ -17,14 +17,14 @@ const tabRouteHref = [
'/', '/',
'/awtis?paj&paj=1', '/awtis?paj&paj=1',
'/teks', '/teks',
'/kont' '/soumet'
] ]
const tabRouteAs = [ const tabRouteAs = [
'/', '/',
'/awtis/paj/1', '/awtis/paj/1',
'/teks', '/teks',
'/kont' '/soumet'
] ]
function TabPanel(props) { function TabPanel(props) {
@@ -97,7 +97,7 @@ export default function Navigasyon({selectedTab}) {
<Tab label='Kay-la' icon={<HomeIcon style={{fontSize: 30}} />} {...a11yProps(0)} /> <Tab label='Kay-la' icon={<HomeIcon style={{fontSize: 30}} />} {...a11yProps(0)} />
<Tab label='Awtis' icon={<RecordVoiceOverIcon style={{fontSize: 30}} />} {...a11yProps(1)} /> <Tab label='Awtis' icon={<RecordVoiceOverIcon style={{fontSize: 30}} />} {...a11yProps(1)} />
<Tab label='Tèks' icon={<MenuBookIcon style={{fontSize: 30}} />} {...a11yProps(2)} /> <Tab label='Tèks' icon={<MenuBookIcon style={{fontSize: 30}} />} {...a11yProps(2)} />
<Tab label='Kont' icon={<AccountCircleIcon style={{fontSize: 30}} />} {...a11yProps(3)} /> <Tab label='Soumèt' icon={<PlaylistAddIcon style={{fontSize: 30}} />} {...a11yProps(3)} />
</Tabs> </Tabs>
</AppBar> </AppBar>
<TabPanel value={value} index={0} /> <TabPanel value={value} index={0} />
@@ -2,6 +2,7 @@ import {useEffect, useState} from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import axios from 'axios' import axios from 'axios'
import { import {
Box,
Button, Button,
Container, Container,
Grid, Grid,
@@ -109,9 +110,14 @@ function EkriTeks({session}) {
return ( return (
<Container maxWidth='sm'> <Container maxWidth='sm'>
<Typography gutterBottom align='center' variant='h4' component='h1'> <Box align='center' marginBottom={2}>
Soumettre un texte <Typography display='inline' variant='h5' component='h1'>
</Typography> Soumèt an tèks
</Typography>
<Typography>
<small>(soumettre un texte)</small>
</Typography>
</Box>
<form noValidate autoComplete='off'> <form noValidate autoComplete='off'>
<Grid container style={{textAlign: 'center'}} spacing={1}> <Grid container style={{textAlign: 'center'}} spacing={1}>
<Grid item xs> <Grid item xs>
@@ -170,7 +176,7 @@ function EkriTeks({session}) {
<Button <Button
fullWidth fullWidth
disabled={loading || teksEkri.awtis === '' || teksEkri.tit === '' || teksEkri.transkripsyon === ''} disabled={loading || teksEkri.awtis === '' || teksEkri.tit === '' || teksEkri.transkripsyon === ''}
style={{marginTop: 20}} style={{marginBlock: 20}}
variant='contained' variant='contained'
color='primary' color='primary'
onClick={handleClick} onClick={handleClick}
@@ -179,7 +185,7 @@ function EkriTeks({session}) {
Soumèt Soumèt
</Typography> </Typography>
</Button> </Button>
{loading && <LinearProgress size={24} style={{width: '100%', marginTop: '1em'}} />} {loading && <LinearProgress size={24} style={{width: '100%', marginBlock: '1em'}} />}
</div> </div>
{success && ( {success && (
<Snackbar open={open} autoHideDuration={10000} onClose={handleClose}> <Snackbar open={open} autoHideDuration={10000} onClose={handleClose}>
@@ -45,7 +45,7 @@ function Koneksyon() {
setLoading(false) setLoading(false)
} else if (response.ok) { } else if (response.ok) {
setLoading(false) setLoading(false)
router.push('/kont') router.push('/soumet')
} }
} }
@@ -62,6 +62,10 @@ function Koneksyon() {
if (loginError) { if (loginError) {
setOpen(true) setOpen(true)
} }
return () => {
setLoading(false)
}
}, [loginError]) }, [loginError])
const handleClickShowPassword = () => { const handleClickShowPassword = () => {
+2 -2
View File
@@ -48,8 +48,8 @@ const options = {
} }
}, },
pages: { pages: {
signIn: '/kont', signIn: '/soumet',
error: '/kont' error: '/soumet'
} }
} }
const Auth = (request, response) => const Auth = (request, response) =>
+4 -4
View File
@@ -2,9 +2,9 @@ import {useState, useEffect} from 'react'
import {useSession} from 'next-auth/client' import {useSession} from 'next-auth/client'
import HeadLayout from '../components/head-layout' import HeadLayout from '../components/head-layout'
import Koneksyon from '../components/kont/koneksyon' import Koneksyon from '../components/soumet/koneksyon'
import Dekoneksyon from '../components/kont/dekoneksyon' import Dekoneksyon from '../components/soumet/dekoneksyon'
import EkriTeks from '../components/kont/ekri-teks' import EkriTeks from '../components/soumet/ekri-teks'
import {jwennTeksEpiUserId} from '../lib/oki-api' import {jwennTeksEpiUserId} from '../lib/oki-api'
@@ -25,7 +25,7 @@ export default function Kont() {
}, [session]) }, [session])
return ( return (
<HeadLayout title='Kont' tab={3} slug='kont'> <HeadLayout title='Soumèt' tab={3} slug='soumet'>
{!session && ( {!session && (
<Koneksyon /> <Koneksyon />
)} )}