28 Commits
Lab2 ... Mod

Author SHA1 Message Date
2475b82277 Fix fix fix fix)) 2025-09-10 23:37:57 +04:00
67506da952 Fised Name 2025-09-10 23:33:47 +04:00
394063ff0f Fixed Error 2025-09-10 23:29:08 +04:00
2db4cdbff9 Отчёт 2025-05-15 10:59:37 +04:00
1dfb65dc5e Всё роботает 2025-05-15 10:49:05 +04:00
baad7a01f6 Отчёт 2025-05-07 14:22:41 +04:00
5a0969668a Всё работает как надо 2025-05-07 13:16:36 +04:00
8946193876 Не работает map 2025-05-07 12:03:51 +04:00
200700cbb4 Создание проекта на React 2025-05-07 10:51:44 +04:00
e10fed8fc5 Отчёт 2025-05-07 10:28:26 +04:00
bc8d5ca5b0 Всё работает 2025-04-17 18:42:23 +04:00
e8309fb6cc доработки 2025-04-17 12:41:55 +04:00
f0cd1cd1f1 правки 2025-04-17 12:41:38 +04:00
7cd561e86b клиент 2025-04-16 22:13:40 +04:00
5e341c99a2 форма 2025-04-16 22:13:31 +04:00
3f1c93c1fb расширения 2025-04-16 22:12:42 +04:00
5ae0533252 Добавление отчёта 2025-03-31 18:28:08 +04:00
6e0dec30c0 Ура сайт заработал нормально! 2025-03-31 18:21:48 +04:00
6967c823fe не рабочая фигня 2025-03-28 12:33:25 +04:00
d5c005d94d bootstrap-icons 2025-03-28 11:06:17 +04:00
3ec2304b8c Bootstrap начало 2025-03-17 14:10:35 +04:00
321bf80c3c Ура vite работает нормально 2025-03-17 12:24:10 +04:00
2b2c04f2df vite не работает нормально 2025-03-14 12:30:14 +04:00
fe5e084561 Для работы vite 2025-03-14 12:08:43 +04:00
1285d4b4d2 git 2 2025-03-14 11:44:26 +04:00
2bbeb3b396 git 1 2025-03-14 11:42:06 +04:00
6613c2a696 git update 2025-03-14 11:40:08 +04:00
d19ebfaf27 Лаба 3. Инициализация npm 2025-03-14 11:26:24 +04:00
38 changed files with 7809 additions and 361 deletions

34
.gitignore vendored
View File

@@ -1,14 +1,24 @@
# ---> VisualStudioCode
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@@ -1,3 +1,12 @@
# PIbd-21_Permyakov_R.G._IP
# React + 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) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## Expanding the ESLint configuration
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.

View File

@@ -1,47 +0,0 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta lang="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<title>Контакты</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="body">
<div class="header">
<img src="logo.png" alt="Логотип УлЧУ" class="logo"/>
<div class="nameBuild">Ульяновский Частный Университет</div>
<div class="navBar">
<div class="dropDown">
<span>Перейти</span>
<ul class="navMenu">
<li><div class="navItem"><a href="info.html" target="_blank">Об университете</a></div></li>
<li><div class="navItem"><a href="Education.html" target="_blank">Образование</a></div></li>
<li><div class="navItem"><a href="StudentLive.html" target="_blank">Студенческая жизнь</a></div></li>
<li><div class="navItem"><a href="Contacts.html" target="_blank">Контакты</a></div></li>
</ul>
</div>
</div>
</div>
<h1>Список контактов:</h1>
<ul>
<li>Телефон: <strong class="numb">8-800-476-92-84</strong></li>
<li>E-mail: <strong>info@ulchu.ru</strong></li>
<li>Адрес: 432027, г. Ульяновск, ул. Северный Венец, д. 32</li>
<li>Официальный телеграмм канал: <strong>https://t.me/UlCHU</strong></li>
</ul>
<div class="footer">
<div cladd="footerItem">
<p><a href="index.html">На главную</a></p>
<p>Телефон: <strong class="numb">8-800-476-92-84</strong></p>
<p>E-mail: <strong>info@ulchu.ru</strong></p>
<P>Адрес: 432027, г. Ульяновск, ул. Северный Венец, д. 32</P>
<p>Официальный телеграмм канал: <strong>https://t.me/UlCHU</strong></p>
</div>
<div class="footerItem">
<img src="qrtg.png" />
</div>
</div>
</div>
</body>
</html>

