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, type UseAppStoreType } from '../../../contexts/AppContext'; import { PhotoSizeSelectActual } from '@mui/icons-material'; import { useTranslation } from 'react-i18next'; import { FederationContext, type UseFederationStoreType, } from '../../../contexts/FederationContext'; 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 { federation } = useContext(FederationContext); const [useTiles, setUseTiles] = useState(false); const [acceptedTilesWarning, setAcceptedTilesWarning] = useState(false); const [openWarningDialog, setOpenWarningDialog] = useState(false); const height = maxHeight < 5 ? 5 : maxHeight; const width = maxWidth < 10 ? 10 : 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. Depending on your setup, private information might be leaked to servers outside the RoboSats federation.', )} {federation.book.length < 1 ? (
) : ( <>
{ if (acceptedTilesWarning) { setUseTiles((value) => !value); } else { setOpenWarningDialog(true); } }} />
)}
); }; export default MapChart;