-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
6994a67
commit b02c61b
Showing
4 changed files
with
34 additions
and
26 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
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
26 changes: 13 additions & 13 deletions
26
src/pages/dashboard/add transaction tile/AddTransactionTile.tsx
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,25 +1,25 @@ | ||
import {ReactNode, useState} from "react"; | ||
import {CSVUpload} from "../../../components/transactions/CSVUpload.tsx"; | ||
import {CSVUpload, stopDragging} from "../../../components/transactions/CSVUpload.tsx"; | ||
import {InputTransaction} from "../../../components/transactions/InputTransaction.tsx"; | ||
|
||
export default function AddTransactionTile(updateTransactions: () => void): ReactNode { | ||
const [showCSVModal, setShowCSVModal] = useState(false); | ||
const [showTransactionModal, setShowTransactionModal] = useState(false); | ||
|
||
const onCSVModalClose = () => { | ||
setShowCSVModal(false); | ||
updateTransactions(); | ||
}; | ||
|
||
const onTransactionModalClose = () => { | ||
setShowTransactionModal(false); | ||
updateTransactions(); | ||
function closeModal(added: boolean, setShow: React.Dispatch<React.SetStateAction<boolean>>) { | ||
setShow(false); | ||
if (added) updateTransactions(); | ||
} | ||
const onCSVModalClose = (added: boolean) => closeModal(added, setShowCSVModal) | ||
const onTransactionModalClose = (added: boolean) => closeModal(added, setShowTransactionModal) | ||
|
||
return <> | ||
return <div className="card w-100 h-100" onPointerDown={showCSVModal || showTransactionModal ? stopDragging : undefined}> | ||
<CSVUpload show={showCSVModal} closeModal={onCSVModalClose}/> | ||
<InputTransaction show={showTransactionModal} closeModal={onTransactionModalClose}/> | ||
<button onClick={() => setShowCSVModal(true)}>Upload CSV</button> | ||
<button onClick={() => setShowTransactionModal(true)}>Add Transaction</button> | ||
</> | ||
<div className="card-header w-100 fw-bold align">Import</div> | ||
<div className="card-body p-1 align-content-center"> | ||
<button className="btn btn-primary w-100 mb-2" onClick={() => setShowCSVModal(true)}>Upload CSV</button> | ||
<button className="btn btn-primary w-100" onClick={() => setShowTransactionModal(true)}>Add Transaction</button> | ||
</div> | ||
</div> | ||
} |
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