| @@ -1,5 +1,5 @@ | |||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||
| import { Box, Grid, Typography, Dialog, DialogContent, IconButton, useMediaQuery } from '@mui/material'; | |||||
| import { Box, Grid, Typography, Dialog, DialogContent, IconButton } from '@mui/material'; | |||||
| import CloseIcon from '@mui/icons-material/Close'; | import CloseIcon from '@mui/icons-material/Close'; | ||||
| import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
| import { lazy, useState } from 'react'; | import { lazy, useState } from 'react'; | ||||
| @@ -20,17 +20,18 @@ const BackgroundHead = { | |||||
| const AuthWrapper = ({ children }) => { | const AuthWrapper = ({ children }) => { | ||||
| const intl = useIntl(); | const intl = useIntl(); | ||||
| const isSmall = useMediaQuery('(max-width:600px)'); | |||||
| const [openPopup, setOpenPopup] = useState(true); | |||||
| const handleClosePopup = () => { | |||||
| setOpenPopup(false); | |||||
| }; | |||||
| // --- Date control --- | |||||
| const today = new Date(); | |||||
| const showUntil = new Date("2025-12-08T00:00:00"); // 8 Dec 2025 and onwards = hide popup | |||||
| const [openPopup, setOpenPopup] = useState(today < showUntil); | |||||
| const handleClosePopup = () => { | |||||
| setOpenPopup(false); | |||||
| }; | |||||
| return ( | return ( | ||||
| <Box sx={{ minHeight: '87vh' }}> | <Box sx={{ minHeight: '87vh' }}> | ||||
| {/* Popup */} | |||||
| <Dialog | <Dialog | ||||
| open={openPopup} | open={openPopup} | ||||
| onClose={handleClosePopup} | onClose={handleClosePopup} | ||||
| @@ -67,9 +68,9 @@ const handleClosePopup = () => { | |||||
| title={intl.formatMessage({ id: 'lgce_title', defaultMessage: '2025 Legislative Council General Election' })} | title={intl.formatMessage({ id: 'lgce_title', defaultMessage: '2025 Legislative Council General Election' })} | ||||
| sx={{ | sx={{ | ||||
| display: 'block', | display: 'block', | ||||
| width: isSmall ? '92vw' : '720px', | |||||
| height: 'auto', | |||||
| maxWidth: '92vw' | |||||
| width: '100%', | |||||
| maxWidth: '720px', | |||||
| height: 'auto' | |||||
| }} | }} | ||||
| /> | /> | ||||
| </DialogContent> | </DialogContent> | ||||