95
database/data.json Normal file
View File

@@ -0,0 +1,95 @@
{
"news": [
{
"id": "e36d",
"name": "NEwwsses",
"bdate": "2025-05-15",
"description": "description",
"tegId": "1"
},
{
"id": "74c6",
"name": "dsdsds",
"bdate": "2025-05-14",
"description": "description",
"tegId": "2"
},
{
"0": {
"id": "e36d",
"name": "NEwwsses",
"bdate": "2025-05-15",
"description": "description",
"tegId": "1"
},
"1": {
"id": "74c6",
"name": "dsdsds",
"bdate": "2025-05-14",
"description": "description",
"tegId": "2"
},
"id": "faa8",
"name": "NEwdfjhdfhdfh",
"bdate": "2025-05-01",
"description": "Третья новость",
"tegId": "2"
},
{
"0": {
"id": "e36d",
"name": "NEwwsses",
"bdate": "2025-05-15",
"description": "description",
"tegId": "1"
},
"1": {
"id": "74c6",
"name": "dsdsds",
"bdate": "2025-05-14",
"description": "description",
"tegId": "2"
},
"2": {
"0": {
"id": "e36d",
"name": "NEwwsses",
"bdate": "2025-05-15",
"description": "description",
"tegId": "1"
},
"1": {
"id": "74c6",
"name": "dsdsds",
"bdate": "2025-05-14",
"description": "description",
"tegId": "2"
},
"id": "faa8",
"name": "NEwdfjhdfhdfh",
"bdate": "2025-05-01",
"description": "Третья новость",
"tegId": "2"
},
"id": "dba5",
"name": "wetyhfjnbfeRWTYH",
"bdate": "2025-05-15",
"description": "FGVDDEF",
"tegId": "1"
}
],
"tegs": [
{
"id": "1",
"name": "Обычно"
},
{
"id": "2",
"name": "Важно"
},
{
"id": "3",
"name": "Срочно"
}
]
}

View File

@@ -1,85 +0,0 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<title>Образование</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="body">
<div class="header">
<img src="logo.png" alt="Логотип УлЧУ" class="logo"/>
<div class="nameBuild">Ульяновский Частный Университет</div>
<div class="navBar">
<div class="dropDown">
<span>Перейти</span>
<ul class="navMenu">
<li><div class="navItem"><a href="info.html" target="_blank">Об университете</a></div></li>
<li><div class="navItem"><a href="Education.html" target="_blank">Образование</a></div></li>
<li><div class="navItem"><a href="StudentLive.html" target="_blank">Студенческая жизнь</a></div></li>
<li><div class="navItem"><a href="Contacts.html" target="_blank">Контакты</a></div></li>
</ul>
</div>
</div>
</div>
<h1>Доступные направления обучения: </h1>
<div class="educItem">
<p>Экономика и управление:</p>
<ul>
<li>Управление предприятиями</li>
<li>Маркетинг</li>
<li>Финансовый менеджмент</li>
<li>Предпринемательская деятельность</li>
</ul>
</div>
<div class="educItem">
<p>Информационные технологии:</p>
<ul>
<li>Программная инженерия</li>
<li>Кибербезопастность</li>
<li>Искуственный интелект</li>
<li>Анализ данных</li>
<li>Веб-дизайнер</li>
</ul>
</div>
<div class="educItem">
<p>Гуманитарные науки:</p>
<ul>
<li>Психология</li>
<li>Социология</li>
<li>Культурология</li>
<li>История</li>
<li>Журналист</li>
</ul>
</div>
<div class="educItem">
<p>Международные отношения и право:</p>
<ul>
<li>Правоведение</li>
<li>Диплоооматя</li>
<li>Международный бизнес</li>
</ul>
</div>
<div class="educItem">
<p>Экология и устойчивое развитие:</p>
<ul>
<li>Специалист по охране окружающей среды</li>
<li>Специалист по возобновляемым источникам энергии</li>
</ul>
</div>
<div class="footer">
<div cladd="footerItem">
<p><a href="index.html">На главную</a></p>
<p>Телефон: <strong class="numb">8-800-476-92-84</strong></p>
<p>E-mail: <strong>info@ulchu.ru</strong></p>
<P>Адрес: 432027, г. Ульяновск, ул. Северный Венец, д. 32</P>
<p>Официальный телеграмм канал: <strong>https://t.me/UlCHU</strong></p>
</div>
<div class="footerItem">
<img src="qrtg.png" />
</div>
</div>
</div>
</body>
</html>

