-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
397 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"liveServer.settings.port": 5501 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export default function Footer(){ | ||
return ( | ||
<footer className="footer"> | ||
<p className="footer-text">Copyright 2020 Argent Bank</p> | ||
<p className="footer-text">Copyright 2023 Argent Bank</p> | ||
</footer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { useSelector } from 'react-redux'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export default function AccountPage({ setViewTransactions }){ | ||
const user = useSelector(state => state.auth.user); | ||
|
||
return ( | ||
<> | ||
<h2 className="sr-only">Accounts</h2> | ||
{user && user.accounts.map(account => ( | ||
<section className="account" key={account.account_type}> | ||
<div className="account-content-wrapper"> | ||
<p className="account-title">Argent Bank - {account.account_type} {'(' + account.account_number + ')'}</p> | ||
<h3 className="account-amount">$2,082.79</h3> | ||
<p className="account-title">Available Balance</p> | ||
</div> | ||
<div className="account-content-wrapper cta"> | ||
{/* <Link to={`/transactions/${account.account_type.toLowerCase().replace(/\s+/g, '_')}`} className="transaction-button">View transactions</Link> */} | ||
{/* <Link to={`/transactions/${account.account_type}`} className="transaction-button" onClick={() => setViewTransactions(true)}>View transactions</Link> */} | ||
<Link to={`${account.account_type}`}><button className="transaction-button" onClick={() => setViewTransactions(true)}>View transactions</button></Link> | ||
</div> | ||
</section> | ||
))} | ||
</> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { useGetTransactionMutation, useUpdateTransactionMutation } from '../rtk/ApiSlice'; | ||
import { useParams } from 'react-router-dom'; | ||
//import Error from '../pages/Error'; | ||
|
||
export default function TransactionPage() { | ||
const { accountType } = useParams(); | ||
//console.log(accountType); | ||
const [getTransactions, { data, error, isError, isLoading }] = useGetTransactionMutation(); | ||
const [collapseStates, setCollapseStates] = useState({}); | ||
|
||
useEffect(() => { | ||
getTransactions(accountType); | ||
}, [getTransactions, accountType]); | ||
|
||
return ( | ||
<main> | ||
<div className="main bg-dark"> | ||
<div className='account-trans'> | ||
<div className='account-content-wrapper'> | ||
<h3>Argent Bank - {accountType} Account</h3> | ||
<h1>$2,082.79</h1> | ||
<p>Available balance</p> | ||
</div> | ||
</div> | ||
{isLoading ? ( | ||
<p>Loading transactions...</p> | ||
) : isError ? ( | ||
<p className="perror">{error.message}</p> | ||
) : ( | ||
<> | ||
<h2 className="sr-only">Transactions for {accountType} Account</h2> | ||
<div className="account-table-header-wrapper"> | ||
<h3 className="">Date</h3> | ||
<h3>Description</h3> | ||
<h3>Amount</h3> | ||
<h3>Balance</h3> | ||
</div> | ||
<section className=""></section> | ||
{data && data.body.transactions && (() => { | ||
const filteredTransactions = data.body.transactions.filter(transaction => transaction.account_type === accountType); | ||
if (filteredTransactions.length === 0) { | ||
return <h2>No transactions found</h2>; | ||
} | ||
return filteredTransactions | ||
.reverse() | ||
.map((transaction) => { | ||
const europeanDate = new Date(transaction.date).toLocaleDateString('en-GB'); | ||
|
||
const toggleCollapse = () => { | ||
setCollapseStates(prevState => ({ | ||
...prevState, | ||
[transaction.date]: !prevState[transaction.date] | ||
})); | ||
}; | ||
|
||
return ( | ||
<div className="table-transactions" key={transaction.date}> | ||
<div className="account-table-transaction" onClick={toggleCollapse}> | ||
<p className="">{europeanDate}</p> | ||
<p className="">{transaction.description}</p> | ||
<p className="">${Number(transaction.amount.$numberDecimal).toFixed(2)}</p> | ||
<p>$2,082.79</p> | ||
<i className={`fa-solid fa-angle-${collapseStates[transaction.date] ? 'up' : 'down'}`}></i> | ||
</div> | ||
<div className={`account-collapse ${collapseStates[transaction.date] ? 'down' : ''}`}> | ||
<div className="account-table-details"> | ||
<p className="">Transaction type</p> | ||
<p className="">{transaction.type}</p> | ||
</div> | ||
<div className="account-table-details"> | ||
<p className="">Category</p> | ||
<p className="">{transaction.category}</p> | ||
</div> | ||
<div className="account-table-details"> | ||
<p className="">Notes</p> | ||
<p className="">{transaction.note}</p> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}); | ||
})()} | ||
</> | ||
)} | ||
</div> | ||
</main> | ||
); | ||
} |
Oops, something went wrong.