From eb506f0ab09dfad31da6864b25e7cfa5f12e3fab Mon Sep 17 00:00:00 2001 From: Christopher Date: Sat, 12 Dec 2020 15:22:33 +0100 Subject: [PATCH] cleanup(bank): general cleanup for bank --- phone/src/apps/bank/components/BankApp.tsx | 62 +++++------ phone/src/apps/bank/components/BankTitle.tsx | 31 +++--- .../account/AccountTransactions.tsx | 79 ++------------ .../bank/components/account/BankAccount.tsx | 28 ++--- .../apps/bank/components/account/BankCard.tsx | 55 ++-------- .../apps/bank/components/alert/BankAlert.tsx | 30 +++--- phone/src/apps/bank/components/bank.styles.ts | 100 +++++++++--------- .../apps/bank/components/home/home.styles.ts | 24 ++--- .../components/navigation/NavigationBar.tsx | 37 ++++--- .../notification/BankNotification.tsx | 35 +++--- .../notification/notification.style.ts | 46 ++++---- .../transactions/TransactionList.tsx | 41 ++----- .../components/transfers/TransferModal.tsx | 99 +++++++++-------- 13 files changed, 282 insertions(+), 385 deletions(-) diff --git a/phone/src/apps/bank/components/BankApp.tsx b/phone/src/apps/bank/components/BankApp.tsx index 55415f5..6c02e5d 100644 --- a/phone/src/apps/bank/components/BankApp.tsx +++ b/phone/src/apps/bank/components/BankApp.tsx @@ -1,45 +1,45 @@ -import React from "react"; -import { makeStyles, Paper, Typography } from "@material-ui/core"; -import { BankTitle } from "./BankTitle"; -import { AppWrapper } from "../../../ui/components"; -import { AppContent } from "../../../ui/components/AppContent"; -import { Button } from "../../../ui/components/Button"; -import { useTranslation } from "react-i18next"; -import { useTransactions } from "../hooks/useTransactions"; -import "./BankApp.css"; -import { TransferModal } from "./transfers/TransferModal"; +import React from 'react'; +import { makeStyles, Paper, Typography } from '@material-ui/core'; +import { BankTitle } from './BankTitle'; +import { AppWrapper } from '../../../ui/components'; +import { AppContent } from '../../../ui/components/AppContent'; +import { Button } from '../../../ui/components/Button'; +import { useTranslation } from 'react-i18next'; +import { useTransactions } from '../hooks/useTransactions'; +import './BankApp.css'; +import { TransferModal } from './transfers/TransferModal'; -import { useBankModal } from "../hooks/useBankModal"; -import { useCredentials } from "../hooks/useCredentials"; +import { useBankModal } from '../hooks/useBankModal'; +import { useCredentials } from '../hooks/useCredentials'; -import { Switch, Route } from "react-router-dom"; +import { Switch, Route } from 'react-router-dom'; // image -import CreditCard from '../img/credit-card.png' -import { NavigationBar } from "./navigation/NavigationBar"; +import CreditCard from '../img/credit-card.png'; +import { NavigationBar } from './navigation/NavigationBar'; -import { BankHome } from './home/BankHome'; +import { BankHome } from './home/BankHome'; import { BankAccount } from './account/BankAccount'; -import { TransactionList } from "./transactions/TransactionList"; -import { BankAlert } from "./alert/BankAlert"; +import { TransactionList } from './transactions/TransactionList'; +import { BankAlert } from './alert/BankAlert'; const useStyles = makeStyles((theme) => ({ root: { - height: "90px", - display: "flex", - justifyContent: "center", - backgroundColor: "#fb8c00", - alignItems: "center", + height: '90px', + display: 'flex', + justifyContent: 'center', + backgroundColor: '#fb8c00', + alignItems: 'center', }, header: { fontFamily: "'Bebas Neue', cursive", - textAlign: "center", + textAlign: 'center', fontSize: 50, }, backgroundModal: { - background: "black", - opacity: "0.6", - position: "absolute", + background: 'black', + opacity: '0.6', + position: 'absolute', top: 0, left: 0, right: 0, @@ -58,15 +58,15 @@ export const BankApp = () => { }; return ( - +
- - - + + + diff --git a/phone/src/apps/bank/components/BankTitle.tsx b/phone/src/apps/bank/components/BankTitle.tsx index 9697a7a..b5751ca 100644 --- a/phone/src/apps/bank/components/BankTitle.tsx +++ b/phone/src/apps/bank/components/BankTitle.tsx @@ -1,32 +1,33 @@ -import React from "react"; -import Paper from "@material-ui/core/Paper"; -import { Typography ,makeStyles } from "@material-ui/core"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import React from 'react'; +import Paper from '@material-ui/core/Paper'; +import { Typography, makeStyles } from '@material-ui/core'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import './BankApp.css' +import './BankApp.css'; const useStyles = makeStyles((theme) => ({ root: { - height: "90px", - width: "100%", - display: "flex", + height: '90px', + width: '100%', + display: 'flex', margin: 0, - justifyContent: "center", - alignItems: "center", - background: "#424242", + justifyContent: 'center', + alignItems: 'center', + background: '#424242', }, icon: { - color: "#f44336", + color: '#f44336', fontSize: 40, }, })); - export const BankTitle = () => { const classes = useStyles(); return ( - - WhoDis Banking + + + WhoDis Banking + ); }; diff --git a/phone/src/apps/bank/components/account/AccountTransactions.tsx b/phone/src/apps/bank/components/account/AccountTransactions.tsx index 3f0e8aa..1513465 100644 --- a/phone/src/apps/bank/components/account/AccountTransactions.tsx +++ b/phone/src/apps/bank/components/account/AccountTransactions.tsx @@ -1,67 +1,8 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { makeStyles, Paper, Typography, Button } from "@material-ui/core"; -import { useTransactions } from "../../hooks/useTransactions"; -import { red } from "@material-ui/core/colors"; -const useStyles = makeStyles((theme) => ({ - root: { - width: "100%", - }, - header: { - width: "90%", - display: "flex", - justifyItems: "center", - justifyContent: "space-between", - margin: "auto", - }, - title: { - padding: 7, - borderRadius: "10px", - display: "flex", - justifyItems: "center", - justifyContent: "center", - fontSize: "24px", - }, - seeAll: { - fontFamily: "Bahnschrift Regular", - fontWeight: "bold", - height: 'auto' - }, - transcationDiv: { - marginTop: '-30px', - }, - transactions: { - marginLeft: "32px", - display: "flex", - justifyContent: "space-between", - borderBottom: "2px solid #707070", - width: "85%", - margin: "auto", - }, - tranSource: { - fontSize: "22px", - }, - tranType: { - fontSize: "18px", - fontWeight: "bold", - color: "#BFBFBF", - marginTop: "-18px", - width: "100%", - }, - - depositType: { - color: "#55B452", - marginRight: "32px", - fontSize: "22px", - fontWeight: "bold", - }, - withdrawType: { - color: "#FF5E5E", - marginRight: "32px", - fontSize: "22px", - fontWeight: "bold", - }, -})); +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { makeStyles, Paper, Typography, Button } from '@material-ui/core'; +import { useTransactions } from '../../hooks/useTransactions'; +import useStyles from './account.styles'; export const AccountTransactions = (): any => { const classes = useStyles(); @@ -69,17 +10,17 @@ export const AccountTransactions = (): any => { const TransactionTypes = { Deposit: classes.depositType, Withdraw: classes.withdrawType, - Transfer: classes.depositType + Transfer: classes.depositType, }; const { transactionList } = useTransactions(); const { t } = useTranslation(); return ( -
+
-

{t("APPS_BANK_ACCOUNT_TRANSACTIONS")}

+

{t('APPS_BANK_ACCOUNT_TRANSACTIONS')}

@@ -92,7 +33,7 @@ export const AccountTransactions = (): any => {

- {transaction.type == "Withdraw" ? "-" : "+"} + {transaction.type == 'Withdraw' ? '-' : '+'} {transaction.amount}

diff --git a/phone/src/apps/bank/components/account/BankAccount.tsx b/phone/src/apps/bank/components/account/BankAccount.tsx index 7531b6a..8dae023 100644 --- a/phone/src/apps/bank/components/account/BankAccount.tsx +++ b/phone/src/apps/bank/components/account/BankAccount.tsx @@ -1,7 +1,7 @@ -import React from 'react' -import { Button } from "../../../../ui/components/Button"; -import { makeStyles, Paper, Typography } from "@material-ui/core"; -import { useTranslation } from "react-i18next"; +import React from 'react'; +import { Button } from '../../../../ui/components/Button'; +import { makeStyles, Paper, Typography } from '@material-ui/core'; +import { useTranslation } from 'react-i18next'; import { BankCard } from './BankCard'; import { AccountTransactions } from './AccountTransactions'; import { useCredentials } from '../../hooks/useCredentials'; @@ -9,13 +9,13 @@ import { useCredentials } from '../../hooks/useCredentials'; const useStyles = makeStyles((theme) => ({ root: { width: '100%', - fontFamily: 'Bahnschrift Regular' + fontFamily: 'Bahnschrift Regular', }, title: { fontSize: '30px', - marginLeft: '29px' - } -})) + marginLeft: '29px', + }, +})); export const BankAccount = () => { const classes = useStyles(); @@ -24,10 +24,14 @@ export const BankAccount = () => { return (
-

{t("APPS_BANK_ACCOUNT_TITLE")}

+

{t('APPS_BANK_ACCOUNT_TITLE')}

- +
- ) -} + ); +}; diff --git a/phone/src/apps/bank/components/account/BankCard.tsx b/phone/src/apps/bank/components/account/BankCard.tsx index 58b84af..39dbeed 100644 --- a/phone/src/apps/bank/components/account/BankCard.tsx +++ b/phone/src/apps/bank/components/account/BankCard.tsx @@ -1,46 +1,6 @@ -import React from 'react' -import { makeStyles, Box, Typography } from "@material-ui/core"; -import { shadows } from '@material-ui/system'; - - /* - overflow: hidden; - text-overflow: ellipsis; - word-wrap: break-word; - display: block; - line-height: 1em; - max-height: 2em; */ - -const useStyles = makeStyles((theme) => ({ - root: { - background: '#388CF8', - height: '179px', - width: '350px', - margin: 'auto', - borderRadius: '15px', - fontFamily: 'Bahnschrift Regular' - }, - cardName: { - margin: 10, - paddingTop: 15, - fontSize: '24px', - }, - cardAccount: { - margin: '10px', - marginTop: '10px', - color: '#DFDFDF', - fontWeight: 'bold', - borderBottom: '2px solid #D8D1D1', - paddingBottom: 5 - }, - balance: { - position: "absolute", - bottom: '53%', - left: '10%' - }, - balanceFont: { - fontSize: '29px' - } -})) +import React from 'react'; +import { Box } from '@material-ui/core'; +import useStyles from './card.styles'; export const BankCard = (props) => { const classes = useStyles(); @@ -51,8 +11,11 @@ export const BankCard = (props) => {

{props.account}

-

${props.balance}

+

+ $ + {props.balance} +

- ) -} + ); +}; diff --git a/phone/src/apps/bank/components/alert/BankAlert.tsx b/phone/src/apps/bank/components/alert/BankAlert.tsx index cda9c51..ceff48e 100644 --- a/phone/src/apps/bank/components/alert/BankAlert.tsx +++ b/phone/src/apps/bank/components/alert/BankAlert.tsx @@ -1,15 +1,15 @@ -import React, { useState, useEffect } from "react"; -import { useBankAlert } from "../../hooks/useBankAlert"; -import Snackbar from "@material-ui/core/Snackbar"; -import Alert from "./Alert"; -import { useTranslation } from "react-i18next"; +import React, { useState, useEffect } from 'react'; +import { useBankAlert } from '../../hooks/useBankAlert'; +import Snackbar from '@material-ui/core/Snackbar'; +import Alert from './Alert'; +import { useTranslation } from 'react-i18next'; export const BankAlert = () => { const { t } = useTranslation(); const [open, setOpen] = useState(false); const { bankAlert, setBankAlert } = useBankAlert(); - const [ message, setMessage ] = useState(null); - const [severity, setSeverity] = useState(""); + const [message, setMessage] = useState(null); + const [severity, setSeverity] = useState(''); const _handleClose = () => { setOpen(false); @@ -17,20 +17,20 @@ export const BankAlert = () => { }; useEffect(() => { - if (bankAlert === true ) { + if (bankAlert === true) { setOpen(true); - setMessage(t("APPS_BANK_ALERT_TRANSFER_SUCCESS")); - setSeverity("success") + setMessage(t('APPS_BANK_ALERT_TRANSFER_SUCCESS')); + setSeverity('success'); } else if (bankAlert === false) { setOpen(true); - setMessage(t("APPS_BANK_ALERT_TRANSFER_FAILURE")); - setSeverity("error") + setMessage(t('APPS_BANK_ALERT_TRANSFER_FAILURE')); + setSeverity('error'); } - }, [bankAlert]) + }, [bankAlert]); return ( { ); -}; \ No newline at end of file +}; diff --git a/phone/src/apps/bank/components/bank.styles.ts b/phone/src/apps/bank/components/bank.styles.ts index 173b7a5..69a5e53 100644 --- a/phone/src/apps/bank/components/bank.styles.ts +++ b/phone/src/apps/bank/components/bank.styles.ts @@ -1,85 +1,85 @@ -import { makeStyles } from "@material-ui/core"; +import { makeStyles } from '@material-ui/core'; const useStyles = makeStyles((theme) => ({ paper: { padding: theme.spacing(1), - textAlign: "center", - width: "50%", - backgroundColor: "#2d3436", + textAlign: 'center', + width: '50%', + backgroundColor: '#2d3436', margin: 20, - color: "#fff", + color: '#fff', }, table: { - width: "100%", - color: "#fff", + width: '100%', + color: '#fff', }, cell: { - color: "#fff", + color: '#fff', }, container: { maxHeight: 350, }, list: { - marginTop: "8.5em", + marginTop: '8.5em', }, root: { - width: "100%", + width: '100%', }, header: { - width: "90%", - display: "flex", - justifyItems: "center", - justifyContent: "space-between", - margin: "auto", + width: '90%', + display: 'flex', + justifyItems: 'center', + justifyContent: 'space-between', + margin: 'auto', }, title: { padding: 7, - borderRadius: "10px", - display: "flex", - justifyItems: "center", - justifyContent: "center", - fontSize: "30px", + borderRadius: '10px', + display: 'flex', + justifyItems: 'center', + justifyContent: 'center', + fontSize: '30px', }, seeAll: { - fontFamily: "Bahnschrift Regular", - fontWeight: "bold", - height: "auto", + fontFamily: 'Bahnschrift Regular', + fontWeight: 'bold', + height: 'auto', }, transcationDiv: { - marginTop: "-30px", - minHeight: 200, - maxHeight: 240 + marginTop: '-30px', + minHeight: 200, + maxHeight: 240, }, transactions: { - marginLeft: "32px", - display: "flex", - justifyContent: "space-between", - borderBottom: "2px solid #707070", - width: "85%", - margin: "auto", + marginLeft: '32px', + display: 'flex', + justifyContent: 'space-between', + borderBottom: '2px solid #707070', + width: '85%', + margin: 'auto', }, tranSource: { - fontSize: "22px", + fontSize: '22px', }, tranType: { - fontSize: "18px", - fontWeight: "bold", - color: "#BFBFBF", - marginTop: "-18px", - width: "100%", + fontSize: '18px', + fontWeight: 'bold', + color: '#BFBFBF', + marginTop: '-18px', + width: '100%', }, depositType: { - color: "#55B452", - marginRight: "32px", - fontSize: "22px", - fontWeight: "bold", + color: '#55B452', + marginRight: '32px', + fontSize: '22px', + fontWeight: 'bold', }, withdrawType: { - color: "#FF5E5E", - marginRight: "32px", - fontSize: "22px", - fontWeight: "bold", + color: '#FF5E5E', + marginRight: '32px', + fontSize: '22px', + fontWeight: 'bold', }, pagination: { background: '#262525', @@ -88,8 +88,8 @@ const useStyles = makeStyles((theme) => ({ bottom: 0, maxWidth: '100%', overflow: 'hidden', - borderBottom: "2px solid #707070" - } -})) + borderBottom: '2px solid #707070', + }, +})); -export default useStyles \ No newline at end of file +export default useStyles; diff --git a/phone/src/apps/bank/components/home/home.styles.ts b/phone/src/apps/bank/components/home/home.styles.ts index 191964e..b98cc9f 100644 --- a/phone/src/apps/bank/components/home/home.styles.ts +++ b/phone/src/apps/bank/components/home/home.styles.ts @@ -1,9 +1,9 @@ -import { makeStyles } from "@material-ui/core"; +import { makeStyles } from '@material-ui/core'; const useStyles = makeStyles((theme) => ({ root: { - width: "100%", - fontFamily: 'Bahnschrift Regular' + width: '100%', + fontFamily: 'Bahnschrift Regular', }, headTitle: { textAlign: 'center', @@ -14,7 +14,7 @@ const useStyles = makeStyles((theme) => ({ width: '50%', display: 'block', margin: '0 auto', - textAlign: 'center' + textAlign: 'center', }, actionButton: { background: '#388CF8', @@ -27,7 +27,7 @@ const useStyles = makeStyles((theme) => ({ fontWeight: 'bold', fontSize: '20px', marginBottom: 20, - boxShadow: '0px 2px 7px -2px rgba(0,0,0,0.75)' + boxShadow: '0px 2px 7px -2px rgba(0,0,0,0.75)', }, accounts: { marginTop: 20, @@ -35,14 +35,10 @@ const useStyles = makeStyles((theme) => ({ alignItems: 'center', justifyContent: 'space-between', margin: 30, - borderBottom: '1px solid #707070' + borderBottom: '1px solid #707070', }, - accountsType: { + accountsType: {}, + accountBalance: {}, +})); - }, - accountBalance: { - - }, -})) - -export default useStyles; \ No newline at end of file +export default useStyles; diff --git a/phone/src/apps/bank/components/navigation/NavigationBar.tsx b/phone/src/apps/bank/components/navigation/NavigationBar.tsx index 9a18dd9..c7fea21 100644 --- a/phone/src/apps/bank/components/navigation/NavigationBar.tsx +++ b/phone/src/apps/bank/components/navigation/NavigationBar.tsx @@ -1,28 +1,31 @@ -import React, { useState } from 'react' - -import { Link } from "react-router-dom"; -import { BottomNavigation, BottomNavigationAction } from "@material-ui/core"; -import { makeStyles } from "@material-ui/core/styles"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faHome, faList, faMoneyCheck } from "@fortawesome/free-solid-svg-icons"; +import React, { useState } from 'react'; +import { Link } from 'react-router-dom'; +import { BottomNavigation, BottomNavigationAction } from '@material-ui/core'; +import { makeStyles } from '@material-ui/core/styles'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { + faHome, + faList, + faMoneyCheck, +} from '@fortawesome/free-solid-svg-icons'; const useStyles = makeStyles((theme) => ({ root: { - width: "100%", + width: '100%', }, icon: { - color: "#f44336", + color: '#f44336', }, -})) +})); export const NavigationBar = () => { const classes = useStyles(); - const [activePage, setActivePage] = useState(0) + const [activePage, setActivePage] = useState(0); return ( { @@ -34,18 +37,18 @@ export const NavigationBar = () => { } - to="/bank" + to='/bank' /> } - to="/bank/account" + to='/bank/account' /> } - to="/bank/transactions" + to='/bank/transactions' /> - ) -} + ); +}; diff --git a/phone/src/apps/bank/components/notification/BankNotification.tsx b/phone/src/apps/bank/components/notification/BankNotification.tsx index 122bff0..a43290b 100644 --- a/phone/src/apps/bank/components/notification/BankNotification.tsx +++ b/phone/src/apps/bank/components/notification/BankNotification.tsx @@ -1,24 +1,24 @@ -import React, { useEffect, useState } from "react"; -import Notification from "../../../../ui/components/Notification"; -import { usePhone } from "../../../../os/phone/hooks/usePhone"; -import { useTranslation } from "react-i18next"; +import React, { useEffect, useState } from 'react'; +import Notification from '../../../../ui/components/Notification'; +import { usePhone } from '../../../../os/phone/hooks/usePhone'; +import { useTranslation } from 'react-i18next'; import useStyles from './notification.style'; -import { useBankNotification } from "../../hooks/useBankNotification"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faWonSign } from "@fortawesome/free-solid-svg-icons"; +import { useBankNotification } from '../../hooks/useBankNotification'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faWonSign } from '@fortawesome/free-solid-svg-icons'; export const BankNotification = () => { - const { notification } = useBankNotification() - const classes = useStyles() + const { notification } = useBankNotification(); + const classes = useStyles(); const { t } = useTranslation(); - const [visible, setVisible ] = useState(false); - const { config } = usePhone() + const [visible, setVisible] = useState(false); + const { config } = usePhone(); useEffect(() => { if (notification) { setVisible(true); } - }, [notification?.id]) + }, [notification?.id]); if (!config?.bank.showNotifications || !notification) return null; @@ -36,10 +36,13 @@ export const BankNotification = () => {
{notification.type}
-
{t("APPS_BANK_TIME_JUST_NOW")}
+
{t('APPS_BANK_TIME_JUST_NOW')}
+ +
+ {notification.source} sent you ${notification.transferAmount}.{' '} +

{notification.message}
-
{notification.source} sent you ${notification.transferAmount}.

{notification.message}
- ) -} \ No newline at end of file + ); +}; diff --git a/phone/src/apps/bank/components/notification/notification.style.ts b/phone/src/apps/bank/components/notification/notification.style.ts index 7d80b71..b1c0254 100644 --- a/phone/src/apps/bank/components/notification/notification.style.ts +++ b/phone/src/apps/bank/components/notification/notification.style.ts @@ -1,43 +1,43 @@ -import { makeStyles, createStyles, Theme } from "@material-ui/core/styles"; +import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'; -const useStyles = makeStyles((theme: Theme) => +const useStyles = makeStyles((theme: Theme) => createStyles({ content: { padding: theme.spacing(2), - overflowY: 'hidden' + overflowY: 'hidden', }, title: { - display: "flex", - flexFlow: "row nowrap", - justifyContent: "space-between", - alignItems: "center", + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'space-between', + alignItems: 'center', }, titleLeft: { - display: "flex", - flexFlow: "row nowrap", - justifyContent: "flex-start", - alignItems: "center", + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'flex-start', + alignItems: 'center', }, icon: { - marginTop: "3px", - marginRight: "5px", + marginTop: '3px', + marginRight: '5px', }, heading: { - marginBottom: "3px", + marginBottom: '3px', }, justNow: { - fontSize: "18px", - fontStyle: "italic", - paddingRight: "3px", + fontSize: '18px', + fontStyle: 'italic', + paddingRight: '3px', }, message: { - fontSize: "16px", - overflow: "hidden", - display: "-webkit-box", + fontSize: '16px', + overflow: 'hidden', + display: '-webkit-box', WebkitLineClamp: 2, - WebkitBoxOrient: "vertical", + WebkitBoxOrient: 'vertical', }, }) -) +); -export default useStyles; \ No newline at end of file +export default useStyles; diff --git a/phone/src/apps/bank/components/transactions/TransactionList.tsx b/phone/src/apps/bank/components/transactions/TransactionList.tsx index 0727829..5a3475f 100644 --- a/phone/src/apps/bank/components/transactions/TransactionList.tsx +++ b/phone/src/apps/bank/components/transactions/TransactionList.tsx @@ -1,28 +1,8 @@ -import React, { useState } from "react"; -import { List } from "../../../../ui/components/List"; -import { ListItem } from "../../../../ui/components/ListItem"; -import ListItemText from "@material-ui/core/ListItemText"; -import { Typography, makeStyles, Button } from "@material-ui/core"; - +import React, { useState } from 'react'; import useStyles from '../bank.styles'; - -import { useTranslation } from "react-i18next"; - +import { useTranslation } from 'react-i18next'; import TablePagination from '@material-ui/core/TablePagination'; - -import { useTransactions } from "../../hooks/useTransactions"; - -const columns = [ - { id: "type", label: "Type", minWidth: 100 }, - { id: "amount", label: "Amount", minWidth: 100 }, - { - id: "message", - label: "Message", - minWidth: 170, - align: "left", - format: (value: number) => value.toLocaleString("en-US"), - }, -]; +import { useTransactions } from '../../hooks/useTransactions'; export const TransactionList = () => { const { transactionList } = useTransactions(); @@ -34,10 +14,9 @@ export const TransactionList = () => { const TransactionTypes = { Deposit: classes.depositType, Withdraw: classes.withdrawType, - Transfer: classes.depositType + Transfer: classes.depositType, }; - const handleChangePage = (event, newPage) => { setPage(newPage); }; @@ -48,9 +27,9 @@ export const TransactionList = () => { }; return ( -
+
-