49
eslint.config.js Normal file
View File

@@ -0,0 +1,49 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier/flat";
import pluginImport from "eslint-plugin-import";
import reactPlugin from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import globals from "globals";
import viteConfigObj from "./vite.config.js";
export default [
{ ignores: ["dist", "vite.config.js"] },
{
files: ["**/*.{js,jsx}"],
languageOptions: {
globals: globals.browser,
},
settings: {
react: {
version: "detect",
},
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
vite: {
viteConfig: viteConfigObj,
},
},
},
plugins: {
react: reactPlugin,
"react-hooks": reactHooks,
},
},
js.configs.recommended,
pluginImport.flatConfigs.recommended,
reactRefresh.configs.recommended,
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat["jsx-runtime"],
eslintConfigPrettier,
{
rules: {
...reactHooks.configs.recommended.rules,
"no-unused-vars": ["error", { varsIgnorePattern: "^[A-Z_]" }],
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
"react/prop-types": ["off"],
},
},
];

View File

@@ -1,51 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<title>Главная страница УлЧУ</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="body">
<div class="header">
<img src="logo.png" alt="Логотип УлЧУ" class="logo"/>
<div class="nameBuild">Ульяновский Частный Университет</div>
<div class="navBar">
<div class="dropDown">
<span>Перейти</span>
<ul class="navMenu">
<li><div class="navItem"><a href="info.html" target="_blank">Об университете</a></div></li>
<li><div class="navItem"><a href="Education.html" target="_blank">Образование</a></div></li>
<li><div class="navItem"><a href="StudentLive.html" target="_blank">Студенческая жизнь</a></div></li>
<li><div class="navItem"><a href="Contacts.html" target="_blank">Контакты</a></div></li>
</ul>
</div>
</div>
</div>
<h1>Новости:</h1>
<div class="news">
<div class="newsItem">новость 1</div>
<div class="newsItem">новость 2</div>
<div class="newsItem">новость 3</div>
<div class="newsItem">новость 4</div>
<div class="newsItem">новость 5</div>
<div class="newsItem">новость 6</div>
<div class="newsItem">новость 7</div>
<div class="newsItem">новость 8</div>
<div class="newsItem">новость 9</div>
</div>
<div class="footer">
<div cladd="footerItem">
<p>Телефон: <strong class="numb">8-800-476-92-84</strong></p>
<p>E-mail: <strong>info@ulchu.ru</strong></p>
<P>Адрес: 432027, г. Ульяновск, ул. Северный Венец, д. 32</P>
<p>Официальный телеграмм канал: <strong>https://t.me/UlCHU</strong></p>
</div>
<div class="footerItem">
<img src="qrtg.png" />
</div>
</div>
</div>
</body>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>УлЧУ</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>

7003
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

37
package.json Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "pibd-21-permyakov-r-g-ip",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"start": "npm-run-all --parallel vite",
"vite": "vite",
"build": "vite build",
"prod": "npm-run-all build --parallel",
"lint": "eslint ."
},
"dependencies": {
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router-dom": "^7.6.0"
},
"devDependencies": {
"http-server": "^14.1.1",
"json-server": "^1.0.0-beta.3",
"npm-run-all": "^4.1.5",
"vite": "^6.3.5",
"@vitejs/plugin-react": "^4.4.1",
"@types/react": "^19.1.4",
"@types/react-dom": "^19.1.5",
"eslint": "^9.26.0",
"@eslint/js": "^9.26.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"eslint-plugin-import": "^2.31.0",
"eslint-import-resolver-vite": "^2.1.0",
"eslint-plugin-prettier": "^5.4.0",
"eslint-config-prettier": "^10.1.5",
"globals": "^16.1.0"
}
}

