diff --git a/package.json b/package.json index 729c7f4..910d0d6 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^13.5.0", "react": "^17.0.2", + "react-csv-reader": "^3.4.0", "react-dom": "^17.0.2", "react-scripts": "5.0.0", "web-vitals": "^2.1.2" diff --git a/src/App.css b/src/App.css index 74b5e05..29c2fa5 100644 --- a/src/App.css +++ b/src/App.css @@ -1,5 +1,6 @@ .App { text-align: center; + font-size: xx-small; } .App-logo { @@ -20,7 +21,7 @@ flex-direction: column; align-items: center; justify-content: center; - font-size: calc(10px + 2vmin); + font-size: calc(8px + 1vmin); color: white; } diff --git a/src/App.js b/src/App.js index 3784575..6594476 100644 --- a/src/App.js +++ b/src/App.js @@ -1,22 +1,37 @@ import logo from './logo.svg'; import './App.css'; +import Table from './Table.js'; +import CSVReader from 'react-csv-reader' +import { useState } from 'react'; +import { transactionPrices, calculateTotal , filterMultiples } from './filter.js'; function App() { + let [dataSet, setDataSet] = useState([]); + let [tableSet, setTableSet] = useState([]); + let [tableHeaders, setTableHeaders] = useState([]); + let [pricesSet, setPricesSet] = useState([]); + let [total, setTotal] = useState(0); + + function importCSV(data) { + setDataSet(data); + setTableHeaders(data.shift()); + setTableSet(data); + setTotal(calculateTotal(data)); + setPricesSet(Object.entries(filterMultiples(transactionPrices(data)))); + //setPricesSet(Object.entries(transactionPrices(data))); + } + return (
- Edit src/App.js
and save to reload.
+ Import a .csv file using the button below
{string} | )}
{string} | )}
---|