import React, { useContext, useState } from 'react'; import { Button, CircularProgress, Dialog, DialogActions, DialogContent, DialogTitle, Grid, Paper, Switch, Tooltip, } from '@mui/material'; import Map from '../../Map'; import { AppContext, UseAppStoreType } from '../../../contexts/AppContext'; import { PhotoSizeSelectActual } from '@mui/icons-material'; import { useTranslation } from 'react-i18next'; interface MapChartProps { maxWidth: number; maxHeight: number; fillContainer?: boolean; elevation?: number; onOrderClicked?: (id: number) => void; } const MapChart: React.FC = ({ maxWidth, maxHeight, fillContainer = false, elevation = 6, onOrderClicked = () => {}, }) => { const { t } = useTranslation(); const { book } = useContext(AppContext); const [useTiles, setUseTiles] = useState(false); const [acceptedTilesWarning, setAcceptedTilesWarning] = useState(false); const [openWarningDialog, setOpenWarningDialog] = useState(false); const height = maxHeight < 20 ? 20 : maxHeight; const width = maxWidth < 20 ? 20 : maxWidth > 72.8 ? 72.8 : maxWidth; return ( { setOpenWarningDialog(false); }} > {t('Download high resolution map?')} {t( 'By doing so, you will be fetching map tiles from a third-party provider. However, depending on your setup, private information might be leaked to servers outside the RoboSats federation.', )} {false ? (
) : ( <>
{ if (acceptedTilesWarning) { setUseTiles((value) => !value); } else { setOpenWarningDialog(true); } }} />
)}
); }; export default MapChart;