Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI update #1535

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6dd3278
NavBar update
sahil-tgs Jul 15, 2024
6729bab
TopNavBar Added
sahil-tgs Jul 15, 2024
6a9e626
Welcome Update
sahil-tgs Jul 15, 2024
d61d4f4
Onboarding Update
sahil-tgs Jul 15, 2024
2f3a353
Refactor: Move inline styles to styled components
sahil-tgs Jul 16, 2024
49458a5
fix: Adjust component heights to prevent nav bar overlap
sahil-tgs Jul 16, 2024
bbe0ffa
NavBar update
sahil-tgs Jul 15, 2024
e08bfa9
TopNavBar Added
sahil-tgs Jul 15, 2024
9e2b4f1
Welcome Update
sahil-tgs Jul 15, 2024
e8d53c9
Onboarding Update
sahil-tgs Jul 15, 2024
6fc5f90
Refactor: Move inline styles to styled components
sahil-tgs Jul 16, 2024
13a681b
fix: Adjust component heights to prevent nav bar overlap
sahil-tgs Jul 16, 2024
f4d4ebe
Merge branch 'RoboSats:main' into ui-updates
sahil-tgs Jul 27, 2024
7a466b9
Merge branch 'RoboSats:main' into ui-updates
sahil-tgs Aug 10, 2024
82412bd
Merge branch 'RoboSats:main' into ui-updates
sahil-tgs Aug 12, 2024
d1e09cc
Merge branch 'RoboSats:main' into ui-updates
sahil-tgs Aug 13, 2024
b818f50
Merge branch 'RoboSats:main' into ui-updates
sahil-tgs Aug 17, 2024
ce80a9a
Merge branch 'RoboSats:main' into ui-updates
sahil-tgs Aug 24, 2024
bae0268
Merge branch 'RoboSats:main' into ui-updates
sahil-tgs Aug 26, 2024
739e6e1
ui-update 2
sahil-tgs Aug 30, 2024
7fe0116
Merge branch 'ui-update' into ui-updates
KoalaSat Oct 18, 2024
ec1b4f2
Merge pull request #1431 from sahil-tgs/ui-updates
KoalaSat Oct 18, 2024
575709b
Merge branch 'ui-update'
KoalaSat Oct 18, 2024
adc34fd
Merge pull request #1534 from RoboSats/ui-update-merge
KoalaSat Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions frontend/src/basic/BookPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import { useTranslation } from 'react-i18next';
import { Button, Grid, ButtonGroup, Dialog, Box } from '@mui/material';
import { useNavigate } from 'react-router-dom';
import DepthChart from '../../components/Charts/DepthChart';

import { NoRobotDialog } from '../../components/Dialogs';
import MakerForm from '../../components/MakerForm';
import BookTable from '../../components/BookTable';

// Icons
import { BarChart, FormatListBulleted, Map } from '@mui/icons-material';
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
import { AppContext, UseAppStoreType } from '../../contexts/AppContext';
import MapChart from '../../components/Charts/MapChart';
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';

const BookPage = (): JSX.Element => {
const { windowSize } = useContext<UseAppStoreType>(AppContext);
Expand Down Expand Up @@ -119,7 +118,7 @@ const BookPage = (): JSX.Element => {
<Grid item>
<BookTable
maxWidth={maxBookTableWidth} // EM units
maxHeight={windowSize.height * 0.825 - 5} // EM units
maxHeight={windowSize.height * 0.65} // Adjusted height to reduce rows
fullWidth={windowSize.width} // EM units
fullHeight={windowSize.height} // EM units
defaultFullscreen={false}
Expand All @@ -130,14 +129,14 @@ const BookPage = (): JSX.Element => {
<Grid item>
<DepthChart
maxWidth={chartWidthEm} // EM units
maxHeight={(windowSize.height * 0.825 - 5) / 2} // EM units
maxHeight={(windowSize.height * 0.65) / 2} // Adjusted height
onOrderClicked={onOrderClicked}
/>
</Grid>
<Grid item>
<MapChart
maxWidth={chartWidthEm} // EM units
maxHeight={(windowSize.height * 0.825 - 5) / 2} // EM units
maxHeight={(windowSize.height * 0.65) / 2} // Adjusted height
onOrderClicked={onOrderClicked}
/>
</Grid>
Expand All @@ -146,19 +145,19 @@ const BookPage = (): JSX.Element => {
) : view === 'depth' ? (
<DepthChart
maxWidth={windowSize.width * 0.8} // EM units
maxHeight={windowSize.height * 0.825 - 5} // EM units
maxHeight={windowSize.height * 0.65} // Adjusted height
onOrderClicked={onOrderClicked}
/>
) : view === 'map' ? (
<MapChart
maxWidth={windowSize.width * 0.8} // EM units
maxHeight={windowSize.height * 0.825 - 5} // EM units
maxHeight={windowSize.height * 0.6} // Adjusted height
onOrderClicked={onOrderClicked}
/>
) : (
<BookTable
maxWidth={windowSize.width * 0.97} // EM units
maxHeight={windowSize.height * 0.825 - 5} // EM units
maxHeight={windowSize.height * 0.624} // Adjusted height to reduce rows
fullWidth={windowSize.width} // EM units
fullHeight={windowSize.height} // EM units
defaultFullscreen={false}
Expand Down
58 changes: 21 additions & 37 deletions frontend/src/basic/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import React, { useContext } from 'react';
import { MemoryRouter, HashRouter, 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 { MemoryRouter, BrowserRouter, HashRouter } from 'react-router-dom';
import { Box, styled } from '@mui/material';
import { type UseAppStoreType, AppContext } from '../contexts/AppContext';
import { TopNavBar, NavBar, MainDialogs } from './';
import Notifications from '../components/Notifications';

import { useTranslation } from 'react-i18next';
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';
import Routes from './Routes';

Expand All @@ -23,30 +19,13 @@ const getRouter = (): any => {
};
const Router = getRouter();

const TestnetTypography = styled(Typography)({
height: 0,
});

interface MainBoxProps {
navbarHeight: number;
}

const MainBox = styled(Box)<MainBoxProps>((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, setOpen, windowSize, navbarHeight } =
useContext<UseAppStoreType>(AppContext);
const { page, setOpen, windowSize } = useContext<UseAppStoreType>(AppContext);
const { garage } = useContext<UseGarageStoreType>(GarageContext);

return (
<Router>
<RobotAvatar style={{ display: 'none' }} hashId={garage.getSlot()?.hashId} />
<TopNavBar />
<Notifications
page={page}
openProfile={() => {
Expand All @@ -55,21 +34,26 @@ const Main: React.FC = () => {
rewards={garage.getSlot()?.getRobot()?.earnedRewards}
windowWidth={windowSize?.width}
/>
{settings.network === 'testnet' ? (
<TestnetTypography color='secondary' align='center'>
<i>{t('Using Testnet Bitcoin')}</i>
</TestnetTypography>
) : (
<></>
)}

<MainBox navbarHeight={navbarHeight}>
<MainContent>
<Routes />
</MainBox>
</MainContent>
<NavBar />
<MainDialogs />
</Router>
);
};

// Styled components
const MainContent = styled(Box)(({ theme }) => ({
marginTop: '100px',
marginBottom: '80px',
padding: theme.spacing(2),
overflowY: 'auto',
overflowX: 'hidden',
height: 'calc(100vh - 180px)',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}));

export default Main;
Loading