added backend and 2 endpoints fetch
This commit is contained in:
1 parent
7c6db3dfbd
commit
ca99cfcf6d
56 files changed
+344
-29
No files matched your search
@@ -0,0 +1,27 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
bun.lock
|
||||
bun.lockb
|
||||
package-lock.json
|
||||
deno.lock
|
||||
@@ -0,0 +1,70 @@
|
||||
# Getting Started with Create React App
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
||||
|
||||
The page will reload when you make changes.\
|
||||
You may also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
||||
|
||||
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
||||
|
||||
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "wallet",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"axios": "^1.11.0",
|
||||
"bootstrap": "^5.3.7",
|
||||
"chart.js": "^4.5.0",
|
||||
"classnames": "^2.5.1",
|
||||
"emoji-picker-react": "^4.13.2",
|
||||
"faker": "^6.6.6",
|
||||
"react": "^19.1.0",
|
||||
"react-bootstrap": "^2.10.10",
|
||||
"react-chartjs-2": "^5.3.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-router-dom": "^7.7.0",
|
||||
"react-scripts": "5.0.1",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
@@ -0,0 +1,35 @@
|
||||
import "./css/App.css";
|
||||
import NavigationBar from "./components/NavigationBar/NavigationBar";
|
||||
import { useTheme } from "./contexts/ThemeContext";
|
||||
import { useEffect } from "react";
|
||||
import Home from "./pages/Home";
|
||||
import {
|
||||
BrowserRouter as Router,
|
||||
Routes,
|
||||
Route,
|
||||
Navigate,
|
||||
} from "react-router-dom";
|
||||
import NotFound from "./pages/NotFound";
|
||||
|
||||
function App() {
|
||||
const { theme } = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
document.body.setAttribute("data-bs-theme", theme);
|
||||
}, [theme]);
|
||||
|
||||
return (
|
||||
<Router>
|
||||
<NavigationBar />
|
||||
<>
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path="/not-found" element={<NotFound />} />
|
||||
<Route path="*" element={<Navigate to="/not-found" replace />} />
|
||||
</Routes>
|
||||
</>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
@@ -0,0 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import axios from "axios";
|
||||
import routes from "../routes";
|
||||
|
||||
const fetchCategories = async () => {
|
||||
try {
|
||||
const response = await axios.get(routes.categories);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching categories:", error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export default fetchCategories;
|
||||
@@ -0,0 +1,167 @@
|
||||
import { Card, Accordion, ProgressBar } from "react-bootstrap";
|
||||
|
||||
const AppointmentDashboard = ({ ...props }) => {
|
||||
return (
|
||||
<>
|
||||
<Card {...props}>
|
||||
<Card.Body>
|
||||
<h3
|
||||
className="mb-3 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
Appointment
|
||||
</h3>
|
||||
<Accordion defaultActiveKey="">
|
||||
<Accordion.Item eventKey="0" className="p-0">
|
||||
<Accordion.Header className="p-0">
|
||||
<div className="p-0" style={{ fontSize: "30px" }}>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<div className="d-flex justify-content-between w-100">
|
||||
<h3 className="mb-0" style={{ fontSize: "1.1rem" }}>
|
||||
Cash loan
|
||||
</h3>
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
21531,00 ₽
|
||||
</h3>
|
||||
</div>
|
||||
<div className="d-flex w-100 align-items-end gap-2">
|
||||
<ProgressBar
|
||||
now={75}
|
||||
className="mt-2 w-100"
|
||||
style={{ height: "5px" }}
|
||||
/>
|
||||
<div
|
||||
className="d-flex text-muted small mb-0"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
75%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Accordion.Header>
|
||||
<Accordion.Body>
|
||||
<div className="d-flex align-items-center">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>➞</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<div className="d-flex justify-content-between w-100">
|
||||
<h3 className="mb-0" style={{ fontSize: "0.8rem" }}>
|
||||
Cash loan
|
||||
</h3>
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "0.8rem", fontWeight: 700 }}
|
||||
>
|
||||
21531,00 ₽
|
||||
</h3>
|
||||
</div>
|
||||
<div className="d-flex w-100 align-items-end gap-2">
|
||||
<ProgressBar
|
||||
now={100}
|
||||
className="mt-2 w-100"
|
||||
style={{ height: "5px" }}
|
||||
/>
|
||||
<div
|
||||
className="d-flex text-muted small mb-0"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
100%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div className="d-flex align-items-center">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>➞</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<div className="d-flex justify-content-between w-100">
|
||||
<h3 className="mb-0" style={{ fontSize: "0.8rem" }}>
|
||||
Cash loan
|
||||
</h3>
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "0.8rem", fontWeight: 700 }}
|
||||
>
|
||||
21531,00 ₽
|
||||
</h3>
|
||||
</div>
|
||||
<div className="d-flex w-100 align-items-end gap-2">
|
||||
<ProgressBar
|
||||
now={100}
|
||||
className="mt-2 w-100"
|
||||
style={{ height: "5px" }}
|
||||
/>
|
||||
<div
|
||||
className="d-flex text-muted small mb-0"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
100%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
</Accordion.Body>
|
||||
</Accordion.Item>
|
||||
</Accordion>
|
||||
{/* <div>
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default AppointmentDashboard;
|
||||
@@ -0,0 +1,26 @@
|
||||
import React from "react";
|
||||
import { Card } from "react-bootstrap";
|
||||
import AddOperationModal from "../../modals/AddOperationModal/AddOperationModal";
|
||||
|
||||
const BalanceBlock = ({ balance }) => {
|
||||
return (
|
||||
<Card style={{ position: "fixed", bottom: 0, width: "100%" }}>
|
||||
<Card.Body className="d-flex justify-content-between">
|
||||
<div>
|
||||
<div className="text-muted small mb-1" style={{ fontSize: "0.8rem" }}>
|
||||
Balance
|
||||
</div>
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
40 407,17 ₽
|
||||
</h3>
|
||||
</div>
|
||||
<AddOperationModal />
|
||||
</Card.Body>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default BalanceBlock;
|
||||
@@ -0,0 +1,69 @@
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
import { Button } from "react-bootstrap";
|
||||
import styles from "./CategorySign.module.css";
|
||||
import classNames from "classnames";
|
||||
|
||||
const CategorySign = ({ icon, title, subcategories }) => {
|
||||
const { theme } = useTheme();
|
||||
return (
|
||||
<Button variant={theme} className="w-100 mt-3">
|
||||
<div>
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>{icon}</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-center align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
{title}
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
{subcategories.length === 0
|
||||
? "No subcategories"
|
||||
: `Subcategories: ${subcategories.length}`}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{subcategories.length === 0 ? (
|
||||
""
|
||||
) : (
|
||||
<div
|
||||
className="d-flex align-items-center gap-3 p-0"
|
||||
style={{ margin: "0 20px" }}
|
||||
>
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
// style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>➞</div>
|
||||
</div>
|
||||
<div
|
||||
className={classNames("d-flex gap-3", styles.hideScrollbar)}
|
||||
style={{ width: "100%", overflowX: "auto" }}
|
||||
>
|
||||
{subcategories.map((subcategory) => (
|
||||
<Button
|
||||
variant="secondary"
|
||||
style={{ borderRadius: "25px", padding: "0 15px" }}
|
||||
key={subcategory.id}
|
||||
>
|
||||
{subcategory.title}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default CategorySign;
|
||||
@@ -0,0 +1,7 @@
|
||||
.hideScrollbar {
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
}
|
||||
.hideScrollbar::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import React, { useState, useRef } from "react";
|
||||
import { Button, Overlay, Popover, InputGroup } from "react-bootstrap";
|
||||
import EmojiPicker from "emoji-picker-react";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
|
||||
const EmojiPickerButton = () => {
|
||||
const { theme } = useTheme();
|
||||
const [showPicker, setShowPicker] = useState(false);
|
||||
const [inputValue, setInputValue] = useState("😀");
|
||||
const target = useRef(null);
|
||||
|
||||
const handleEmojiSelect = (emoji) => {
|
||||
setInputValue(emoji.emoji);
|
||||
setShowPicker(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="p-3">
|
||||
<InputGroup>
|
||||
<Button
|
||||
ref={target}
|
||||
variant="secondary"
|
||||
style={{
|
||||
borderRadius: "50%",
|
||||
width: "100px",
|
||||
height: "100px",
|
||||
fontSize: "45px",
|
||||
}}
|
||||
onClick={() => setShowPicker(!showPicker)}
|
||||
>
|
||||
{inputValue}
|
||||
</Button>
|
||||
|
||||
<Overlay
|
||||
show={showPicker}
|
||||
target={target.current}
|
||||
placement="bottom"
|
||||
rootClose
|
||||
onHide={() => setShowPicker(false)}
|
||||
>
|
||||
<Popover id="emoji-popover">
|
||||
<Popover.Body className="p-0">
|
||||
<EmojiPicker
|
||||
onEmojiClick={handleEmojiSelect}
|
||||
height={350}
|
||||
width="100%"
|
||||
previewConfig={{ showPreview: false }}
|
||||
theme={theme}
|
||||
/>
|
||||
</Popover.Body>
|
||||
</Popover>
|
||||
</Overlay>
|
||||
</InputGroup>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default EmojiPickerButton;
|
||||
@@ -0,0 +1,121 @@
|
||||
import React from "react";
|
||||
import { Card, Col } from "react-bootstrap";
|
||||
import { Bar } from "react-chartjs-2";
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
BarElement,
|
||||
Tooltip,
|
||||
} from "chart.js";
|
||||
// import { useTheme } from "../../contexts/ThemeContext";
|
||||
import styles from "./FinancialDashboard.module.css";
|
||||
|
||||
ChartJS.register(CategoryScale, LinearScale, BarElement, Tooltip);
|
||||
|
||||
const FinancialDashboard = ({
|
||||
chartData,
|
||||
chartOptions,
|
||||
maxValue,
|
||||
LeftCardData,
|
||||
RightCardData,
|
||||
}) => {
|
||||
// const { theme } = useTheme();
|
||||
// const [incomedata, setIncomeData] = useState(income);
|
||||
// const [expensesdata, setExpensesData] = useState(expenses);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="d-flex flex-column p-3 gap-3"
|
||||
style={{
|
||||
margin: "0 auto",
|
||||
fontFamily: "Inter, sans-serif",
|
||||
}}
|
||||
>
|
||||
{/* Карточка с диаграммой */}
|
||||
<Card className="border-0 shadow-sm" style={{ borderRadius: "15px" }}>
|
||||
<Card.Body className="p-4">
|
||||
<div className="d-flex justify-content-between align-items-center mb-0">
|
||||
<Col md={6} className="mb-0">
|
||||
<Card className="border-0">
|
||||
<Card.Body className="p-0">
|
||||
<div className="d-flex align-items-center p-0 m-0">
|
||||
<div
|
||||
style={{
|
||||
width: "10px",
|
||||
height: "10px",
|
||||
backgroundColor: "#3576C3",
|
||||
borderRadius: "50%",
|
||||
display: "inline-block",
|
||||
marginRight: "10px",
|
||||
}}
|
||||
/>
|
||||
<div className="p-0 m-0">
|
||||
<h3
|
||||
className="mb-0 fw-bold"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
{LeftCardData.value.toLocaleString("ru-RU", {
|
||||
minimumFractionDigits: 2,
|
||||
})}{" "}
|
||||
₽
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
{LeftCardData.label}
|
||||
</div>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col md={6} className="mb-0">
|
||||
<Card className="border-0">
|
||||
<Card.Body className="p-0">
|
||||
<div className="d-flex align-items-center">
|
||||
<div
|
||||
style={{
|
||||
width: "10px",
|
||||
height: "10px",
|
||||
backgroundColor: "#38393F",
|
||||
borderRadius: "50%",
|
||||
display: "inline-block",
|
||||
marginRight: "10px",
|
||||
}}
|
||||
/>
|
||||
<div className="p-0">
|
||||
<h3
|
||||
className="mb-0 fw-bold"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
{RightCardData.value.toLocaleString("ru-RU", {
|
||||
minimumFractionDigits: 2,
|
||||
})}{" "}
|
||||
₽
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
{RightCardData.label}
|
||||
</div>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
</div>
|
||||
|
||||
{/* Контейнер для диаграммы */}
|
||||
<div className={styles.chartContainer}>
|
||||
<Bar data={chartData} options={chartOptions} />
|
||||
</div>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default FinancialDashboard;
|
||||
@@ -0,0 +1,13 @@
|
||||
.chartContainer {
|
||||
margin: 0;
|
||||
height: 200px;
|
||||
width: auto;
|
||||
position: relative;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.chartContainer {
|
||||
height: 100px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import React from "react";
|
||||
import Navbar from "react-bootstrap/Navbar";
|
||||
import SettingsModal from "../../modals/SettingsModal/SettingsModal";
|
||||
|
||||
const NavigationBar = () => {
|
||||
return (
|
||||
<div
|
||||
expand="lg"
|
||||
className="d-flex align-items-center justify-content-between"
|
||||
style={{ padding: "1rem 1rem 0 1rem" }}
|
||||
>
|
||||
<Navbar.Brand href="/">Wallet</Navbar.Brand>
|
||||
<SettingsModal />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default NavigationBar;
|
||||
Whitespace-only changes.
@@ -0,0 +1,60 @@
|
||||
import getDateString from "../../logic/getDateString";
|
||||
import { Button } from "react-bootstrap";
|
||||
import classNames from "classnames";
|
||||
import styles from "./OperationSign.module.css";
|
||||
|
||||
const OperationSign = ({ operation }) => {
|
||||
return (
|
||||
<div className="gap-2">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={
|
||||
operation.type === "income"
|
||||
? { fontSize: "1.1rem", fontWeight: 700, color: "#2DBB4D" }
|
||||
: { fontSize: "1.1rem", fontWeight: 700 }
|
||||
}
|
||||
>
|
||||
{operation.type === "income" ? "" : "-"}
|
||||
{operation.amount} ₽
|
||||
</h3>
|
||||
<div className="text-muted small mb-1" style={{ fontSize: "0.8rem" }}>
|
||||
{operation.category}
|
||||
</div>
|
||||
{!operation.subcategory ? (
|
||||
""
|
||||
) : (
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
{operation.subcategory.title}
|
||||
</div>
|
||||
)}
|
||||
<div className="text-muted small mb-1" style={{ fontSize: "0.8rem" }}>
|
||||
{operation.note && operation.note !== ""
|
||||
? operation.note
|
||||
: "No note"}
|
||||
</div>
|
||||
</div>
|
||||
<div className="p-0 m-0" style={{ width: "100%", height: "100%" }}>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
{getDateString(operation.date)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default OperationSign;
|
||||
@@ -0,0 +1,7 @@
|
||||
.hideScrollbar {
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
}
|
||||
.hideScrollbar::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import React from "react";
|
||||
import { Form, Row, Col } from "react-bootstrap";
|
||||
import { useTheme } from "../contexts/ThemeContext";
|
||||
|
||||
const ThemeToggle = () => {
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form.Group as={Row}>
|
||||
<Form.Label column>Dark Mode</Form.Label>
|
||||
<Col className="d-flex align-items-center justify-content-end">
|
||||
<Form.Check
|
||||
type="switch"
|
||||
id="dark-mode-switch"
|
||||
checked={theme === "dark"}
|
||||
onChange={toggleTheme}
|
||||
/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ThemeToggle;
|
||||
@@ -0,0 +1,35 @@
|
||||
import React, { createContext, useState, useEffect, useContext } from "react";
|
||||
|
||||
const ThemeContext = createContext();
|
||||
|
||||
export const ThemeProvider = ({ children }) => {
|
||||
const [theme, setTheme] = useState(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
const savedTheme = localStorage.getItem("theme");
|
||||
const systemPreferDark = window.matchMedia(
|
||||
"(prefers-color-scheme: dark)",
|
||||
).matches;
|
||||
return savedTheme || (systemPreferDark ? "dark" : "light");
|
||||
}
|
||||
return "light";
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
document.body.setAttribute("data-bs-theme", theme);
|
||||
localStorage.setItem("theme", theme);
|
||||
}
|
||||
}, [theme]);
|
||||
|
||||
const toggleTheme = () => {
|
||||
setTheme((prev) => (prev === "light" ? "dark" : "light"));
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeContext.Provider value={{ theme, toggleTheme }}>
|
||||
{children}
|
||||
</ThemeContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export const useTheme = () => useContext(ThemeContext);
|
||||
@@ -0,0 +1,36 @@
|
||||
/* src/App.css */
|
||||
body[data-bs-theme="dark"] {
|
||||
background-color: #121212;
|
||||
color: #f8f9fa;
|
||||
.modal-content {
|
||||
background-color: #121212 !important;
|
||||
}
|
||||
.nav-link.active {
|
||||
background-color: #121212 !important;
|
||||
}
|
||||
}
|
||||
|
||||
body[data-bs-theme="light"] {
|
||||
background-color: #f8f9fa;
|
||||
color: #212529;
|
||||
}
|
||||
|
||||
.progress {
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.accordion-button {
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.accordion-body {
|
||||
padding: 0 10px !important;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 0 !important;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
||||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family:
|
||||
source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import "./css/index.css";
|
||||
import App from "./App";
|
||||
import reportWebVitals from "./reportWebVitals";
|
||||
import "bootstrap/dist/css/bootstrap.min.css";
|
||||
import { ThemeProvider } from "./contexts/ThemeContext";
|
||||
|
||||
const savedTheme =
|
||||
localStorage.getItem("theme") ||
|
||||
(window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||
? "dark"
|
||||
: "light");
|
||||
document.body.setAttribute("data-bs-theme", savedTheme);
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById("root"));
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<ThemeProvider>
|
||||
<App />
|
||||
</ThemeProvider>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
@@ -0,0 +1,8 @@
|
||||
const getDateString = (date) => {
|
||||
const dateData = new Date(date);
|
||||
return [
|
||||
dateData.getHours().toString().padStart(2, "0"),
|
||||
dateData.getMinutes().toString().padStart(2, "0"),
|
||||
].join(":");
|
||||
};
|
||||
export default getDateString;
|
||||
@@ -0,0 +1,70 @@
|
||||
import { useState } from "react";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
import { Modal, Button, Card, Form } from "react-bootstrap";
|
||||
import EmojiPickerButton from "../../components/EmojiPickerButton/EmojiPickerButton";
|
||||
|
||||
const AddCategoryModal = ({ variant, ...props }) => {
|
||||
const { theme } = useTheme();
|
||||
const [show, setShow] = useState(false);
|
||||
const handleClose = () => setShow(false);
|
||||
const handleShow = () => setShow(true);
|
||||
const [title, setTitle] = useState("");
|
||||
return (
|
||||
<>
|
||||
<Button variant={theme} onClick={handleShow} className="m-0" {...props}>
|
||||
New Category
|
||||
</Button>
|
||||
<Modal show={show} onHide={handleClose} fullscreen={true}>
|
||||
<Modal.Header className="d-flex align-items-center justify-content-between">
|
||||
<spacer />
|
||||
<Modal.Title>New Category</Modal.Title>
|
||||
<Button
|
||||
variant={theme}
|
||||
type="button"
|
||||
onClick={handleClose}
|
||||
style={{
|
||||
borderRadius: "50%",
|
||||
width: "30px",
|
||||
height: "30px",
|
||||
padding: "0",
|
||||
}}
|
||||
>
|
||||
✕
|
||||
</Button>
|
||||
</Modal.Header>
|
||||
<Modal.Body className="p-3">
|
||||
<div className="d-flex align-items-center justify-content-center">
|
||||
<EmojiPickerButton />
|
||||
</div>
|
||||
<Form.Control
|
||||
type="text"
|
||||
placeholder="Title"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
className="mb-3"
|
||||
/>
|
||||
<Card>
|
||||
<Card.Body>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
SUBCATEGORIES
|
||||
</div>
|
||||
<Button
|
||||
variant={"secondary"}
|
||||
onClick={() => {}}
|
||||
className="w-100 text-start mb-3"
|
||||
>
|
||||
Add subcategory
|
||||
</Button>
|
||||
<spacer />
|
||||
<Button className="w-100">Add</Button>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default AddCategoryModal;
|
||||
@@ -0,0 +1,194 @@
|
||||
import { useState } from "react";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
import {
|
||||
ListGroup,
|
||||
Modal,
|
||||
Button,
|
||||
Card,
|
||||
Form,
|
||||
Row,
|
||||
Col,
|
||||
} from "react-bootstrap";
|
||||
// import styles from "./HistoryModal.module.css";
|
||||
|
||||
const AddOperationModal = ({ variant }) => {
|
||||
const { theme } = useTheme();
|
||||
const [show, setShow] = useState(false);
|
||||
const handleClose = () => setShow(false);
|
||||
const handleShow = () => setShow(true);
|
||||
const [isIncome, setIsIncome] = useState(false);
|
||||
const [isExpense, setIsExpense] = useState(true);
|
||||
const [isNoteVisible, setIsNoteVisible] = useState(false);
|
||||
const [amount, setAmount] = useState();
|
||||
return (
|
||||
<>
|
||||
{variant ? (
|
||||
<Button variant={variant} onClick={handleShow}>
|
||||
✚
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
className="fw-bold p-0 m-0"
|
||||
variant="primary"
|
||||
style={{ borderRadius: "50%", width: "40px", height: "40px" }}
|
||||
onClick={handleShow}
|
||||
>
|
||||
✚
|
||||
</Button>
|
||||
)}
|
||||
<Modal show={show} onHide={handleClose} fullscreen={true}>
|
||||
<Modal.Header className="d-flex align-items-center justify-content-between">
|
||||
<spacer />
|
||||
<Modal.Title>Add operation</Modal.Title>
|
||||
<Button
|
||||
variant={theme}
|
||||
type="button"
|
||||
onClick={handleClose}
|
||||
style={{
|
||||
borderRadius: "50%",
|
||||
width: "30px",
|
||||
height: "30px",
|
||||
padding: "0",
|
||||
}}
|
||||
>
|
||||
✕
|
||||
</Button>
|
||||
</Modal.Header>
|
||||
<Modal.Body className="p-0">
|
||||
<div className="d-flex flex-column align-items-center justify-content-center m-2">
|
||||
<h3
|
||||
className="mb-0 fw-bolder text-start w-100"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
Amount
|
||||
</h3>
|
||||
<div className="mb-3 d-flex gap-2 w-100 m-2">
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
placeholder="-100 ₽"
|
||||
value={amount}
|
||||
onChange={(e) => setAmount(e.target.value)}
|
||||
/>
|
||||
<Button variant={theme} onClick={() => setAmount("")}>
|
||||
✕
|
||||
</Button>
|
||||
</div>
|
||||
<div className="d-flex gap-2 w-100">
|
||||
<Button
|
||||
variant={isIncome ? "primary" : theme}
|
||||
className="w-100"
|
||||
onClick={() => {
|
||||
setIsIncome(true);
|
||||
setIsExpense(false);
|
||||
}}
|
||||
>
|
||||
Income
|
||||
</Button>
|
||||
<Button
|
||||
variant={isExpense ? "primary" : theme}
|
||||
className="w-100"
|
||||
onClick={() => {
|
||||
setIsExpense(true);
|
||||
setIsIncome(false);
|
||||
}}
|
||||
>
|
||||
Expense
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column align-items-center justify-content-center m-2">
|
||||
<h3
|
||||
className="mb-0 fw-bolder text-start w-100"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
Appointment
|
||||
</h3>
|
||||
<Button variant={theme} className="w-100 mt-3">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-center align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
<Card className="m-2">
|
||||
<Card.Body>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
ADDITIONAL
|
||||
</div>
|
||||
<ListGroup>
|
||||
<ListGroup.Item>
|
||||
<Form.Group as={Row}>
|
||||
<Form.Label column>Date</Form.Label>
|
||||
<Col>
|
||||
<Form.Control type="date" />
|
||||
</Col>
|
||||
</Form.Group>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item>
|
||||
<Form.Group as={Row}>
|
||||
<Form.Label column>Tag</Form.Label>
|
||||
<Col>
|
||||
<Form.Control type="text" />
|
||||
</Col>
|
||||
</Form.Group>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item>
|
||||
<Form.Group>
|
||||
<Row>
|
||||
<Form.Label column>Note</Form.Label>
|
||||
<Col className="d-flex align-items-center justify-content-end">
|
||||
<Form.Check
|
||||
type="switch"
|
||||
value={isNoteVisible}
|
||||
onChange={() => setIsNoteVisible(!isNoteVisible)}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row
|
||||
style={{ display: isNoteVisible ? "block" : "none" }}
|
||||
className="p-2"
|
||||
>
|
||||
<Form.Control type="text" placeholder="Your note text" />
|
||||
</Row>
|
||||
</Form.Group>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item>
|
||||
<Form.Group as={Row}>
|
||||
<Form.Label column>Repeat payment</Form.Label>
|
||||
<Col className="d-flex align-items-center justify-content-end">
|
||||
<Form.Check type="switch" />
|
||||
</Col>
|
||||
</Form.Group>
|
||||
</ListGroup.Item>
|
||||
</ListGroup>
|
||||
<Button className="w-100 mt-3">Add</Button>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default AddOperationModal;
|
||||
@@ -0,0 +1,185 @@
|
||||
import { useState } from "react";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
import { Tabs, Tab, Modal, Button } from "react-bootstrap";
|
||||
import FinancialDashboard from "../../components/FinancialDashboard/FinancialDashboard";
|
||||
import AppointmentDashboard from "../../components/AppointmentDashboard/AppointmentDashboard";
|
||||
import styles from "./AnalyticsModal.module.css";
|
||||
|
||||
const AnalyticsModal = () => {
|
||||
const { theme } = useTheme();
|
||||
const [show, setShow] = useState(false);
|
||||
const handleClose = () => setShow(false);
|
||||
const handleShow = () => setShow(true);
|
||||
|
||||
// const income = 40407.17;
|
||||
const expenses = 39985.23;
|
||||
|
||||
const monthdata = [
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 141, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 2, 29, 30, 31,
|
||||
];
|
||||
|
||||
const monthMaxValue = Math.max(...monthdata);
|
||||
|
||||
const MonthChartData = {
|
||||
labels: [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"16",
|
||||
"17",
|
||||
"18",
|
||||
"19",
|
||||
"20",
|
||||
"21",
|
||||
"22",
|
||||
"23",
|
||||
"24",
|
||||
"25",
|
||||
"26",
|
||||
"27",
|
||||
"28",
|
||||
"29",
|
||||
"30",
|
||||
"31",
|
||||
],
|
||||
datasets: [
|
||||
{
|
||||
data: monthdata,
|
||||
backgroundColor: "#3576C3",
|
||||
categoryPercentage: 0.5,
|
||||
borderRadius: 3,
|
||||
responsive: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const MonthLeftCardData = {
|
||||
label: "Total for the period",
|
||||
value: expenses,
|
||||
};
|
||||
|
||||
const MonthRightCardData = {
|
||||
label: "Daily average",
|
||||
value: expenses / monthdata.length,
|
||||
};
|
||||
|
||||
const MonthChartOptions = {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
y: {
|
||||
display: false,
|
||||
beginAtZero: true,
|
||||
max: monthMaxValue * 1.1,
|
||||
},
|
||||
x: {
|
||||
grid: {
|
||||
display: false,
|
||||
drawBorder: false,
|
||||
},
|
||||
ticks: {
|
||||
color: "#6b7280",
|
||||
font: {
|
||||
size: 12,
|
||||
weight: "500",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false,
|
||||
},
|
||||
tooltip: {
|
||||
// enabled: true,
|
||||
callbacks: {
|
||||
// title: function (context) {
|
||||
// // Customize the tooltip title
|
||||
// return `${context[0].label}`;
|
||||
// },
|
||||
label: function (context) {
|
||||
// Customize the tooltip label
|
||||
let label = context.dataset.label || "";
|
||||
if (label) {
|
||||
label += ": ";
|
||||
}
|
||||
if (context.parsed.y !== null) {
|
||||
label += `${context.parsed.y} ₽`;
|
||||
}
|
||||
return label;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
variant={theme}
|
||||
className="shadow-sm p-2"
|
||||
style={{ width: "100%", borderRadius: "15px" }}
|
||||
onClick={handleShow}
|
||||
>
|
||||
Analytics
|
||||
</Button>
|
||||
|
||||
<Modal show={show} onHide={handleClose} fullscreen={true}>
|
||||
<Modal.Header className="d-flex align-items-center justify-content-between">
|
||||
<Button variant={theme} type="button" onClick={handleClose}>
|
||||
Close
|
||||
</Button>
|
||||
<Modal.Title>Analytics</Modal.Title>
|
||||
<spacer />
|
||||
</Modal.Header>
|
||||
<Modal.Body style={{ paddingLeft: "0", paddingRight: "0" }}>
|
||||
<Tabs defaultActiveKey="Expenses" id="analytics-tabs">
|
||||
<Tab eventKey="Incomes" title="Incomes"></Tab>
|
||||
<Tab eventKey="Expenses" title="Expenses" style={{ padding: "0" }}>
|
||||
<div className="d-flex mt-2 justify-content-center">
|
||||
<div className="d-flex flex-column p-0 justify-content-center align-items-center w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
July 2025
|
||||
</h3>
|
||||
<div
|
||||
className="d-flex text-muted small mb-0"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Period: month
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr className="mt-1" />
|
||||
<div className={styles.scrollableContent}>
|
||||
<FinancialDashboard
|
||||
chartData={MonthChartData}
|
||||
chartOptions={MonthChartOptions}
|
||||
maxValue={monthMaxValue}
|
||||
LeftCardData={MonthLeftCardData}
|
||||
RightCardData={MonthRightCardData}
|
||||
/>
|
||||
<AppointmentDashboard className="m-3" />
|
||||
</div>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default AnalyticsModal;
|
||||
@@ -0,0 +1,11 @@
|
||||
.scrollableContent {
|
||||
height: calc(100vh - 220px);
|
||||
bottom: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.scrollableContent {
|
||||
height: calc(100vh - 280px);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
import { useEffect, useState, useMemo, useCallback } from "react";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
import {
|
||||
Modal,
|
||||
Button,
|
||||
Form,
|
||||
InputGroup,
|
||||
Tabs,
|
||||
Tab,
|
||||
Dropdown,
|
||||
DropdownButton,
|
||||
} from "react-bootstrap";
|
||||
import styles from "./CategoriesModal.module.css";
|
||||
import CategorySign from "../../components/CategorySign/CategorySign";
|
||||
import AddCategoryModal from "../../modals/AddCategoryModal/AddCategoryModal";
|
||||
import fetchCategories from "../../category/GetAllCategories";
|
||||
|
||||
const CategoriesModal = ({ variant }) => {
|
||||
let [categories, setCategories] = useState([]);
|
||||
const { theme } = useTheme();
|
||||
const [show, setShow] = useState(false);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const handleClose = () => setShow(false);
|
||||
const handleShow = () => setShow(true);
|
||||
useEffect(() => {
|
||||
fetchCategories().then((data) => {
|
||||
setCategories(data);
|
||||
console.log(data);
|
||||
});
|
||||
}, []);
|
||||
const filteredCategories = useMemo(() => {
|
||||
if (!searchTerm) return categories;
|
||||
const term = searchTerm.toLowerCase();
|
||||
return categories.filter((category) =>
|
||||
category.title.toLowerCase().includes(term),
|
||||
);
|
||||
}, [categories, searchTerm]);
|
||||
const handleSearch = useCallback((e) => {
|
||||
setSearchTerm(e.target.value);
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
variant={theme}
|
||||
onClick={handleShow}
|
||||
className="w-100 d-flex justify-content-between"
|
||||
>
|
||||
<div>© Categories</div>
|
||||
<div>❯</div>
|
||||
</Button>
|
||||
<Modal show={show} onHide={handleClose} fullscreen={true}>
|
||||
<Modal.Header>
|
||||
<div className="d-flex flex-column w-100 gap-2">
|
||||
<div className="d-flex align-items-center justify-content-between">
|
||||
<Button
|
||||
variant={theme}
|
||||
onClick={handleClose}
|
||||
className="d-flex justify-content-between gap-2"
|
||||
>
|
||||
<div style={{ transform: "rotate(180deg)" }}>❯</div>
|
||||
<div>Settings</div>
|
||||
</Button>
|
||||
<Modal.Title>Categories</Modal.Title>
|
||||
<spacer />
|
||||
<DropdownButton title="☰" variant={theme} drop="start">
|
||||
<Dropdown.Item className="p-0">
|
||||
<AddCategoryModal
|
||||
className="w-100"
|
||||
style={{ paddingLeft: "0" }}
|
||||
/>
|
||||
</Dropdown.Item>
|
||||
<Dropdown.Item>Reorder</Dropdown.Item>
|
||||
</DropdownButton>
|
||||
</div>
|
||||
<InputGroup className="mb-3">
|
||||
<InputGroup.Text id="basic-addon1">
|
||||
<div style={{ transform: "rotate(90deg)" }}>☌</div>
|
||||
</InputGroup.Text>
|
||||
<Form.Control
|
||||
placeholder="Search"
|
||||
aria-label="Search"
|
||||
aria-describedby="basic-addon1"
|
||||
value={searchTerm}
|
||||
onChange={handleSearch}
|
||||
/>
|
||||
</InputGroup>
|
||||
</div>
|
||||
</Modal.Header>
|
||||
<Modal.Body className="p-0">
|
||||
<Tabs
|
||||
defaultActiveKey="Expenses"
|
||||
id="categories-tabs"
|
||||
className="nav nav-tabs"
|
||||
>
|
||||
<Tab eventKey="Incomes" title="Incomes">
|
||||
asdf
|
||||
</Tab>
|
||||
<Tab eventKey="Expenses" title="Expenses">
|
||||
<div
|
||||
className={styles.scrollableContent}
|
||||
style={{ padding: "10px" }}
|
||||
>
|
||||
{filteredCategories.map((category) => (
|
||||
<CategorySign
|
||||
key={category.id}
|
||||
icon={category.icon}
|
||||
title={category.title}
|
||||
subcategories={
|
||||
category.subcategories ? category.subcategories : []
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default CategoriesModal;
|
||||
@@ -0,0 +1,11 @@
|
||||
.scrollableContent {
|
||||
height: calc(100vh - 220px);
|
||||
bottom: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.scrollableContent {
|
||||
height: calc(100vh - 280px);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,670 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
import { ListGroup, Tabs, Tab, Modal, Button } from "react-bootstrap";
|
||||
import styles from "./HistoryModal.module.css";
|
||||
import AddOperationModal from "../AddOperationModal/AddOperationModal";
|
||||
import GetAllOperation from "../../operation/GetAllOperation";
|
||||
import OperationSign from "../../components/OperationSign/OperationSign";
|
||||
|
||||
const HistoryModal = () => {
|
||||
const { theme } = useTheme();
|
||||
const [show, setShow] = useState(false);
|
||||
const handleClose = () => setShow(false);
|
||||
const handleShow = () => setShow(true);
|
||||
const [operations, setOperations] = useState([]);
|
||||
useEffect(() => {
|
||||
GetAllOperation().then((data) => {
|
||||
console.log(data);
|
||||
setOperations(data);
|
||||
});
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
variant={theme}
|
||||
className="shadow-sm p-2"
|
||||
style={{ width: "100%", borderRadius: "15px" }}
|
||||
onClick={handleShow}
|
||||
>
|
||||
History
|
||||
</Button>
|
||||
|
||||
<Modal show={show} onHide={handleClose} fullscreen={true}>
|
||||
<Modal.Header className="d-flex align-items-center justify-content-between">
|
||||
<Button variant={theme} type="button" onClick={handleClose}>
|
||||
Close
|
||||
</Button>
|
||||
<Modal.Title>History</Modal.Title>
|
||||
<AddOperationModal variant={theme} />
|
||||
{/* <Button variant={theme}>+</Button> */}
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
<Tabs defaultActiveKey="D" id="history-tabs">
|
||||
<Tab
|
||||
eventKey="D"
|
||||
title="D"
|
||||
className="pt-2 pb-2"
|
||||
// style={{ maxHeight: "calc(100vh - 200px)", overflowY: "auto" }}
|
||||
>
|
||||
<div className={styles.scrollableContent}>
|
||||
{operations.map((operation) => {
|
||||
return (
|
||||
<ListGroup className="mb-3 mt-0">
|
||||
<ListGroup.Item className="p-0">
|
||||
<OperationSign operation={operation} />
|
||||
</ListGroup.Item>
|
||||
</ListGroup>
|
||||
);
|
||||
})}
|
||||
{/* <div className="d-flex m-1">
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
25 Jul 2025
|
||||
</h3>
|
||||
<div
|
||||
className="d-flex text-muted small mb-1 w-100"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
<div className="w-100">
|
||||
Income: <b>0,00 ₽</b>
|
||||
</div>
|
||||
<div className="w-100 text-end">
|
||||
Expense: <b>0,00 ₽</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ListGroup className="mb-3 mt-0">
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>🗼</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{
|
||||
fontSize: "1.1rem",
|
||||
fontWeight: 700,
|
||||
color: "#2DBB4D",
|
||||
}}
|
||||
>
|
||||
18000 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
</ListGroup>
|
||||
<div className="d-flex m-1">
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
25 Jul 2025
|
||||
</h3>
|
||||
<div
|
||||
className="d-flex text-muted small mb-1 w-100"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
<div className="w-100">
|
||||
Income: <b>0,00 ₽</b>
|
||||
</div>
|
||||
<div className="w-100 text-end">
|
||||
Expense: <b>0,00 ₽</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ListGroup className="mb-3 mt-0">
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>🗼</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{
|
||||
fontSize: "1.1rem",
|
||||
fontWeight: 700,
|
||||
color: "#2DBB4D",
|
||||
}}
|
||||
>
|
||||
18000 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
</ListGroup>
|
||||
<div className="d-flex m-1">
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
25 Jul 2025
|
||||
</h3>
|
||||
<div
|
||||
className="d-flex text-muted small mb-1 w-100"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
<div className="w-100">
|
||||
Income: <b>0,00 ₽</b>
|
||||
</div>
|
||||
<div className="w-100 text-end">
|
||||
Expense: <b>0,00 ₽</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ListGroup className="mb-3 mt-0">
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>🗼</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{
|
||||
fontSize: "1.1rem",
|
||||
fontWeight: 700,
|
||||
color: "#2DBB4D",
|
||||
}}
|
||||
>
|
||||
18000 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
</ListGroup>
|
||||
<div className="d-flex m-1">
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
25 Jul 2025
|
||||
</h3>
|
||||
<div
|
||||
className="d-flex text-muted small mb-1 w-100"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
<div className="w-100">
|
||||
Income: <b>0,00 ₽</b>
|
||||
</div>
|
||||
<div className="w-100 text-end">
|
||||
Expense: <b>0,00 ₽</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ListGroup className="mb-3 mt-0">
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>🗼</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{
|
||||
fontSize: "1.1rem",
|
||||
fontWeight: 700,
|
||||
color: "#2DBB4D",
|
||||
}}
|
||||
>
|
||||
18000 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item>
|
||||
<ListGroup.Item className="p-0">
|
||||
<div className="d-flex flex-row gap-3 p-2">
|
||||
<div
|
||||
className="p-2 justify-content-start align-items-start d-flex flex-column"
|
||||
style={{ fontSize: "30px" }}
|
||||
>
|
||||
<div>😀</div>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 justify-content-start align-items-start w-100">
|
||||
<h3
|
||||
className="mb-0 fw-bolder"
|
||||
style={{ fontSize: "1.1rem", fontWeight: 700 }}
|
||||
>
|
||||
-63.00 ₽
|
||||
</h3>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Transport
|
||||
</div>
|
||||
<div
|
||||
className="text-muted small mb-1"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
Note
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="p-0 m-0"
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
>
|
||||
<div
|
||||
className="text-muted small mb-1 text-end"
|
||||
style={{ fontSize: "0.8rem" }}
|
||||
>
|
||||
09:14
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListGroup.Item> */}
|
||||
{/* </ListGroup> */}
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab eventKey="W" title="W" className="pt-2 pb-2"></Tab>
|
||||
<Tab eventKey="M" title="M" className="pt-2 pb-2"></Tab>
|
||||
<Tab eventKey="Y" title="Y" className="pt-2 pb-2"></Tab>
|
||||
</Tabs>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default HistoryModal;
|
||||
@@ -0,0 +1,10 @@
|
||||
.scrollableContent {
|
||||
height: calc(100vh - 220px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.scrollableContent {
|
||||
height: calc(100vh - 240px);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { useState } from "react";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
import { ListGroup, Modal, Button } from "react-bootstrap";
|
||||
import ThemeToggle from "../../components/ThemeToggle";
|
||||
import CategoriesModal from "../../modals/CategoriesModal/CategoriesModal";
|
||||
|
||||
const SettingsModal = () => {
|
||||
const { theme } = useTheme();
|
||||
const [show, setShow] = useState(false);
|
||||
const handleClose = () => setShow(false);
|
||||
const handleShow = () => setShow(true);
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
className="fw-bold p-0 m-0"
|
||||
variant={theme}
|
||||
style={{ borderRadius: "50%", width: "40px", height: "40px" }}
|
||||
onClick={handleShow}
|
||||
>
|
||||
⚙
|
||||
</Button>
|
||||
|
||||
<Modal show={show} onHide={handleClose} fullscreen={true}>
|
||||
<Modal.Header className="d-flex align-items-center justify-content-between">
|
||||
<Modal.Title>
|
||||
<h1>Settings</h1>
|
||||
</Modal.Title>
|
||||
<Button
|
||||
variant={theme}
|
||||
type="button"
|
||||
onClick={handleClose}
|
||||
style={{
|
||||
borderRadius: "50%",
|
||||
width: "30px",
|
||||
height: "30px",
|
||||
padding: "0",
|
||||
}}
|
||||
>
|
||||
✕
|
||||
</Button>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
<h3 className="text-muted small m-1" style={{ fontSize: "0.8rem" }}>
|
||||
DATA
|
||||
</h3>
|
||||
<ListGroup>
|
||||
<ListGroup.Item className="p-0">
|
||||
<CategoriesModal />
|
||||
</ListGroup.Item>
|
||||
</ListGroup>
|
||||
<h3 className="text-muted small m-1" style={{ fontSize: "0.8rem" }}>
|
||||
APPLICATION
|
||||
</h3>
|
||||
<ListGroup>
|
||||
<ListGroup.Item>
|
||||
<ThemeToggle />
|
||||
</ListGroup.Item>
|
||||
</ListGroup>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default SettingsModal;
|
||||
@@ -0,0 +1,10 @@
|
||||
.scrollableContent {
|
||||
height: calc(100vh - 220px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.scrollableContent {
|
||||
height: calc(100vh - 240px);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import routes from "../routes";
|
||||
|
||||
const GetAllOperation = async () => {
|
||||
const response = await fetch(routes.operations);
|
||||
const data = await response.json();
|
||||
return data;
|
||||
};
|
||||
|
||||
export default GetAllOperation;
|
||||
@@ -0,0 +1,110 @@
|
||||
import FinancialDashboard from "../components/FinancialDashboard/FinancialDashboard";
|
||||
import { Row, Col } from "react-bootstrap";
|
||||
import HistoryModal from "../modals/HistoryModal/HistoryModal";
|
||||
import AnalyticsModal from "../modals/AnalyticsModal/AnalyticsModal";
|
||||
import BalanceBlock from "../components/BalanceBlock/BalanceBlock";
|
||||
|
||||
const Home = () => {
|
||||
const weeklyData = [63, 63, 63, 63, 63, 63, 63];
|
||||
const weeklyData1 = [20, 80, 50, 100, 1800, 60, 90];
|
||||
const weeklyMaxValue = Math.max(...weeklyData, ...weeklyData1);
|
||||
const chartData = {
|
||||
labels: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
||||
datasets: [
|
||||
{
|
||||
data: weeklyData,
|
||||
backgroundColor: "#3576C3",
|
||||
categoryPercentage: 0.5,
|
||||
borderRadius: 3,
|
||||
responsive: true,
|
||||
},
|
||||
{
|
||||
data: weeklyData1,
|
||||
backgroundColor: "#38393F",
|
||||
categoryPercentage: 0.5,
|
||||
borderRadius: 3,
|
||||
responsive: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
const chartOptions = {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
y: {
|
||||
display: false,
|
||||
beginAtZero: true,
|
||||
max: weeklyMaxValue * 1.1,
|
||||
},
|
||||
x: {
|
||||
grid: {
|
||||
display: false,
|
||||
drawBorder: false,
|
||||
},
|
||||
ticks: {
|
||||
color: "#6b7280",
|
||||
font: {
|
||||
size: 12,
|
||||
weight: "500",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false,
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: function (context) {
|
||||
let label = context.dataset.label || "";
|
||||
if (label) {
|
||||
label += ": ";
|
||||
}
|
||||
if (context.parsed.y !== null) {
|
||||
label +=
|
||||
`${weeklyData[context.dataIndex]}₽ ` +
|
||||
`${weeklyData1[context.dataIndex]}₽`;
|
||||
}
|
||||
return label;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const income = 40407.17;
|
||||
const expenses = 39985.23;
|
||||
|
||||
const LeftCardData = {
|
||||
label: "Monthly Icome",
|
||||
value: income,
|
||||
};
|
||||
|
||||
const RightCardData = {
|
||||
label: "Monthly Expenses",
|
||||
value: expenses,
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<FinancialDashboard
|
||||
chartData={chartData}
|
||||
chartOptions={chartOptions}
|
||||
maxValue={weeklyMaxValue}
|
||||
LeftCardData={LeftCardData}
|
||||
RightCardData={RightCardData}
|
||||
/>
|
||||
<Row className="m-1">
|
||||
<Col>
|
||||
<AnalyticsModal />
|
||||
</Col>
|
||||
<Col>
|
||||
<HistoryModal />
|
||||
</Col>
|
||||
</Row>
|
||||
<BalanceBlock />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Alert, Button } from "react-bootstrap";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
const NotFound = () => (
|
||||
<Alert variant="danger" className="text-center">
|
||||
<Alert.Heading>404 - Page Not Found</Alert.Heading>
|
||||
<p>The page you're looking for doesn't exist.</p>
|
||||
<Button as={Link} to="/" variant="outline-danger">
|
||||
Go Home
|
||||
</Button>
|
||||
</Alert>
|
||||
);
|
||||
|
||||
export default NotFound;
|
||||
@@ -0,0 +1,13 @@
|
||||
const reportWebVitals = onPerfEntry => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
||||
@@ -0,0 +1,7 @@
|
||||
const host = window.location.origin;
|
||||
const prefix = "/api";
|
||||
const routes = {
|
||||
categories: `${host}${prefix}/category`,
|
||||
operations: `${host}${prefix}/operation`,
|
||||
};
|
||||
export default routes;
|
||||
@@ -0,0 +1,5 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
Reference in new issue
Block a user