2026-07-03 14:16:26 +04:00
|
|
|
import {useState} from 'react'
|
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
|
import Button from '@mui/material/Button'
|
|
|
|
|
import Dialog from '@mui/material/Dialog'
|
|
|
|
|
import DialogActions from '@mui/material/DialogActions'
|
|
|
|
|
import DialogContent from '@mui/material/DialogContent'
|
|
|
|
|
import DialogTitle from '@mui/material/DialogTitle'
|
|
|
|
|
import List from '@mui/material/List'
|
|
|
|
|
import ListItem from '@mui/material/ListItem'
|
|
|
|
|
import ListItemButton from '@mui/material/ListItemButton'
|
|
|
|
|
import ListItemIcon from '@mui/material/ListItemIcon'
|
|
|
|
|
import ListItemText from '@mui/material/ListItemText'
|
|
|
|
|
import useMediaQuery from '@mui/material/useMediaQuery'
|
|
|
|
|
import {useTheme} from '@mui/material/styles'
|
|
|
|
|
|
|
|
|
|
import CloudDownloadIcon from '@mui/icons-material/CloudDownload'
|
|
|
|
|
import {Nextcloud} from '@icons-pack/react-simple-icons'
|
|
|
|
|
|
|
|
|
|
const PLATFORM_ICON = {
|
|
|
|
|
NIYAJ: Nextcloud,
|
|
|
|
|
kDrive: CloudDownloadIcon,
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-03 16:57:44 +04:00
|
|
|
export default function KitsDialog({kits}) {
|
2026-07-03 14:16:26 +04:00
|
|
|
const [open, setOpen] = useState(false)
|
|
|
|
|
const theme = useTheme()
|
|
|
|
|
const fullScreen = useMediaQuery(theme.breakpoints.down('md'))
|
|
|
|
|
|
|
|
|
|
const handleClickOpen = () => {
|
|
|
|
|
setOpen(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleClose = () => {
|
|
|
|
|
setOpen(false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Button endIcon={<CloudDownloadIcon />} sx={{marginBottom: 2}} variant='outlined' onClick={handleClickOpen}>
|
2026-07-03 16:57:44 +04:00
|
|
|
Kits
|
2026-07-03 14:16:26 +04:00
|
|
|
</Button>
|
|
|
|
|
<Dialog
|
|
|
|
|
fullScreen={fullScreen}
|
|
|
|
|
open={open}
|
2026-07-03 16:57:44 +04:00
|
|
|
aria-labelledby='KitsDialog'
|
2026-07-03 14:16:26 +04:00
|
|
|
onClose={handleClose}
|
|
|
|
|
>
|
2026-07-03 16:57:44 +04:00
|
|
|
<DialogTitle>Télécharger un kit</DialogTitle>
|
2026-07-03 14:16:26 +04:00
|
|
|
<DialogContent dividers>
|
|
|
|
|
<List>
|
2026-07-04 14:34:50 +04:00
|
|
|
{kits.map(kit => {
|
2026-07-03 16:57:44 +04:00
|
|
|
const PlatformIcon = PLATFORM_ICON[kit.plateforme] ?? CloudDownloadIcon
|
2026-07-03 14:16:26 +04:00
|
|
|
return (
|
2026-07-04 14:34:50 +04:00
|
|
|
<ListItem key={kit.url} disablePadding>
|
2026-07-03 16:57:44 +04:00
|
|
|
<ListItemButton component='a' href={kit.url} target='_blank' rel='noopener noreferrer'>
|
2026-07-03 14:16:26 +04:00
|
|
|
<ListItemIcon>
|
|
|
|
|
<PlatformIcon />
|
|
|
|
|
</ListItemIcon>
|
2026-07-03 16:57:44 +04:00
|
|
|
<ListItemText primary={kit.type} secondary={kit.plateforme} />
|
2026-07-03 14:16:26 +04:00
|
|
|
</ListItemButton>
|
|
|
|
|
</ListItem>
|
|
|
|
|
)
|
|
|
|
|
})}
|
|
|
|
|
</List>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
<DialogActions>
|
|
|
|
|
<Button autoFocus onClick={handleClose}>
|
|
|
|
|
Fermer
|
|
|
|
|
</Button>
|
|
|
|
|
</DialogActions>
|
|
|
|
|
</Dialog>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-03 16:57:44 +04:00
|
|
|
KitsDialog.propTypes = {
|
|
|
|
|
kits: PropTypes.array.isRequired
|
2026-07-03 14:16:26 +04:00
|
|
|
}
|