View File

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 146 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

1
public/vite.svg Normal file
View 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

72
src/App.css Normal file
View File

@@ -0,0 +1,72 @@
.nav-link:active {
color: #a6a6a6;
}
#root {
display: flex;
flex-direction: column;
}
.newsItem {
display: flex;
object-fit: contain;
flex-direction: column;
background-color: #1097ec;
border: 3px solid #223843;
border-radius: 50px;
color: #223843;
width: 20vw;
height: 20vw;
min-width: 150px;
min-height: 150px;
font-size: 20px;
align-items: center;
justify-content: center;
margin: 20px;
}
.newsBoard {
display: flex;
flex-wrap: wrap;
flex-direction: row;
}
.newsItem > p {
margin: 2px auto;
text-align: center;
}
.pname {
color: #000000;
}
.ptag {
color: #ff0000;
}
.buttonsDiv {
display: flex;
flex-direction: row;
}
.input {
display: flex;
width: 20vw;
font-size: 3vh;
justify-content: space-between;
}
.card {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
align-self: center;
width: 50vw;
}
.main {
display: flex;
justify-content: center;
flex-direction: column;
}

26
src/App.jsx Normal file
View File

@@ -0,0 +1,26 @@
import { BrowserRouter, Route, Routes } from "react-router-dom"
import MainLayout from "./components/Layout/MainLayout"
import NewsPage from "./components/Pages/NewsPage"
import NewsEditPage from "./components/Pages/NewsEditPage"
import InfoPage from "./components/Pages/InfoPage"
import ContactsPage from "./components/Pages/ContactsPage"
import EducationPage from "./components/Pages/EducationPage"
import StudentLivePage from "./components/Pages/StudentLivePage"
import './App.css'
export default function App() {
return (
<BrowserRouter>
<Routes>
<Route element={<MainLayout />}>
<Route index element={<NewsPage />} />
<Route path="/news/edit/:newsId?" element={<NewsEditPage />} />
<Route path="/info" element={<InfoPage />} />
<Route path="/contacts" element={<ContactsPage />} />
<Route path="education" element={<EducationPage />} />
<Route path="/student-live" element={<StudentLivePage />} />
</Route>
</Routes>
</BrowserRouter>
)
}

View File

@@ -0,0 +1,38 @@
const URL = "http://localhost:8080/api/1.0/";
const makeRequest = async (path, params, vars, method = "GET", data = null) => {
try {
const requestParams = params ? `?${params}` : "";
const pathVariables = vars ? `/${vars}` : "";
const options = { method };
const hasBody = (method === "POST" || method === "PUT") && data;
if (hasBody) {
options.headers = { "Content-Type": "application/json;charset=utf-8" };
options.body = JSON.stringify(data);
}
const response = await fetch(`${URL}${path}${pathVariables}${requestParams}`, options);
if (!response.ok) {
throw new Error(`Response status: ${response?.status}`);
}
const json = await response.json();
console.debug(path, json);
return json;
} catch (error) {
if (error instanceof SyntaxError) {
throw new Error("There was a SyntaxError");
} else {
throw new Error("There was an error");
}
}
};
export const getAllItems = (path, params) => makeRequest(path, params);
export const getItem = (path, id) => makeRequest(path, null, id);
export const createItem = (path, data) => makeRequest(path, null, null, "POST", data);
export const updateItem = (path, id, data) => makeRequest(path, null, id, "PUT", data);
export const deleteItem = (path, id) => makeRequest(path, null, id, "DELETE");

View File

