Skip to content

Commit af56c2e

Browse files
committed
working
1 parent 9ad9a72 commit af56c2e

File tree

17 files changed

+3578
-17252
lines changed

17 files changed

+3578
-17252
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frontend (React)
22
frontend/node_modules/
3+
frontend/node_modules/*
34
frontend/build/
45
frontend/.env
56
frontend/.cache/

frontend/package-lock.json

+3,305-17,100
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

+11-7
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@emotion/react": "^11.13.3",
7-
"@emotion/styled": "^11.13.0",
8-
"@mui/icons-material": "^6.1.0",
9-
"@mui/material": "^6.1.0",
10-
"@testing-library/jest-dom": "^5.17.0",
6+
"@emotion/react": "^11.11.0",
7+
"@emotion/styled": "^11.11.0",
8+
"@mui/icons-material": "^5.11.16",
9+
"@mui/material": "^5.13.0",
10+
"@testing-library/jest-dom": "^5.16.5",
1111
"@testing-library/react": "^13.4.0",
1212
"@testing-library/user-event": "^13.5.0",
1313
"papaparse": "^5.4.1",
14-
"react": "^18.3.1",
15-
"react-dom": "^18.3.1",
14+
"react": "^18.2.0",
15+
"react-dom": "^18.2.0",
16+
"react-router-dom": "^6.28.0",
1617
"react-scripts": "5.0.1",
1718
"web-vitals": "^2.1.4"
1819
},
@@ -39,5 +40,8 @@
3940
"last 1 firefox version",
4041
"last 1 safari version"
4142
]
43+
},
44+
"devDependencies": {
45+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11"
4246
}
4347
}

frontend/src/App.js

-138
This file was deleted.

frontend/src/App.jsx

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react';
2+
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
3+
import StockPortfolio from './pages/StockPortfolio';
4+
import HelloWorldPage from './pages/HelloWorldPage';
5+
6+
const router = createBrowserRouter([
7+
{
8+
path: "/",
9+
element: <StockPortfolio />,
10+
children: [
11+
{
12+
path: "hello",
13+
element: <HelloWorldPage />
14+
}
15+
]
16+
}
17+
], {
18+
future: {
19+
v7_startTransition: true,
20+
v7_relativeSplatPath: true
21+
}
22+
});
23+
24+
function App() {
25+
return <RouterProvider router={router} />;
26+
}
27+
28+
export default App;

frontend/src/components/common/Button/index.jsx

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
import { Button } from '@mui/material';
3+
import CloudUploadIcon from '@mui/icons-material/CloudUpload';
4+
import { styled } from '@mui/material/styles';
5+
6+
const VisuallyHiddenInput = styled('input')({
7+
clip: 'rect(0 0 0 0)',
8+
clipPath: 'inset(50%)',
9+
height: 1,
10+
overflow: 'hidden',
11+
position: 'absolute',
12+
bottom: 0,
13+
left: 0,
14+
whiteSpace: 'nowrap',
15+
width: 1,
16+
});
17+
18+
const FileUploadButton = ({ onFileSelect, accept = '*/*' }) => {
19+
return (
20+
<Button
21+
component="label"
22+
variant="contained"
23+
startIcon={<CloudUploadIcon />}
24+
>
25+
Upload file
26+
<VisuallyHiddenInput
27+
type="file"
28+
onChange={onFileSelect}
29+
accept={accept}
30+
/>
31+
</Button>
32+
);
33+
};
34+
35+
export default FileUploadButton;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import React from 'react';
2+
import {
3+
Table,
4+
TableBody,
5+
TableCell,
6+
TableContainer,
7+
TableHead,
8+
TableRow,
9+
Paper
10+
} from '@mui/material';
11+
12+
const DataTable = ({ columns, data, onRowClick }) => {
13+
const getStatusColor = (status) => {
14+
switch (status) {
15+
case 'Profit':
16+
return 'success.main';
17+
case 'Loss':
18+
return 'error.main';
19+
default:
20+
return 'text.primary';
21+
}
22+
};
23+
24+
return (
25+
<TableContainer component={Paper}>
26+
<Table sx={{ minWidth: 650 }}>
27+
<TableHead>
28+
<TableRow>
29+
{columns.map((column) => (
30+
<TableCell
31+
key={column.id}
32+
align={column.align || 'left'}
33+
sx={{
34+
backgroundColor: 'primary.main',
35+
color: 'white',
36+
fontWeight: 'bold'
37+
}}
38+
>
39+
{column.label}
40+
</TableCell>
41+
))}
42+
</TableRow>
43+
</TableHead>
44+
<TableBody>
45+
{data.map((row, index) => (
46+
<TableRow
47+
key={index}
48+
onClick={() => onRowClick?.(row)}
49+
sx={{
50+
'&:nth-of-type(odd)': { backgroundColor: 'action.hover' },
51+
cursor: onRowClick ? 'pointer' : 'default'
52+
}}
53+
>
54+
{columns.map((column) => (
55+
<TableCell
56+
key={column.id}
57+
align={column.align || 'left'}
58+
sx={{
59+
color: column.id === 'status'
60+
? getStatusColor(row[column.id])
61+
: 'text.primary'
62+
}}
63+
>
64+
{row[column.id]}
65+
</TableCell>
66+
))}
67+
</TableRow>
68+
))}
69+
</TableBody>
70+
</Table>
71+
</TableContainer>
72+
);
73+
};
74+
75+
export default DataTable;
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const stockTableColumns = [
2+
{ id: 'symbol', label: 'Symbol' },
3+
{ id: 'quantity', label: 'Quantity' },
4+
{ id: 'purchasePrice', label: 'Purchase Price ($)', align: 'right' },
5+
{ id: 'currentValue', label: 'Current Value ($)', align: 'right' },
6+
{ id: 'dividends', label: 'Dividends ($)', align: 'right' },
7+
{ id: 'difference', label: 'Difference ($)', align: 'right' },
8+
{ id: 'balance', label: 'Balance ($)', align: 'right' },
9+
{ id: 'status', label: 'Status' }
10+
];

frontend/src/index.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom/client';
3-
import './index.css';
43
import App from './App';
5-
import reportWebVitals from './reportWebVitals';
4+
import './index.css';
65

76
const root = ReactDOM.createRoot(document.getElementById('root'));
87
root.render(
98
<React.StrictMode>
109
<App />
1110
</React.StrictMode>
1211
);
13-
14-
// If you want to start measuring performance in your app, pass a function
15-
// to log results (for example: reportWebVitals(console.log))
16-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17-
reportWebVitals();

frontend/src/pages/StockPortffolio/index.jsx

Whitespace-only changes.

0 commit comments

Comments
 (0)