import React, { useContext } from 'react'; import { MemoryRouter, BrowserRouter } from 'react-router-dom'; import { Box, Typography, styled } from '@mui/material'; import { type UseAppStoreType, AppContext, closeAll } from '../contexts/AppContext'; import { NavBar, MainDialogs } from './'; import RobotAvatar from '../components/RobotAvatar'; import Notifications from '../components/Notifications'; import { useTranslation } from 'react-i18next'; import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext'; import Routes from './Routes'; const Router = window.NativeRobosats === undefined ? BrowserRouter : MemoryRouter; const TestnetTypography = styled(Typography)({ height: 0, }); interface MainBoxProps { navbarHeight: number; } const MainBox = styled(Box)((props) => ({ position: 'absolute', top: '50%', left: '50%', transform: `translate(-50%, -50%) translate(0, -${props.navbarHeight / 2}em)`, })); const Main: React.FC = () => { const { t } = useTranslation(); const { settings, page, slideDirection, setOpen, windowSize, navbarHeight } = useContext(AppContext); const { garage } = useContext(GarageContext); return ( { setOpen({ ...closeAll, profile: true }); }} rewards={garage.getSlot()?.getRobot()?.earnedRewards} windowWidth={windowSize?.width} /> {settings.network === 'testnet' ? ( {t('Using Testnet Bitcoin')} ) : ( <> )} ); }; export default Main;