Remove pwopose page
This commit is contained in:
@@ -1,38 +0,0 @@
|
|||||||
export const metadata = {
|
|
||||||
title: 'OKI | Proposer une parole de chanson',
|
|
||||||
description: 'Proposez la transcription d’une parole, accompagnée d’une ou plusieurs traductions.',
|
|
||||||
openGraph: {
|
|
||||||
title: 'OKI | Proposer une parole de chanson',
|
|
||||||
description: 'Proposez la transcription d’une parole, accompagnée d’une ou plusieurs traductions.',
|
|
||||||
url: 'https://oki.re/pwopose',
|
|
||||||
siteName: 'OKI | ORGANISATION KA INTERNATIONALE. Paroles et traductions.',
|
|
||||||
images: [
|
|
||||||
{
|
|
||||||
url: 'https://oki.re/logo-512x512.png',
|
|
||||||
width: 512,
|
|
||||||
height: 512
|
|
||||||
}
|
|
||||||
],
|
|
||||||
locale: 'fr_FR',
|
|
||||||
type: 'website'
|
|
||||||
},
|
|
||||||
twitter: {
|
|
||||||
site: '@OrganisationKA',
|
|
||||||
card: 'summary_large_image',
|
|
||||||
title: 'OKI | Proposer une parole de chanson',
|
|
||||||
description: 'Proposez la transcription d’une parole, accompagnée d’une ou plusieurs traductions.',
|
|
||||||
creator: '@OrganisationKA',
|
|
||||||
images: {
|
|
||||||
url: 'https://oki.re/logo-512x512.png',
|
|
||||||
alt: 'OKI Logo',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function PwoposeLayout({children}) {
|
|
||||||
return (
|
|
||||||
<section>
|
|
||||||
{children}
|
|
||||||
</section>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
'use client'
|
|
||||||
|
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import {useState, useEffect, forwardRef, Suspense} from 'react'
|
|
||||||
import {useSession} from 'next-auth/react'
|
|
||||||
import MuiAlert from '@mui/material/Alert'
|
|
||||||
import Snackbar from '@mui/material/Snackbar'
|
|
||||||
import Box from '@mui/material/Box'
|
|
||||||
import {useSearchParams} from 'next/navigation'
|
|
||||||
import Koneksyon from '../../components/sesyon/koneksyon'
|
|
||||||
import Dekoneksyon from '../../components/sesyon/dekoneksyon'
|
|
||||||
import EkriTeks from '../../components/soumet/ekri-teks'
|
|
||||||
|
|
||||||
import {jwennUserEpiToken, jwennUserEpiUsername} from '../../lib/oki-api'
|
|
||||||
import NewPassword from '../../components/password/new-password'
|
|
||||||
import ChwaTeks from '../../components/soumet/chwa-teks'
|
|
||||||
import Footer from '../../components/footer'
|
|
||||||
|
|
||||||
const Alert = forwardRef(function Alert(props, ref) {
|
|
||||||
return <MuiAlert ref={ref} elevation={6} variant='filled' {...props} />
|
|
||||||
})
|
|
||||||
|
|
||||||
function HandleSession({session}) {
|
|
||||||
const params = useSearchParams()
|
|
||||||
const {code} = params
|
|
||||||
|
|
||||||
if (!session && !code) {
|
|
||||||
return (
|
|
||||||
<Koneksyon
|
|
||||||
chimen='/pwopose'
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!session && code) {
|
|
||||||
return (
|
|
||||||
<NewPassword code={code} />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Pwopose() {
|
|
||||||
const {data: session} = useSession()
|
|
||||||
const [localUsername, setLocalUsername] = useState(null)
|
|
||||||
const [username, setUsername] = useState(null)
|
|
||||||
const [open, setOpen] = useState(true)
|
|
||||||
const [selectedTeks, setSelectedTeks] = useState(null)
|
|
||||||
const [canAutoTranslate, setCanAutoTranslate] = useState(false)
|
|
||||||
|
|
||||||
const handleClose = (event, reason) => {
|
|
||||||
if (reason === 'clickaway') {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
setOpen(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (session?.jwt) {
|
|
||||||
const getUser = async token => {
|
|
||||||
const user = await jwennUserEpiToken(token)
|
|
||||||
setCanAutoTranslate(user.canAutoTranslate)
|
|
||||||
}
|
|
||||||
|
|
||||||
getUser(session.jwt)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (localStorage.getItem('username')) {
|
|
||||||
const username = localStorage.getItem('username')
|
|
||||||
setLocalUsername(username)
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (localUsername) {
|
|
||||||
const getUser = async username => {
|
|
||||||
const user = await jwennUserEpiUsername(username)
|
|
||||||
setUsername(user?.username)
|
|
||||||
}
|
|
||||||
|
|
||||||
getUser(localUsername)
|
|
||||||
}
|
|
||||||
}, [localUsername])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (username && localStorage.getItem('username')) {
|
|
||||||
localStorage.removeItem('username')
|
|
||||||
}
|
|
||||||
}, [username])
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box sx={{display: 'flex', flexDirection: 'column', minHeight: '100vh'}}>
|
|
||||||
<Box sx={{flexGrow: 1, marginTop: 1, marginBottom: 10}}>
|
|
||||||
<Suspense>
|
|
||||||
<HandleSession session={session} />
|
|
||||||
</Suspense>
|
|
||||||
|
|
||||||
{session && session.user && (
|
|
||||||
<>
|
|
||||||
<Dekoneksyon position='absolute' top={95} left={5} chimen='/pwopose' />
|
|
||||||
<ChwaTeks selectedTeks={selectedTeks} setSelectedTeks={setSelectedTeks} />
|
|
||||||
<EkriTeks canAutoTranslate={canAutoTranslate} selectedTeks={selectedTeks} setSelectedTeks={setSelectedTeks} />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{session && !session.user && (
|
|
||||||
<Dekoneksyon position='absolute' top={95} left={5} chimen='/pwopose' />
|
|
||||||
)}
|
|
||||||
{username && (
|
|
||||||
<Snackbar
|
|
||||||
open={open}
|
|
||||||
autoHideDuration={10_000}
|
|
||||||
onClose={handleClose}
|
|
||||||
>
|
|
||||||
<Alert severity='success' onClose={handleClose}><strong>Bonjour {username}, votre compte a été activé avec succès. Vous pouvez vous connecter.</strong></Alert>
|
|
||||||
</Snackbar>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
<Footer />
|
|
||||||
</Box>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
HandleSession.propTypes = {
|
|
||||||
session: PropTypes.object.isRequired
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,6 @@ import {useMediaQuery} from '@mui/material'
|
|||||||
import MusicNoteIcon from '@mui/icons-material/MusicNote'
|
import MusicNoteIcon from '@mui/icons-material/MusicNote'
|
||||||
import RecordVoiceOverIcon from '@mui/icons-material/RecordVoiceOver'
|
import RecordVoiceOverIcon from '@mui/icons-material/RecordVoiceOver'
|
||||||
import HomeIcon from '@mui/icons-material/Home'
|
import HomeIcon from '@mui/icons-material/Home'
|
||||||
import EditNoteIcon from '@mui/icons-material/EditNote'
|
|
||||||
import VolunteerActivismIcon from '@mui/icons-material/VolunteerActivism'
|
import VolunteerActivismIcon from '@mui/icons-material/VolunteerActivism'
|
||||||
|
|
||||||
const PREFIX = 'navigasyon'
|
const PREFIX = 'navigasyon'
|
||||||
@@ -40,8 +39,7 @@ const tabRouteHref = [
|
|||||||
'/',
|
'/',
|
||||||
'/sipote',
|
'/sipote',
|
||||||
'/paroles',
|
'/paroles',
|
||||||
'/awtis',
|
'/awtis'
|
||||||
'/pwopose'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const tabPath = {
|
const tabPath = {
|
||||||
@@ -49,7 +47,6 @@ const tabPath = {
|
|||||||
sipote: 1,
|
sipote: 1,
|
||||||
paroles: 2,
|
paroles: 2,
|
||||||
awtis: 3,
|
awtis: 3,
|
||||||
pwopose: 4
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
@@ -126,7 +123,6 @@ export default function Navigasyon() {
|
|||||||
<Tab icon={<VolunteerActivismIcon />} aria-label='Nous soutenir' {...a11yProps(1)} />
|
<Tab icon={<VolunteerActivismIcon />} aria-label='Nous soutenir' {...a11yProps(1)} />
|
||||||
<Tab icon={<MusicNoteIcon />} aria-label='Paroles' {...a11yProps(2)} />
|
<Tab icon={<MusicNoteIcon />} aria-label='Paroles' {...a11yProps(2)} />
|
||||||
<Tab icon={<RecordVoiceOverIcon />} aria-label='Artistes' {...a11yProps(3)} />
|
<Tab icon={<RecordVoiceOverIcon />} aria-label='Artistes' {...a11yProps(3)} />
|
||||||
<Tab icon={<EditNoteIcon />} aria-label='Proposer des paroles' {...a11yProps(4)} />
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
}
|
}
|
||||||
</AppBar>
|
</AppBar>
|
||||||
@@ -134,7 +130,6 @@ export default function Navigasyon() {
|
|||||||
<TabPanel value={value} index={1} />
|
<TabPanel value={value} index={1} />
|
||||||
<TabPanel value={value} index={2} />
|
<TabPanel value={value} index={2} />
|
||||||
<TabPanel value={value} index={3} />
|
<TabPanel value={value} index={3} />
|
||||||
<TabPanel value={value} index={4} />
|
|
||||||
</div>
|
</div>
|
||||||
</Appdiv>
|
</Appdiv>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user