Refactor and Init RoboSats PRO (#296)

commit 9c6d55cfc7
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Thu Oct 20 10:35:49 2022 -0700

    Small fixes

commit 23d6c00ccb
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Thu Oct 20 06:12:42 2022 -0700

    Refactor frontend

commit b2c21d4a98
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Wed Oct 19 07:26:00 2022 -0700

    Small fixes (more)

commit 78a8ab799d
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Wed Oct 19 02:11:03 2022 -0700

    Try out to revert depth chart

commit ef73c980a8
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Tue Oct 18 11:43:37 2022 -0700

    Small fixes

commit fa3e60208f
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Tue Oct 18 09:43:03 2022 -0700

    Add old UserGen and BottomBar to new main.tsx

commit 1e257d1924
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Tue Oct 18 04:01:53 2022 -0700

    Add Maker and Book page to new main.tsx

commit 037d46ceef
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Mon Oct 17 08:54:55 2022 -0700

    Add Main component WIP

commit e43b274c33
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Mon Oct 17 04:32:43 2022 -0700

    App as functional component
This commit is contained in:
Reckless_Satoshi 2022-10-20 11:06:16 -07:00
parent 04126ae0bd
commit 1dea4e73b6
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
142 changed files with 627 additions and 841 deletions

View File

@ -26,22 +26,38 @@ jobs:
rm nodeapp/static rm nodeapp/static
cp -r frontend/static nodeapp/static cp -r frontend/static nodeapp/static
- name: 'Download main.js Artifact' - name: 'Download basic.js Artifact'
if: inputs.semver == '' # Only if workflow fired from frontend-build.yml if: inputs.semver == '' # Only if workflow fired from frontend-build.yml
uses: dawidd6/action-download-artifact@v2 uses: dawidd6/action-download-artifact@v2
with: with:
workflow: frontend-build.yml workflow: frontend-build.yml
workflow_conclusion: success workflow_conclusion: success
name: web-main-js name: web-basic-js
path: nodeapp/static/frontend/ path: nodeapp/static/frontend/
- name: 'Download main.js Artifact for a release' - name: 'Download basic.js Artifact for a release'
if: inputs.semver != '' # Only if fired as job in release.yml if: inputs.semver != '' # Only if fired as job in release.yml
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: web-main-js name: web-basic-js
path: nodeapp/static/frontend/ path: nodeapp/static/frontend/
- name: 'Download pro.js Artifact'
if: inputs.semver == '' # Only if workflow fired from frontend-build.yml
uses: dawidd6/action-download-artifact@v2
with:
workflow: frontend-build.yml
workflow_conclusion: success
name: web-pro-js
path: nodeapp/static/frontend/
- name: 'Download pro.js Artifact for a release'
if: inputs.semver != '' # Only if fired as job in release.yml
uses: actions/download-artifact@v3
with:
name: web-pro-js
path: nodeapp/static/frontend/
- name: 'Log in to Docker Hub' - name: 'Log in to Docker Hub'
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:

View File

@ -15,20 +15,36 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: 'Download main.js Artifact' - name: 'Download basic.js Artifact'
if: inputs.semver == '' # Only if workflow fired from frontend-build.yml if: inputs.semver == '' # Only if workflow fired from frontend-build.yml
uses: dawidd6/action-download-artifact@v2 uses: dawidd6/action-download-artifact@v2
with: with:
workflow: frontend-build.yml workflow: frontend-build.yml
workflow_conclusion: success workflow_conclusion: success
name: web-main-js name: web-basic-js
path: nodeapp/static/frontend/ path: nodeapp/static/frontend/
- name: 'Download main.js Artifact for a release' - name: 'Download basic.js Artifact for a release'
if: inputs.semver != '' # Only if fired as job in release.yml if: inputs.semver != '' # Only if fired as job in release.yml
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: web-main-js name: web-basic-js
path: nodeapp/static/frontend/
- name: 'Download pro.js Artifact'
if: inputs.semver == '' # Only if workflow fired from frontend-build.yml
uses: dawidd6/action-download-artifact@v2
with:
workflow: frontend-build.yml
workflow_conclusion: success
name: web-pro-js
path: nodeapp/static/frontend/
- name: 'Download pro.js Artifact for a release'
if: inputs.semver != '' # Only if fired as job in release.yml
uses: actions/download-artifact@v3
with:
name: web-pro-js
path: nodeapp/static/frontend/ path: nodeapp/static/frontend/
- name: 'Log in to Docker Hub' - name: 'Log in to Docker Hub'

View File

@ -48,11 +48,16 @@ jobs:
run: | run: |
cd frontend cd frontend
npm run build npm run build
- name: 'Archive Web Build Results' - name: 'Archive Web Basic Build Results'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: web-main-js name: web-basic-js
path: frontend/static/frontend/main.js path: frontend/static/frontend/basic.js
- name: 'Archive Web PRO Build Results'
uses: actions/upload-artifact@v3
with:
name: web-pro-js
path: frontend/static/frontend/pro.js
- name: 'Archive Mobile Build Results' - name: 'Archive Mobile Build Results'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:

7
.gitignore vendored
View File

@ -656,9 +656,8 @@ api/lightning/googleapis*
frontend/static/admin* frontend/static/admin*
frontend/static/rest_framework* frontend/static/rest_framework*
frontend/static/import_export* frontend/static/import_export*
frontend/src/components/payment-methods/code* frontend/src/components/PaymentMethods/Icons/code*
frontend/src/components/payment-methods/code/* frontend/src/components/PaymentMethods/Icons/webp*
frontend/src/components/payment-methods/webp*
frontend/static/frontend/** frontend/static/frontend/**
docs/.jekyll-cache* docs/.jekyll-cache*
docs/_site* docs/_site*
@ -666,4 +665,4 @@ commit_sha.txt
node node
# mobile frontend js # mobile frontend js
mobile/html/Web.bundle/js* mobile/html/Web.bundle/js*

102
frontend/src/App.tsx Normal file
View File

@ -0,0 +1,102 @@
import React, { Suspense, useState } from 'react';
import ReactDOM from 'react-dom/client';
import Main from './basic/Main';
import { CssBaseline, IconButton } from '@mui/material';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import UnsafeAlert from './components/UnsafeAlert';
import { LearnDialog } from './components/Dialogs';
import TorConnection from './components/TorConnection';
import { I18nextProvider } from 'react-i18next';
import i18n from './i18n/Web';
// Icons
import DarkModeIcon from '@mui/icons-material/DarkMode';
import LightModeIcon from '@mui/icons-material/LightMode';
import SchoolIcon from '@mui/icons-material/School';
import { systemClient } from './services/System';
const defaultTheme = createTheme({
palette: {
mode:
window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light',
background: {
default:
window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
? '#070707'
: '#fff',
},
},
});
const App = (): JSX.Element => {
const [openLearn, setOpenLearn] = useState<boolean>(false);
const [theme, setTheme] = useState(defaultTheme);
const handleModeChange = function () {
if (theme.palette.mode === 'light') {
setTheme(
createTheme({
palette: {
mode: 'dark',
background: {
default: '#070707',
},
},
}),
);
} else if (theme.palette.mode === 'dark') {
setTheme(
createTheme({
palette: {
mode: 'light',
background: {
default: '#fff',
},
},
}),
);
}
};
return (
<Suspense fallback='loading language'>
<I18nextProvider i18n={i18n}>
<ThemeProvider theme={theme}>
<CssBaseline />
<LearnDialog open={openLearn} onClose={() => setOpenLearn(false)} />
<TorConnection />
<IconButton
color='inherit'
sx={{ position: 'fixed', right: '34px', color: 'text.secondary' }}
onClick={() => setOpenLearn(true)}
>
<SchoolIcon />
</IconButton>
<IconButton
color='inherit'
sx={{ position: 'fixed', right: '0px', color: 'text.secondary' }}
onClick={() => handleModeChange()}
>
{theme.palette.mode === 'dark' ? <LightModeIcon /> : <DarkModeIcon />}
</IconButton>
<UnsafeAlert className='unsafeAlert' />
<Main />
</ThemeProvider>
</I18nextProvider>
</Suspense>
);
};
const loadApp = () => {
if (systemClient.loading) {
setTimeout(loadApp, 200);
} else {
const root = ReactDOM.createRoot(document.getElementById('app') ?? new HTMLElement());
root.render(<App />);
}
};
loadApp();

View File

@ -3,14 +3,14 @@ import { useTranslation } from 'react-i18next';
import { Button, Typography, Grid, ButtonGroup, Dialog, Box } from '@mui/material'; import { Button, Typography, Grid, ButtonGroup, Dialog, Box } from '@mui/material';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import currencyDict from '../../../static/assets/currencies.json'; import currencyDict from '../../../static/assets/currencies.json';
import DepthChart from '../Charts/DepthChart'; import DepthChart from '../../components/Charts/DepthChart';
import { Book, Favorites, LimitList, Maker } from '../../models'; import { Book, Favorites, LimitList, Maker } from '../../models';
// Icons // Icons
import { BarChart, FormatListBulleted } from '@mui/icons-material'; import { BarChart, FormatListBulleted } from '@mui/icons-material';
import BookTable from './BookTable'; import MakerForm from '../../components/MakerForm';
import { MakerForm } from '../MakerPage'; import BookTable from '../../components/BookTable';
interface BookPageProps { interface BookPageProps {
book: Book; book: Book;

View File

@ -19,7 +19,7 @@ import Flags from 'country-flag-icons/react/3x2';
import { Link as LinkRouter } from 'react-router-dom'; import { Link as LinkRouter } from 'react-router-dom';
import { apiClient } from '../services/api'; import { apiClient } from '../services/api';
import { systemClient } from '../services/System'; import { systemClient } from '../services/System';
import RobotAvatar from './Robots/RobotAvatar'; import RobotAvatar from '../components/RobotAvatar';
// Icons // Icons
import BarChartIcon from '@mui/icons-material/BarChart'; import BarChartIcon from '@mui/icons-material/BarChart';
@ -31,7 +31,7 @@ import PercentIcon from '@mui/icons-material/Percent';
import PriceChangeIcon from '@mui/icons-material/PriceChange'; import PriceChangeIcon from '@mui/icons-material/PriceChange';
// Missing flags // Missing flags
import { CataloniaFlag, BasqueCountryFlag } from './Icons'; import { CataloniaFlag, BasqueCountryFlag } from '../components/Icons';
import { import {
CommunityDialog, CommunityDialog,
@ -39,7 +39,7 @@ import {
ProfileDialog, ProfileDialog,
StatsDialog, StatsDialog,
UpdateClientDialog, UpdateClientDialog,
} from './Dialogs'; } from '../components/Dialogs';
class BottomBar extends Component { class BottomBar extends Component {
constructor(props) { constructor(props) {

197
frontend/src/basic/Main.tsx Normal file
View File

@ -0,0 +1,197 @@
import React, { useEffect, useState } from 'react';
import { HashRouter, BrowserRouter, Switch, Route, useHistory } from 'react-router-dom';
import { useTheme } from '@mui/material';
import UserGenPage from './UserGenPage';
import MakerPage from './MakerPage';
import BookPage from './BookPage';
import OrderPage from './OrderPage';
import BottomBar from './BottomBar';
import { apiClient } from '../services/api';
import checkVer from '../utils/checkVer';
import {
Book,
LimitList,
Maker,
Robot,
Info,
Settings,
Favorites,
defaultMaker,
defaultRobot,
defaultInfo,
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 != null ? HashRouter : BrowserRouter;
const basename = window.NativeRobosats != null ? window.location.pathname : '';
// All app data structured
const [book, setBook] = useState<Book>({ orders: [], loading: true });
const [limits, setLimits] = useState<{ list: LimitList; loading: boolean }>({
list: [],
loading: true,
});
const [robot, setRobot] = useState<Robot>(defaultRobot);
const [maker, setMaker] = useState<Maker>(defaultMaker);
const [info, setInfo] = useState<Info>(defaultInfo);
const [fav, setFav] = useState<Favorites>({ type: null, currency: 0 });
const [settings, setSettings] = useState<Settings>(defaultSettings);
const [windowSize, setWindowSize] = useState<{ width: number; height: number }>(
getWindowSize(theme.typography.fontSize),
);
useEffect(() => {
if (typeof window !== undefined) {
window.addEventListener('resize', onResize);
}
fetchBook();
fetchLimits();
fetchInfo();
return () => {
if (typeof window !== undefined) {
window.removeEventListener('resize', onResize);
}
};
}, []);
const onResize = function () {
setWindowSize(getWindowSize(theme.typography.fontSize));
};
const fetchBook = function () {
setBook({ ...book, loading: true });
apiClient.get('/api/book/').then((data: any) =>
setBook({
loading: false,
orders: data.not_found ? [] : data,
}),
);
};
const fetchLimits = async () => {
setLimits({ ...limits, loading: true });
const data = apiClient.get('/api/limits/').then((data) => {
setLimits({ list: data ?? [], loading: false });
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 ?? null,
lastOrderId: 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 ?? 0,
stealthInvoices: data.wants_stealth,
});
});
};
return (
<Router basename={basename}>
<div className='appCenter'>
<Switch>
<Route
exact
path='/'
render={(props: any) => (
<UserGenPage match={props.match} theme={theme} robot={robot} setRobot={setRobot} />
)}
/>
<Route
path='/ref/:refCode'
render={(props: any) => (
<UserGenPage match={props.match} theme={theme} robot={robot} setRobot={setRobot} />
)}
/>
<Route
path='/make'
render={() => (
<MakerPage
orders={book.orders}
limits={limits}
fetchLimits={fetchLimits}
maker={maker}
setMaker={setMaker}
fav={fav}
setFav={setFav}
windowSize={windowSize}
/>
)}
/>
<Route
path='/book'
render={() => (
<BookPage
book={book}
fetchBook={fetchBook}
limits={limits}
fetchLimits={fetchLimits}
fav={fav}
setFav={setFav}
maker={maker}
setMaker={setMaker}
lastDayPremium={info.last_day_nonkyc_btc_premium}
windowSize={windowSize}
/>
)}
/>
<Route
path='/order/:orderId'
render={(props: any) => <OrderPage theme={theme} history={history} {...props} />}
/>
</Switch>
</div>
<div
style={{
height: '2.5em',
position: 'fixed',
bottom: 0,
}}
>
<BottomBar
theme={theme}
windowSize={windowSize}
redirectTo={(location: string) => history.push(location)}
robot={robot}
setRobot={setRobot}
info={info}
setInfo={setInfo}
fetchInfo={fetchInfo}
/>
</div>
</Router>
);
};
export default Main;

View File

@ -1,14 +1,15 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import { Button, Grid, Paper, Collapse, Typography } from '@mui/material'; import { Button, Grid, Paper, Collapse, Typography } from '@mui/material';
import { LimitList, Maker, Order, Favorites, defaultMaker } from '../../models'; import { LimitList, Maker, Order, Favorites } from '../../models';
import MakerForm from './MakerForm';
import BookTable from '../BookPage/BookTable';
import { useHistory } from 'react-router-dom';
import filterOrders from '../../utils/filterOrders'; import filterOrders from '../../utils/filterOrders';
import MakerForm from '../../components/MakerForm';
import BookTable from '../../components/BookTable';
interface MakerPageProps { interface MakerPageProps {
limits: { list: LimitList; loading: boolean }; limits: { list: LimitList; loading: boolean };
fetchLimits: () => void; fetchLimits: () => void;

View File

View File

@ -4,8 +4,6 @@ import {
TextField, TextField,
Chip, Chip,
Tooltip, Tooltip,
IconButton,
Badge,
Tab, Tab,
Tabs, Tabs,
Alert, Alert,
@ -19,10 +17,8 @@ import {
ListItemIcon, ListItemIcon,
ListItemText, ListItemText,
ListItemAvatar, ListItemAvatar,
Avatar,
Divider, Divider,
Box, Box,
LinearProgress,
Dialog, Dialog,
DialogActions, DialogActions,
DialogContent, DialogContent,
@ -30,12 +26,11 @@ import {
DialogTitle, DialogTitle,
} from '@mui/material'; } from '@mui/material';
import Countdown, { zeroPad } from 'react-countdown'; import Countdown, { zeroPad } from 'react-countdown';
import { StoreTokenDialog, NoRobotDialog } from './Dialogs'; import { StoreTokenDialog, NoRobotDialog } from '../../components/Dialogs';
import currencyDict from '../../static/assets/currencies.json'; import currencyDict from '../../../static/assets/currencies.json';
import PaymentText from './PaymentText'; import TradeBox from '../../components/TradeBox';
import TradeBox from './TradeBox'; import { FlagWithProps } from '../../components/Icons';
import FlagWithProps from './FlagWithProps';
import LinearDeterminate from './LinearDeterminate'; import LinearDeterminate from './LinearDeterminate';
import MediaQuery from 'react-responsive'; import MediaQuery from 'react-responsive';
import { t } from 'i18next'; import { t } from 'i18next';
@ -48,14 +43,14 @@ import PaymentsIcon from '@mui/icons-material/Payments';
import ArticleIcon from '@mui/icons-material/Article'; import ArticleIcon from '@mui/icons-material/Article';
import HourglassTopIcon from '@mui/icons-material/HourglassTop'; import HourglassTopIcon from '@mui/icons-material/HourglassTop';
import CheckIcon from '@mui/icons-material/Check'; import CheckIcon from '@mui/icons-material/Check';
import { SendReceiveIcon } from './Icons';
import { pn } from '../utils/prettyNumbers'; import { pn } from '../../utils/prettyNumbers';
import { systemClient } from '../services/System'; import { systemClient } from '../../services/System';
import { getWebln } from '../utils/webln'; import { getWebln } from '../../utils/webln';
import { apiClient } from '../services/api'; import { apiClient } from '../../services/api';
import RobotAvatar from './Robots/RobotAvatar'; import RobotAvatar from '../../components/RobotAvatar';
import statusBadgeColor from '../utils/statusBadgeColor'; import statusBadgeColor from '../../utils/statusBadgeColor';
import { PaymentStringAsIcons } from '../../components/PaymentMethods';
class OrderPage extends Component { class OrderPage extends Component {
constructor(props) { constructor(props) {
@ -793,7 +788,7 @@ class OrderPage extends Component {
</ListItemIcon> </ListItemIcon>
<ListItemText <ListItemText
primary={ primary={
<PaymentText <PaymentStringAsIcons
size={20} size={20}
othersText={t('Others')} othersText={t('Others')}
verbose={true} verbose={true}

View File

View File

@ -11,14 +11,14 @@ import {
IconButton, IconButton,
} from '@mui/material'; } from '@mui/material';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { InfoDialog } from './Dialogs'; import { InfoDialog } from '../components/Dialogs';
import SmartToyIcon from '@mui/icons-material/SmartToy'; import SmartToyIcon from '@mui/icons-material/SmartToy';
import CasinoIcon from '@mui/icons-material/Casino'; import CasinoIcon from '@mui/icons-material/Casino';
import ContentCopy from '@mui/icons-material/ContentCopy'; import ContentCopy from '@mui/icons-material/ContentCopy';
import BoltIcon from '@mui/icons-material/Bolt'; import BoltIcon from '@mui/icons-material/Bolt';
import DownloadIcon from '@mui/icons-material/Download'; import DownloadIcon from '@mui/icons-material/Download';
import { RoboSatsNoTextIcon } from './Icons'; import { RoboSatsNoTextIcon } from '../components/Icons';
import { sha256 } from 'js-sha256'; import { sha256 } from 'js-sha256';
import { genBase62Token, tokenStrength } from '../utils/token'; import { genBase62Token, tokenStrength } from '../utils/token';
@ -26,7 +26,7 @@ import { genKey } from '../utils/pgp';
import { saveAsJson } from '../utils/saveFile'; import { saveAsJson } from '../utils/saveFile';
import { systemClient } from '../services/System'; import { systemClient } from '../services/System';
import { apiClient } from '../services/api/index'; import { apiClient } from '../services/api/index';
import RobotAvatar from './Robots/RobotAvatar'; import RobotAvatar from '../components/RobotAvatar';
class UserGenPage extends Component { class UserGenPage extends Component {
constructor(props) { constructor(props) {

View File

@ -1,4 +0,0 @@
import BookPage from './BookPage';
export default BookPage;
export { default as BookTable } from './BookTable';

View File

@ -12,10 +12,9 @@ import {
} from '@mui/material'; } from '@mui/material';
import currencyDict from '../../../static/assets/currencies.json'; import currencyDict from '../../../static/assets/currencies.json';
import { useTheme } from '@mui/system'; import { useTheme } from '@mui/system';
import { AutocompletePayments } from '../MakerPage'; import { AutocompletePayments } from '../MakerForm';
import { paymentMethods, swapDestinations } from '../payment-methods/Methods'; import { fiatMethods, swapMethods, PaymentIcon } from '../PaymentMethods';
import FlagWithProps from '../FlagWithProps'; import { FlagWithProps } from '../Icons';
import PaymentIcon from '../payment-methods/Icons';
import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank'; import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
@ -218,7 +217,7 @@ const BookControl = ({
</div> </div>
</MenuItem> </MenuItem>
{currency === 1000 {currency === 1000
? swapDestinations.map((method, index) => ( ? swapMethods.map((method, index) => (
<MenuItem <MenuItem
style={{ width: '10em' }} style={{ width: '10em' }}
key={index} key={index}
@ -234,7 +233,7 @@ const BookControl = ({
</div> </div>
</MenuItem> </MenuItem>
)) ))
: paymentMethods.map((method, index) => ( : fiatMethods.map((method, index) => (
<MenuItem <MenuItem
style={{ width: '14em' }} style={{ width: '14em' }}
key={index} key={index}

View File

@ -22,10 +22,10 @@ import { Book, Favorites } from '../../models';
import filterOrders from '../../utils/filterOrders'; import filterOrders from '../../utils/filterOrders';
import BookControl from './BookControl'; import BookControl from './BookControl';
import FlagWithProps from '../FlagWithProps'; import { FlagWithProps } from '../Icons';
import { pn, amountToString } from '../../utils/prettyNumbers'; import { pn, amountToString } from '../../utils/prettyNumbers';
import PaymentText from '../PaymentText'; import { PaymentStringAsIcons } from '../PaymentMethods';
import RobotAvatar from '../Robots/RobotAvatar'; import RobotAvatar from '../RobotAvatar';
import hexToRgb from '../../utils/hexToRgb'; import hexToRgb from '../../utils/hexToRgb';
import statusBadgeColor from '../../utils/statusBadgeColor'; import statusBadgeColor from '../../utils/statusBadgeColor';
@ -272,7 +272,7 @@ const BookTable = ({
renderCell: (params: any) => { renderCell: (params: any) => {
return ( return (
<div style={{ cursor: 'pointer' }}> <div style={{ cursor: 'pointer' }}>
<PaymentText <PaymentStringAsIcons
othersText={t('Others')} othersText={t('Others')}
verbose={true} verbose={true}
size={1.7 * fontSize} size={1.7 * fontSize}
@ -299,7 +299,7 @@ const BookTable = ({
cursor: 'pointer', cursor: 'pointer',
}} }}
> >
<PaymentText <PaymentStringAsIcons
othersText={t('Others')} othersText={t('Others')}
size={1.3 * fontSize} size={1.3 * fontSize}
text={params.row.payment_method} text={params.row.payment_method}

View File

@ -22,10 +22,10 @@ import { AddCircleOutline, RemoveCircleOutline } from '@mui/icons-material';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { Order, LimitList } from '../../../models'; import { Order, LimitList } from '../../../models';
import RobotAvatar from '../../Robots/RobotAvatar'; import RobotAvatar from '../../RobotAvatar';
import { amountToString } from '../../../utils/prettyNumbers'; import { amountToString } from '../../../utils/prettyNumbers';
import currencyDict from '../../../../static/assets/currencies.json'; import currencyDict from '../../../../static/assets/currencies.json';
import PaymentText from '../../PaymentText'; import { PaymentStringAsIcons } from '../../PaymentMethods';
import getNivoScheme from '../NivoScheme'; import getNivoScheme from '../NivoScheme';
import median from '../../../utils/match'; import median from '../../../utils/match';
import statusBadgeColor from '../../../utils/statusBadgeColor'; import statusBadgeColor from '../../../utils/statusBadgeColor';
@ -208,60 +208,62 @@ const DepthChart: React.FC<DepthChartProps> = ({
/> />
); );
const generateTooltip: React.FunctionComponent<PointTooltipProps> = ( // Unkown Bug. Temporarily silenced until cause is found.
pointTooltip: PointTooltipProps,
) => { // const generateTooltip: React.FunctionComponent<PointTooltipProps> = (
const order: Order = pointTooltip.point.data.order; // pointTooltip: PointTooltipProps,
return order ? ( // ) => {
<Paper elevation={12} style={{ padding: 10, width: 250 }}> // const order: Order = pointTooltip.point.data.order;
<Grid container justifyContent='space-between'> // return order ? (
<Grid item xs={3}> // <Paper elevation={12} style={{ padding: 10, width: 250 }}>
<Grid container justifyContent='center' alignItems='center'> // <Grid container justifyContent='space-between'>
<RobotAvatar // <Grid item xs={3}>
nickname={order.maker_nick} // <Grid container justifyContent='center' alignItems='center'>
orderType={order.type} // <RobotAvatar
statusColor={statusBadgeColor(order.maker_status)} // nickname={order.maker_nick}
tooltip={t(order.maker_status)} // orderType={order.type}
/> // statusColor={statusBadgeColor(order.maker_status)}
</Grid> // tooltip={t(order.maker_status)}
</Grid> // />
<Grid item xs={8}> // </Grid>
<Grid container direction='column' justifyContent='center' alignItems='flex-start'> // </Grid>
<Box>{order.maker_nick}</Box> // <Grid item xs={8}>
<Box> // <Grid container direction='column' justifyContent='center' alignItems='flex-start'>
<Grid // <Box>{order.maker_nick}</Box>
container // <Box>
direction='column' // <Grid
justifyContent='flex-start' // container
alignItems='flex-start' // direction='column'
> // justifyContent='flex-start'
<Grid item xs={12}> // alignItems='flex-start'
{amountToString( // >
order.amount, // <Grid item xs={12}>
order.has_range, // {amountToString(
order.min_amount, // order.amount,
order.max_amount, // order.has_range,
)}{' '} // order.min_amount,
{currencyDict[order.currency]} // order.max_amount,
</Grid> // )}{' '}
<Grid item xs={12}> // {currencyDict[order.currency]}
<PaymentText // </Grid>
othersText={t('Others')} // <Grid item xs={12}>
verbose={true} // <PaymentStringAsIcons
size={20} // othersText={t('Others')}
text={order.payment_method} // verbose={true}
/> // size={20}
</Grid> // text={order.payment_method}
</Grid> // />
</Box> // </Grid>
</Grid> // </Grid>
</Grid> // </Box>
</Grid> // </Grid>
</Paper> // </Grid>
) : ( // </Grid>
<></> // </Paper>
); // ) : (
}; // <></>
// );
// };
const formatAxisX = (value: number): string => { const formatAxisX = (value: number): string => {
if (xType === 'base_amount') { if (xType === 'base_amount') {
@ -345,7 +347,7 @@ const DepthChart: React.FC<DepthChartProps> = ({
useMesh={true} useMesh={true}
animate={false} animate={false}
crosshairType='cross' crosshairType='cross'
tooltip={generateTooltip} // tooltip={generateTooltip}
onClick={handleOnClick} onClick={handleOnClick}
axisRight={{ axisRight={{
tickSize: 5, tickSize: 5,

View File

@ -38,7 +38,7 @@ import { UserNinjaIcon, BitcoinIcon } from '../Icons';
import { systemClient } from '../../services/System'; import { systemClient } from '../../services/System';
import { getWebln } from '../../utils/webln'; import { getWebln } from '../../utils/webln';
import RobotAvatar from '../Robots/RobotAvatar'; import RobotAvatar from '../RobotAvatar';
interface Props { interface Props {
open: boolean; open: boolean;

View File

@ -1 +0,0 @@
export { default } from './FlagWithProps';

View File

@ -16,6 +16,8 @@ export { default as ExportIcon } from './Export';
export { default as UserNinjaIcon } from './UserNinja'; export { default as UserNinjaIcon } from './UserNinja';
export { default as TorIcon } from './Tor'; export { default as TorIcon } from './Tor';
// Flags with props
export { default as FlagWithProps } from './WorldFlags';
// Some Flags missing on react-flags // Some Flags missing on react-flags
export { default as BasqueCountryFlag } from './BasqueCountryFlag'; export { default as BasqueCountryFlag } from './BasqueCountryFlag';
export { default as CataloniaFlag } from './CataloniaFlag'; export { default as CataloniaFlag } from './CataloniaFlag';

View File

@ -1 +0,0 @@
export { default } from './LinearDeterminate';

View File

@ -11,7 +11,7 @@ import {
useTheme, useTheme,
} from '@mui/material'; } from '@mui/material';
import FlagWithProps from '../FlagWithProps'; import { FlagWithProps } from '../Icons';
import RangeSlider from './RangeSlider'; import RangeSlider from './RangeSlider';
import currencyDict from '../../../static/assets/currencies.json'; import currencyDict from '../../../static/assets/currencies.json';
import { pn } from '../../utils/prettyNumbers'; import { pn } from '../../utils/prettyNumbers';

View File

@ -4,11 +4,10 @@ import { useTranslation } from 'react-i18next';
import { useAutocomplete } from '@mui/base/AutocompleteUnstyled'; import { useAutocomplete } from '@mui/base/AutocompleteUnstyled';
import { styled } from '@mui/material/styles'; import { styled } from '@mui/material/styles';
import { Button, Fade, Tooltip, Typography, Grow } from '@mui/material'; import { Button, Fade, Tooltip, Typography, Grow } from '@mui/material';
import { paymentMethods, swapDestinations } from '../payment-methods/Methods'; import { fiatMethods, swapMethods, PaymentIcon } from '../PaymentMethods';
// Icons // Icons
import DashboardCustomizeIcon from '@mui/icons-material/DashboardCustomize'; import DashboardCustomizeIcon from '@mui/icons-material/DashboardCustomize';
import PaymentIcon from '../payment-methods/Icons';
import CheckIcon from '@mui/icons-material/Check'; import CheckIcon from '@mui/icons-material/Check';
import CloseIcon from '@mui/icons-material/Close'; import CloseIcon from '@mui/icons-material/Close';
@ -226,7 +225,7 @@ export default function AutocompletePayments(props) {
id: 'payment-methods', id: 'payment-methods',
multiple: true, multiple: true,
value: props.value, value: props.value,
options: props.optionsType == 'fiat' ? paymentMethods : swapDestinations, options: props.optionsType == 'fiat' ? fiatMethods : swapMethods,
getOptionLabel: (option) => option.name, getOptionLabel: (option) => option.name,
onInputChange: (e) => setVal(e ? (e.target.value ? e.target.value : '') : ''), onInputChange: (e) => setVal(e ? (e.target.value ? e.target.value : '') : ''),
onChange: (event, value) => props.onAutocompleteChange(value), onChange: (event, value) => props.onAutocompleteChange(value),
@ -237,7 +236,7 @@ export default function AutocompletePayments(props) {
const fewerOptions = groupedOptions.length > 8 ? groupedOptions.slice(0, 8) : groupedOptions; const fewerOptions = groupedOptions.length > 8 ? groupedOptions.slice(0, 8) : groupedOptions;
function handleAddNew(inputProps) { function handleAddNew(inputProps) {
paymentMethods.push({ name: inputProps.value, icon: 'custom' }); fiatMethods.push({ name: inputProps.value, icon: 'custom' });
const a = value.push({ name: inputProps.value, icon: 'custom' }); const a = value.push({ name: inputProps.value, icon: 'custom' });
setVal(() => ''); setVal(() => '');

View File

@ -33,7 +33,7 @@ import { StoreTokenDialog, NoRobotDialog } from '../Dialogs';
import { apiClient } from '../../services/api'; import { apiClient } from '../../services/api';
import { systemClient } from '../../services/System'; import { systemClient } from '../../services/System';
import FlagWithProps from '../FlagWithProps'; import { FlagWithProps } from '../Icons';
import AutocompletePayments from './AutocompletePayments'; import AutocompletePayments from './AutocompletePayments';
import AmountRange from './AmountRange'; import AmountRange from './AmountRange';
import currencyDict from '../../../static/assets/currencies.json'; import currencyDict from '../../../static/assets/currencies.json';

View File

@ -0,0 +1,4 @@
import MakerForm from './MakerForm';
export default MakerForm;
export { default as AutocompletePayments } from './AutocompletePayments';

View File

@ -1,5 +0,0 @@
import MakerPage from './MakerPage';
export default MakerPage;
export { default as MakerForm } from './MakerForm';
export { default as AutocompletePayments } from './AutocompletePayments';

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View File

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View File

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

View File

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 335 KiB

After

Width:  |  Height:  |  Size: 335 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 146 KiB

View File

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

View File

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

View File

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 128 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 175 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 944 B

After

Width:  |  Height:  |  Size: 944 B

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Some files were not shown because too many files have changed in this diff Show More