mirror of
https://github.com/RoboSats/robosats.git
synced 2025-02-20 12:19:00 +00:00
Add old UserGen and BottomBar to new main.tsx
This commit is contained in:
parent
1e257d1924
commit
fa3e60208f
@ -4,7 +4,6 @@ import {
|
||||
Badge,
|
||||
Tooltip,
|
||||
ListItemAvatar,
|
||||
Avatar,
|
||||
Paper,
|
||||
Grid,
|
||||
IconButton,
|
||||
@ -42,99 +41,38 @@ import {
|
||||
UpdateClientDialog,
|
||||
} from './Dialogs';
|
||||
|
||||
import checkVer from '../utils/checkVer';
|
||||
|
||||
class BottomBar extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
openStatsForNerds: false,
|
||||
openCommuniy: false,
|
||||
openExchangeSummary: false,
|
||||
openClaimRewards: false,
|
||||
openUpdateClient: false,
|
||||
num_public_buy_orders: 0,
|
||||
num_public_sell_orders: 0,
|
||||
book_liquidity: 0,
|
||||
active_robots_today: 0,
|
||||
maker_fee: 0,
|
||||
taker_fee: 0,
|
||||
last_day_nonkyc_btc_premium: 0,
|
||||
last_day_volume: 0,
|
||||
lifetime_volume: 0,
|
||||
robosats_running_commit_hash: '000000000000000',
|
||||
openProfile: false,
|
||||
profileShown: false,
|
||||
alternative_site: 'robosats...',
|
||||
node_id: '00000000',
|
||||
showRewards: false,
|
||||
rewardInvoice: null,
|
||||
badInvoice: false,
|
||||
showRewardsSpinner: false,
|
||||
withdrawn: false,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getInfo();
|
||||
}
|
||||
|
||||
getInfo() {
|
||||
this.setState(null);
|
||||
apiClient.get('/api/info/').then((data) => {
|
||||
const versionInfo = checkVer(data.version.major, data.version.minor, data.version.patch);
|
||||
this.setState({
|
||||
...data,
|
||||
openUpdateClient: versionInfo.updateAvailable,
|
||||
coordinatorVersion: versionInfo.coordinatorVersion,
|
||||
clientVersion: versionInfo.clientVersion,
|
||||
});
|
||||
this.props.setAppState({
|
||||
nickname: data.nickname,
|
||||
loading: false,
|
||||
activeOrderId: data.active_order_id ? data.active_order_id : null,
|
||||
lastOrderId: data.last_order_id ? data.last_order_id : null,
|
||||
referralCode: data.referral_code,
|
||||
tgEnabled: data.tg_enabled,
|
||||
tgBotName: data.tg_bot_name,
|
||||
tgToken: data.tg_token,
|
||||
earnedRewards: data.earned_rewards,
|
||||
lastDayPremium: data.last_day_nonkyc_btc_premium,
|
||||
stealthInvoices: data.wants_stealth,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
handleClickOpenStatsForNerds = () => {
|
||||
this.setState({ openStatsForNerds: true });
|
||||
this.props.setInfo({ ...this.props.info, openStatsForNerds: true });
|
||||
};
|
||||
|
||||
handleClickCloseStatsForNerds = () => {
|
||||
this.setState({ openStatsForNerds: false });
|
||||
this.props.setInfo({ ...this.props.info, openStatsForNerds: false });
|
||||
};
|
||||
|
||||
handleClickOpenCommunity = () => {
|
||||
this.setState({ openCommuniy: true });
|
||||
this.props.setInfo({ ...this.props.info, openCommunity: true });
|
||||
};
|
||||
|
||||
handleClickCloseCommunity = () => {
|
||||
this.setState({ openCommuniy: false });
|
||||
this.props.setInfo({ ...this.props.info, openCommunity: false });
|
||||
};
|
||||
|
||||
handleClickOpenProfile = () => {
|
||||
this.getInfo();
|
||||
this.setState({ openProfile: true, profileShown: true });
|
||||
this.props.fetchInfo();
|
||||
this.props.setInfo({ ...this.props.info, openProfile: true, profileShown: true });
|
||||
};
|
||||
|
||||
handleClickCloseProfile = () => {
|
||||
this.setState({ openProfile: false });
|
||||
this.props.setInfo({ ...this.props.info, openProfile: false });
|
||||
};
|
||||
|
||||
handleSubmitInvoiceClicked = (e, rewardInvoice) => {
|
||||
this.setState({
|
||||
badInvoice: false,
|
||||
showRewardsSpinner: true,
|
||||
});
|
||||
this.props.setInfo({ ...this.props.info, badInvoice: false, showRewardsSpinner: true });
|
||||
|
||||
apiClient
|
||||
.post('/api/reward/', {
|
||||
@ -142,14 +80,16 @@ class BottomBar extends Component {
|
||||
})
|
||||
.then(
|
||||
(data) =>
|
||||
this.setState({
|
||||
this.props.setInfo({
|
||||
...this.props.info,
|
||||
badInvoice: data.bad_invoice,
|
||||
openClaimRewards: !data.successful_withdrawal,
|
||||
withdrawn: !!data.successful_withdrawal,
|
||||
showRewardsSpinner: false,
|
||||
}) &
|
||||
this.props.setAppState({
|
||||
earnedRewards: data.successful_withdrawal ? 0 : this.props.earnedRewards,
|
||||
this.props.setRobot({
|
||||
...this.props.robot,
|
||||
earnedRewards: data.successful_withdrawal ? 0 : this.props.robot.earnedRewards,
|
||||
}),
|
||||
);
|
||||
e.preventDefault();
|
||||
@ -158,7 +98,9 @@ class BottomBar extends Component {
|
||||
handleSetStealthInvoice = (wantsStealth) => {
|
||||
apiClient
|
||||
.put('/api/stealth/', { wantsStealth })
|
||||
.then((data) => this.props.setAppState({ stealthInvoices: data?.wantsStealth }));
|
||||
.then((data) =>
|
||||
this.props.setRobot({ ...this.props.robot, stealthInvoices: data?.wantsStealth }),
|
||||
);
|
||||
};
|
||||
|
||||
getHost() {
|
||||
@ -171,19 +113,21 @@ class BottomBar extends Component {
|
||||
|
||||
showProfileButton = () => {
|
||||
return (
|
||||
this.props.avatarLoaded &&
|
||||
(this.props.token ? systemClient.getCookie('robot_token') === this.props.token : true) &&
|
||||
this.props.robot.avatarLoaded &&
|
||||
(this.props.robot.token
|
||||
? systemClient.getCookie('robot_token') === this.props.robot.token
|
||||
: true) &&
|
||||
systemClient.getCookie('sessionid')
|
||||
);
|
||||
};
|
||||
|
||||
bottomBarDesktop = () => {
|
||||
const { t } = this.props;
|
||||
const hasRewards = this.props.earnedRewards > 0;
|
||||
const hasRewards = this.props.robot.earnedRewards > 0;
|
||||
const hasOrder = !!(
|
||||
(this.props.activeOrderId > 0) &
|
||||
!this.state.profileShown &
|
||||
this.props.avatarLoaded
|
||||
(this.props.robot.activeOrderId > 0) &
|
||||
!this.props.infoprofileShown &
|
||||
this.props.robot.avatarLoaded
|
||||
);
|
||||
const fontSize = this.props.theme.typography.fontSize;
|
||||
const fontSizeFactor = fontSize / 14; // default fontSize is 14
|
||||
@ -208,16 +152,18 @@ class BottomBar extends Component {
|
||||
<RobotAvatar
|
||||
style={{ marginTop: -13 }}
|
||||
statusColor={
|
||||
(this.props.activeOrderId > 0) & !this.props.profileShown
|
||||
(this.props.robot.activeOrderId > 0) & !this.props.robot.profileShown
|
||||
? 'primary'
|
||||
: undefined
|
||||
}
|
||||
nickname={this.props.nickname}
|
||||
onLoad={() => this.props.setAppState({ avatarLoaded: true })}
|
||||
nickname={this.props.robot.nickname}
|
||||
onLoad={() =>
|
||||
this.props.setRobot({ ...this.props.robot, avatarLoaded: true })
|
||||
}
|
||||
/>
|
||||
</ListItemAvatar>
|
||||
</Tooltip>
|
||||
<ListItemText primary={this.props.nickname} />
|
||||
<ListItemText primary={this.props.robot.nickname} />
|
||||
</ListItemButton>
|
||||
</div>
|
||||
</Grid>
|
||||
@ -228,10 +174,6 @@ class BottomBar extends Component {
|
||||
<IconButton
|
||||
disabled={!this.showProfileButton()}
|
||||
color='primary'
|
||||
onClick={() =>
|
||||
this.props.setAppState({ buyChecked: false, sellChecked: true, type: 0 }) &
|
||||
this.getInfo()
|
||||
}
|
||||
to={`/book/`}
|
||||
component={LinkRouter}
|
||||
>
|
||||
@ -240,7 +182,7 @@ class BottomBar extends Component {
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
{...typographyProps}
|
||||
primary={this.state.num_public_buy_orders}
|
||||
primary={this.props.info.num_public_buy_orders}
|
||||
secondary={t('Public Buy Orders')}
|
||||
/>
|
||||
</ListItem>
|
||||
@ -252,10 +194,6 @@ class BottomBar extends Component {
|
||||
<IconButton
|
||||
disabled={!this.showProfileButton()}
|
||||
color='primary'
|
||||
onClick={() =>
|
||||
this.props.setAppState({ buyChecked: true, sellChecked: false, type: 1 }) &
|
||||
this.getInfo()
|
||||
}
|
||||
to={`/book/`}
|
||||
component={LinkRouter}
|
||||
>
|
||||
@ -264,7 +202,7 @@ class BottomBar extends Component {
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
{...typographyProps}
|
||||
primary={this.state.num_public_sell_orders}
|
||||
primary={this.props.info.num_public_sell_orders}
|
||||
secondary={t('Public Sell Orders')}
|
||||
/>
|
||||
</ListItem>
|
||||
@ -276,7 +214,6 @@ class BottomBar extends Component {
|
||||
<IconButton
|
||||
disabled={!this.showProfileButton()}
|
||||
color='primary'
|
||||
onClick={() => this.getInfo()}
|
||||
to={`/`}
|
||||
component={LinkRouter}
|
||||
>
|
||||
@ -285,7 +222,7 @@ class BottomBar extends Component {
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
{...typographyProps}
|
||||
primary={this.state.active_robots_today}
|
||||
primary={this.props.info.active_robots_today}
|
||||
secondary={t('Today Active Robots')}
|
||||
/>
|
||||
</ListItem>
|
||||
@ -300,7 +237,7 @@ class BottomBar extends Component {
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
{...typographyProps}
|
||||
primary={this.state.last_day_nonkyc_btc_premium + '%'}
|
||||
primary={this.props.info.last_day_nonkyc_btc_premium + '%'}
|
||||
secondary={t('24h Avg Premium')}
|
||||
/>
|
||||
</ListItem>
|
||||
@ -315,7 +252,7 @@ class BottomBar extends Component {
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
{...typographyProps}
|
||||
primary={(this.state.maker_fee + this.state.taker_fee) * 100}
|
||||
primary={(this.props.info.maker_fee + this.props.info.taker_fee) * 100}
|
||||
secondary={t('Trade Fee')}
|
||||
/>
|
||||
</ListItem>
|
||||
@ -471,24 +408,20 @@ class BottomBar extends Component {
|
||||
};
|
||||
|
||||
handleClickOpenExchangeSummary = () => {
|
||||
// avoid calling getInfo while sessionid not yet set. Temporary fix.
|
||||
if (systemClient.getCookie('sessionid')) {
|
||||
this.getInfo();
|
||||
}
|
||||
this.setState({ openExchangeSummary: true });
|
||||
this.props.setInfo({ ...this.props.info, openExchangeSummary: true });
|
||||
};
|
||||
|
||||
handleClickCloseExchangeSummary = () => {
|
||||
this.setState({ openExchangeSummary: false });
|
||||
this.props.setInfo({ ...this.props.info, openExchangeSummary: false });
|
||||
};
|
||||
|
||||
bottomBarPhone = () => {
|
||||
const { t } = this.props;
|
||||
const hasRewards = this.props.earnedRewards > 0;
|
||||
const hasRewards = this.props.robot.earnedRewards > 0;
|
||||
const hasOrder = !!(
|
||||
(this.state.active_order_id > 0) &
|
||||
!this.state.profileShown &
|
||||
this.props.avatarLoaded
|
||||
(this.props.info.active_order_id > 0) &
|
||||
!this.props.info.profileShown &
|
||||
this.props.robot.avatarLoaded
|
||||
);
|
||||
return (
|
||||
<Paper elevation={6} style={{ height: '2.85em', width: '100%' }}>
|
||||
@ -534,7 +467,7 @@ class BottomBar extends Component {
|
||||
to={`/book/`}
|
||||
component={LinkRouter}
|
||||
>
|
||||
<Badge badgeContent={this.state.num_public_buy_orders} color='action'>
|
||||
<Badge badgeContent={this.props.info.num_public_buy_orders} color='action'>
|
||||
<InventoryIcon />
|
||||
</Badge>
|
||||
</IconButton>
|
||||
@ -553,7 +486,7 @@ class BottomBar extends Component {
|
||||
to={`/book/`}
|
||||
component={LinkRouter}
|
||||
>
|
||||
<Badge badgeContent={this.state.num_public_sell_orders} color='action'>
|
||||
<Badge badgeContent={this.props.info.num_public_sell_orders} color='action'>
|
||||
<SellIcon />
|
||||
</Badge>
|
||||
</IconButton>
|
||||
@ -569,7 +502,7 @@ class BottomBar extends Component {
|
||||
to={`/`}
|
||||
component={LinkRouter}
|
||||
>
|
||||
<Badge badgeContent={this.state.active_robots_today} color='action'>
|
||||
<Badge badgeContent={this.props.info.active_robots_today} color='action'>
|
||||
<SmartToyIcon />
|
||||
</Badge>
|
||||
</IconButton>
|
||||
@ -579,7 +512,10 @@ class BottomBar extends Component {
|
||||
<Grid item xs={1.8} align='center'>
|
||||
<Tooltip enterTouchDelay={300} title={t('24h non-KYC bitcoin premium')}>
|
||||
<IconButton color='primary' onClick={this.handleClickOpenExchangeSummary}>
|
||||
<Badge badgeContent={this.state.last_day_nonkyc_btc_premium + '%'} color='action'>
|
||||
<Badge
|
||||
badgeContent={this.props.info.last_day_nonkyc_btc_premium + '%'}
|
||||
color='action'
|
||||
>
|
||||
<PriceChangeIcon />
|
||||
</Badge>
|
||||
</IconButton>
|
||||
@ -622,65 +558,65 @@ class BottomBar extends Component {
|
||||
return (
|
||||
<div>
|
||||
<CommunityDialog
|
||||
isOpen={this.state.openCommuniy}
|
||||
open={this.props.info.openCommunity}
|
||||
handleClickCloseCommunity={this.handleClickCloseCommunity}
|
||||
/>
|
||||
|
||||
<UpdateClientDialog
|
||||
open={this.state.openUpdateClient}
|
||||
coordinatorVersion={this.state.coordinatorVersion}
|
||||
clientVersion={this.state.clientVersion}
|
||||
open={this.props.info.openUpdateClient}
|
||||
coordinatorVersion={this.props.info.coordinatorVersion}
|
||||
clientVersion={this.props.info.clientVersion}
|
||||
handleClickClose={() => this.setState({ openUpdateClient: false })}
|
||||
/>
|
||||
|
||||
<ExchangeSummaryDialog
|
||||
isOpen={this.state.openExchangeSummary}
|
||||
open={this.props.info.openExchangeSummary}
|
||||
handleClickCloseExchangeSummary={this.handleClickCloseExchangeSummary}
|
||||
numPublicBuyOrders={this.state.num_public_buy_orders}
|
||||
numPublicSellOrders={this.state.num_public_sell_orders}
|
||||
bookLiquidity={this.state.book_liquidity}
|
||||
activeRobotsToday={this.state.active_robots_today}
|
||||
lastDayNonkycBtcPremium={this.state.last_day_nonkyc_btc_premium}
|
||||
makerFee={this.state.maker_fee}
|
||||
takerFee={this.state.taker_fee}
|
||||
swapFeeRate={this.state.current_swap_fee_rate}
|
||||
numPublicBuyOrders={this.props.info.num_public_buy_orders}
|
||||
numPublicSellOrders={this.props.info.num_public_sell_orders}
|
||||
bookLiquidity={this.props.info.book_liquidity}
|
||||
activeRobotsToday={this.props.info.active_robots_today}
|
||||
lastDayNonkycBtcPremium={this.props.info.last_day_nonkyc_btc_premium}
|
||||
makerFee={this.props.info.maker_fee}
|
||||
takerFee={this.props.info.taker_fee}
|
||||
swapFeeRate={this.props.info.current_swap_fee_rate}
|
||||
/>
|
||||
|
||||
<ProfileDialog
|
||||
isOpen={this.state.openProfile}
|
||||
open={this.props.info.openProfile}
|
||||
handleClickCloseProfile={this.handleClickCloseProfile}
|
||||
nickname={this.props.nickname}
|
||||
activeOrderId={this.props.activeOrderId}
|
||||
lastOrderId={this.props.lastOrderId}
|
||||
referralCode={this.props.referralCode}
|
||||
tgEnabled={this.props.tgEnabled}
|
||||
tgBotName={this.props.tgBotName}
|
||||
tgToken={this.props.tgToken}
|
||||
nickname={this.props.robot.nickname}
|
||||
activeOrderId={this.props.robot.activeOrderId}
|
||||
lastOrderId={this.props.robotlastOrderId}
|
||||
referralCode={this.props.robot.referralCode}
|
||||
tgEnabled={this.props.robot.tgEnabled}
|
||||
tgBotName={this.props.robot.tgBotName}
|
||||
tgToken={this.props.robot.tgToken}
|
||||
handleSubmitInvoiceClicked={this.handleSubmitInvoiceClicked}
|
||||
host={this.getHost()}
|
||||
showRewardsSpinner={this.state.showRewardsSpinner}
|
||||
withdrawn={this.state.withdrawn}
|
||||
badInvoice={this.state.badInvoice}
|
||||
earnedRewards={this.props.earnedRewards}
|
||||
setAppState={this.props.setAppState}
|
||||
showRewardsSpinner={this.props.info.showRewardsSpinner}
|
||||
withdrawn={this.props.info.withdrawn}
|
||||
badInvoice={this.props.info.badInvoice}
|
||||
earnedRewards={this.props.robot.earnedRewards}
|
||||
updateRobot={(newParams) => this.props.setRobot({ ...robot, ...newParams })}
|
||||
stealthInvoices={this.props.stealthInvoices}
|
||||
handleSetStealthInvoice={this.handleSetStealthInvoice}
|
||||
/>
|
||||
|
||||
<StatsDialog
|
||||
isOpen={this.state.openStatsForNerds}
|
||||
open={this.props.info.openStatsForNerds}
|
||||
handleClickCloseStatsForNerds={this.handleClickCloseStatsForNerds}
|
||||
coordinatorVersion={this.state.coordinatorVersion}
|
||||
clientVersion={this.state.clientVersion}
|
||||
lndVersion={this.state.lnd_version}
|
||||
network={this.state.network}
|
||||
nodeAlias={this.state.node_alias}
|
||||
nodeId={this.state.node_id}
|
||||
alternativeName={this.state.alternative_name}
|
||||
alternativeSite={this.state.alternative_site}
|
||||
commitHash={this.state.robosats_running_commit_hash}
|
||||
lastDayVolume={this.state.last_day_volume}
|
||||
lifetimeVolume={this.state.lifetime_volume}
|
||||
coordinatorVersion={this.props.info.coordinatorVersion}
|
||||
clientVersion={this.props.info.clientVersion}
|
||||
lndVersion={this.props.info.lnd_version}
|
||||
network={this.props.info.network}
|
||||
nodeAlias={this.props.info.node_alias}
|
||||
nodeId={this.props.info.node_id}
|
||||
alternativeName={this.props.info.alternative_name}
|
||||
alternativeSite={this.props.info.alternative_site}
|
||||
commitHash={this.props.info.robosats_running_commit_hash}
|
||||
lastDayVolume={this.props.info.last_day_volume}
|
||||
lifetimeVolume={this.props.info.lifetime_volume}
|
||||
/>
|
||||
|
||||
<MediaQuery minWidth={1200}>{this.bottomBarDesktop()}</MediaQuery>
|
||||
|
@ -20,11 +20,11 @@ import RedditIcon from '@mui/icons-material/Reddit';
|
||||
import Flags from 'country-flag-icons/react/3x2';
|
||||
|
||||
interface Props {
|
||||
isOpen: boolean;
|
||||
open: boolean;
|
||||
handleClickCloseCommunity: () => void;
|
||||
}
|
||||
|
||||
const CommunityDialog = ({ isOpen, handleClickCloseCommunity }: Props): JSX.Element => {
|
||||
const CommunityDialog = ({ open = false, handleClickCloseCommunity }: Props): JSX.Element => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const flagProps = {
|
||||
@ -38,7 +38,7 @@ const CommunityDialog = ({ isOpen, handleClickCloseCommunity }: Props): JSX.Elem
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={isOpen}
|
||||
open={open}
|
||||
onClose={handleClickCloseCommunity}
|
||||
aria-labelledby='community-dialog-title'
|
||||
aria-describedby='community-description'
|
||||
|
@ -24,7 +24,7 @@ import LinkIcon from '@mui/icons-material/Link';
|
||||
import { pn } from '../../utils/prettyNumbers';
|
||||
|
||||
interface Props {
|
||||
isOpen: boolean;
|
||||
open: boolean;
|
||||
handleClickCloseExchangeSummary: () => void;
|
||||
numPublicBuyOrders: number;
|
||||
numPublicSellOrders: number;
|
||||
@ -37,7 +37,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const ExchangeSummaryDialog = ({
|
||||
isOpen,
|
||||
open = false,
|
||||
handleClickCloseExchangeSummary,
|
||||
numPublicBuyOrders,
|
||||
numPublicSellOrders,
|
||||
@ -55,7 +55,7 @@ const ExchangeSummaryDialog = ({
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={isOpen}
|
||||
open={open}
|
||||
onClose={handleClickCloseExchangeSummary}
|
||||
aria-labelledby='exchange-summary-title'
|
||||
aria-describedby='exchange-summary-description'
|
||||
|
@ -41,7 +41,7 @@ import { getWebln } from '../../utils/webln';
|
||||
import RobotAvatar from '../Robots/RobotAvatar';
|
||||
|
||||
interface Props {
|
||||
isOpen: boolean;
|
||||
open: boolean;
|
||||
handleClickCloseProfile: () => void;
|
||||
nickname: string;
|
||||
activeOrderId: string | number;
|
||||
@ -58,11 +58,11 @@ interface Props {
|
||||
earnedRewards: number;
|
||||
stealthInvoices: boolean;
|
||||
handleSetStealthInvoice: (stealth: boolean) => void;
|
||||
setAppState: (state: any) => void; // TODO: move to a ContextProvider
|
||||
updateRobot: (state: any) => void; // TODO: move to a ContextProvider
|
||||
}
|
||||
|
||||
const ProfileDialog = ({
|
||||
isOpen,
|
||||
open = false,
|
||||
handleClickCloseProfile,
|
||||
nickname,
|
||||
activeOrderId,
|
||||
@ -77,7 +77,7 @@ const ProfileDialog = ({
|
||||
withdrawn,
|
||||
badInvoice,
|
||||
earnedRewards,
|
||||
setAppState,
|
||||
updateRobot,
|
||||
stealthInvoices,
|
||||
handleSetStealthInvoice,
|
||||
}: Props): JSX.Element => {
|
||||
@ -101,7 +101,7 @@ const ProfileDialog = ({
|
||||
|
||||
if (robotToken) {
|
||||
systemClient.copyToClipboard(robotToken);
|
||||
setAppState({ copiedToken: true });
|
||||
updateRobot({ copiedToken: true });
|
||||
}
|
||||
};
|
||||
|
||||
@ -128,7 +128,7 @@ const ProfileDialog = ({
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={isOpen}
|
||||
open={open}
|
||||
onClose={handleClickCloseProfile}
|
||||
aria-labelledby='profile-title'
|
||||
aria-describedby='profile-description'
|
||||
|
@ -26,7 +26,7 @@ import { AmbossIcon, BitcoinSignIcon, RoboSatsNoTextIcon } from '../Icons';
|
||||
import { pn } from '../../utils/prettyNumbers';
|
||||
|
||||
interface Props {
|
||||
isOpen: boolean;
|
||||
open: boolean;
|
||||
handleClickCloseStatsForNerds: () => void;
|
||||
lndVersion: string;
|
||||
coordinatorVersion: string;
|
||||
@ -42,7 +42,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const StatsDialog = ({
|
||||
isOpen,
|
||||
open = false,
|
||||
handleClickCloseStatsForNerds,
|
||||
lndVersion,
|
||||
coordinatorVersion,
|
||||
@ -60,7 +60,7 @@ const StatsDialog = ({
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={isOpen}
|
||||
open={open}
|
||||
onClose={handleClickCloseStatsForNerds}
|
||||
aria-labelledby='stats-for-nerds-dialog-title'
|
||||
aria-describedby='stats-for-nerds-description'
|
||||
|
@ -75,7 +75,7 @@ class Chat extends Component {
|
||||
this.setState({ connected: false });
|
||||
});
|
||||
|
||||
this.setState({ connected: true, connection: connection });
|
||||
this.setState({ connected: true, connection });
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import OrderPage from './OrderPage';
|
||||
import BottomBar from './BottomBar';
|
||||
|
||||
import { apiClient } from '../services/api';
|
||||
import checkVer from '../utils/checkVer';
|
||||
|
||||
import {
|
||||
Book,
|
||||
@ -24,11 +25,19 @@ import {
|
||||
defaultSettings,
|
||||
} from '../models';
|
||||
|
||||
const getWindowSize = function (fontSize: number) {
|
||||
// returns window size in EM units
|
||||
return {
|
||||
width: window.innerWidth / fontSize,
|
||||
height: window.innerHeight / fontSize,
|
||||
};
|
||||
};
|
||||
|
||||
const Main = (): JSX.Element => {
|
||||
const theme = useTheme();
|
||||
const history = useHistory();
|
||||
const Router = window.NativeRobosats ? HashRouter : BrowserRouter;
|
||||
const basename = window.NativeRobosats ? window.location.pathname : '';
|
||||
const Router = window.NativeRobosats != null ? HashRouter : BrowserRouter;
|
||||
const basename = window.NativeRobosats != null ? window.location.pathname : '';
|
||||
|
||||
// All app data structured
|
||||
const [book, setBook] = useState<Book>({ orders: [], loading: true });
|
||||
@ -42,13 +51,8 @@ const Main = (): JSX.Element => {
|
||||
const [fav, setFav] = useState<Favorites>({ type: null, currency: 0 });
|
||||
const [settings, setSettings] = useState<Settings>(defaultSettings);
|
||||
|
||||
console.log(info);
|
||||
const initialWindowSize = {
|
||||
width: window.innerWidth / theme.typography.fontSize,
|
||||
height: window.innerHeight / theme.typography.fontSize,
|
||||
}; // EM values
|
||||
const [windowSize, setWindowSize] = useState<{ width: number; height: number }>(
|
||||
initialWindowSize,
|
||||
getWindowSize(theme.typography.fontSize),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@ -57,6 +61,7 @@ const Main = (): JSX.Element => {
|
||||
}
|
||||
fetchBook();
|
||||
fetchLimits();
|
||||
fetchInfo();
|
||||
return () => {
|
||||
if (typeof window !== undefined) {
|
||||
window.removeEventListener('resize', onResize);
|
||||
@ -65,15 +70,12 @@ const Main = (): JSX.Element => {
|
||||
}, []);
|
||||
|
||||
const onResize = function () {
|
||||
setWindowSize({
|
||||
width: window.innerWidth / theme.typography.fontSize,
|
||||
height: window.innerHeight / theme.typography.fontSize,
|
||||
});
|
||||
setWindowSize(getWindowSize(theme.typography.fontSize));
|
||||
};
|
||||
|
||||
const fetchBook = function () {
|
||||
setBook({ ...book, loading: true });
|
||||
apiClient.get('/api/book/').then((data) =>
|
||||
apiClient.get('/api/book/').then((data: any) =>
|
||||
setBook({
|
||||
loading: false,
|
||||
orders: data.not_found ? [] : data,
|
||||
@ -81,43 +83,57 @@ const Main = (): JSX.Element => {
|
||||
);
|
||||
};
|
||||
|
||||
const fetchLimits = () => {
|
||||
const fetchLimits = async () => {
|
||||
setLimits({ ...limits, loading: true });
|
||||
const data = apiClient.get('/api/limits/').then((data) => {
|
||||
setLimits({ list: data, loading: false });
|
||||
return data;
|
||||
});
|
||||
return data;
|
||||
return await data;
|
||||
};
|
||||
|
||||
const fetchInfo = function () {
|
||||
apiClient.get('/api/info/').then((data: any) => {
|
||||
const versionInfo: any = checkVer(data.version.major, data.version.minor, data.version.patch);
|
||||
setInfo({
|
||||
...data,
|
||||
openUpdateClient: versionInfo.updateAvailable,
|
||||
coordinatorVersion: versionInfo.coordinatorVersion,
|
||||
clientVersion: versionInfo.clientVersion,
|
||||
});
|
||||
setRobot({
|
||||
...robot,
|
||||
nickname: data.nickname,
|
||||
loading: false,
|
||||
activeOrderId: data.active_order_id ? data.active_order_id : null,
|
||||
lastOrderId: data.last_order_id ? data.last_order_id : null,
|
||||
referralCode: data.referral_code,
|
||||
tgEnabled: data.tg_enabled,
|
||||
tgBotName: data.tg_bot_name,
|
||||
tgToken: data.tg_token,
|
||||
earnedRewards: data.earned_rewards,
|
||||
stealthInvoices: data.wants_stealth,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Router basename={basename}>
|
||||
<div className='appCenter'>
|
||||
<Switch>
|
||||
{/*
|
||||
<Route
|
||||
exact
|
||||
path='/'
|
||||
render={(props) => (
|
||||
<UserGenPage
|
||||
{...props}
|
||||
{...this.state}
|
||||
{...this.props}
|
||||
setAppState={this.setAppState}
|
||||
/>
|
||||
render={(props: any) => (
|
||||
<UserGenPage match={props.match} theme={theme} robot={robot} setRobot={setRobot} />
|
||||
)}
|
||||
/>
|
||||
<Route
|
||||
path='/ref/:refCode'
|
||||
render={(props) => (
|
||||
<UserGenPage
|
||||
{...props}
|
||||
{...this.state}
|
||||
{...this.props}
|
||||
setAppState={this.setAppState}
|
||||
/>
|
||||
render={(props: any) => (
|
||||
<UserGenPage match={props.match} theme={theme} robot={robot} setRobot={setRobot} />
|
||||
)}
|
||||
/> */}
|
||||
/>
|
||||
<Route
|
||||
path='/make'
|
||||
render={() => (
|
||||
@ -150,29 +166,30 @@ const Main = (): JSX.Element => {
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{/* <Route
|
||||
<Route
|
||||
path='/order/:orderId'
|
||||
render={(props) => (
|
||||
<OrderPage
|
||||
{...props}
|
||||
{...this.state}
|
||||
{...this.props}
|
||||
setAppState={this.setAppState}
|
||||
/>
|
||||
)}
|
||||
render={(props) => <OrderPage theme={theme} history={history} {...props} />}
|
||||
/>
|
||||
*/}
|
||||
</Switch>
|
||||
</div>
|
||||
{/* <div
|
||||
className='bottomBar'
|
||||
<div
|
||||
style={{
|
||||
height: '2.857em',
|
||||
width: `${(windowSize.width / 16) * 14}em`,
|
||||
position: 'fixed',
|
||||
bottom: 0,
|
||||
}}
|
||||
>
|
||||
<BottomBar redirectTo={(location) => history.push(location)} info={info} />
|
||||
</div> */}
|
||||
<BottomBar
|
||||
theme={theme}
|
||||
redirectTo={(location: string) => history.push(location)}
|
||||
robot={robot}
|
||||
setRobot={setRobot}
|
||||
info={info}
|
||||
setInfo={setInfo}
|
||||
fetchInfo={fetchInfo}
|
||||
/>
|
||||
</div>
|
||||
</Router>
|
||||
);
|
||||
};
|
||||
|
@ -525,10 +525,7 @@ class OrderPage extends Component {
|
||||
<StoreTokenDialog
|
||||
open={this.state.openStoreToken}
|
||||
onClose={() => this.setState({ openStoreToken: false })}
|
||||
onClickCopy={() =>
|
||||
systemClient.copyToClipboard(systemClient.getCookie('robot_token')) &
|
||||
this.props.setAppState({ copiedToken: true })
|
||||
}
|
||||
onClickCopy={() => systemClient.copyToClipboard(systemClient.getCookie('robot_token'))}
|
||||
copyIconColor={this.props.copiedToken ? 'inherit' : 'primary'}
|
||||
onClickBack={() => this.setState({ openStoreToken: false })}
|
||||
onClickDone={() =>
|
||||
|
@ -11,7 +11,6 @@ import {
|
||||
IconButton,
|
||||
} from '@mui/material';
|
||||
import { Link } from 'react-router-dom';
|
||||
import SmoothImage from 'react-smooth-image';
|
||||
import { InfoDialog } from './Dialogs';
|
||||
|
||||
import SmartToyIcon from '@mui/icons-material/SmartToy';
|
||||
@ -44,19 +43,18 @@ class UserGenPage extends Component {
|
||||
componentDidMount() {
|
||||
// Checks in parent HomePage if there is already a nick and token
|
||||
// Displays the existing one
|
||||
if (this.props.nickname != null) {
|
||||
if (this.props.robot.nickname != null) {
|
||||
this.setState({
|
||||
token: this.props.token ? this.props.token : '',
|
||||
loadingRobot: false,
|
||||
inputToken: this.props.robot.token ? this.props.robot.token : '',
|
||||
});
|
||||
} else if (window.NativeRobosats && systemClient.getCookie('robot_token')) {
|
||||
const token = systemClient.getCookie('robot_token');
|
||||
this.setState({ token });
|
||||
this.setState({ inputToken: token });
|
||||
this.getGeneratedUser(token);
|
||||
} else {
|
||||
const newToken = genBase62Token(36);
|
||||
this.setState({
|
||||
token: newToken,
|
||||
inputToken: newToken,
|
||||
});
|
||||
this.getGeneratedUser(newToken);
|
||||
}
|
||||
@ -65,6 +63,7 @@ class UserGenPage extends Component {
|
||||
getGeneratedUser = (token) => {
|
||||
const strength = tokenStrength(token);
|
||||
const refCode = this.refCode;
|
||||
this.props.setRobot({ ...this.props.robot, loading: true });
|
||||
|
||||
const requestBody = genKey(token).then(function (key) {
|
||||
return {
|
||||
@ -79,46 +78,48 @@ class UserGenPage extends Component {
|
||||
});
|
||||
requestBody.then((body) =>
|
||||
apiClient.post('/api/user/', body).then((data) => {
|
||||
this.setState({
|
||||
this.props.setRobot({
|
||||
bit_entropy: data.token_bits_entropy,
|
||||
shannon_entropy: data.token_shannon_entropy,
|
||||
bad_request: data.bad_request,
|
||||
found: data.found,
|
||||
loadingRobot: false,
|
||||
loading: false,
|
||||
stealthInvoices: data.wants_stealth,
|
||||
}) &
|
||||
// Add nick and token to App state (token only if not a bad request)
|
||||
(data.bad_request
|
||||
? this.props.setAppState({
|
||||
nickname: data.nickname,
|
||||
avatarLoaded: false,
|
||||
activeOrderId: data.active_order_id ? data.active_order_id : null,
|
||||
referralCode: data.referral_code,
|
||||
earnedRewards: data.earned_rewards,
|
||||
lastOrderId: data.last_order_id ? data.last_order_id : null,
|
||||
stealthInvoices: data.wants_stealth,
|
||||
})
|
||||
: this.props.setAppState({
|
||||
nickname: data.nickname,
|
||||
token,
|
||||
avatarLoaded: false,
|
||||
activeOrderId: data.active_order_id ? data.active_order_id : null,
|
||||
lastOrderId: data.last_order_id ? data.last_order_id : null,
|
||||
referralCode: data.referral_code,
|
||||
earnedRewards: data.earned_rewards,
|
||||
stealthInvoices: data.wants_stealth,
|
||||
tgEnabled: data.tg_enabled,
|
||||
tgBotName: data.tg_bot_name,
|
||||
tgToken: data.tg_token,
|
||||
}) &
|
||||
systemClient.setCookie('robot_token', token) &
|
||||
systemClient.setCookie('pub_key', data.public_key.split('\n').join('\\')) &
|
||||
systemClient.setCookie(
|
||||
'enc_priv_key',
|
||||
data.encrypted_private_key.split('\n').join('\\'),
|
||||
)) &
|
||||
// If the robot has been found (recovered) we assume the token is backed up
|
||||
(data.found ? this.props.setAppState({ copiedToken: true }) : null);
|
||||
});
|
||||
// Add nick and token to App state (token only if not a bad request)
|
||||
data.bad_request
|
||||
? this.props.setRobot({
|
||||
...this.props.robot,
|
||||
nickname: data.nickname,
|
||||
avatarLoaded: false,
|
||||
activeOrderId: data.active_order_id ? data.active_order_id : null,
|
||||
referralCode: data.referral_code,
|
||||
earnedRewards: data.earned_rewards,
|
||||
lastOrderId: data.last_order_id ? data.last_order_id : null,
|
||||
stealthInvoices: data.wants_stealth,
|
||||
})
|
||||
: this.props.setRobot({
|
||||
...this.props.robot,
|
||||
nickname: data.nickname,
|
||||
token,
|
||||
avatarLoaded: false,
|
||||
activeOrderId: data.active_order_id ? data.active_order_id : null,
|
||||
lastOrderId: data.last_order_id ? data.last_order_id : null,
|
||||
referralCode: data.referral_code,
|
||||
earnedRewards: data.earned_rewards,
|
||||
stealthInvoices: data.wants_stealth,
|
||||
tgEnabled: data.tg_enabled,
|
||||
tgBotName: data.tg_bot_name,
|
||||
tgToken: data.tg_token,
|
||||
}) &
|
||||
systemClient.setCookie('robot_token', token) &
|
||||
systemClient.setCookie('pub_key', data.public_key.split('\n').join('\\')) &
|
||||
systemClient.setCookie(
|
||||
'enc_priv_key',
|
||||
data.encrypted_private_key.split('\n').join('\\'),
|
||||
);
|
||||
// If the robot has been found (recovered) we assume the token is backed up
|
||||
data.found ? this.props.setRobot({ ...this.props.robot, copiedToken: true }) : null;
|
||||
}),
|
||||
);
|
||||
};
|
||||
@ -133,26 +134,27 @@ class UserGenPage extends Component {
|
||||
}
|
||||
|
||||
handleClickNewRandomToken = () => {
|
||||
const token = genBase62Token(36);
|
||||
const inputToken = genBase62Token(36);
|
||||
this.setState({
|
||||
token,
|
||||
inputToken,
|
||||
tokenHasChanged: true,
|
||||
});
|
||||
this.props.setAppState({ copiedToken: true });
|
||||
this.props.setRobot({ ...this.props.robot, copiedToken: true });
|
||||
};
|
||||
|
||||
handleChangeToken = (e) => {
|
||||
this.setState({
|
||||
token: e.target.value.split(' ').join(''),
|
||||
inputToken: e.target.value.split(' ').join(''),
|
||||
tokenHasChanged: true,
|
||||
});
|
||||
};
|
||||
|
||||
handleClickSubmitToken = () => {
|
||||
this.delGeneratedUser();
|
||||
this.getGeneratedUser(this.state.token);
|
||||
this.setState({ loadingRobot: true, tokenHasChanged: false });
|
||||
this.props.setAppState({
|
||||
this.getGeneratedUser(this.state.inputToken);
|
||||
this.setState({ tokenHasChanged: false });
|
||||
this.props.setRobot({
|
||||
...this.props.robot,
|
||||
avatarLoaded: false,
|
||||
nickname: null,
|
||||
token: null,
|
||||
@ -181,6 +183,10 @@ class UserGenPage extends Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
console.log(systemClient.getCookie('robot_token'));
|
||||
console.log(this.props.robot.token);
|
||||
console.log(systemClient.getCookie('robot_token') === this.props.robot.token);
|
||||
|
||||
const { t, i18n } = this.props;
|
||||
const fontSize = this.props.theme.typography.fontSize;
|
||||
const fontSizeFactor = fontSize / 14; // to scale sizes, default fontSize is 14
|
||||
@ -195,12 +201,12 @@ class UserGenPage extends Component {
|
||||
align='center'
|
||||
sx={{ width: 370 * fontSizeFactor, height: 260 * fontSizeFactor }}
|
||||
>
|
||||
{this.props.avatarLoaded && this.props.nickname ? (
|
||||
{this.props.robot.avatarLoaded && this.props.robot.nickname ? (
|
||||
<div>
|
||||
<Grid item xs={12} align='center'>
|
||||
<Typography component='h5' variant='h5'>
|
||||
<b>
|
||||
{this.props.nickname && systemClient.getCookie('sessionid') ? (
|
||||
{this.props.robot.nickname && systemClient.getCookie('sessionid') ? (
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
@ -217,7 +223,7 @@ class UserGenPage extends Component {
|
||||
width: 33 * fontSizeFactor,
|
||||
}}
|
||||
/>
|
||||
<a>{this.props.nickname}</a>
|
||||
<a>{this.props.robot.nickname}</a>
|
||||
<BoltIcon
|
||||
sx={{
|
||||
color: '#fcba03',
|
||||
@ -234,7 +240,7 @@ class UserGenPage extends Component {
|
||||
</Grid>
|
||||
<Grid item xs={12} align='center'>
|
||||
<RobotAvatar
|
||||
nickname={this.props.nickname}
|
||||
nickname={this.props.robot.nickname}
|
||||
smooth={true}
|
||||
style={{ maxWidth: 203 * fontSizeFactor, maxHeight: 203 * fontSizeFactor }}
|
||||
imageStyle={{
|
||||
@ -271,7 +277,7 @@ class UserGenPage extends Component {
|
||||
error={!!this.state.bad_request}
|
||||
label={t('Store your token safely')}
|
||||
required={true}
|
||||
value={this.state.token}
|
||||
value={this.state.inputToken}
|
||||
variant='standard'
|
||||
helperText={this.state.bad_request}
|
||||
size='small'
|
||||
@ -301,11 +307,14 @@ class UserGenPage extends Component {
|
||||
<IconButton
|
||||
color='primary'
|
||||
disabled={
|
||||
!this.props.avatarLoaded ||
|
||||
!(systemClient.getCookie('robot_token') === this.state.token)
|
||||
!this.props.robot.avatarLoaded ||
|
||||
!(systemClient.getCookie('robot_token') === this.state.inputToken)
|
||||
}
|
||||
onClick={() =>
|
||||
saveAsJson(this.props.nickname + '.json', this.createJsonFile())
|
||||
saveAsJson(
|
||||
this.props.robot.nickname + '.json',
|
||||
this.createJsonFile(),
|
||||
)
|
||||
}
|
||||
>
|
||||
<DownloadIcon
|
||||
@ -318,14 +327,14 @@ class UserGenPage extends Component {
|
||||
<Grid item xs={6}>
|
||||
<Tooltip disableHoverListener enterTouchDelay={0} title={t('Copied!')}>
|
||||
<IconButton
|
||||
color={this.props.copiedToken ? 'inherit' : 'primary'}
|
||||
color={this.props.robot.copiedToken ? 'inherit' : 'primary'}
|
||||
disabled={
|
||||
!this.props.avatarLoaded ||
|
||||
!(systemClient.getCookie('robot_token') === this.state.token)
|
||||
!this.props.robot.avatarLoaded ||
|
||||
!(systemClient.getCookie('robot_token') === this.state.inputToken)
|
||||
}
|
||||
onClick={() =>
|
||||
systemClient.copyToClipboard(systemClient.getCookie('robot_token')) &
|
||||
this.props.setAppState({ copiedToken: true })
|
||||
this.props.setRobot({ ...this.props.robot, copiedToken: true })
|
||||
}
|
||||
>
|
||||
<ContentCopy
|
||||
@ -351,7 +360,7 @@ class UserGenPage extends Component {
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item xs={12} align='center'>
|
||||
{this.state.tokenHasChanged ? (
|
||||
{this.state.inputTokenHasChanged ? (
|
||||
<Button type='submit' size='small' onClick={this.handleClickSubmitToken}>
|
||||
<SmartToyIcon sx={{ width: 18 * fontSizeFactor, height: 18 * fontSizeFactor }} />
|
||||
<span> {t('Generate Robot')}</span>
|
||||
@ -376,9 +385,9 @@ class UserGenPage extends Component {
|
||||
<ButtonGroup variant='contained' aria-label='outlined primary button group'>
|
||||
<Button
|
||||
disabled={
|
||||
this.state.loadingRobot !== false ||
|
||||
!(this.props.token
|
||||
? systemClient.getCookie('robot_token') === this.props.token
|
||||
this.props.robot.loading ||
|
||||
!(this.props.robot.token
|
||||
? systemClient.getCookie('robot_token') === this.props.robot.token
|
||||
: true)
|
||||
}
|
||||
color='primary'
|
||||
@ -397,9 +406,9 @@ class UserGenPage extends Component {
|
||||
/>
|
||||
<Button
|
||||
disabled={
|
||||
this.state.loadingRobot !== false ||
|
||||
!(this.props.token
|
||||
? systemClient.getCookie('robot_token') === this.props.token
|
||||
this.props.robot.loading ||
|
||||
!(this.props.robot.token
|
||||
? systemClient.getCookie('robot_token') === this.props.robot.token
|
||||
: true)
|
||||
}
|
||||
color='secondary'
|
||||
@ -411,11 +420,11 @@ class UserGenPage extends Component {
|
||||
</ButtonGroup>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} align='center' sx={{ width: 370 * fontSizeFactor }}>
|
||||
<Grid item xs={12} align='center' sx={{ width: '26.43em' }}>
|
||||
<Grid item>
|
||||
<div style={{ height: 30 * fontSizeFactor }} />
|
||||
<div style={{ height: '2.143em' }} />
|
||||
</Grid>
|
||||
<div style={{ width: 370 * fontSizeFactor, left: 30 * fontSizeFactor }}>
|
||||
<div style={{ width: '26.43em', left: '2.143em' }}>
|
||||
<Grid container align='center'>
|
||||
<Grid item xs={0.8} />
|
||||
<Grid item xs={7.5} align='right'>
|
||||
@ -424,10 +433,7 @@ class UserGenPage extends Component {
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={2.5} align='left'>
|
||||
<RoboSatsNoTextIcon
|
||||
color='primary'
|
||||
sx={{ height: 72 * fontSizeFactor, width: 72 * fontSizeFactor }}
|
||||
/>
|
||||
<RoboSatsNoTextIcon color='primary' sx={{ height: '5.143em', width: '5.143em' }} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</div>
|
||||
|
@ -17,16 +17,16 @@ export interface Info {
|
||||
taker_fee: number;
|
||||
bond_size: number;
|
||||
current_swap_fee_rate: number;
|
||||
|
||||
// Other keys that do not belong here. TODO on NavBar PR.
|
||||
coordinatorVersion: string;
|
||||
clientVersion: string;
|
||||
openUpdateClient: boolean;
|
||||
|
||||
// Other keys that do not belong here. TODO on NavBar PR.
|
||||
profileShown: boolean;
|
||||
openStatsForNerds: boolean;
|
||||
openCommuniy: boolean;
|
||||
openCommunity: boolean;
|
||||
openExchangeSummary: boolean;
|
||||
openClaimRewards: boolean;
|
||||
openUpdateClient: boolean;
|
||||
openProfile: boolean;
|
||||
showRewards: boolean;
|
||||
rewardInvoice: string | null;
|
||||
@ -54,16 +54,16 @@ export const defaultInfo: Info = {
|
||||
taker_fee: 0,
|
||||
bond_size: 0,
|
||||
current_swap_fee_rate: 0,
|
||||
|
||||
// Other keys that do not belong here. TODO on NavBar PR.
|
||||
coordinatorVersion: 'v?.?.?',
|
||||
clientVersion: 'v?.?.?',
|
||||
openUpdateClient: false,
|
||||
|
||||
// Other keys that do not belong here. TODO on NavBar PR.
|
||||
profileShown: false,
|
||||
openStatsForNerds: false,
|
||||
openCommuniy: false,
|
||||
openCommunity: false,
|
||||
openExchangeSummary: false,
|
||||
openClaimRewards: false,
|
||||
openUpdateClient: false,
|
||||
openProfile: false,
|
||||
showRewards: false,
|
||||
rewardInvoice: null,
|
||||
|
@ -8,7 +8,11 @@ export interface Robot {
|
||||
lastOrderId: number | null;
|
||||
earnedRewards: number;
|
||||
referralCode: string;
|
||||
tgEnabled: boolean;
|
||||
tgBotName: string;
|
||||
tgToken: string;
|
||||
loading: boolean;
|
||||
avatarLoaded: boolean;
|
||||
copiedToken: boolean;
|
||||
}
|
||||
|
||||
@ -22,7 +26,11 @@ export const defaultRobot: Robot = {
|
||||
lastOrderId: null,
|
||||
earnedRewards: 0,
|
||||
referralCode: '',
|
||||
tgEnabled: false,
|
||||
tgBotName: 'unknown',
|
||||
tgToken: 'unknown',
|
||||
loading: true,
|
||||
avatarLoaded: false,
|
||||
copiedToken: false,
|
||||
};
|
||||
|
||||
|
@ -11,8 +11,8 @@ export const checkVer: (
|
||||
return { updateAvailable: null };
|
||||
}
|
||||
const semver = packageJson.version.split('.');
|
||||
const updateAvailable = major > Number(semver[0]) || minor > Number(semver[1]);
|
||||
const patchAvailable = !updateAvailable && patch > Number(semver[2]);
|
||||
const updateAvailable: boolean = major > Number(semver[0]) || minor > Number(semver[1]);
|
||||
const patchAvailable: boolean = !updateAvailable && patch > Number(semver[2]);
|
||||
|
||||
return {
|
||||
updateAvailable,
|
||||
|
@ -79,11 +79,6 @@ input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
.bottomBar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.amboss {
|
||||
fill: url(#SVGID_1_);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user