From 155d3b611a4ab4a946d07f885e4936063b12b003 Mon Sep 17 00:00:00 2001 From: chip Date: Mon, 26 Oct 2020 15:35:52 +0100 Subject: [PATCH] feat(bank/nui): new layout for account summary | showing balance | displaying trancactions --- .../account/AccountTransactions.tsx | 103 ++++++++++++++++++ .../bank/components/account/BankAccount.tsx | 33 ++++++ .../apps/bank/components/account/BankCard.tsx | 49 +++++++++ 3 files changed, 185 insertions(+) create mode 100644 phone/src/apps/bank/components/account/AccountTransactions.tsx create mode 100644 phone/src/apps/bank/components/account/BankAccount.tsx create mode 100644 phone/src/apps/bank/components/account/BankCard.tsx diff --git a/phone/src/apps/bank/components/account/AccountTransactions.tsx b/phone/src/apps/bank/components/account/AccountTransactions.tsx new file mode 100644 index 0000000..d4cb9a5 --- /dev/null +++ b/phone/src/apps/bank/components/account/AccountTransactions.tsx @@ -0,0 +1,103 @@ +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: { + color: "#fff", + padding: 7, + borderRadius: "10px", + display: "flex", + justifyItems: "center", + justifyContent: "center", + fontSize: "24px", + }, + seeAll: { + fontFamily: "Bahnschrift Regular", + fontWeight: "bold", + }, + 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", + }, +})); + +export const AccountTransactions = (): any => { + const classes = useStyles(); + + const TransactionTypes = { + Deposit: classes.depositType, + Withdraw: classes.withdrawType, + }; + + const { transactionList } = useTransactions(); + const { t } = useTranslation(); + return ( +
+
+

{t("APPS_BANK_ACCOUNT_TRANSACTIONS")}

+ +
+ +
+ {transactionList.map((transaction: any) => ( +
+
+

{transaction.source}

+

{transaction.type}

+
+
+

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

+
+
+ ))} +
+
+ ); +}; diff --git a/phone/src/apps/bank/components/account/BankAccount.tsx b/phone/src/apps/bank/components/account/BankAccount.tsx new file mode 100644 index 0000000..7531b6a --- /dev/null +++ b/phone/src/apps/bank/components/account/BankAccount.tsx @@ -0,0 +1,33 @@ +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'; + +const useStyles = makeStyles((theme) => ({ + root: { + width: '100%', + fontFamily: 'Bahnschrift Regular' + }, + title: { + fontSize: '30px', + marginLeft: '29px' + } +})) + +export const BankAccount = () => { + const classes = useStyles(); + const { credentials } = useCredentials(); + const { t } = useTranslation(); + return ( +
+
+

{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 new file mode 100644 index 0000000..f09b967 --- /dev/null +++ b/phone/src/apps/bank/components/account/BankCard.tsx @@ -0,0 +1,49 @@ +import React from 'react' +import { makeStyles, Box, Typography } from "@material-ui/core"; +import { shadows } from '@material-ui/system'; + +const useStyles = makeStyles((theme) => ({ + root: { + background: '#388CF8', + height: '179px', + width: '350px', + margin: 'auto', + borderRadius: '15px', + fontFamily: 'Bahnschrift Regular' + }, + cardName: { + margin: 10, + paddingTop: 15 + }, + 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' + } +})) + +export const BankCard = (props) => { + const classes = useStyles(); + return ( + +
+

{props.name}

+

{props.account}

+
+
+

${props.balance}

+
+
+ ) +}