@@ -0,0 +1,26 @@
.footer{
display: flex;
flex-direction: row;
justify-content: space-around;
background-color: #223843;
border-bottom-left-radius: 50px;
border-bottom-right-radius: 50px;
padding: 20px 0px;
width: 100%;
color: #D77A61;
}
.divF {
display: flex;
flex-direction: column;
align-items: center;
margin: 5px 0px;
}
.strong {
color: rgb(76, 147, 255);
}
.fimg {
width: 200px;
}

View File

@@ -0,0 +1,18 @@
import "./Footer.css"
export default function Footer() {
return (
<footer className="footer">
<div className="divF">
<p>Телефон: <strong className="strong">8-800-476-92-84</strong></p>
<p>E-mail: <strong className="strong">info@ulchu.ru</strong></p>
<p>Адрес: 432027, г. Ульяновск, ул. Северный Венец, д. 32</p>
<p>Официальный телеграмм канал: <strong className="strong">
https://t.me/UlCHU</strong></p>
</div>
<div className="divF">
<img src="qrtg.png" className="fimg"/>
</div>
</footer>
)
}

View File

@@ -0,0 +1,42 @@
.header {
display: flex;
flex-direction: column;
background-color: #223843;
border: 0px solid #223843;
border-top-left-radius: 50px;
border-top-right-radius: 50px;
color: #D77A61;
}
.div {
display: flex;
flex-direction: row;
}
.logo {
display: block;
margin: 10px 20px;
width: 30%;
object-fit: contain;
}
.nameBuild{
display: flex;
align-self: center;
font-size: 5vw;
}
.navBar{
display: flex;
flex-direction: row;
justify-content: space-around;
background-color: #D77A61;
align-self: flex-end;
width: 100%;
height: 3vh;
align-items: center;
}
.nav-link {
color: #5bc8ff;
}

View File

@@ -0,0 +1,20 @@
import { NavLink } from "react-router-dom"
import "./Header.css"
export default function Header() {
return (
<header className="header">
<div className="div">
<img src="logo.png" alt="Логотип УлЧУ" className="logo"/>
<label className="nameBuild">Ульяновский Частный Университет</label>
</div>
<div className="navBar">
<NavLink className="nav-link" to="/">Главная</NavLink>
<NavLink className="nav-link" to="/info">Об университете</NavLink>
<NavLink className="nav-link" to="/education">Образование</NavLink>
<NavLink className="nav-link" to="/student-live">Студенческая жизнь</NavLink>
<NavLink className="nav-link" to="/contacts">Контакты</NavLink>
</div>
</header>
)
}

View File

@@ -0,0 +1,15 @@
import Header from "./Header"
import Footer from "./Footer"
import { Outlet } from "react-router-dom"
export default function MainLayout() {
return (
<>
<Header />
<main className="main">
<Outlet />
</main>
<Footer />
</>
)
}

View File

@@ -0,0 +1,36 @@
import { useEffect, useState } from "react";
import { createItem, getItem, updateItem } from "../../Api/client";
const PATH = "news";
export const useNews = (id) => {
const [news, setNews] = useState(null);
const getNews = (id) => {
return getItem(PATH, id);
};
useEffect(() => {
getNews(id).then((value) => setNews(value))
}, [])
const saveNews = async () => {
let newsId = news.id;
if (!newsId) {
await createItem(PATH, news);
} else {
await updateItem(PATH, newsId, news);
}
getNews(newsId).then((value) => setNews(value))
};
const updateNews = (key, value) => {
setNews({ ...news, [key]: value });
};
const clearNews = () => {
setNews(null);
};
return { news, updateNews, saveNews, clearNews };
};

View File

@@ -0,0 +1,12 @@
import { useEffect, useState } from "react";
import { getAllItems } from "../../Api/client";
export default function NewsTagHook() {
const [tags, setTags] = useState(null);
useEffect(() => {
getAllItems("tags").then((value) => setTags(value))
}, [])
return tags;
};

View File

