Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Nov 7, 2022
1 parent 0ce3aff commit 7c2f6e1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions frontend/src/basic/BookPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const BookPage = ({
setPage('order');
history.push('/order/' + id);
}}
baseUrl={baseUrl}
/>
</Box>
</Dialog>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/basic/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
window.removeEventListener('resize', onResize);
}
};
}, []);
}, [baseUrl]);

useEffect(() => {
let host = '';
Expand Down Expand Up @@ -316,6 +316,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
setFav={setFav}
windowSize={{ ...windowSize, height: windowSize.height - navbarHeight }}
hasRobot={robot.avatarLoaded}
baseUrl={baseUrl}
/>
</div>
</Slide>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/basic/MakerPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface MakerPageProps {
hasRobot: boolean;
setCurrentOrder: (state: number) => void;
setPage: (state: Page) => void;
baseUrl: string;
}

const MakerPage = ({
Expand All @@ -38,6 +39,7 @@ const MakerPage = ({
setCurrentOrder,
setPage,
hasRobot = false,
baseUrl,
}: MakerPageProps): JSX.Element => {
const { t } = useTranslation();
const history = useHistory();
Expand Down Expand Up @@ -108,6 +110,7 @@ const MakerPage = ({
onReset={() => setShowMatches(false)}
submitButtonLabel={matches.length > 0 && !showMatches ? 'Submit' : 'Create order'}
setPage={setPage}
baseUrl={baseUrl}
/>
</Paper>
</Grid>
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/MakerForm/MakerForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ import { LimitList, Maker, Favorites, defaultMaker } from '../../models';
import { LocalizationProvider, TimePicker } from '@mui/x-date-pickers';
import DateFnsUtils from '@date-io/date-fns';
import { useHistory } from 'react-router-dom';
import { StoreTokenDialog, NoRobotDialog, ConfirmationDialog } from '../Dialogs';
import { ConfirmationDialog } from '../Dialogs';
import { apiClient } from '../../services/api';
import { systemClient } from '../../services/System';

import { FlagWithProps } from '../Icons';
import AutocompletePayments from './AutocompletePayments';
Expand Down Expand Up @@ -59,6 +58,7 @@ interface MakerFormProps {
onOrderCreated?: (id: number) => void;
hasRobot?: boolean;
setPage?: (state: Page) => void;
baseUrl: string;
}

const MakerForm = ({
Expand All @@ -77,6 +77,7 @@ const MakerForm = ({
onOrderCreated = () => null,
hasRobot = true,
setPage = () => null,
baseUrl,
}: MakerFormProps): JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();
Expand Down Expand Up @@ -263,7 +264,7 @@ const MakerForm = ({
escrow_duration: maker.escrowDuration,
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);
if (data.id) {
onOrderCreated(data.id);
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/SettingsForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ const SettingsForm = ({
<ToggleButtonGroup
exclusive={true}
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'>
{t('Mainnet')}
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/models/Settings.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ class BaseSettings {
: i18n.resolvedLanguage == null
? 'en'
: i18n.resolvedLanguage.substring(0, 2);

const networkCookie = systemClient.getCookie('settings_network');
this.network = networkCookie !== '' ? networkCookie : 'mainnet';
}

public frontend: 'basic' | 'pro' = 'basic';
public mode: 'light' | 'dark' = 'light';
public fontSize: number = 14;
public language?: Language;
public freezeViewports: boolean = false;
public network: 'mainnet' | 'testnet' | undefined = 'testnet';
public network: 'mainnet' | 'testnet' | undefined = 'mainnet';
public coordinator: Coordinator | undefined = undefined;
public host?: string;
public unsafeClient: boolean = false;
Expand Down
1 change: 1 addition & 0 deletions mobile/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const App = () => {
loadCookie('settings_fontsize_basic');
loadCookie('settings_language');
loadCookie('settings_mode');
loadCookie('settings_network');
loadCookie('enc_priv_key').then(() => injectMessageResolve(reponseId));
};

Expand Down

0 comments on commit 7c2f6e1

Please sign in to comment.