{t("APPS_BANK_ACCOUNT_TRANSACTIONS")}

+

{t('APPS_BANK_ACCOUNT_TRANSACTIONS')}

@@ -64,22 +43,22 @@ export const TransactionList = () => {

- {transaction.type == "Withdraw" ? "-" : "+"} + {transaction.type == 'Withdraw' ? '-' : '+'} {transaction.amount}

))} - + />
); diff --git a/phone/src/apps/bank/components/transfers/TransferModal.tsx b/phone/src/apps/bank/components/transfers/TransferModal.tsx index 6759bf0..39d430c 100644 --- a/phone/src/apps/bank/components/transfers/TransferModal.tsx +++ b/phone/src/apps/bank/components/transfers/TransferModal.tsx @@ -1,101 +1,108 @@ -import React, { useState } from 'react' +import React, { useState } from 'react'; import Modal from '../../../../ui/components/Modal'; -import { Button, List, ListItem, TextField, makeStyles } from '@material-ui/core'; +import { + Button, + List, + ListItem, + TextField, + makeStyles, +} from '@material-ui/core'; import CloseIcon from '@material-ui/icons/Close'; import Nui from '../../../../os/nui-events/utils/Nui'; -import { useBankModal} from '../../hooks/useBankModal'; -import { Message } from '@material-ui/icons'; +import { useBankModal } from '../../hooks/useBankModal'; const useStyles = makeStyles((theme) => ({ input: { - width: "60%", + width: '60%', margin: 'auto', - }, modalInput: { - fontSize: 20 + fontSize: 20, }, modalInputCenter: { fontSize: 20, textAlign: 'center', }, transferButton: { - background: "#2E7D32", + background: '#2E7D32', width: 120, padding: 5, - margin: "auto", + margin: 'auto', fontSize: 16, - marginBottom: 30 + marginBottom: 30, }, closeButton: { position: 'absolute', right: 0, - width: "10%" - } -})) - + width: '10%', + }, +})); export const TransferModal = () => { const classes = useStyles(); - const [ targetID, setTargetID ] = useState(''); - const [ amount, setAmount ] = useState(''); - const [ message, setMessage ] = useState(''); - + const [targetID, setTargetID] = useState(''); + const [amount, setAmount] = useState(''); + const [message, setMessage] = useState(''); + const { showBankModal, setShowBankModal } = useBankModal(); const _handleClose = () => { - setShowBankModal(false) - } + setShowBankModal(false); + }; const addTransfer = () => { const transferAmount = parseInt(amount); Nui.send('phone:addTransfer', { - targetID, - transferAmount, - message - }) - setShowBankModal(false) - } + targetID, + transferAmount, + message, + }); + setShowBankModal(false); + }; return ( - + setTargetID(e.target.value)} - /> - - - setAmount(e.target.value)} + onChange={(e) => setTargetID(e.target.value)} /> setAmount(e.target.value)} + /> + + + setMessage(e.target.value)} + onChange={(e) => setMessage(e.target.value)} /> - + - ) -} + ); +};