Small fixes

This commit is contained in:
Reckless_Satoshi 2022-11-07 04:50:43 -08:00
parent 0ce3aff484
commit 7c2f6e1659
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
7 changed files with 19 additions and 6 deletions

View File

@ -132,6 +132,7 @@ const BookPage = ({
setPage('order'); setPage('order');
history.push('/order/' + id); history.push('/order/' + id);
}} }}
baseUrl={baseUrl}
/> />
</Box> </Box>
</Dialog> </Dialog>

View File

@ -107,7 +107,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
window.removeEventListener('resize', onResize); window.removeEventListener('resize', onResize);
} }
}; };
}, []); }, [baseUrl]);
useEffect(() => { useEffect(() => {
let host = ''; let host = '';
@ -316,6 +316,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
setFav={setFav} setFav={setFav}
windowSize={{ ...windowSize, height: windowSize.height - navbarHeight }} windowSize={{ ...windowSize, height: windowSize.height - navbarHeight }}
hasRobot={robot.avatarLoaded} hasRobot={robot.avatarLoaded}
baseUrl={baseUrl}
/> />
</div> </div>
</Slide> </Slide>

View File

@ -24,6 +24,7 @@ interface MakerPageProps {
hasRobot: boolean; hasRobot: boolean;
setCurrentOrder: (state: number) => void; setCurrentOrder: (state: number) => void;
setPage: (state: Page) => void; setPage: (state: Page) => void;
baseUrl: string;
} }
const MakerPage = ({ const MakerPage = ({
@ -38,6 +39,7 @@ const MakerPage = ({
setCurrentOrder, setCurrentOrder,
setPage, setPage,
hasRobot = false, hasRobot = false,
baseUrl,
}: MakerPageProps): JSX.Element => { }: MakerPageProps): JSX.Element => {
const { t } = useTranslation(); const { t } = useTranslation();
const history = useHistory(); const history = useHistory();
@ -108,6 +110,7 @@ const MakerPage = ({
onReset={() => setShowMatches(false)} onReset={() => setShowMatches(false)}
submitButtonLabel={matches.length > 0 && !showMatches ? 'Submit' : 'Create order'} submitButtonLabel={matches.length > 0 && !showMatches ? 'Submit' : 'Create order'}
setPage={setPage} setPage={setPage}
baseUrl={baseUrl}
/> />
</Paper> </Paper>
</Grid> </Grid>

View File

@ -29,9 +29,8 @@ import { LimitList, Maker, Favorites, defaultMaker } from '../../models';
import { LocalizationProvider, TimePicker } from '@mui/x-date-pickers'; import { LocalizationProvider, TimePicker } from '@mui/x-date-pickers';
import DateFnsUtils from '@date-io/date-fns'; import DateFnsUtils from '@date-io/date-fns';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { StoreTokenDialog, NoRobotDialog, ConfirmationDialog } from '../Dialogs'; import { ConfirmationDialog } from '../Dialogs';
import { apiClient } from '../../services/api'; import { apiClient } from '../../services/api';
import { systemClient } from '../../services/System';
import { FlagWithProps } from '../Icons'; import { FlagWithProps } from '../Icons';
import AutocompletePayments from './AutocompletePayments'; import AutocompletePayments from './AutocompletePayments';
@ -59,6 +58,7 @@ interface MakerFormProps {
onOrderCreated?: (id: number) => void; onOrderCreated?: (id: number) => void;
hasRobot?: boolean; hasRobot?: boolean;
setPage?: (state: Page) => void; setPage?: (state: Page) => void;
baseUrl: string;
} }
const MakerForm = ({ const MakerForm = ({
@ -77,6 +77,7 @@ const MakerForm = ({
onOrderCreated = () => null, onOrderCreated = () => null,
hasRobot = true, hasRobot = true,
setPage = () => null, setPage = () => null,
baseUrl,
}: MakerFormProps): JSX.Element => { }: MakerFormProps): JSX.Element => {
const { t } = useTranslation(); const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
@ -263,7 +264,7 @@ const MakerForm = ({
escrow_duration: maker.escrowDuration, escrow_duration: maker.escrowDuration,
bond_size: maker.bondSize, bond_size: maker.bondSize,
}; };
apiClient.post('/api/make/', body).then((data: object) => { apiClient.post(baseUrl, '/api/make/', body).then((data: object) => {
setBadRequest(data.bad_request); setBadRequest(data.bad_request);
if (data.id) { if (data.id) {
onOrderCreated(data.id); onOrderCreated(data.id);

View File

@ -150,7 +150,10 @@ const SettingsForm = ({
<ToggleButtonGroup <ToggleButtonGroup
exclusive={true} exclusive={true}
value={settings.network} value={settings.network}
onChange={(e, network) => setSettings({ ...settings, network })} onChange={(e, network) => {
setSettings({ ...settings, network });
systemClient.setCookie('settings_network', network);
}}
> >
<ToggleButton value='mainnet' color='primary'> <ToggleButton value='mainnet' color='primary'>
{t('Mainnet')} {t('Mainnet')}

View File

@ -37,6 +37,9 @@ class BaseSettings {
: i18n.resolvedLanguage == null : i18n.resolvedLanguage == null
? 'en' ? 'en'
: i18n.resolvedLanguage.substring(0, 2); : i18n.resolvedLanguage.substring(0, 2);
const networkCookie = systemClient.getCookie('settings_network');
this.network = networkCookie !== '' ? networkCookie : 'mainnet';
} }
public frontend: 'basic' | 'pro' = 'basic'; public frontend: 'basic' | 'pro' = 'basic';
@ -44,7 +47,7 @@ class BaseSettings {
public fontSize: number = 14; public fontSize: number = 14;
public language?: Language; public language?: Language;
public freezeViewports: boolean = false; public freezeViewports: boolean = false;
public network: 'mainnet' | 'testnet' | undefined = 'testnet'; public network: 'mainnet' | 'testnet' | undefined = 'mainnet';
public coordinator: Coordinator | undefined = undefined; public coordinator: Coordinator | undefined = undefined;
public host?: string; public host?: string;
public unsafeClient: boolean = false; public unsafeClient: boolean = false;

View File

@ -50,6 +50,7 @@ const App = () => {
loadCookie('settings_fontsize_basic'); loadCookie('settings_fontsize_basic');
loadCookie('settings_language'); loadCookie('settings_language');
loadCookie('settings_mode'); loadCookie('settings_mode');
loadCookie('settings_network');
loadCookie('enc_priv_key').then(() => injectMessageResolve(reponseId)); loadCookie('enc_priv_key').then(() => injectMessageResolve(reponseId));
}; };