@@ -0,0 +1,26 @@
import { useState, useEffect } from "react"
import { deleteItem, getAllItems } from "../../Api/client"
const PATH = "news"
export default function useNewss() {
const [news, setNews] = useState(null)
function getNews() {
return getAllItems(PATH)
}
useEffect(() => {
getNews().then((value) => setNews(value))
}, [])
async function deleteNews(id) {
if (!id) {
throw new Error("News id is not defined");
}
await deleteItem(PATH, id)
getNews().then((value) => setNews(value))
}
return { news, deleteNews }
}

View File

@@ -0,0 +1,20 @@
import { Link, useNavigate } from "react-router-dom"
import NewsBoard from "./NewsBoard/NewsBoard"
import useNewsTag from "./Hooks/NewsTagHook"
import useNewss from "./Hooks/NewssHook"
export default function News() {
const navigate = useNavigate()
const { news, deleteNews } = useNewss()
const tags = useNewsTag()
function handleUpdate(id) { navigate(`/news/edit/${id}`) }
function handleDelete(id) { deleteNews(id) }
return (
<div>
<Link to="/news/edit"><button>Добавить новость</button></Link>
<NewsBoard data={news} tags={tags} onUpdate={handleUpdate} onDelete={handleDelete} />
</div>
)
}

View File

@@ -0,0 +1,23 @@
export default function NewsBoard({ data, tags, onUpdate, onDelete}) {
const body = data?.map((news) => {
return (
<div className="newsItem" key={news.id}>
<p className="pname">{news.name}</p>
<p className="ptag">{tags?.find((tag) => tag.id === news.tagId).name}</p>
<p>{news.bdate}</p>
<p>{news.description}</p>
<div className="buttonsDiv">
<button onClick={() => onUpdate(news.id)}>Изменить</button>
<button onClick={() => onDelete(news.id)}>Удалить</button>
</div>
</div>
)
})
return (
<>
<h1>Новости:</h1>
<div className="newsBoard">{body}</div>
</>
)
}

View File

@@ -0,0 +1,78 @@
import { useParams } from "react-router-dom"
import useNewsTag from "../Hooks/NewsTagHook"
import { useNews } from "../Hooks/NewsHook"
const newsModel = {
name: ["Название", "text"],
tagId: ["Тег", "text"],
bdate: ["Дата", "date"],
description: ["Описание", "text"]
}
export default function NewsForm() {
const params = useParams()
const tags = useNewsTag()
const { news, updateNews, saveNews, clearNews } = useNews(params.newsId)
async function handleSave(event) {
event.preventDefault()
event.stopPropagation()
try {
await saveNews()
}
catch (err) {
console.log(err)
}
}
function handleChange(event) {
updateNews(event.target.name, event.target.value)
}
const inputs = Object.keys(newsModel).map((field) => {
if (field === "tagId") return
return (
<div key={field} className="input">
<label htmlFor={field}>{newsModel[field][0]}:</label>
<input
id={field}
name={field}
type={newsModel[field][1]}
value={news === null ? "" : news[field]}
onChange={handleChange}
/>
</div>
);
});
const tagOptions = tags?.map((tag) => {
return (
<option key={tag.id} value={tag.id}>
{tag.name}
</option>
);
});
return (
<form className="card" onSubmit={handleSave}>
{inputs}
<div className="input">
<label htmlFor="tagId">Тег:</label>
<select
id="tagId"
name="tagId"
value={news === null ? 0 : news.tagId}
onChange={handleChange}
>
<option value="">Выберите тег</option>
{tagOptions}
</select>
</div>
<div>
<button type="submit"> Сохранить </button>
<button type="button" onClick={() => clearNews()}> Очистить </button>
</div>
</form>
)
}

View File

@@ -0,0 +1,13 @@
export default function ContactsPage() {
return (
<>
<h1>Список контактов:</h1>
<ul>
<li>Телефон: <strong className="numb">8-800-476-92-84</strong></li>
<li>E-mail: <strong>info@ulchu.ru</strong></li>
<li>Адрес: 432027, г. Ульяновск, ул. Северный Венец, д. 32</li>
<li>Официальный телеграмм канал: <strong>https://t.me/UlCHU</strong></li>
</ul>
</>
)
}

View File

