diff --git a/frontend/src/basic/Main.tsx b/frontend/src/basic/Main.tsx index 9c6ec456..7f8659b9 100644 --- a/frontend/src/basic/Main.tsx +++ b/frontend/src/basic/Main.tsx @@ -1,13 +1,14 @@ import React, { useEffect, useState } from 'react'; import { HashRouter, BrowserRouter, Switch, Route, useHistory } from 'react-router-dom'; -import { useTheme, IconButton, Box, Slide } from '@mui/material'; +import { useTheme, Box, Slide } from '@mui/material'; import UserGenPage from './UserGenPage'; import MakerPage from './MakerPage'; import BookPage from './BookPage'; import OrderPage from './OrderPage'; +import SettingsPage from './SettingsPage'; import NavBar from './NavBar'; -import { LearnDialog } from '../components/Dialogs'; +import MainDialogs, { OpenDialogs } from './MainDialogs'; import { apiClient } from '../services/api'; import { checkVer } from '../utils'; @@ -25,12 +26,6 @@ import { defaultInfo, } from '../models'; -// Icons -import DarkModeIcon from '@mui/icons-material/DarkMode'; -import LightModeIcon from '@mui/icons-material/LightMode'; -import SchoolIcon from '@mui/icons-material/School'; -import SettingsPage from './SettingsPage'; - const getWindowSize = function (fontSize: number) { // returns window size in EM units return { @@ -73,7 +68,16 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => { }); const navbarHeight = 2.5; - const [openLearn, setOpenLearn] = useState(false); + const closeAll = { + more: false, + learn: false, + community: false, + info: false, + coordinator: false, + stats: false, + update: false, + }; + const [open, setOpen] = useState(closeAll); const [windowSize, setWindowSize] = useState<{ width: number; height: number }>( getWindowSize(theme.typography.fontSize), @@ -146,16 +150,6 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => { console.log(page, slideDirection); return ( -
- setOpenLearn(false)} /> - setOpenLearn(true)} - > - - -
{ direction={page === 'settings' ? slideDirection.in : slideDirection.out} in={page === 'settings'} appear={slideDirection.in != undefined} - mountOnEnter >
{ height={navbarHeight} page={page} setPage={setPage} + open={open} + setOpen={setOpen} + closeAll={closeAll} setSlideDirection={setSlideDirection} robot={robot} setRobot={setRobot} @@ -258,6 +254,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => { setInfo={setInfo} fetchInfo={fetchInfo} /> + ); }; diff --git a/frontend/src/basic/MainDialogs/index.tsx b/frontend/src/basic/MainDialogs/index.tsx new file mode 100644 index 00000000..73aee5de --- /dev/null +++ b/frontend/src/basic/MainDialogs/index.tsx @@ -0,0 +1,90 @@ +import React, { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { useTheme, styled, Grid, IconButton } from '@mui/material'; +import { Info } from '../../models'; +import { + CommunityDialog, + CoordinatorSummaryDialog, + InfoDialog, + LearnDialog, + StatsDialog, + UpdateClientDialog, +} from '../../components/Dialogs'; + +export interface OpenDialogs { + more: boolean; + learn: boolean; + community: boolean; + info: boolean; + coordinator: boolean; + stats: boolean; + update: boolean; +} + +interface MainDialogsProps { + open: OpenDialogs; + setOpen: (state: OpenDialogs) => void; + info: Info; + closeAll: OpenDialogs; +} + +const MainDialogs = ({ open, setOpen, info, closeAll }: MainDialogsProps): JSX.Element => { + const { t } = useTranslation(); + const theme = useTheme(); + + useEffect(() => { + if (info.openUpdateClient) { + setOpen({ ...closeAll, update: true }); + } + }, [info]); + + return ( + <> + setOpen({ ...open, update: false })} + /> + setOpen({ ...open, info: false })} + /> + setOpen({ ...open, learn: false })} /> + setOpen({ ...open, community: false })} + /> + setOpen({ ...open, coordinator: false })} + numPublicBuyOrders={info.num_public_buy_orders} + numPublicSellOrders={info.num_public_sell_orders} + bookLiquidity={info.book_liquidity} + activeRobotsToday={info.active_robots_today} + lastDayNonkycBtcPremium={info.last_day_nonkyc_btc_premium} + makerFee={info.maker_fee} + takerFee={info.taker_fee} + swapFeeRate={info.current_swap_fee_rate} + /> + setOpen({ ...open, stats: false })} + coordinatorVersion={info.coordinatorVersion} + clientVersion={info.clientVersion} + lndVersion={info.lnd_version} + network={info.network} + nodeAlias={info.node_alias} + nodeId={info.node_id} + alternativeName={info.alternative_name} + alternativeSite={info.alternative_site} + commitHash={info.robosats_running_commit_hash} + lastDayVolume={info.last_day_volume} + lifetimeVolume={info.lifetime_volume} + /> + + ); +}; + +export default MainDialogs; diff --git a/frontend/src/basic/NavBar/MoreTooltip.tsx b/frontend/src/basic/NavBar/MoreTooltip.tsx new file mode 100644 index 00000000..581fb456 --- /dev/null +++ b/frontend/src/basic/NavBar/MoreTooltip.tsx @@ -0,0 +1,131 @@ +import React, { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { useTheme, styled, Grid, IconButton } from '@mui/material'; +import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip'; + +import { OpenDialogs } from '../MainDialogs'; + +import { BubbleChart, Info, People, PriceChange, School } from '@mui/icons-material'; + +const StyledTooltip = styled(({ className, ...props }: TooltipProps) => ( + +))(({ theme }) => ({ + [`& .${tooltipClasses.tooltip}`]: { + backgroundColor: theme.palette.background.paper, + color: theme.palette.text.primary, + boxShadow: theme.shadows[1], + fontSize: theme.typography.fontSize, + borderRadius: '2em', + }, +})); + +export interface OpenDialogs { + more: boolean; + learn: boolean; + community: boolean; + info: boolean; + coordinator: boolean; + stats: boolean; + update: boolean; +} + +interface MoreTooltipProps { + open: OpenDialogs; + setOpen: (state: OpenDialogs) => void; + closeAll: OpenDialogs; + children: JSX.Element; +} + +const MoreTooltip = ({ open, setOpen, closeAll, children }: MoreTooltipProps): JSX.Element => { + const { t } = useTranslation(); + const theme = useTheme(); + return ( + + + + setOpen({ ...closeAll, more: true, info: !open.info })} + > + + + + + + + + setOpen({ ...closeAll, more: true, learn: !open.learn })} + > + + + + + + + + setOpen({ ...closeAll, more: true, community: !open.community })} + > + + + + + + + + setOpen({ ...closeAll, more: true, coordinator: !open.coordinator })} + > + + + + + + + + setOpen({ ...closeAll, more: true, stats: !open.stats })} + > + + + + + + } + > + {children} + + ); +}; + +export default MoreTooltip; diff --git a/frontend/src/basic/NavBar/NavBar.tsx b/frontend/src/basic/NavBar/NavBar.tsx new file mode 100644 index 00000000..0cec35e9 --- /dev/null +++ b/frontend/src/basic/NavBar/NavBar.tsx @@ -0,0 +1,625 @@ +import React, { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { useHistory } from 'react-router-dom'; +import { Tabs, Tab, Paper, useTheme } from '@mui/material'; +import RobotAvatar from '../../components/RobotAvatar'; +import MoreTooltip from './MoreTooltip'; + +import { OpenDialogs } from '../MainDialogs'; + +import { + SettingsApplications, + SmartToy, + Storefront, + AddBox, + Assignment, + MoreHoriz, +} from '@mui/icons-material'; + +type Page = 'robot' | 'offers' | 'create' | 'order' | 'settings' | 'none'; +type Direction = 'left' | 'right' | undefined; + +interface NavBarProps { + page: Page; + setPage: (state: Page) => void; + slideDirection: { in: Direction; out: Direction }; + setSlideDirection: (state: { in: Direction; out: Direction }) => void; + width: number; + height: number; + open: OpenDialogs; + setOpen: (state: OpenDialogs) => void; + closeAll: OpenDialogs; +} + +const NavBar = ({ + page, + setPage, + slideDirection, + setSlideDirection, + open, + setOpen, + closeAll, + width, + height, +}: NavBarProps): JSX.Element => { + const theme = useTheme(); + const { t } = useTranslation(); + const history = useHistory(); + const smallBar = width < 50; + const tabWidth = smallBar ? 1 : 12; + + const [newPage, setNewPage] = useState(history.location.pathname.split('/')[1]); + + const tabSx = smallBar ? {} : { position: 'relative', bottom: '1em' }; + const pagesPosition = { + robot: 1, + offers: 2, + create: 3, + order: 4, + settings: 5, + }; + + const handleSlideDirection = function (oldPage: Page, newPage: Page) { + const oldPos: number = pagesPosition[oldPage]; + const newPos: number = pagesPosition[newPage]; + setSlideDirection( + newPos > oldPos ? { in: 'left', out: 'right' } : { in: 'right', out: 'left' }, + ); + }; + + const changePage = function (mouseEvent: any, newPage: Page) { + if (newPage === 'none') { + return null; + } else { + handleSlideDirection(page, newPage); + setNewPage(newPage); + setTimeout(() => history.push(`/${newPage}`), theme.transitions.duration.leavingScreen * 3); + } + }; + + useEffect(() => { + setPage(newPage); + }, [slideDirection, newPage]); + + useEffect(() => { + setOpen(closeAll); + }, [page]); + + return ( + + + } + iconPosition='start' + /> + + } + iconPosition='start' + /> + } + iconPosition='start' + /> + } + iconPosition='start' + /> + } + iconPosition='start' + /> + + + { + setOpen(open.more ? closeAll : { ...open, more: true }); + }} + icon={} + iconPosition='start' + /> + + + + ); +}; + +export default NavBar; + +// constructor(props) { +// super(props); +// this.state = { +// profileShown: false, +// openStatsForNerds: false, +// openCommunity: false, +// openExchangeSummary: false, +// openClaimRewards: false, +// openProfile: false, +// showRewards: false, +// rewardInvoice: null, +// badInvoice: false, +// showRewardsSpinner: false, +// withdrawn: false, +// }; +// } + +// handleClickOpenStatsForNerds = () => { +// this.setState({ openStatsForNerds: true }); +// }; + +// handleClickCloseStatsForNerds = () => { +// this.setState({ openStatsForNerds: false }); +// }; + +// handleClickOpenCommunity = () => { +// this.setState({ openCommunity: true }); +// }; + +// handleClickCloseCommunity = () => { +// this.setState({ openCommunity: false }); +// }; + +// handleClickOpenProfile = () => { +// this.setState({ openProfile: true, profileShown: true }); +// }; + +// handleClickCloseProfile = () => { +// this.setState({ openProfile: false }); +// }; + +// handleClickOpenExchangeSummary = () => { +// this.setState({ openExchangeSummary: true }); +// }; + +// handleClickCloseExchangeSummary = () => { +// this.setState({ openExchangeSummary: false }); +// }; + +// handleSubmitInvoiceClicked = (e, rewardInvoice) => { +// this.setState({ badInvoice: false, showRewardsSpinner: true }); + +// apiClient +// .post('/api/reward/', { +// invoice: rewardInvoice, +// }) +// .then((data) => { +// this.setState({ badInvoice: data.bad_invoice, showRewardsSpinner: false }); +// this.props.setInfo({ +// ...this.props.info, +// badInvoice: data.bad_invoice, +// openClaimRewards: !data.successful_withdrawal, +// withdrawn: !!data.successful_withdrawal, +// showRewardsSpinner: false, +// }); +// this.props.setRobot({ +// ...this.props.robot, +// earnedRewards: data.successful_withdrawal ? 0 : this.props.robot.earnedRewards, +// }); +// }); +// e.preventDefault(); +// }; + +// handleSetStealthInvoice = (wantsStealth) => { +// apiClient +// .put('/api/stealth/', { wantsStealth }) +// .then((data) => +// this.props.setRobot({ ...this.props.robot, stealthInvoices: data?.wantsStealth }), +// ); +// }; + +// showProfileButton = () => { +// return ( +// 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.robot.earnedRewards > 0; +// const hasOrder = !!( +// (this.props.robot.activeOrderId > 0) & +// !this.state.profileShown & +// this.props.robot.avatarLoaded +// ); +// const fontSize = this.props.theme.typography.fontSize; +// const fontSizeFactor = fontSize / 14; // default fontSize is 14 +// const typographyProps = { +// primaryTypographyProps: { fontSize }, +// secondaryTypographyProps: { fontSize: (fontSize * 12) / 14 }, +// }; +// return ( +// +// +// +//
+// +// +// +// 0) & !this.state.profileShown +// ? 'primary' +// : undefined +// } +// nickname={this.props.robot.nickname} +// onLoad={() => +// this.props.setRobot({ ...this.props.robot, avatarLoaded: true }) +// } +// /> +// +// +// +// +//
+//
+ +// +// +// +// +// +// +// +// +// +// + +// +// +// +// +// +// +// +// +// +// + +// +// +// +// +// +// +// +// +// +// + +// +// +// +// +// +// +// +// +// +// + +// +// +// +// +// +// +// +// +// +// + +// +// +// {this.LangSelect()} +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +//
+//
+// ); +// }; + +// bottomBarPhone = () => { +// const { t } = this.props; +// const hasRewards = this.props.robot.earnedRewards > 0; +// const hasOrder = !!( +// (this.props.info.active_order_id > 0) & +// !this.state.profileShown & +// this.props.robot.avatarLoaded +// ); +// return ( +// +// +// +//
+// +// +// 0) & !this.state.profileShown +// ? 'primary' +// : undefined +// } +// nickname={this.props.robot.nickname} +// onLoad={() => this.props.setRobot({ ...this.props.robot, avatarLoaded: true })} +// /> +// +// +//
+//
+ +// +// +// +// +// +// +// +// +// + +// +// +// +// +// +// +// +// +// + +// +// +// +// +// +// +// +// +// + +// +// +// +// +// +// +// +// +// + +// +// +// {this.LangSelect()} +// +// +// +// +// +// +// +// +// +// +// this.props.fetchInfo()} +// onClick={this.handleClickOpenStatsForNerds} +// > +// +// +// +// +// +//
+//
+// ); +// }; + +// render() { +// return ( +//
+ +// +// this.props.setInfo({ ...this.props.info, openUpdateClient: false }) +// } +// /> + +// + +// this.props.setRobot({ ...robot, ...newParam })} +// stealthInvoices={this.props.robot.stealthInvoices} +// handleSetStealthInvoice={this.handleSetStealthInvoice} +// /> + +// + +// {this.bottomBarDesktop()} + +// {this.bottomBarPhone()} +//
+// ); +// } +// } + +// export default NavBar; diff --git a/frontend/src/basic/NavBar/index.tsx b/frontend/src/basic/NavBar/index.tsx index bebf3841..269d480c 100644 --- a/frontend/src/basic/NavBar/index.tsx +++ b/frontend/src/basic/NavBar/index.tsx @@ -1,729 +1,4 @@ -import React, { useEffect, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; -import { Tabs, Tab, Paper, Button, useTheme } from '@mui/material'; -import RobotAvatar from '../../components/RobotAvatar'; - -import { - SettingsApplications, - SmartToy, - Storefront, - AddBox, - Assignment, - MoreHoriz, -} from '@mui/icons-material'; - -type Page = 'robot' | 'offers' | 'create' | 'order' | 'settings' | 'none'; -type Direction = 'left' | 'right' | 'none'; - -interface NavBarProps { - page: Page; - setPage: (state: Page) => void; - slideDirection: { in: Direction; out: Direction }; - setSlideDirection: (state: { in: Direction; out: Direction }) => void; - width: number; - height: number; -} - -const NavBar = ({ - page, - setPage, - slideDirection, - setSlideDirection, - width, - height, -}: NavBarProps): JSX.Element => { - const theme = useTheme(); - const { t } = useTranslation(); - const history = useHistory(); - const smallBar = width < 50; - const tabWidth = smallBar ? 1 : 1; - - const [showMore, setShowMore] = useState(false); - const [newPage, setNewPage] = useState(history.location.pathname.split('/')[1]); - - const pagesPosition = { - robot: 1, - offers: 2, - create: 3, - order: 4, - settings: 5, - }; - const handleSlideDirection = function (oldPage: Page, newPage: Page) { - const oldPos: number = pagesPosition[oldPage]; - const newPos: number = pagesPosition[newPage]; - setSlideDirection( - newPos > oldPos ? { in: 'left', out: 'right' } : { in: 'right', out: 'left' }, - ); - }; - - const changePage = function (mouseEvent: any, newPage: Page) { - if (newPage === 'none') { - return null; - } else { - handleSlideDirection(page, newPage); - setNewPage(newPage); - setTimeout(() => history.push(`/${newPage}`), theme.transitions.duration.leavingScreen * 3); - } - }; - - useEffect(() => { - setPage(newPage); - }, [slideDirection, newPage]); - - return ( - - - } - iconPosition='start' - /> - } - iconPosition='start' - /> - } - iconPosition='start' - /> - } - iconPosition='start' - /> - } - iconPosition='start' - /> - { - setShowMore(!showMore); - }} - icon={} - iconPosition='start' - /> - - - ); -}; +import NavBar from './NavBar'; +export type { OpenDialogs } from './MoreTooltip'; export default NavBar; - -// constructor(props) { -// super(props); -// this.state = { -// profileShown: false, -// openStatsForNerds: false, -// openCommunity: false, -// openExchangeSummary: false, -// openClaimRewards: false, -// openProfile: false, -// showRewards: false, -// rewardInvoice: null, -// badInvoice: false, -// showRewardsSpinner: false, -// withdrawn: false, -// }; -// } - -// handleClickOpenStatsForNerds = () => { -// this.setState({ openStatsForNerds: true }); -// }; - -// handleClickCloseStatsForNerds = () => { -// this.setState({ openStatsForNerds: false }); -// }; - -// handleClickOpenCommunity = () => { -// this.setState({ openCommunity: true }); -// }; - -// handleClickCloseCommunity = () => { -// this.setState({ openCommunity: false }); -// }; - -// handleClickOpenProfile = () => { -// this.setState({ openProfile: true, profileShown: true }); -// }; - -// handleClickCloseProfile = () => { -// this.setState({ openProfile: false }); -// }; - -// handleClickOpenExchangeSummary = () => { -// this.setState({ openExchangeSummary: true }); -// }; - -// handleClickCloseExchangeSummary = () => { -// this.setState({ openExchangeSummary: false }); -// }; - -// handleSubmitInvoiceClicked = (e, rewardInvoice) => { -// this.setState({ badInvoice: false, showRewardsSpinner: true }); - -// apiClient -// .post('/api/reward/', { -// invoice: rewardInvoice, -// }) -// .then((data) => { -// this.setState({ badInvoice: data.bad_invoice, showRewardsSpinner: false }); -// this.props.setInfo({ -// ...this.props.info, -// badInvoice: data.bad_invoice, -// openClaimRewards: !data.successful_withdrawal, -// withdrawn: !!data.successful_withdrawal, -// showRewardsSpinner: false, -// }); -// this.props.setRobot({ -// ...this.props.robot, -// earnedRewards: data.successful_withdrawal ? 0 : this.props.robot.earnedRewards, -// }); -// }); -// e.preventDefault(); -// }; - -// handleSetStealthInvoice = (wantsStealth) => { -// apiClient -// .put('/api/stealth/', { wantsStealth }) -// .then((data) => -// this.props.setRobot({ ...this.props.robot, stealthInvoices: data?.wantsStealth }), -// ); -// }; - -// showProfileButton = () => { -// return ( -// 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.robot.earnedRewards > 0; -// const hasOrder = !!( -// (this.props.robot.activeOrderId > 0) & -// !this.state.profileShown & -// this.props.robot.avatarLoaded -// ); -// const fontSize = this.props.theme.typography.fontSize; -// const fontSizeFactor = fontSize / 14; // default fontSize is 14 -// const typographyProps = { -// primaryTypographyProps: { fontSize }, -// secondaryTypographyProps: { fontSize: (fontSize * 12) / 14 }, -// }; -// return ( -// -// -// -//
-// -// -// -// 0) & !this.state.profileShown -// ? 'primary' -// : undefined -// } -// nickname={this.props.robot.nickname} -// onLoad={() => -// this.props.setRobot({ ...this.props.robot, avatarLoaded: true }) -// } -// /> -// -// -// -// -//
-//
- -// -// -// -// -// -// -// -// -// -// - -// -// -// -// -// -// -// -// -// -// - -// -// -// -// -// -// -// -// -// -// - -// -// -// -// -// -// -// -// -// -// - -// -// -// -// -// -// -// -// -// -// - -// -// -// {this.LangSelect()} -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -//
-//
-// ); -// }; - -// handleChangeLang = (e) => { -// const { i18n } = this.props; -// i18n.changeLanguage(e.target.value); -// }; - -// LangSelect = () => { -// const { i18n } = this.props; -// const lang = i18n.resolvedLanguage == null ? 'en' : i18n.resolvedLanguage.substring(0, 2); -// const flagProps = { -// width: 20, -// height: 20, -// }; - -// return ( -// -// ); -// }; - -// bottomBarPhone = () => { -// const { t } = this.props; -// const hasRewards = this.props.robot.earnedRewards > 0; -// const hasOrder = !!( -// (this.props.info.active_order_id > 0) & -// !this.state.profileShown & -// this.props.robot.avatarLoaded -// ); -// return ( -// -// -// -//
-// -// -// 0) & !this.state.profileShown -// ? 'primary' -// : undefined -// } -// nickname={this.props.robot.nickname} -// onLoad={() => this.props.setRobot({ ...this.props.robot, avatarLoaded: true })} -// /> -// -// -//
-//
- -// -// -// -// -// -// -// -// -// - -// -// -// -// -// -// -// -// -// - -// -// -// -// -// -// -// -// -// - -// -// -// -// -// -// -// -// -// - -// -// -// {this.LangSelect()} -// -// -// -// -// -// -// -// -// -// -// this.props.fetchInfo()} -// onClick={this.handleClickOpenStatsForNerds} -// > -// -// -// -// -// -//
-//
-// ); -// }; - -// render() { -// return ( -//
-// - -// -// this.props.setInfo({ ...this.props.info, openUpdateClient: false }) -// } -// /> - -// - -// this.props.setRobot({ ...robot, ...newParam })} -// stealthInvoices={this.props.robot.stealthInvoices} -// handleSetStealthInvoice={this.handleSetStealthInvoice} -// /> - -// - -// {this.bottomBarDesktop()} - -// {this.bottomBarPhone()} -//
-// ); -// } -// } - -// export default NavBar; diff --git a/frontend/src/basic/UserGenPage.js b/frontend/src/basic/UserGenPage.js index 12be5ef5..7b3f591c 100644 --- a/frontend/src/basic/UserGenPage.js +++ b/frontend/src/basic/UserGenPage.js @@ -31,7 +31,6 @@ class UserGenPage extends Component { constructor(props) { super(props); this.state = { - openInfo: false, tokenHasChanged: false, inputToken: '', found: false, @@ -155,14 +154,6 @@ class UserGenPage extends Component { }); }; - handleClickOpenInfo = () => { - this.setState({ openInfo: true }); - }; - - handleCloseInfo = () => { - this.setState({ openInfo: false }); - }; - createJsonFile = () => { return { token: this.props.robot.token, @@ -383,14 +374,6 @@ class UserGenPage extends Component { > {t('Make Order')} - - + diff --git a/frontend/src/components/Dialogs/index.ts b/frontend/src/components/Dialogs/index.ts index 4cae4c13..2f2152c2 100644 --- a/frontend/src/components/Dialogs/index.ts +++ b/frontend/src/components/Dialogs/index.ts @@ -4,7 +4,7 @@ export { default as InfoDialog } from './Info'; export { default as LearnDialog } from './Learn'; export { default as NoRobotDialog } from './NoRobot'; export { default as StoreTokenDialog } from './StoreToken'; -export { default as ExchangeSummaryDialog } from './ExchangeSummary'; +export { default as CoordinatorSummaryDialog } from './CoordinatorSummary'; export { default as ProfileDialog } from './Profile'; export { default as StatsDialog } from './Stats'; export { default as EnableTelegramDialog } from './EnableTelegram'; diff --git a/frontend/src/models/Info.model.ts b/frontend/src/models/Info.model.ts index f6c289af..0f21400e 100644 --- a/frontend/src/models/Info.model.ts +++ b/frontend/src/models/Info.model.ts @@ -23,6 +23,9 @@ export interface Info { openUpdateClient: boolean; } +import packageJson from '../../package.json'; +const semver = packageJson.version.split('.'); + export const defaultInfo: Info = { num_public_buy_orders: 0, num_public_sell_orders: 0, @@ -44,7 +47,7 @@ export const defaultInfo: Info = { current_swap_fee_rate: 0, network: undefined, coordinatorVersion: 'v?.?.?', - clientVersion: 'v?.?.?', + clientVersion: `v${semver[0]}.${semver[1]}.${semver[2]}`, openUpdateClient: false, };