import React, { useContext } from 'react'; import { HashRouter, BrowserRouter, Switch, Route } from 'react-router-dom'; import { Box, Slide, Typography } from '@mui/material'; import RobotPage from './RobotPage'; import MakerPage from './MakerPage'; import BookPage from './BookPage'; import OrderPage from './OrderPage'; import SettingsPage from './SettingsPage'; import NavBar from './NavBar'; import MainDialogs from './MainDialogs'; import RobotAvatar from '../components/RobotAvatar'; import { useTranslation } from 'react-i18next'; import Notifications from '../components/Notifications'; import { AppContextProps, AppContext } from '../contexts/AppContext'; const Main = (): JSX.Element => { const { t } = useTranslation(); const { book, fetchBook, maker, setMaker, clearOrder, torStatus, settings, limits, fetchLimits, robot, setRobot, fetchRobot, setOrder, setDelay, info, fav, setFav, baseUrl, order, page, setPage, slideDirection, setSlideDirection, currentOrder, setCurrentOrder, closeAll, open, setOpen, windowSize, badOrder, navbarHeight, setBadOrder, } = useContext(AppContext); const Router = window.NativeRobosats === undefined ? BrowserRouter : HashRouter; const basename = window.NativeRobosats === undefined ? '' : window.location.pathname; return ( setRobot({ ...robot, avatarLoaded: true })} /> setOpen({ ...closeAll, profile: true })} rewards={robot.earnedRewards} setPage={setPage} windowWidth={windowSize.width} /> {settings.network === 'testnet' ? (
{t('Using Testnet Bitcoin')}
) : ( <> )} (
)} />
{ setOrder(undefined); setDelay(10000); }} limits={limits} fetchLimits={fetchLimits} fav={fav} setFav={setFav} maker={maker} setMaker={setMaker} clearOrder={clearOrder} lastDayPremium={info.last_day_nonkyc_btc_premium} windowSize={windowSize} hasRobot={robot.avatarLoaded} setPage={setPage} setCurrentOrder={setCurrentOrder} baseUrl={baseUrl} />
(
)} />
); }; export default Main;