@@ -0,0 +1,52 @@
export default function EducationPage() {
return (
<>
<h1>Доступные направления обучения: </h1>
<div className="educItem">
<p>Экономика и управление:</p>
<ul>
<li>Управление предприятиями</li>
<li>Маркетинг</li>
<li>Финансовый менеджмент</li>
<li>Предпринемательская деятельность</li>
</ul>
</div>
<div className="educItem">
<p>Информационные технологии:</p>
<ul>
<li>Программная инженерия</li>
<li>Кибербезопастность</li>
<li>Искуственный интелект</li>
<li>Анализ данных</li>
<li>Веб-дизайнер</li>
</ul>
</div>
<div className="educItem">
<p>Гуманитарные науки:</p>
<ul>
<li>Психология</li>
<li>Социология</li>
<li>Культурология</li>
<li>История</li>
<li>Журналист</li>
</ul>
</div>
<div className="educItem">
<p>Международные отношения и право:</p>
<ul>
<li>Правоведение</li>
<li>Диплоооматя</li>
<li>Международный бизнес</li>
</ul>
</div>
<div className="educItem">
<p>Экология и устойчивое развитие:</p>
<ul>
<li>Специалист по охране окружающей среды</li>
<li>Специалист по возобновляемым источникам энергии</li>
</ul>
</div>
</>
)
}

View File

@@ -1,28 +1,6 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<title>Об университете</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="body">
<div class="header">
<img src="logo.png" alt="Логотип УлЧУ" class="logo"/>
<div class="nameBuild">Ульяновский Частный Университет</div>
<div class="navBar">
<div class="dropDown">
<span>Перейти</span>
<ul class="navMenu">
<li><div class="navItem"><a href="info.html" target="_blank">Об университете</a></div></li>
<li><div class="navItem"><a href="Education.html" target="_blank">Образование</a></div></li>
<li><div class="navItem"><a href="StudentLive.html" target="_blank">Студенческая жизнь</a></div></li>
<li><div class="navItem"><a href="Contacts.html" target="_blank">Контакты</a></div></li>
</ul>
</div>
</div>
</div>
export default function InfoPage() {
return (
<>
<p>
Мы стояли на пороге нового начала, когда в нашем городе возникла идея создания
Ульяновского Частного Университета. Это было время, когда образовательные учреждения
@@ -71,18 +49,6 @@
вдохновляя друг друга на новые достижения и открытия. Это только начало нашего пути, и
мы с нетерпением ждем, что принесет будущее!
</p>
<div class="footer">
<div cladd="footerItem">
<p><a href="index.html">На главную</a></p>
<p>Телефон: <strong class="numb">8-800-476-92-84</strong></p>
<p>E-mail: <strong>info@ulchu.ru</strong></p>
<P>Адрес: 432027, г. Ульяновск, ул. Северный Венец, д. 32</P>
<p>Официальный телеграмм канал: <strong>https://t.me/UlCHU</strong></p>
</div>
<div class="footerItem">
<img src="qrtg.png" />
</div>
</div>
</div>
</body>
</html>
</>
)
}

View File

@@ -0,0 +1,11 @@
import { Link } from "react-router-dom";
import NewsForm from "../News/NewsForm/NewsForm";
export default function NewsEditPage() {
return (
<>
<NewsForm />
<Link to="/"><button>Вернуться назад</button></Link>
</>
)
}

View File

@@ -0,0 +1,7 @@
import News from "../News/News"
export default function NewsPage() {
return (
<News />
)
}

View File

