diff --git a/frontend/src/components/Transaction.jsx b/frontend/src/components/Transaction.jsx index 12cdc24..7ca7f85 100644 --- a/frontend/src/components/Transaction.jsx +++ b/frontend/src/components/Transaction.jsx @@ -1,13 +1,11 @@ import React, { useEffect, useState, useContext } from "react"; import TransactionContext from "../context/TransactionContext"; -import TransactionDetailsPopup from "../components/TransactionDetailPopup"; const Transaction = ({ transaction }) => { const [isAmountNegative, setIsAmountNegative] = useState(false); const [convertedAmount, setConvertedAmount] = useState(transaction.amount); - const [showDetails, setShowDetails] = useState(false); const { currency, convertCurrency, handleSelect } = - useContext(TransactionContext); + useContext(TransactionContext); // useEffect to check if each transaction is negative and then convert the currency useEffect(() => { @@ -27,40 +25,22 @@ const Transaction = ({ transaction }) => { handleSelect(transaction.id, e.target.checked); console.log("clicked: ", transaction.id); }; - return ( - <> -
- - -
setShowDetails(true)}> - -

- {isAmountNegative ? convertedAmount : `+${convertedAmount}`}:{" "} - {transaction.title} -

- -

{transaction.created_at.substring(0, 10)}

- -
+
+ +
+

+ {isAmountNegative ? convertedAmount : `+${convertedAmount}`}:{" "} + {transaction.description} +

+

{transaction.created_at.substring(0, 10)}

- - {/*displays the currently hovered transaction in a popup*/ - - showDetails && ( -
- -
- ) - } - - ) +
+ ); }; export default Transaction; diff --git a/frontend/src/components/TransactionDetailPopup.jsx b/frontend/src/components/TransactionDetailPopup.jsx deleted file mode 100644 index 1724e2f..0000000 --- a/frontend/src/components/TransactionDetailPopup.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import { useState, useEffect } from "react"; - -export default function TransactionDetailPopup({transaction, setShowDetails}){ - - //exits out of the current popup by setting the popup boolean to false in transaction.jsx - const handleExit =() => { - setShowDetails(false); - } - - return( - <> -
-
- -

Transaction Details

- -
-

Title:

-

{transaction.title}

-
- -
-

Amount:

-

${transaction.amount}

-
- -

Description

- - -