first commit - create home login and register
25
.gitignore
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
*.env
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
50
README.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# React + TypeScript + Vite
|
||||||
|
|
||||||
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||||
|
|
||||||
|
Currently, two official plugins are available:
|
||||||
|
|
||||||
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
||||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||||
|
|
||||||
|
## Expanding the ESLint configuration
|
||||||
|
|
||||||
|
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
||||||
|
|
||||||
|
- Configure the top-level `parserOptions` property like this:
|
||||||
|
|
||||||
|
```js
|
||||||
|
export default tseslint.config({
|
||||||
|
languageOptions: {
|
||||||
|
// other options...
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
|
||||||
|
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
||||||
|
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// eslint.config.js
|
||||||
|
import react from 'eslint-plugin-react'
|
||||||
|
|
||||||
|
export default tseslint.config({
|
||||||
|
// Set the react version
|
||||||
|
settings: { react: { version: '18.3' } },
|
||||||
|
plugins: {
|
||||||
|
// Add the react plugin
|
||||||
|
react,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// other rules...
|
||||||
|
// Enable its recommended rules
|
||||||
|
...react.configs.recommended.rules,
|
||||||
|
...react.configs['jsx-runtime'].rules,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
28
eslint.config.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import js from '@eslint/js'
|
||||||
|
import globals from 'globals'
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||||
|
import tseslint from 'typescript-eslint'
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
{ ignores: ['dist'] },
|
||||||
|
{
|
||||||
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
globals: globals.browser,
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
'react-hooks': reactHooks,
|
||||||
|
'react-refresh': reactRefresh,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...reactHooks.configs.recommended.rules,
|
||||||
|
'react-refresh/only-export-components': [
|
||||||
|
'warn',
|
||||||
|
{ allowConstantExport: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
16
index.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/png" href="/bell.png" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Cal Dimoni Order Manager</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
40
package.json
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"name": "command-generator-client",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite --host",
|
||||||
|
"build": "tsc -b && vite build",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@emotion/react": "^11.13.3",
|
||||||
|
"@emotion/styled": "^11.13.0",
|
||||||
|
"@mui/icons-material": "^6.1.1",
|
||||||
|
"@mui/material": "^6.1.1",
|
||||||
|
"@mui/x-date-pickers": "^7.18.0",
|
||||||
|
"cookiejs": "^2.1.3",
|
||||||
|
"dayjs": "^1.11.13",
|
||||||
|
"pocketbase": "^0.21.5",
|
||||||
|
"react": "^18.3.1",
|
||||||
|
"react-dom": "^18.3.1",
|
||||||
|
"react-hook-form": "^7.53.0",
|
||||||
|
"react-router-dom": "^6.26.2",
|
||||||
|
"react-toastify": "^10.0.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.9.0",
|
||||||
|
"@types/react": "^18.3.3",
|
||||||
|
"@types/react-dom": "^18.3.0",
|
||||||
|
"@vitejs/plugin-react": "^4.3.1",
|
||||||
|
"eslint": "^9.9.0",
|
||||||
|
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.9",
|
||||||
|
"globals": "^15.9.0",
|
||||||
|
"typescript": "^5.5.3",
|
||||||
|
"typescript-eslint": "^8.0.1",
|
||||||
|
"vite": "^5.4.1"
|
||||||
|
}
|
||||||
|
}
|
2472
pnpm-lock.yaml
Normal file
BIN
public/bg-0.jpg
Normal file
After Width: | Height: | Size: 418 KiB |
BIN
public/bg-50.jpg
Normal file
After Width: | Height: | Size: 761 KiB |
BIN
public/bg-70.jpg
Normal file
After Width: | Height: | Size: 642 KiB |
BIN
public/bg.jpg
Normal file
After Width: | Height: | Size: 642 KiB |
BIN
public/contact-form.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/logo.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
public/pic01.jpg
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
public/pic02.jpg
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
public/pic03.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
public/pic04.jpg
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
public/pic05.jpg
Normal file
After Width: | Height: | Size: 2.8 KiB |
1
public/react.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
After Width: | Height: | Size: 4.0 KiB |
1
public/vite.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
After Width: | Height: | Size: 1.5 KiB |
31
src/App.tsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
||||||
|
import { PrivateRoutes, PublicRoutes } from './config/routes';
|
||||||
|
import Dashboard from './pages/dashboard/Dashboard';
|
||||||
|
import Login from './pages/login/Login';
|
||||||
|
import AuthGuard from './guards/AuthGuard';
|
||||||
|
import NotFound from './pages/NotFound';
|
||||||
|
import { ToastContainer } from 'react-toastify';
|
||||||
|
|
||||||
|
import Home from './pages/home/Home';
|
||||||
|
import Register from './pages/register/Register';
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
return (
|
||||||
|
<BrowserRouter>
|
||||||
|
<Routes>
|
||||||
|
<Route path={PublicRoutes.LOGIN} element={<Login />} />
|
||||||
|
<Route path={PublicRoutes.REGISTER} element={<Register />} />
|
||||||
|
<Route path={PublicRoutes.HOME} element={<Home />} />
|
||||||
|
<Route element={<AuthGuard />}>
|
||||||
|
<Route path={PrivateRoutes.DASHBOARD} element={<Dashboard />} />
|
||||||
|
{/* <Route path={PrivateRoutes.FAULTS} element={<Faults />} /> */}
|
||||||
|
<Route path='*' element={<NotFound />} />
|
||||||
|
</Route>
|
||||||
|
<Route path='*' element={<NotFound />} />
|
||||||
|
</Routes>
|
||||||
|
<ToastContainer theme='dark' />
|
||||||
|
</BrowserRouter>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
BIN
src/assets/bg-0.jpg
Normal file
After Width: | Height: | Size: 418 KiB |
BIN
src/assets/bg-50.jpg
Normal file
After Width: | Height: | Size: 761 KiB |
BIN
src/assets/bg-70.jpg
Normal file
After Width: | Height: | Size: 642 KiB |
BIN
src/assets/bg.jpg
Normal file
After Width: | Height: | Size: 642 KiB |
BIN
src/assets/logo.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
src/assets/pic01.jpg
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
src/assets/pic02.jpg
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
src/assets/pic03.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
src/assets/pic04.jpg
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
src/assets/pic05.jpg
Normal file
After Width: | Height: | Size: 2.8 KiB |
1
src/assets/react.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
After Width: | Height: | Size: 4.0 KiB |
22
src/components/layout/Layout.tsx
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { FC } from 'react';
|
||||||
|
// import { Sidebar } from './sidebar/Sidebar';
|
||||||
|
import { Box, Toolbar } from '@mui/material';
|
||||||
|
|
||||||
|
interface LayoutProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
// const drawerWidth = 240;
|
||||||
|
|
||||||
|
export const Layout: FC<LayoutProps> = ({ children }) => {
|
||||||
|
return (
|
||||||
|
<Box sx={{ display: 'flex' }}>
|
||||||
|
{/* <Sidebar drawerWidth={drawerWidth} /> */}
|
||||||
|
|
||||||
|
<Box component='main' sx={{ flexGrow: 1, px: 3, py: 2 }}>
|
||||||
|
<Toolbar />
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
104
src/components/navbar/Navbar.tsx
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import AppBar from '@mui/material/AppBar';
|
||||||
|
import Box from '@mui/material/Box';
|
||||||
|
import Toolbar from '@mui/material/Toolbar';
|
||||||
|
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
|
||||||
|
import Container from '@mui/material/Container';
|
||||||
|
import Avatar from '@mui/material/Avatar';
|
||||||
|
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
const pages = [
|
||||||
|
{ name: 'Login', path: '/login' },
|
||||||
|
{ name: 'Register', path: '/register' },
|
||||||
|
];
|
||||||
|
|
||||||
|
function Navbar() {
|
||||||
|
return (
|
||||||
|
<AppBar
|
||||||
|
position='fixed'
|
||||||
|
sx={{
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0.9)',
|
||||||
|
height: 64,
|
||||||
|
transition: 'background-color 0.5s',
|
||||||
|
boxShadow: 'none',
|
||||||
|
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: '#000',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Container maxWidth='xl'>
|
||||||
|
<Toolbar
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
flexGrow: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Avatar
|
||||||
|
alt='Eledana'
|
||||||
|
sx={{ width: 24, height: 24, mr: 1 }}
|
||||||
|
src='./logo.png'
|
||||||
|
/>
|
||||||
|
<Typography
|
||||||
|
variant='h6'
|
||||||
|
noWrap
|
||||||
|
component='a'
|
||||||
|
sx={{
|
||||||
|
mr: 2,
|
||||||
|
display: { xs: 'none', md: 'flex' },
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
fontWeight: 700,
|
||||||
|
letterSpacing: '.3rem',
|
||||||
|
color: 'inherit',
|
||||||
|
textDecoration: 'none',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
ELEDANA
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
gap: 4,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{pages.map((page) => (
|
||||||
|
<Link
|
||||||
|
to={page.path}
|
||||||
|
style={{ color: 'inherit', textDecoration: 'none' }}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
variant='h6'
|
||||||
|
noWrap
|
||||||
|
component='a'
|
||||||
|
sx={{
|
||||||
|
color: 'inherit',
|
||||||
|
textDecoration: 'none',
|
||||||
|
fontSize: { xs: '1rem', md: '1.5rem' },
|
||||||
|
'&:hover': {
|
||||||
|
textDecoration: 'underline',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{page.name}
|
||||||
|
</Typography>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</Box>
|
||||||
|
</Toolbar>
|
||||||
|
</Container>
|
||||||
|
</AppBar>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default Navbar;
|
100
src/components/sidebar/Sidebar.tsx
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
import Box from '@mui/material/Box';
|
||||||
|
import SwipeableDrawer from '@mui/material/SwipeableDrawer';
|
||||||
|
import Button from '@mui/material/Button';
|
||||||
|
import List from '@mui/material/List';
|
||||||
|
import ListItem from '@mui/material/ListItem';
|
||||||
|
import ListItemButton from '@mui/material/ListItemButton';
|
||||||
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
||||||
|
import ListItemText from '@mui/material/ListItemText';
|
||||||
|
import InboxIcon from '@mui/icons-material/MoveToInbox';
|
||||||
|
import { FC, Fragment, KeyboardEvent, useState } from 'react';
|
||||||
|
import MenuIcon from '@mui/icons-material/Menu';
|
||||||
|
import GridViewIcon from '@mui/icons-material/GridView';
|
||||||
|
|
||||||
|
import { Divider } from '@mui/material';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { PrivateRoutes } from '../../config/routes';
|
||||||
|
|
||||||
|
interface SidebarProps {
|
||||||
|
drawerWidth: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Sidebar: FC<SidebarProps> = ({ drawerWidth }) => {
|
||||||
|
const [isOpen, setisOpen] = useState(false);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const list = () => (
|
||||||
|
<Box
|
||||||
|
sx={{ width: drawerWidth }}
|
||||||
|
onClick={() => setisOpen(false)}
|
||||||
|
onKeyDown={(event: KeyboardEvent) => {
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
setisOpen(false);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<List>
|
||||||
|
<ListItem
|
||||||
|
disablePadding
|
||||||
|
onClick={() => navigate(PrivateRoutes.DASHBOARD)}
|
||||||
|
sx={{
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0.08)',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemButton component='div'>
|
||||||
|
<ListItemIcon>
|
||||||
|
<GridViewIcon color='primary' />
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText
|
||||||
|
sx={{
|
||||||
|
textTransform: 'capitalize',
|
||||||
|
color: '#90caf9',
|
||||||
|
}}
|
||||||
|
primary={'Dashboard'}
|
||||||
|
/>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
<Divider />
|
||||||
|
<ListItem
|
||||||
|
disablePadding
|
||||||
|
onClick={() => navigate('/')}
|
||||||
|
sx={{
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0.08)',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemButton component='div'>
|
||||||
|
<ListItemIcon>{<InboxIcon />}</ListItemIcon>
|
||||||
|
<ListItemText
|
||||||
|
sx={{
|
||||||
|
textTransform: 'capitalize',
|
||||||
|
}}
|
||||||
|
primary={'fake menu'}
|
||||||
|
/>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
</List>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Fragment key={'left'}>
|
||||||
|
<Button onClick={() => setisOpen(!isOpen)}>
|
||||||
|
<MenuIcon />
|
||||||
|
</Button>
|
||||||
|
<SwipeableDrawer
|
||||||
|
anchor={'left'}
|
||||||
|
open={isOpen}
|
||||||
|
onClose={() => setisOpen(false)}
|
||||||
|
onOpen={() => setisOpen(true)}
|
||||||
|
>
|
||||||
|
{list()}
|
||||||
|
</SwipeableDrawer>
|
||||||
|
</Fragment>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
21
src/components/ux/Card.tsx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { styled } from '@mui/material';
|
||||||
|
import MuiCard from '@mui/material/Card';
|
||||||
|
|
||||||
|
export const Card = styled(MuiCard)(({ theme }) => ({
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignSelf: 'center',
|
||||||
|
width: '100%',
|
||||||
|
padding: theme.spacing(4),
|
||||||
|
gap: theme.spacing(2),
|
||||||
|
margin: 'auto',
|
||||||
|
[theme.breakpoints.up('sm')]: {
|
||||||
|
maxWidth: '450px',
|
||||||
|
},
|
||||||
|
boxShadow:
|
||||||
|
'hsla(220, 30%, 5%, 0.05) 0px 5px 15px 0px, hsla(220, 25%, 10%, 0.05) 0px 15px 35px -5px',
|
||||||
|
...theme.applyStyles('dark', {
|
||||||
|
boxShadow:
|
||||||
|
'hsla(220, 30%, 5%, 0.5) 0px 5px 15px 0px, hsla(220, 25%, 10%, 0.08) 0px 15px 35px -5px',
|
||||||
|
}),
|
||||||
|
}));
|
59
src/components/ux/InputText.tsx
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import { FormControl, FormLabel, TextField } from '@mui/material';
|
||||||
|
|
||||||
|
import {
|
||||||
|
FieldErrors,
|
||||||
|
FieldValues,
|
||||||
|
Path,
|
||||||
|
UseFormRegister,
|
||||||
|
} from 'react-hook-form';
|
||||||
|
|
||||||
|
interface InputTextProps<T extends FieldValues> {
|
||||||
|
register: UseFormRegister<T>;
|
||||||
|
errors?: FieldErrors<T>;
|
||||||
|
type: string;
|
||||||
|
field: Path<T>;
|
||||||
|
label: string;
|
||||||
|
helpText: string;
|
||||||
|
placeHolder?: string;
|
||||||
|
multiline?: boolean;
|
||||||
|
rows?: number;
|
||||||
|
required?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const InputText = <T extends FieldValues>({
|
||||||
|
register,
|
||||||
|
errors,
|
||||||
|
type,
|
||||||
|
field,
|
||||||
|
label,
|
||||||
|
helpText,
|
||||||
|
placeHolder,
|
||||||
|
rows,
|
||||||
|
multiline,
|
||||||
|
required,
|
||||||
|
}: InputTextProps<T>) => {
|
||||||
|
return (
|
||||||
|
<FormControl>
|
||||||
|
<FormLabel htmlFor={field}>{label}</FormLabel>
|
||||||
|
<TextField
|
||||||
|
{...register(field as Path<T>, { required: required ?? true })}
|
||||||
|
error={!!errors?.[field]}
|
||||||
|
helperText={errors?.[field] ? helpText : ''}
|
||||||
|
id={field}
|
||||||
|
type={type}
|
||||||
|
name={field}
|
||||||
|
placeholder={placeHolder}
|
||||||
|
autoFocus
|
||||||
|
required={required ?? true}
|
||||||
|
fullWidth
|
||||||
|
variant='outlined'
|
||||||
|
color={errors?.[field] ? 'error' : 'primary'}
|
||||||
|
sx={{ ariaLabel: label }}
|
||||||
|
multiline={multiline}
|
||||||
|
rows={rows}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default InputText;
|
20
src/components/ux/LoginContainer.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { Stack, styled } from '@mui/material';
|
||||||
|
|
||||||
|
export const LoginContainer = styled(Stack)(({ theme }) => ({
|
||||||
|
padding: 20,
|
||||||
|
marginTop: '10vh',
|
||||||
|
'&::before': {
|
||||||
|
content: '""',
|
||||||
|
display: 'block',
|
||||||
|
position: 'absolute',
|
||||||
|
zIndex: -1,
|
||||||
|
inset: 0,
|
||||||
|
backgroundImage:
|
||||||
|
'radial-gradient(ellipse at 50% 50%, hsl(210, 100%, 97%), hsl(0, 0%, 100%))',
|
||||||
|
backgroundRepeat: 'no-repeat',
|
||||||
|
...theme.applyStyles('dark', {
|
||||||
|
backgroundImage:
|
||||||
|
'radial-gradient(at 50% 50%, hsla(210, 100%, 16%, 0.5), hsl(220, 30%, 5%))',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}));
|
16
src/components/ux/Modal.tsx
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import Dialog from '@mui/material/Dialog';
|
||||||
|
|
||||||
|
interface ModalProps {
|
||||||
|
open: boolean;
|
||||||
|
handleClose: () => void;
|
||||||
|
children?: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Modal({ open, handleClose, children }: ModalProps) {
|
||||||
|
return (
|
||||||
|
<Dialog open={open} onClose={handleClose}>
|
||||||
|
{children}
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
16
src/config/routes.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
export const PublicRoutes = {
|
||||||
|
HOME: '/',
|
||||||
|
LOGIN: '/login',
|
||||||
|
REGISTER: '/register',
|
||||||
|
FORGOT_PASSWORD: '/forgot-password',
|
||||||
|
RESET_PASSWORD: '/reset-password',
|
||||||
|
NOT_FOUND: '/404',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const PrivateRoutes = {
|
||||||
|
DASHBOARD: '/dashboard',
|
||||||
|
FAULTS: '/faults',
|
||||||
|
USERS: '/users',
|
||||||
|
USER: '/users/:userId',
|
||||||
|
NOT_FOUND: '/404',
|
||||||
|
};
|
0
src/context/.git-geek
Normal file
9
src/guards/AuthGuard.tsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { Navigate, Outlet } from 'react-router-dom';
|
||||||
|
import { PublicRoutes } from '../config/routes';
|
||||||
|
|
||||||
|
const AuthGuard = () => {
|
||||||
|
const user = true;
|
||||||
|
return user ? <Outlet /> : <Navigate replace to={PublicRoutes.HOME} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AuthGuard;
|
0
src/hooks/gitgeek
Normal file
15
src/main.tsx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { createRoot } from 'react-dom/client';
|
||||||
|
import App from './App.tsx';
|
||||||
|
|
||||||
|
import 'react-toastify/dist/ReactToastify.css';
|
||||||
|
|
||||||
|
import { ThemeProvider } from '@emotion/react';
|
||||||
|
import { CssBaseline } from '@mui/material';
|
||||||
|
import { darkTheme } from './theme/darkTheme.tsx';
|
||||||
|
|
||||||
|
createRoot(document.getElementById('root')!).render(
|
||||||
|
<ThemeProvider theme={darkTheme}>
|
||||||
|
<CssBaseline />
|
||||||
|
<App />
|
||||||
|
</ThemeProvider>
|
||||||
|
);
|
14
src/models/user.interface.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
export interface UserResponse {
|
||||||
|
userId: string;
|
||||||
|
name: string;
|
||||||
|
email: string;
|
||||||
|
verifyEmail: boolean;
|
||||||
|
isActive: boolean;
|
||||||
|
roles: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ErrorResponse {
|
||||||
|
statusCode: number;
|
||||||
|
message: string;
|
||||||
|
error: string;
|
||||||
|
}
|
25
src/pages/NotFound.tsx
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { Box, Button, Typography } from '@mui/material';
|
||||||
|
|
||||||
|
const NotFound = () => {
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
gap: 2,
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
minHeight: '100vh',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography variant='h1' style={{ color: 'white' }}>
|
||||||
|
404
|
||||||
|
</Typography>
|
||||||
|
<Button variant='outlined' color='primary' href='/'>
|
||||||
|
Home
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default NotFound;
|
13
src/pages/dashboard/Dashboard.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Box, Container, Typography } from '@mui/material';
|
||||||
|
|
||||||
|
const Dashboard = () => {
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<Box sx={{ width: '100%', textAlign: 'center', paddingTop: 3 }}>
|
||||||
|
<Typography variant='h3'> DanaElec</Typography>
|
||||||
|
</Box>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Dashboard;
|
282
src/pages/home/Home.tsx
Normal file
@ -0,0 +1,282 @@
|
|||||||
|
import { Fragment } from 'react';
|
||||||
|
import Navbar from '../../components/navbar/Navbar';
|
||||||
|
import { Box, Typography, Divider, IconButton } from '@mui/material';
|
||||||
|
import InstagramIcon from '@mui/icons-material/Instagram';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import './styles.css';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import Modal from '../../components/ux/Modal';
|
||||||
|
const Home = () => {
|
||||||
|
const [openModal, setOpenModal] = useState(false);
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<Navbar />
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
height: '100vh',
|
||||||
|
width: '100%',
|
||||||
|
position: 'relative',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
color: '#fff',
|
||||||
|
textAlign: 'center',
|
||||||
|
px: 2,
|
||||||
|
overflow: 'hidden',
|
||||||
|
'&::before': {
|
||||||
|
content: '""',
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
backgroundImage: 'url(bg-0.jpg)',
|
||||||
|
backgroundSize: 'cover',
|
||||||
|
backgroundPosition: 'center',
|
||||||
|
backgroundRepeat: 'no-repeat',
|
||||||
|
|
||||||
|
zIndex: 1,
|
||||||
|
},
|
||||||
|
'&::after': {
|
||||||
|
content: '""',
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
||||||
|
zIndex: 2,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: 'relative',
|
||||||
|
zIndex: 3,
|
||||||
|
maxWidth: 800,
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
||||||
|
padding: 4,
|
||||||
|
borderRadius: 2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
variant='h2'
|
||||||
|
component='h1'
|
||||||
|
gutterBottom
|
||||||
|
sx={{
|
||||||
|
fontWeight: 'bold',
|
||||||
|
textShadow: '2px 2px 4px rgba(0, 0, 0, 0.7)',
|
||||||
|
fontSize: { xs: '2rem', md: '3rem' },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Electricistas Dana
|
||||||
|
</Typography>
|
||||||
|
<Divider sx={{ backgroundColor: '#fff', mb: 4 }} />
|
||||||
|
<Typography
|
||||||
|
variant='body1'
|
||||||
|
component='p'
|
||||||
|
gutterBottom
|
||||||
|
sx={{
|
||||||
|
textShadow: '1px 1px 3px rgba(0, 0, 0, 0.7)',
|
||||||
|
mb: 4,
|
||||||
|
fontSize: { xs: '1rem', md: '1.5rem' },
|
||||||
|
fontWeight: { xs: 'bold', md: 'normal' },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Coordinamos voluntarios y averías de suministro eléctrico.
|
||||||
|
</Typography>
|
||||||
|
<Link
|
||||||
|
to='https://docs.google.com/forms/d/e/1FAIpQLSc4AEd_omBLePop9-RBylFjTI-57kaBvYGiMx5nU6ggpTDYGA/viewform'
|
||||||
|
className='formLink'
|
||||||
|
target='_blank'
|
||||||
|
rel='noopener noreferrer'
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
style={{ marginRight: 4 }}
|
||||||
|
src='contact-form.png'
|
||||||
|
alt='plus'
|
||||||
|
width={25}
|
||||||
|
height={25}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
color: '#000',
|
||||||
|
textDecoration: 'none',
|
||||||
|
fontSize: { xs: '1rem', md: '1.5rem' },
|
||||||
|
fontWeight: { xs: 'bold', md: 'normal' },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Registrar Incidencia
|
||||||
|
</Typography>
|
||||||
|
</Link>
|
||||||
|
<Typography
|
||||||
|
variant='body1'
|
||||||
|
component='p'
|
||||||
|
sx={{
|
||||||
|
mt: 3,
|
||||||
|
textShadow: '1px 1px 3px rgba(0, 0, 0, 0.7)',
|
||||||
|
fontSize: { xs: '1rem', md: '1.5rem' },
|
||||||
|
fontWeight: { xs: 'bold', md: 'normal' },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Ayudamos a restablecer el servicio mínimo en las viviendas
|
||||||
|
afectadas, de forma totalmente gratuita.
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Typography
|
||||||
|
variant='body1'
|
||||||
|
component='p'
|
||||||
|
sx={{
|
||||||
|
mt: 2,
|
||||||
|
textShadow: '1px 1px 3px rgba(0, 0, 0, 0.7)',
|
||||||
|
fontSize: { xs: '1rem', md: '1.5rem' },
|
||||||
|
fontWeight: { xs: 'bold', md: 'normal' },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Indique únicamente averías eléctricas.
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant='body1'
|
||||||
|
component='p'
|
||||||
|
sx={{
|
||||||
|
mt: 1,
|
||||||
|
textShadow: '1px 1px 3px rgba(0, 0, 0, 0.7)',
|
||||||
|
fontSize: { xs: '1rem', md: '1.5rem' },
|
||||||
|
fontWeight: { xs: 'bold', md: 'normal' },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
No se atenderán avisos de otro tipo.
|
||||||
|
</Typography>
|
||||||
|
<Divider sx={{ backgroundColor: '#fff', mt: 4 }} />
|
||||||
|
<Typography
|
||||||
|
variant='button'
|
||||||
|
component='p'
|
||||||
|
onClick={() => {
|
||||||
|
setOpenModal(true);
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
mt: 3,
|
||||||
|
textShadow: '1px 1px 3px rgba(0, 0, 0, 0.7)',
|
||||||
|
fontSize: { xs: '1rem', md: '1.5rem' },
|
||||||
|
fontWeight: { xs: 'bold', md: 'normal' },
|
||||||
|
cursor: 'pointer',
|
||||||
|
'&:hover': {
|
||||||
|
textDecoration: 'underline',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
¿Quienes somos?
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Modal open={openModal} handleClose={() => setOpenModal(false)}>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
padding: { xs: 2, md: 4 },
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
color: '#414141',
|
||||||
|
borderRadius: 2,
|
||||||
|
maxWidth: 800,
|
||||||
|
margin: 'auto',
|
||||||
|
textAlign: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
variant='h1'
|
||||||
|
component='h1'
|
||||||
|
gutterBottom
|
||||||
|
sx={{
|
||||||
|
fontWeight: 'bold',
|
||||||
|
|
||||||
|
fontSize: { xs: '2rem', md: '3rem' },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
¿Quiénes somos?
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Divider sx={{ backgroundColor: '#414141', mb: 4 }} />
|
||||||
|
<Typography
|
||||||
|
variant='body1'
|
||||||
|
component='p'
|
||||||
|
gutterBottom
|
||||||
|
sx={{
|
||||||
|
mb: 4,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Somos un grupo de voluntarios electricistas comprometidos en
|
||||||
|
ofrecer apoyo eléctrico mínimo vital allí donde se necesita.
|
||||||
|
Nuestro objetivo es restablecer un servicio básico en las
|
||||||
|
viviendas afectadas para que puedan contar con luz y mantener en
|
||||||
|
funcionamiento electrodomésticos esenciales como el frigorífico.
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Typography
|
||||||
|
variant='body1'
|
||||||
|
component='p'
|
||||||
|
gutterBottom
|
||||||
|
sx={{
|
||||||
|
mb: 4,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Los usuarios pueden enviar un aviso a través de un formulario
|
||||||
|
sencillo, y nuestros voluntarios atenderán las incidencias por
|
||||||
|
zonas dentro de sus posibilidades. Damos prioridad a aquellos que
|
||||||
|
están aislados y que aún no han recibido ayuda, así como a las
|
||||||
|
personas electro-dependientes que necesitan tener máquinas en
|
||||||
|
funcionamiento para su subsistencia.
|
||||||
|
</Typography>
|
||||||
|
<Divider sx={{ backgroundColor: '#414141', mb: 4 }} />
|
||||||
|
<Typography
|
||||||
|
variant='button'
|
||||||
|
component='button'
|
||||||
|
gutterBottom
|
||||||
|
sx={{
|
||||||
|
fontWeight: { xs: 'bold', md: 'normal' },
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
border: 'none',
|
||||||
|
|
||||||
|
cursor: 'pointer',
|
||||||
|
'&:hover': {
|
||||||
|
textDecoration: 'underline',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
setOpenModal(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
cerrar
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 20,
|
||||||
|
width: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
zIndex: 3,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconButton
|
||||||
|
href='https://www.instagram.com/p/DCCjwSPAkmb/?igsh=MTh5MXAwcHljeHk0OA%3D%3D'
|
||||||
|
target='_blank'
|
||||||
|
sx={{ color: '#fff' }}
|
||||||
|
aria-label='Instagram'
|
||||||
|
>
|
||||||
|
<InstagramIcon />
|
||||||
|
</IconButton>
|
||||||
|
<Typography variant='body2' sx={{ mt: 1 }}>
|
||||||
|
© ElectricistasDana.com
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Home;
|
21
src/pages/home/styles.css
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
.formLink {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #f7ca4d;
|
||||||
|
padding: 10px 20px;
|
||||||
|
width: 50%;
|
||||||
|
margin: 0 auto;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.formLink {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.formLink:hover {
|
||||||
|
background-color: #f3d584;
|
||||||
|
}
|
73
src/pages/login/Login.tsx
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
import Box from '@mui/material/Box';
|
||||||
|
import Button from '@mui/material/Button';
|
||||||
|
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
|
||||||
|
import { Card } from '../../components/ux/Card';
|
||||||
|
import { LoginContainer } from '../../components/ux/LoginContainer';
|
||||||
|
|
||||||
|
import useLogin from './useLogin';
|
||||||
|
import InputText from '../../components/ux/InputText';
|
||||||
|
|
||||||
|
export default function Login() {
|
||||||
|
// const navigate = useNavigate();
|
||||||
|
const { handleSubmit, onSubmit, register, errors } = useLogin();
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// if (isAdmin) {
|
||||||
|
// navigate(PrivateRoutes.DASHBOARD, {
|
||||||
|
// replace: true,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LoginContainer direction='column' justifyContent='space-between'>
|
||||||
|
<Card variant='outlined'>
|
||||||
|
<Typography
|
||||||
|
component='h1'
|
||||||
|
variant='h4'
|
||||||
|
sx={{ width: '100%', fontSize: 'clamp(2rem, 10vw, 2.15rem)' }}
|
||||||
|
>
|
||||||
|
Login
|
||||||
|
</Typography>
|
||||||
|
<Box
|
||||||
|
component='form'
|
||||||
|
onSubmit={handleSubmit(onSubmit)}
|
||||||
|
noValidate
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
width: '100%',
|
||||||
|
gap: 2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<InputText
|
||||||
|
register={register}
|
||||||
|
errors={errors}
|
||||||
|
type='email'
|
||||||
|
field='email'
|
||||||
|
label='Email'
|
||||||
|
helpText='Email is required'
|
||||||
|
placeHolder='Enter your email'
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputText
|
||||||
|
register={register}
|
||||||
|
errors={errors}
|
||||||
|
type='password'
|
||||||
|
field='password'
|
||||||
|
label='Password'
|
||||||
|
helpText='Password is required'
|
||||||
|
placeHolder='••••••'
|
||||||
|
/>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<Button type='submit' fullWidth variant='contained'>
|
||||||
|
Sign in
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Card>
|
||||||
|
</LoginContainer>
|
||||||
|
);
|
||||||
|
}
|
42
src/pages/login/useLogin.tsx
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { FieldValues, SubmitHandler, useForm } from 'react-hook-form';
|
||||||
|
import { login, LoginResponse } from '../../services';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
import { PrivateRoutes } from '../../config/routes';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
interface Inputs extends FieldValues {
|
||||||
|
email: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const useLogin = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const {
|
||||||
|
register,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { errors },
|
||||||
|
} = useForm<Inputs>();
|
||||||
|
|
||||||
|
const onSubmit: SubmitHandler<Inputs> = async (data) => {
|
||||||
|
const response: LoginResponse = await login(data.email, data.password);
|
||||||
|
|
||||||
|
if (response.status === 200) {
|
||||||
|
toast.success('Login successful');
|
||||||
|
|
||||||
|
navigate(PrivateRoutes.DASHBOARD, {
|
||||||
|
replace: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toast.error('Login failed');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
onSubmit,
|
||||||
|
register,
|
||||||
|
handleSubmit,
|
||||||
|
errors,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useLogin;
|
74
src/pages/register/Register.tsx
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import Box from '@mui/material/Box';
|
||||||
|
import Button from '@mui/material/Button';
|
||||||
|
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
|
||||||
|
import { Card } from '../../components/ux/Card';
|
||||||
|
import { LoginContainer } from '../../components/ux/LoginContainer';
|
||||||
|
|
||||||
|
import InputText from '../../components/ux/InputText';
|
||||||
|
import useRegister from './useRegister';
|
||||||
|
|
||||||
|
export default function Register() {
|
||||||
|
const { handleSubmit, onSubmit, register, errors } = useRegister();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LoginContainer direction='column' justifyContent='space-between'>
|
||||||
|
<Card variant='outlined'>
|
||||||
|
<Typography
|
||||||
|
component='h1'
|
||||||
|
variant='h4'
|
||||||
|
sx={{ width: '100%', fontSize: 'clamp(2rem, 10vw, 2.15rem)' }}
|
||||||
|
>
|
||||||
|
Register
|
||||||
|
</Typography>
|
||||||
|
<Box
|
||||||
|
component='form'
|
||||||
|
onSubmit={handleSubmit(onSubmit)}
|
||||||
|
noValidate
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
width: '100%',
|
||||||
|
gap: 2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<InputText
|
||||||
|
register={register}
|
||||||
|
errors={errors}
|
||||||
|
type='text'
|
||||||
|
field='name'
|
||||||
|
label='Name'
|
||||||
|
helpText='Name is required'
|
||||||
|
placeHolder='Enter your name'
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputText
|
||||||
|
register={register}
|
||||||
|
errors={errors}
|
||||||
|
type='email'
|
||||||
|
field='email'
|
||||||
|
label='Email'
|
||||||
|
helpText='Email is required'
|
||||||
|
placeHolder='Enter your email'
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputText
|
||||||
|
register={register}
|
||||||
|
errors={errors}
|
||||||
|
type='password'
|
||||||
|
field='password'
|
||||||
|
label='Password'
|
||||||
|
helpText='Password is required'
|
||||||
|
placeHolder='••••••'
|
||||||
|
/>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<Button type='submit' fullWidth variant='contained'>
|
||||||
|
Register
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Card>
|
||||||
|
</LoginContainer>
|
||||||
|
);
|
||||||
|
}
|
65
src/pages/register/useRegister.tsx
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import { FieldValues, SubmitHandler, useForm } from 'react-hook-form';
|
||||||
|
import { register as registerService, RegisterResponse } from '../../services';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
|
import { PublicRoutes } from '../../config/routes';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
interface Inputs extends FieldValues {
|
||||||
|
email: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const useRegister = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const {
|
||||||
|
register,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { errors },
|
||||||
|
} = useForm<Inputs>();
|
||||||
|
|
||||||
|
const onSubmit: SubmitHandler<Inputs> = async (data) => {
|
||||||
|
const response: RegisterResponse = await registerService(
|
||||||
|
data.email,
|
||||||
|
data.password,
|
||||||
|
data.name
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.code === 500) {
|
||||||
|
toast.error('Server error');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.code !== 200) {
|
||||||
|
const errorMessages = [];
|
||||||
|
|
||||||
|
if (response.data?.data?.password?.message) {
|
||||||
|
errorMessages.push(`Password: ${response.data.data.password.message}`);
|
||||||
|
}
|
||||||
|
if (response.data?.data?.email?.message) {
|
||||||
|
errorMessages.push(`Email: ${response.data.data.email.message}`);
|
||||||
|
}
|
||||||
|
if (response.data?.data?.name?.message) {
|
||||||
|
errorMessages.push(`Name: ${response.data.data.name.message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errorMessage = errorMessages.join(' | ');
|
||||||
|
toast.error(errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.code === 200) {
|
||||||
|
toast.info(response.message);
|
||||||
|
navigate(PublicRoutes.LOGIN, {
|
||||||
|
replace: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
onSubmit,
|
||||||
|
register,
|
||||||
|
handleSubmit,
|
||||||
|
errors,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useRegister;
|
2
src/services/auth/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './login';
|
||||||
|
export * from './register';
|
62
src/services/auth/login.ts
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
const pb = new PocketBase(import.meta.env.VITE_BASE_URL_API);
|
||||||
|
|
||||||
|
export interface LoginResponse {
|
||||||
|
record: {
|
||||||
|
avatar: string;
|
||||||
|
email: string;
|
||||||
|
emailVisibility: false;
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
verified: false;
|
||||||
|
};
|
||||||
|
token: string;
|
||||||
|
status: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const login = async (
|
||||||
|
email: string,
|
||||||
|
password: string
|
||||||
|
): Promise<LoginResponse> => {
|
||||||
|
const collection = 'users';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const authData = await pb
|
||||||
|
.collection(collection)
|
||||||
|
.authWithPassword(email, password);
|
||||||
|
|
||||||
|
document.cookie = pb.authStore.exportToCookie({
|
||||||
|
maxAge: 3600000,
|
||||||
|
httpOnly: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
pb.authStore.clear();
|
||||||
|
return {
|
||||||
|
record: {
|
||||||
|
avatar: authData.record.avatar,
|
||||||
|
email: authData.record.email,
|
||||||
|
emailVisibility: authData.record.emailVisibility,
|
||||||
|
id: authData.record.id,
|
||||||
|
name: authData.record.name,
|
||||||
|
verified: authData.record.verified,
|
||||||
|
},
|
||||||
|
token: authData.token,
|
||||||
|
status: 200,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
const err = error as { status: number };
|
||||||
|
return {
|
||||||
|
record: {
|
||||||
|
avatar: '',
|
||||||
|
email: '',
|
||||||
|
emailVisibility: false,
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
verified: false,
|
||||||
|
},
|
||||||
|
token: '',
|
||||||
|
status: err.status,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
45
src/services/auth/register.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
const pb = new PocketBase(import.meta.env.VITE_BASE_URL_API);
|
||||||
|
|
||||||
|
export interface RegisterResponse {
|
||||||
|
code: number;
|
||||||
|
message: string;
|
||||||
|
data: any;
|
||||||
|
}
|
||||||
|
export const register = async (
|
||||||
|
email: string,
|
||||||
|
password: string,
|
||||||
|
name: string
|
||||||
|
): Promise<RegisterResponse> => {
|
||||||
|
const collection = 'users';
|
||||||
|
try {
|
||||||
|
const response = await pb.collection(collection).create({
|
||||||
|
email: email,
|
||||||
|
password: password,
|
||||||
|
passwordConfirm: password,
|
||||||
|
name: name,
|
||||||
|
role: ['user'],
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
code: 200,
|
||||||
|
message: 'Registro exitoso',
|
||||||
|
data: response,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error al registrar:', error);
|
||||||
|
const errorResponse = error as {
|
||||||
|
status?: number;
|
||||||
|
message?: string;
|
||||||
|
data?: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
code: errorResponse.status || 400,
|
||||||
|
message: errorResponse.message || 'Error desconocido',
|
||||||
|
data: errorResponse.data || {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
1
src/services/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './auth';
|
119
src/shared/CustomIcons.tsx
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
import SvgIcon from '@mui/material/SvgIcon';
|
||||||
|
|
||||||
|
export function SitemarkIcon() {
|
||||||
|
return (
|
||||||
|
<SvgIcon sx={{ height: 21, width: 100 }}>
|
||||||
|
<svg
|
||||||
|
width={86}
|
||||||
|
height={19}
|
||||||
|
viewBox='0 0 86 19'
|
||||||
|
fill='none'
|
||||||
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill='#B4C0D3'
|
||||||
|
d='m.787 12.567 6.055-2.675 3.485 2.006.704 6.583-4.295-.035.634-4.577-.74-.422-3.625 2.817-2.218-3.697Z'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fill='#00D3AB'
|
||||||
|
d='m10.714 11.616 5.352 3.908 2.112-3.767-4.295-1.725v-.845l4.295-1.76-2.112-3.732-5.352 3.908v4.013Z'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fill='#4876EF'
|
||||||
|
d='m10.327 7.286.704-6.583-4.295.07.634 4.577-.74.422-3.66-2.816L.786 6.617l6.055 2.676 3.485-2.007Z'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fill='#4876EE'
|
||||||
|
d='M32.507 8.804v6.167h2.312v-7.86h-3.366v1.693h1.054ZM32.435 6.006c.212.22.535.33.968.33.434 0 .751-.11.953-.33.213-.23.318-.516.318-.86 0-.354-.105-.641-.318-.86-.202-.23-.52-.345-.953-.345-.433 0-.756.115-.968.344-.202.22-.303.507-.303.86 0 .345.101.632.303.861ZM24.46 14.799c.655.296 1.46.444 2.413.444.896 0 1.667-.139 2.312-.416.645-.277 1.141-.664 1.488-1.162.357-.506.535-1.094.535-1.764 0-.65-.169-1.2-.506-1.649-.328-.459-.785-.818-1.373-1.076-.587-.267-1.266-.435-2.037-.502l-.809-.071c-.481-.039-.828-.168-1.04-.388a1.08 1.08 0 0 1-.318-.774c0-.23.058-.44.173-.631.116-.201.29-.359.52-.474.241-.114.535-.172.882-.172.366 0 .67.067.91.201.053.029.104.059.15.09l.012.009.052.037c.146.111.263.243.35.395.125.21.188.444.188.703h2.311c0-.689-.159-1.286-.476-1.793-.318-.516-.776-.913-1.373-1.19-.588-.287-1.296-.43-2.124-.43-.79 0-1.474.133-2.052.4a3.131 3.131 0 0 0-1.358 1.12c-.318.487-.477 1.066-.477 1.735 0 .927.314 1.673.94 2.237.626.564 1.464.89 2.514.976l.794.071c.645.058 1.113.187 1.401.388a.899.899 0 0 1 .434.788 1.181 1.181 0 0 1-.231.717c-.154.201-.38.36-.68.474-.298.115-.669.172-1.112.172-.49 0-.89-.067-1.199-.2-.308-.144-.539-.33-.694-.56a1.375 1.375 0 0 1-.216-.746h-2.297c0 .679.168 1.281.505 1.807.337.517.834.928 1.489 1.234ZM39.977 15.07c-.8 0-1.445-.095-1.936-.286a2.03 2.03 0 0 1-1.084-.99c-.221-.469-.332-1.1-.332-1.893V8.789h-1.2V7.11h1.2V4.988h2.153V7.11h2.312V8.79h-2.312v3.198c0 .373.096.66.289.86.202.192.486.287.852.287h1.17v1.937h-1.112Z'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fill='#4876EE'
|
||||||
|
fillRule='evenodd'
|
||||||
|
d='M43.873 14.899c.52.23 1.117.344 1.791.344.665 0 1.252-.115 1.763-.344.51-.23.934-.55 1.271-.96.337-.412.564-.88.679-1.407h-2.124c-.096.24-.279.44-.549.603-.27.162-.616.244-1.04.244-.262 0-.497-.031-.704-.093a1.572 1.572 0 0 1-.423-.194 1.662 1.662 0 0 1-.636-.803 3.159 3.159 0 0 1-.163-.645h5.784v-.775a4.28 4.28 0 0 0-.463-1.98 3.686 3.686 0 0 0-1.343-1.477c-.578-.382-1.291-.574-2.139-.574-.645 0-1.223.115-1.733.345-.501.22-.92.52-1.257.903a4.178 4.178 0 0 0-.78 1.305c-.174.478-.26.98-.26 1.506v.287c0 .507.086 1.004.26 1.492.183.478.443.913.78 1.305.347.382.775.688 1.286.918Zm-.094-4.674.02-.09a2.507 2.507 0 0 1 .117-.356c.145-.354.356-.622.636-.804.104-.067.217-.123.339-.165.204-.071.433-.107.686-.107.395 0 .723.09.983.272.27.173.472.426.607.76a2.487 2.487 0 0 1 .16.603h-3.57c.006-.038.013-.076.022-.113Z'
|
||||||
|
clipRule='evenodd'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fill='#4876EE'
|
||||||
|
d='M50.476 14.97V7.112h1.835v1.98a4.54 4.54 0 0 1 .173-.603c.202-.536.506-.937.91-1.205.405-.277.9-.416 1.488-.416h.101c.598 0 1.094.139 1.489.416.404.268.707.67.91 1.205l.016.04.013.037.028-.077c.212-.536.52-.937.925-1.205.405-.277.901-.416 1.489-.416h.1c.598 0 1.098.139 1.503.416.414.268.727.67.94 1.205.211.535.317 1.205.317 2.008v4.475h-2.312v-4.604c0-.43-.115-.78-.346-1.047-.222-.268-.54-.402-.954-.402-.414 0-.742.139-.982.416-.241.268-.362.626-.362 1.076v4.56h-2.326v-4.603c0-.43-.115-.78-.346-1.047-.222-.268-.535-.402-.94-.402-.423 0-.756.139-.996.416-.241.268-.362.626-.362 1.076v4.56h-2.311Z'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fill='#4876EE'
|
||||||
|
fillRule='evenodd'
|
||||||
|
d='M68.888 13.456v1.515h1.834v-4.82c0-.726-.144-1.319-.433-1.778-.289-.468-.712-.817-1.271-1.047-.549-.23-1.228-.344-2.037-.344a27.76 27.76 0 0 0-.896.014c-.318.01-.626.024-.924.043l-.229.016a36.79 36.79 0 0 0-.552.042v1.936a81.998 81.998 0 0 1 1.733-.09 37.806 37.806 0 0 1 1.171-.025c.424 0 .732.1.925.301.193.201.289.502.289.904v.029h-1.43c-.704 0-1.325.09-1.864.272-.54.172-.959.445-1.257.818-.299.363-.448.832-.448 1.405 0 .526.12.98.361 1.363.24.373.573.66.997.86.433.201.934.302 1.502.302.55 0 1.012-.1 1.388-.302.385-.2.683-.487.895-.86a2.443 2.443 0 0 0 .228-.498l.018-.056Zm-.39-1.397v-.63h-1.445c-.405 0-.718.1-.939.3-.212.192-.318.455-.318.79 0 .157.026.3.08.429a.99.99 0 0 0 .238.345c.221.191.534.287.939.287a2.125 2.125 0 0 0 .394-.038c.106-.021.206-.052.3-.092.212-.095.385-.253.52-.473.135-.22.212-.526.23-.918Z'
|
||||||
|
clipRule='evenodd'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fill='#4876EE'
|
||||||
|
d='M72.106 14.97V7.11h1.835v2.595c.088-.74.31-1.338.665-1.791.481-.603 1.174-.904 2.08-.904h.303v1.98h-.578c-.635 0-1.127.172-1.473.516-.347.334-.52.822-.52 1.463v4.001h-2.312ZM79.92 11.298h.767l2.499 3.672h2.6l-3.169-4.51 2.606-3.35h-2.427l-2.875 3.737V4.5h-2.312v10.47h2.312v-3.672Z'
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function FacebookIcon() {
|
||||||
|
return (
|
||||||
|
<SvgIcon>
|
||||||
|
<svg
|
||||||
|
width='16'
|
||||||
|
height='16'
|
||||||
|
viewBox='0 0 16 16'
|
||||||
|
fill='none'
|
||||||
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d='M6.68 15.92C2.88 15.24 0 11.96 0 8C0 3.6 3.6 0 8 0C12.4 0 16 3.6 16 8C16 11.96 13.12 15.24 9.32 15.92L8.88 15.56H7.12L6.68 15.92Z'
|
||||||
|
fill='url(#paint0_linear_795_116)'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d='M11.12 10.2391L11.48 7.99914H9.36V6.43914C9.36 5.79914 9.6 5.31914 10.56 5.31914H11.6V3.27914C11.04 3.19914 10.4 3.11914 9.84 3.11914C8 3.11914 6.72 4.23914 6.72 6.23914V7.99914H4.72V10.2391H6.72V15.8791C7.16 15.9591 7.6 15.9991 8.04 15.9991C8.48 15.9991 8.92 15.9591 9.36 15.8791V10.2391H11.12Z'
|
||||||
|
fill='white'
|
||||||
|
/>
|
||||||
|
<defs>
|
||||||
|
<linearGradient
|
||||||
|
id='paint0_linear_795_116'
|
||||||
|
x1='8'
|
||||||
|
y1='0'
|
||||||
|
x2='8'
|
||||||
|
y2='15.9991'
|
||||||
|
gradientUnits='userSpaceOnUse'
|
||||||
|
>
|
||||||
|
<stop stopColor='#1AAFFF' />
|
||||||
|
<stop offset='1' stopColor='#0163E0' />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GoogleIcon() {
|
||||||
|
return (
|
||||||
|
<SvgIcon>
|
||||||
|
<svg
|
||||||
|
width='16'
|
||||||
|
height='16'
|
||||||
|
viewBox='0 0 16 16'
|
||||||
|
fill='none'
|
||||||
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d='M15.68 8.18182C15.68 7.61455 15.6291 7.06909 15.5345 6.54545H8V9.64364H12.3055C12.1164 10.64 11.5491 11.4836 10.6982 12.0509V14.0655H13.2945C14.8073 12.6691 15.68 10.6182 15.68 8.18182Z'
|
||||||
|
fill='#4285F4'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d='M8 16C10.16 16 11.9709 15.2873 13.2945 14.0655L10.6982 12.0509C9.98545 12.5309 9.07636 12.8218 8 12.8218C5.92 12.8218 4.15273 11.4182 3.52 9.52727H0.858182V11.5927C2.17455 14.2036 4.87273 16 8 16Z'
|
||||||
|
fill='#34A853'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d='M3.52 9.52C3.36 9.04 3.26545 8.53091 3.26545 8C3.26545 7.46909 3.36 6.96 3.52 6.48V4.41455H0.858182C0.312727 5.49091 0 6.70545 0 8C0 9.29455 0.312727 10.5091 0.858182 11.5855L2.93091 9.97091L3.52 9.52Z'
|
||||||
|
fill='#FBBC05'
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d='M8 3.18545C9.17818 3.18545 10.2255 3.59273 11.0618 4.37818L13.3527 2.08727C11.9636 0.792727 10.16 0 8 0C4.87273 0 2.17455 1.79636 0.858182 4.41455L3.52 6.48C4.15273 4.58909 5.92 3.18545 8 3.18545Z'
|
||||||
|
fill='#EA4335'
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
}
|
16
src/theme/darkTheme.tsx
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { createTheme } from '@mui/material';
|
||||||
|
|
||||||
|
export const darkTheme = createTheme({
|
||||||
|
palette: {
|
||||||
|
mode: 'dark',
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
MuiInputLabel: {
|
||||||
|
styleOverrides: {
|
||||||
|
root: {
|
||||||
|
color: '#fff',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
1
src/vite-env.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
24
tsconfig.app.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
1
tsconfig.app.tsbuildinfo
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/generateordermodal.tsx","./src/components/layout/layout.tsx","./src/components/order-components/order-form/orderform.tsx","./src/components/order-components/order-form/useorderform.tsx","./src/components/order-components/order-table/ordercounter.tsx","./src/components/order-components/order-table/ordertable.tsx","./src/components/order-components/order-table/ordertableheader.tsx","./src/components/sidebar/sidebar.tsx","./src/components/ux/card.tsx","./src/components/ux/inputtext.tsx","./src/components/ux/logincontainer.tsx","./src/components/ux/modal.tsx","./src/config/routes.ts","./src/context/appcontext.tsx","./src/context/ordercontext.tsx","./src/context/index.ts","./src/guards/authguard.tsx","./src/hooks/usegeneratefile.tsx","./src/models/order.interface.ts","./src/models/rice-menu.ts","./src/models/user.interface.ts","./src/pages/notfound.tsx","./src/pages/dashboard/dashboard.tsx","./src/pages/login/login.tsx","./src/pages/login/uselogin.tsx","./src/pages/orders/orders.tsx","./src/services/index.ts","./src/services/auth/index.ts","./src/services/auth/login.ts","./src/services/orders/create-order.ts","./src/services/orders/delete-order.ts","./src/services/orders/generate-file.ts","./src/services/orders/get-orders.ts","./src/services/user/get-user.ts","./src/shared/customicons.tsx","./src/theme/darktheme.tsx"],"version":"5.6.2"}
|
7
tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{ "path": "./tsconfig.app.json" },
|
||||||
|
{ "path": "./tsconfig.node.json" }
|
||||||
|
]
|
||||||
|
}
|
22
tsconfig.node.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"lib": ["ES2023"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
1
tsconfig.node.tsbuildinfo
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"root":["./vite.config.ts"],"version":"5.6.2"}
|
7
vite.config.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
})
|