diff --git a/components/teks/teks.js b/components/teks/teks.js index 635bfac..770c7ea 100644 --- a/components/teks/teks.js +++ b/components/teks/teks.js @@ -3,7 +3,11 @@ import {useEffect, useState} from 'react' import PropTypes from 'prop-types' import Box from '@mui/material/Box' -import Chip from '@mui/material/Chip' +import Select from '@mui/material/Select' +import MenuItem from '@mui/material/MenuItem' +import ListSubheader from '@mui/material/ListSubheader' +import Divider from '@mui/material/Divider' +import FormControl from '@mui/material/FormControl' import Typography from '@mui/material/Typography' import Tooltip from '@mui/material/Tooltip' import {useMediaQuery} from '@mui/material' @@ -12,6 +16,9 @@ import slugify from 'slugify' import {styled} from '@mui/material/styles' import ExplicitIcon from '@mui/icons-material/Explicit' +import TranslateIcon from '@mui/icons-material/Translate' +import StarIcon from '@mui/icons-material/Star' +import ArticleIcon from '@mui/icons-material/Article' import Image from 'next/image' @@ -88,15 +95,34 @@ const LANG_NAMES = { pt: 'Português', ja: '日本語', ko: '한국어', } +const CONTINENTS = ['Afrique', 'Asie', 'Europe'] + const TRAD_FIELDS = [ - {field: 'japonais', title: '日本語'}, - {field: 'coreen', title: '한국어'}, - {field: 'anglais', title: 'English'}, - {field: 'francais', title: 'Français'}, - {field: 'espagnol', title: 'Español'}, - {field: 'allemand', title: 'Deutsch'}, - {field: 'italien', title: 'Italiano'}, - {field: 'portugais', title: 'Português'}, + // Afrique — langues vedettes en premier + {field: 'yoruba', title: 'Yorùbá', continent: 'Afrique', vedette: true}, + {field: 'lingala', title: 'Lingála', continent: 'Afrique', vedette: true}, + {field: 'wolof', title: 'Wolof', continent: 'Afrique', vedette: true}, + {field: 'swahili', title: 'Kiswahili', continent: 'Afrique', vedette: true}, + {field: 'hausa', title: 'Hausa', continent: 'Afrique', vedette: true}, + {field: 'arabe', title: 'العربية', continent: 'Afrique'}, + {field: 'oromo', title: 'Oromoo', continent: 'Afrique'}, + {field: 'igbo', title: 'Igbo', continent: 'Afrique'}, + {field: 'zoulou', title: 'isiZulu', continent: 'Afrique'}, + {field: 'malgache', title: 'Malagasy', continent: 'Afrique'}, + {field: 'xhosa', title: 'isiXhosa', continent: 'Afrique'}, + {field: 'tswana', title: 'Setswana', continent: 'Afrique'}, + {field: 'tsonga', title: 'Xitsonga', continent: 'Afrique'}, + {field: 'sesotho', title: 'Sesotho', continent: 'Afrique'}, + // Asie + {field: 'japonais', title: '日本語', continent: 'Asie'}, + {field: 'coreen', title: '한국어', continent: 'Asie'}, + // Europe + {field: 'anglais', title: 'English', continent: 'Europe'}, + {field: 'francais', title: 'Français', continent: 'Europe'}, + {field: 'espagnol', title: 'Español', continent: 'Europe'}, + {field: 'allemand', title: 'Deutsch', continent: 'Europe'}, + {field: 'italien', title: 'Italiano', continent: 'Europe'}, + {field: 'portugais', title: 'Português', continent: 'Europe'}, ] const langToArray = parole => { @@ -106,10 +132,13 @@ const langToArray = parole => { return TRAD_FIELDS .filter(({field}) => parole.traductions[field]) - .map(({field, title}) => ({field, title, lang: parole.traductions[field]})) + .map(({field, title, continent, vedette}) => ({field, title, continent, vedette, lang: parole.traductions[field]})) } const BROWSER_LANG_TO_FIELD = { + yo: 'yoruba', ln: 'lingala', wo: 'wolof', sw: 'swahili', ha: 'hausa', + ar: 'arabe', om: 'oromo', ig: 'igbo', zu: 'zoulou', mg: 'malgache', + xh: 'xhosa', tn: 'tswana', ts: 'tsonga', st: 'sesotho', ja: 'japonais', ko: 'coreen', en: 'anglais', fr: 'francais', es: 'espagnol', de: 'allemand', it: 'italien', pt: 'portugais', } @@ -123,7 +152,6 @@ export default function Teks({parole}) { const coverFmt = formatKuveti(parole.couverture) const [tab, setTab] = useState(0) const [, setCurrentTrack] = useCurrentTrack() - const options = ['Transcription', ...langArray.map(({title}) => title)] useEffect(() => { const isBrowser = () => typeof window !== 'undefined' @@ -247,18 +275,60 @@ export default function Teks({parole}) { )} - - {options.map((label, index) => ( - setTab(index)} - /> - ))} + + + + {tab === 0 && ( <>