убрал SCSS (пока рано)

This commit is contained in:
Андрей Дувакин 2025-02-08 19:16:47 +05:00
parent 685a052f73
commit 17c4c69ec2
6 changed files with 115 additions and 101 deletions

View File

@ -16,8 +16,7 @@
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.1.1",
"sass": "^1.84.0"
"react-router-dom": "^7.1.1"
},
"devDependencies": {
"@eslint/js": "^9.17.0",
@ -789,9 +788,11 @@
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz",
"integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"detect-libc": "^1.0.3",
"is-glob": "^4.0.3",
@ -828,11 +829,13 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -848,11 +851,13 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -868,11 +873,13 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -888,11 +895,13 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -908,11 +917,13 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -928,11 +939,13 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -948,11 +961,13 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -968,11 +983,13 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -988,11 +1005,13 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -1008,11 +1027,13 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -1028,11 +1049,13 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -1048,11 +1071,13 @@
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -1068,11 +1093,13 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"peer": true,
"engines": {
"node": ">= 10.0.0"
},
@ -2125,8 +2152,10 @@
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"fill-range": "^7.1.1"
},
@ -2215,7 +2244,10 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"readdirp": "^4.0.1"
},
@ -2450,8 +2482,10 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
"integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==",
"dev": true,
"license": "Apache-2.0",
"optional": true,
"peer": true,
"bin": {
"detect-libc": "bin/detect-libc.js"
},
@ -2960,8 +2994,10 @@
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
@ -3328,7 +3364,10 @@
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.3.tgz",
"integrity": "sha512-P8IdPQHq3lA1xVeBRi5VPqUm5HDgKnx0Ru51wZz5mjxHr5n3RWhjIpOFU7ybkUxfB+5IToy+OLaHYDBIWsv+uw==",
"license": "MIT"
"dev": true,
"license": "MIT",
"optional": true,
"peer": true
},
"node_modules/import-fresh": {
"version": "3.3.0",
@ -3510,7 +3549,7 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"devOptional": true,
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
@ -3555,7 +3594,7 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"devOptional": true,
"dev": true,
"license": "MIT",
"dependencies": {
"is-extglob": "^2.1.1"
@ -3581,8 +3620,10 @@
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": ">=0.12.0"
}
@ -3919,8 +3960,10 @@
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"braces": "^3.0.3",
"picomatch": "^2.3.1"
@ -4000,8 +4043,10 @@
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
"integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
"dev": true,
"license": "MIT",
"optional": true
"optional": true,
"peer": true
},
"node_modules/object-assign": {
"version": "4.1.1",
@ -4228,8 +4273,10 @@
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": ">=8.6"
},
@ -4999,7 +5046,10 @@
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.1.tgz",
"integrity": "sha512-h80JrZu/MHUZCyHu5ciuoI0+WxsCxzxJTILn6Fs8rxSnFPh+UVHYfeIxK1nVGugMqkfC4vJcBOYbkfkwYK0+gw==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": ">= 14.18.0"
},
@ -5190,7 +5240,10 @@
"version": "1.84.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.84.0.tgz",
"integrity": "sha512-XDAbhEPJRxi7H0SxrnOpiXFQoUJHwkR2u3Zc4el+fK/Tt5Hpzw5kkQ59qVDfvdaUq6gCrEZIbySFBM2T9DNKHg==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"chokidar": "^4.0.0",
"immutable": "^5.0.2",
@ -5392,6 +5445,7 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@ -5559,8 +5613,10 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"is-number": "^7.0.0"
},

View File

