Skip to content

Commit

Permalink
Add testnet bitcoin styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Nov 7, 2022
1 parent d7e464e commit 0ce3aff
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
17 changes: 15 additions & 2 deletions frontend/src/basic/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { HashRouter, BrowserRouter, Switch, Route, useHistory } from 'react-router-dom';
import { useTheme, Box, Slide } from '@mui/material';
import { useTheme, Box, Slide, Typography } from '@mui/material';

import UserGenPage from './UserGenPage';
import MakerPage from './MakerPage';
Expand Down Expand Up @@ -29,6 +29,7 @@ import { checkVer, getHost } from '../utils';
import { sha256 } from 'js-sha256';

import defaultCoordinators from '../../static/federation.json';
import { useTranslation } from 'react-i18next';

const getWindowSize = function (fontSize: number) {
// returns window size in EM units
Expand All @@ -49,6 +50,8 @@ interface MainProps {
}

const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
const { t } = useTranslation();

// All app data structured
const [book, setBook] = useState<Book>({ orders: [], loading: true });
const [limits, setLimits] = useState<{ list: LimitList; loading: boolean }>({
Expand Down Expand Up @@ -117,7 +120,6 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
: coordinators[0].testnetOnion;
}
setBaseUrl(`http://${host}`);
console.log(`http://${host}`);
}, [settings.network]);

useEffect(() => {
Expand Down Expand Up @@ -225,6 +227,16 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
baseUrl={baseUrl}
onLoad={() => setRobot({ ...robot, avatarLoaded: true })}
/>
{settings.network === 'testnet' ? (
<div style={{ height: 0 }}>
<Typography color='secondary' align='center'>
<i>{t('Using Testnet Bitcoin')}</i>
</Typography>
</div>
) : (
<></>
)}

<Box
style={{
position: 'absolute',
Expand Down Expand Up @@ -343,6 +355,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
</Box>
<NavBar
nickname={robot.avatarLoaded ? robot.nickname : null}
color={settings.network === 'mainnet' ? 'primary' : 'secondary'}
width={windowSize.width}
height={navbarHeight}
page={page}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/basic/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface NavBarProps {
currentOrder: number | null;
hasRobot: boolean;
baseUrl: string;
color: 'primary' | 'secondary';
}

const NavBar = ({
Expand All @@ -48,6 +49,7 @@ const NavBar = ({
currentOrder,
hasRobot = false,
baseUrl,
color,
}: NavBarProps): JSX.Element => {
const theme = useTheme();
const { t } = useTranslation();
Expand Down Expand Up @@ -100,6 +102,8 @@ const NavBar = ({
TabIndicatorProps={{ sx: { height: '0.3em', position: 'absolute', top: 0 } }}
variant='fullWidth'
value={page}
indicatorColor={color}
textColor={color}
onChange={changePage}
>
<Tab
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/models/Settings.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class BaseSettings {
public fontSize: number = 14;
public language?: Language;
public freezeViewports: boolean = false;
public network: 'mainnet' | 'testnet' | undefined = 'mainnet';
public network: 'mainnet' | 'testnet' | undefined = 'testnet';
public coordinator: Coordinator | undefined = undefined;
public host?: string;
public unsafeClient: boolean = false;
Expand Down

0 comments on commit 0ce3aff

Please sign in to comment.