@@ -1,28 +1,6 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta lang="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<title>Студенческая жизнь</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="body">
<div class="header">
<img src="logo.png" alt="Логотип УлЧУ" class="logo"/>
<div class="nameBuild">Ульяновский Частный Университет</div>
<div class="navBar">
<div class="dropDown">
<span>Перейти</span>
<ul class="navMenu">
<li><div class="navItem"><a href="info.html" target="_blank">Об университете</a></div></li>
<li><div class="navItem"><a href="Education.html" target="_blank">Образование</a></div></li>
<li><div class="navItem"><a href="StudentLive.html" target="_blank">Студенческая жизнь</a></div></li>
<li><div class="navItem"><a href="Contacts.html" target="_blank">Контакты</a></div></li>
</ul>
</div>
</div>
</div>
export default function StudentLivePage() {
return (
<>
<p>
Студенты Ульяновского Частного Университета будут активно участвовать в разнообразной
деятельности, которая поможет им развивать навыки, получать практический опыт и обогащать
@@ -64,18 +42,6 @@
навыки командной работы, лидерства и критического мышления, что сделает их более
конкурентоспособными на рынке труда.
</p>
<div class="footer">
<div cladd="footerItem">
<p><a href="index.html">На главную</a></p>
<p>Телефон: <strong class="numb">8-800-476-92-84</strong></p>
<p>E-mail: <strong>info@ulchu.ru</strong></p>
<P>Адрес: 432027, г. Ульяновск, ул. Северный Венец, д. 32</P>
<p>Официальный телеграмм канал: <strong>https://t.me/UlCHU</strong></p>
</div>
<div class="footerItem">
<img src="qrtg.png" />
</div>
</div>
</div>
</body>
</html>
</>
)
}

3
src/index.css Normal file
View File

@@ -0,0 +1,3 @@
body {
background-color: #b1b1b1;
}

10
src/main.jsx Normal file
View File

@@ -0,0 +1,10 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>,
)

101
style.css
View File

@@ -1,90 +1,39 @@
body{
display: flex;
color: #D77A61;
background-color: #EFF1F3;
justify-content: center;
margin: 3px;
}
.body{
display: flex;
background-color: #DBD3D8;
border: 0px solid #DBD3D8;
border-radius: 50px;
width: 80%;
flex-direction: column;
}
.color1{
color: #DBD3D8;
}
.color2{
color: #91ff00;
}
.header{
display: flex;
background-color: #223843;
border: 0px solid #223843;
border-top-left-radius: 50px;
border-top-right-radius: 50px;
justify-content: space-between;
}
.logo{
display: block;
margin: 10px 20px;
width: 30%;
object-fit: contain;
}
.nameBuild{
display: flex;
align-self: center;
font-size: 5vw;
}
.navBar{
display: flex;
background-color: #EFF1F3;
align-self: flex-end;
margin-left: -20px;
background-color: #D77A61;
}
.dropDown{
position: relative;
.nav-link:hover{
color: #1097ec;
}
.dropDown > span{
z-index: 2;
position: relative;
cursor: pointer;
padding: 10px 30px;
font-size: 20px;
}
.navMenu{
display: none;
}
.dropDown:hover .navMenu{
display: flex;
flex-direction: column;
position: absolute;
top: 10px;
left: -40px;
z-index: 1;
}
.dropDown > ul{
list-style: none;
width: 100%;
}
.navItem{
background-color: #EFF1F3;
border-bottom: 5px solid #D77A61;
text-align: center;
padding: 20px 0px;
}
.news{
display: flex;
justify-content: space-around;
flex-wrap: wrap;
.nav-link{
color: #DBD3D8;
}
.newsItem{
@@ -102,26 +51,15 @@ body{
align-items: center;
justify-content: center;
margin: 20px;
text-align: center;
}
.footer{
display: flex;
flex-direction: row;
justify-content: space-around;
background-color: #223843;
border-bottom-left-radius: 50px;
border-bottom-right-radius: 50px;
padding: 20px 0px;
}
.footerItem{
display: flex;
align-items: center;
margin: 5px 0px;
}
.footerItem > img{
.fimg{
width: 100px;
}
@@ -130,11 +68,7 @@ body{
}
.educItem{
display: flex;
background-color: #EFF1F3;
margin: 20px;
border: 3px solid #000000;
border-radius: 50px;
}
.educItem > p{
@@ -147,11 +81,6 @@ h1{
margin-left: 20px;
}
hr{
background-color: #223843;
height: 3px;
}
strong{
text-decoration: underline;
color: #D77A61;

6
vite.config.js Normal file
View File

@@ -0,0 +1,6 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
})

Binary file not shown.

BIN
Отчёт6.docx Normal file

Binary file not shown.