@ -18,8 +18,7 @@
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.1.1",
"sass": "^1.84.0"
"react-router-dom": "^7.1.1"
},
"devDependencies": {
"@eslint/js": "^9.17.0",

View File

@ -1,6 +1,6 @@
import { useState } from "react";
import { Layout, Menu } from "antd";
import { Outlet, useLocation, useNavigate } from "react-router-dom";
import {useState} from "react";
import {Layout, Menu} from "antd";
import {Outlet, useLocation, useNavigate} from "react-router-dom";
import {
AppstoreOutlined,
CalendarOutlined,
@ -11,30 +11,30 @@ import {
} from "@ant-design/icons";
import {useAuth} from "../AuthContext.jsx";
const { Content, Footer, Sider } = Layout;
const {Content, Footer, Sider} = Layout;
const getItem = (label, key, icon, children) => ({ key, icon, children, label });
const getItem = (label, key, icon, children) => ({key, icon, children, label});
const MainLayout = () => {
const [collapsed, setCollapsed] = useState(true);
const navigate = useNavigate();
const location = useLocation();
const { logout } = useAuth();
const {logout} = useAuth();
const menuItems = [
getItem("Главная", "/", <AppstoreOutlined />),
getItem("Приёмы", "/appointments", <CalendarOutlined />),
getItem("Линзы", "/lenses", <DatabaseOutlined />),
getItem("Пациенты", "/patients", <SolutionOutlined />),
getItem("Выдачи линз", "/dispensing", <DatabaseOutlined />),
{ type: "divider" },
getItem("Мой профиль", "profile", <UserOutlined />, [
getItem("Перейти в профиль", "/profile", <UserOutlined />),
getItem("Выйти", "logout", <LogoutOutlined />)
getItem("Главная", "/", <AppstoreOutlined/>),
getItem("Приёмы", "/appointments", <CalendarOutlined/>),
getItem("Линзы", "/lenses", <DatabaseOutlined/>),
getItem("Пациенты", "/patients", <SolutionOutlined/>),
getItem("Выдачи линз", "/dispensing", <DatabaseOutlined/>),
{type: "divider"},
getItem("Мой профиль", "profile", <UserOutlined/>, [
getItem("Перейти в профиль", "/profile", <UserOutlined/>),
getItem("Выйти", "logout", <LogoutOutlined/>)
])
];
const handleMenuClick = ({ key }) => {
const handleMenuClick = ({key}) => {
if (key === "logout") {
logout();
return;
@ -43,13 +43,13 @@ const MainLayout = () => {
};
return (
<Layout style={{ minHeight: "100vh" }}>
<Layout style={{minHeight: "100vh"}}>
<Sider collapsible collapsed={collapsed} onCollapse={setCollapsed}>
<div style={{ display: "flex", justifyContent: "center", padding: 16 }}>
<div style={{display: "flex", justifyContent: "center", padding: 16}}>
<img
src="/logo_rounded.png"
alt="Логотип"
style={{ width: collapsed ? 40 : 80, transition: "width 0.2s" }}
style={{width: collapsed ? 40 : 80, transition: "width 0.2s"}}
/>
</div>
<Menu
@ -62,13 +62,13 @@ const MainLayout = () => {
</Sider>
<Layout>
<Content style={{ margin: "0 16px" }}>
<div style={{ marginTop: 15, padding: 24, minHeight: 360, background: "#fff", borderRadius: 8 }}>
<Outlet />
<Content style={{margin: "0 16px"}}>
<div style={{marginTop: 15, padding: 24, minHeight: 360, background: "#fff", borderRadius: 8}}>
<Outlet/>
</div>
</Content>
<Footer style={{ textAlign: "center" }}>Линза+ © {new Date().getFullYear()}</Footer>
<Footer style={{textAlign: "center"}}>Линза+ © {new Date().getFullYear()}</Footer>
</Layout>
</Layout>
);

View File

@ -1,13 +1,12 @@
import { Form, Input, Button, Row, Col, Typography } from "antd";
import { useEffect, useState } from "react";
import { useAuth } from "../AuthContext.jsx";
import { useNavigate } from "react-router-dom";
import styles from "/src/styles/LoginPage.module.scss";
import {Form, Input, Button, Row, Col, Typography} from 'antd';
import {useEffect, useState} from 'react';
import {useAuth} from "../AuthContext.jsx";
import {useNavigate} from "react-router-dom";
const { Title } = Typography;
const {Title} = Typography;
const LoginPage = () => {
const { user, login } = useAuth();
const {user, login} = useAuth();
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
@ -34,24 +33,39 @@ const LoginPage = () => {
};
return (
<Row justify="center" align="middle" className={styles["login-container"]}>
<Row justify="center" align="middle" style={{minHeight: '100vh'}}>
<Col xs={24} sm={18} md={12} lg={8} xl={6}>
<div style={{padding: 20, border: '1px solid #ddd', borderRadius: 8}}>
<Title level={2} style={{textAlign: 'center'}}>Авторизация</Title>
{error && <div className={styles.error}>{error}</div>}
{error && <div style={{color: 'red', marginBottom: 15}}>{error}</div>}
<Form name="login" initialValues={{ remember: true }} onFinish={onFinish}>
<Form.Item name="login" rules={[{ required: true, message: "Пожалуйста, введите логин" }]}>
<Input placeholder="Логин" />
<Form
name="login"
initialValues={{remember: true}}
onFinish={onFinish}
>
<Form.Item
name="login"
rules={[{required: true, message: 'Пожалуйста, введите логин'}]}
>
<Input placeholder="Логин"/>
</Form.Item>
<Form.Item name="password" rules={[{ required: true, message: "Пожалуйста, введите пароль" }]}>
<Input.Password placeholder="Пароль" />
<Form.Item
name="password"
rules={[{required: true, message: 'Пожалуйста, введите пароль'}]}
>
<Input.Password placeholder="Пароль"/>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit" block loading={loading}>
<Button
type="primary"
htmlType="submit"
block
loading={loading}
>
Войти
</Button>
</Form.Item>

View File

@ -1,13 +0,0 @@
$primary-color: #2c499a;
.login-container {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
.error {
color: red;
margin-bottom: 15px;
}
}

View File

@ -1,42 +0,0 @@
// Переменные
$primary-color: #2c499a;
$footer-bg: #f1f1f1;
$menu-bg: #001529;
.layout-container {
min-height: 100vh;
}
.sider {
.logo {
display: flex;
justify-content: center;
padding: 16px;
img {
width: 40px;
transition: width 0.2s;
}
}
}
.content {
margin: 0 16px;
.content-box {
margin-top: 15px;
padding: 24px;
min-height: 360px;
background: #fff;
border-radius: 8px;
}
}
.footer {
text-align: center;
background: $footer-bg;
}
.menu {
background: $menu-bg;
}