lab14
BIN
lab1/home page.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
lab1/page Channel.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
lab1/page Search.png
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
lab1/page browse.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
lab1/page profile login reg.png
Normal file
After Width: | Height: | Size: 54 KiB |
20
lab4/.eslintrc.cjs
Normal file
@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: { browser: true, es2020: true },
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react/jsx-runtime',
|
||||
'plugin:react-hooks/recommended',
|
||||
],
|
||||
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
||||
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
|
||||
settings: { react: { version: '18.2' } },
|
||||
plugins: ['react-refresh'],
|
||||
rules: {
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{ allowConstantExport: true },
|
||||
],
|
||||
},
|
||||
}
|
24
lab4/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# 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/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
16
lab4/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# 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/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
|
||||
|
||||
|
||||
|
||||
npm install
|
||||
|
||||
npm install react-bootstrap
|
||||
|
||||
npm run dev
|
15
lab4/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<html lang="ru">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Streaming-video service</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root" class="h-100 d-flex flex-column"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
14
lab4/jsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"target": "ES2020",
|
||||
"jsx": "react",
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/node_modules/*"
|
||||
]
|
||||
}
|
BIN
lab4/lab4 IP.docx
Normal file
4330
lab4/package-lock.json
generated
Normal file
33
lab4/package.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "lec4",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap": "^5.3.2",
|
||||
"prop-types": "^15.8.1",
|
||||
"react": "^18.2.0",
|
||||
"react-bootstrap": "^2.9.1",
|
||||
"react-bootstrap-icons": "^1.10.3",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.15",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@vitejs/plugin-react": "^4.0.3",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.3",
|
||||
"vite": "^4.4.5"
|
||||
}
|
||||
}
|
BIN
lab4/png/StreamerLogo.png
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
lab4/png/streamer1.png
Normal file
After Width: | Height: | Size: 986 KiB |
BIN
lab4/png/streamer2.png
Normal file
After Width: | Height: | Size: 736 KiB |
BIN
lab4/png/streamer3.jpg
Normal file
After Width: | Height: | Size: 130 KiB |
BIN
lab4/png/video4.jpg
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
lab4/png/video5.jpg
Normal file
After Width: | Height: | Size: 225 KiB |
BIN
lab4/png/video6.jpg
Normal file
After Width: | Height: | Size: 192 KiB |
BIN
lab4/png/video7.jpg
Normal file
After Width: | Height: | Size: 87 KiB |
1
lab4/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 |
217
lab4/src/App.css
Normal file
@ -0,0 +1,217 @@
|
||||
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.col-md-9 {
|
||||
flex: 1;
|
||||
padding: 20px; /* Любой желаемый внутренний отступ для основного контента */
|
||||
}
|
||||
|
||||
|
||||
header nav {
|
||||
background-color: #292828;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
header nav {
|
||||
height: 64px;
|
||||
}
|
||||
container-fluid nav{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.full-page-div {
|
||||
background-color: #ececec; /* Цвет фона */
|
||||
padding: 1%; /* Внутренний отступ */
|
||||
margin: 1%; /* Внешний отступ */
|
||||
}
|
||||
|
||||
header nav a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #9c9c9c;
|
||||
height: 32px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
h4 {
|
||||
font-size: 1.5px;
|
||||
}
|
||||
/* .container{
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
}*/
|
||||
/* .container-fluid{
|
||||
height: 100vh;
|
||||
}
|
||||
.full-page-div {
|
||||
width: 100%;
|
||||
height: calc(100vh - 56px); /* 56px - высота навигационной панели (navbar)
|
||||
overflow-y: auto; Добавляет вертикальную прокрутку, если содержимое не помещается
|
||||
|
||||
} */
|
||||
.card{
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
.circle-container {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden; /* обрезаем лишнее изображение за пределами круга */
|
||||
margin: auto; /* автоматическое выравнивание по горизонтали */
|
||||
margin-top: 20px; /* опциональное выравнивание по вертикали (если нужно) */
|
||||
}
|
||||
|
||||
.circle-container img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover; /* сохраняем соотношение сторон и обрезаем изображение, чтобы оно полностью заполнило круг */
|
||||
}
|
||||
|
||||
a{
|
||||
margin-bottom: 2px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
/* .container-main {
|
||||
flex: 1;
|
||||
} */
|
||||
|
||||
.streamer-nickname {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
font-size: 26px;
|
||||
}
|
||||
.online-indicator {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
background-color: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.online-count {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
/* .sidebar {
|
||||
background-color: #f8f9fa;
|
||||
height: 100vh;
|
||||
} */
|
||||
.video-thumbnail {
|
||||
/* width: 1920px;
|
||||
height: 1080px; */
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.embed-responsive{
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 1600px;
|
||||
height: 800px;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.btn-info{
|
||||
color:rgb(22, 9, 93);
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
.card-img-top{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 500px;
|
||||
}
|
||||
.avatar-img{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 40px;
|
||||
}
|
||||
.modal-dialog img{
|
||||
max-width: 310px;
|
||||
max-height: 200px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.fa-pencil{
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
|
||||
/* #root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
transition: filter 300ms;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||
}
|
||||
|
||||
@keyframes logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
a:nth-of-type(2) .logo {
|
||||
animation: logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
} */
|
128
lab4/src/App.jsx
Normal file
@ -0,0 +1,128 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Container } from 'react-bootstrap';
|
||||
import { Outlet } from 'react-router-dom';
|
||||
import './App.css';
|
||||
import Footer from './components/footer/Footer.jsx';
|
||||
import Navigation from './components/navigation/Navigation.jsx';
|
||||
import Sidebar from './components/sidebar/Sidebar.jsx';
|
||||
|
||||
const App = ({ routes }) => {
|
||||
return (
|
||||
<>
|
||||
<Navigation routes={routes}></Navigation>
|
||||
|
||||
<Container className='flex-container container-fluid' as="main" fluid>
|
||||
<Sidebar />
|
||||
<Container className='' as="main" fluid>
|
||||
<Outlet />
|
||||
</Container>
|
||||
|
||||
</Container>
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
App.propTypes = {
|
||||
routes: PropTypes.array,
|
||||
};
|
||||
|
||||
export default App;
|
||||
{/* <div className="app-container">
|
||||
<Navigation routes={routes}></Navigation>
|
||||
|
||||
<Container fluid className="main-container">
|
||||
<div className="row">
|
||||
<Sidebar />
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<div className="full-page-div">
|
||||
<Outlet />
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</Container>
|
||||
|
||||
<Footer />
|
||||
</div> */}
|
||||
|
||||
|
||||
{/* <>
|
||||
<Navigation routes={routes}></Navigation>
|
||||
|
||||
<Container className='p-2' as="main" fluid>
|
||||
<Sidebar />
|
||||
|
||||
<Outlet />
|
||||
</Container>
|
||||
<Footer />
|
||||
</> */}
|
||||
|
||||
// const App = () => {
|
||||
// return (
|
||||
// <Router>
|
||||
// <div>
|
||||
// <header>
|
||||
// <nav className="navbar navbar-expand-md navbar-dark">
|
||||
// <div className="container-fluid">
|
||||
// <Link to="/" className="navbar-brand">
|
||||
// Streaming-video service
|
||||
// </Link>
|
||||
// <button
|
||||
// className="navbar-toggler"
|
||||
// type="button"
|
||||
// data-bs-toggle="collapse"
|
||||
// data-bs-target="#navbarNav"
|
||||
// aria-controls="navbarNav"
|
||||
// aria-expanded="false"
|
||||
// aria-label="Toggle navigation"
|
||||
// >
|
||||
// <span className="navbar-toggler-icon"></span>
|
||||
// </button>
|
||||
// <div className="collapse navbar-collapse justify-content-end" id="navbarNav">
|
||||
// <div className="navbar-nav">
|
||||
// <Link to="/page1" className="nav-link">
|
||||
// Главная страница
|
||||
// </Link>
|
||||
// <Link to="/page2" className="nav-link">
|
||||
// Поиск
|
||||
// </Link>
|
||||
// <Link to="/page3" className="nav-link">
|
||||
// Подписки
|
||||
// </Link>
|
||||
// <Link to="/page4" className="nav-link">
|
||||
// Вход/Регистрация
|
||||
// </Link>
|
||||
// </div>
|
||||
// <form
|
||||
// className="col-12 col-md-auto mb-2 mb-md-0 me-md-3"
|
||||
// role="search"
|
||||
// action="/page2"
|
||||
// method="get"
|
||||
// >
|
||||
// <input className="form-control" type="text" placeholder="Search" aria-label="Search" />
|
||||
// </form>
|
||||
// </div>
|
||||
// </div>
|
||||
// </nav>
|
||||
// </header>
|
||||
// <div className="container-fluid">
|
||||
// <div className="row">
|
||||
// <nav className="col-md-2 bg-dark sidebar">
|
||||
// {/* Sidebar content goes here */}
|
||||
// </nav>
|
||||
// <main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
// <div className="full-page-div">
|
||||
// {/* Main content goes here */}
|
||||
// </div>
|
||||
// </main>
|
||||
// </div>
|
||||
// </div>
|
||||
// <footer className="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
|
||||
// Copyright ©{new Date().getFullYear()} All rights reserved
|
||||
// </footer>
|
||||
// </div>
|
||||
// </Router>
|
||||
// );
|
||||
// };
|
||||
|
||||
// export default App;
|
BIN
lab4/src/assets/StreamerLogo.png
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
lab4/src/assets/TwitchLogo2.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
1
lab4/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 |
BIN
lab4/src/assets/twitchLogo.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
BIN
lab4/src/assets/video1.png
Normal file
After Width: | Height: | Size: 1.6 MiB |
BIN
lab4/src/assets/video2.png
Normal file
After Width: | Height: | Size: 2.0 MiB |
BIN
lab4/src/assets/video3.png
Normal file
After Width: | Height: | Size: 2.2 MiB |
BIN
lab4/src/assets/video4.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
lab4/src/assets/video5.png
Normal file
After Width: | Height: | Size: 2.5 MiB |
BIN
lab4/src/assets/video6.png
Normal file
After Width: | Height: | Size: 2.1 MiB |
BIN
lab4/src/assets/video7.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
13
lab4/src/components/footer/Footer.css
Normal file
@ -0,0 +1,13 @@
|
||||
/* .my-footer {
|
||||
background-color: #9c9c9c;
|
||||
height: 32px;
|
||||
color: #fff;
|
||||
} */
|
||||
|
||||
|
||||
footer {
|
||||
width: 100%;
|
||||
background-color: #9c9c9c;
|
||||
height: 32px;
|
||||
color: #ffffff;
|
||||
}
|
11
lab4/src/components/footer/Footer.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import './Footer.css';
|
||||
|
||||
const Footer = () => {
|
||||
return (
|
||||
<footer className="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
|
||||
Copyright ©<script>document.write(new Date().getFullYear());</script> All rights reserved
|
||||
</footer>
|
||||
);
|
||||
};
|
||||
|
||||
export default Footer;
|
56
lab4/src/components/navigation/Navigation.css
Normal file
@ -0,0 +1,56 @@
|
||||
.my-navbar {
|
||||
width: 100% !important;
|
||||
}
|
||||
/*
|
||||
.my-navbar .link a:hover {
|
||||
text-decoration: underline !important;
|
||||
}
|
||||
|
||||
.my-navbar .logo {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
} */
|
||||
header nav a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
header nav {
|
||||
background-color: #292828;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
header nav {
|
||||
height: 64px;
|
||||
}
|
||||
container-fluid nav{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.full-page-div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.container-fluid {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.full-page-div {
|
||||
background-color: #ececec; /* Цвет фона */
|
||||
padding: 1%; /* Внутренний отступ */
|
||||
margin: 1%; /* Внешний отступ */
|
||||
}
|
||||
|
||||
a{
|
||||
margin-bottom: 2px;
|
||||
margin-top: 2px;
|
||||
}
|
84
lab4/src/components/navigation/Navigation.jsx
Normal file
@ -0,0 +1,84 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Container, Nav, Navbar, Form, FormControl } from 'react-bootstrap';
|
||||
import { Link } from 'react-router-dom';
|
||||
import './Navigation.css';
|
||||
|
||||
const Navigation = ({ routes }) => {
|
||||
const indexPageLink = routes.filter((route) => route.index === true).shift();
|
||||
const pages = routes.filter((route) => Object.prototype.hasOwnProperty.call(route, 'title'));
|
||||
|
||||
return (
|
||||
<header>
|
||||
<Navbar expand='md' bg='dark' variant='dark' className='my-navbar'>
|
||||
<Container fluid>
|
||||
<Navbar.Brand as={Link} to={indexPageLink?.path ?? '/'}>
|
||||
{/* <Cart2 className='d-inline-block align-top me-1 logo' /> */}
|
||||
Streaming-video service
|
||||
</Navbar.Brand>
|
||||
<Navbar.Toggle aria-controls='main-navbar' />
|
||||
<Navbar.Collapse id='main-navbar'>
|
||||
<Nav className='me-auto'>
|
||||
{
|
||||
pages.map((page) => (
|
||||
<Nav.Link as={Link} key={page.path} to={page.path ?? '/'}>{page.title}</Nav.Link>
|
||||
))
|
||||
}
|
||||
</Nav>
|
||||
<Form className='col-12 col-md-auto mb-2 mb-md-0 me-md-3' role='search' action='./search' method='get'>
|
||||
<FormControl type='text' placeholder='Search' className='mr-sm-2' aria-label='Search' />
|
||||
</Form>
|
||||
</Navbar.Collapse>
|
||||
</Container>
|
||||
</Navbar>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
|
||||
Navigation.propTypes = {
|
||||
routes: PropTypes.array,
|
||||
};
|
||||
|
||||
export default Navigation;
|
||||
|
||||
|
||||
// import PropTypes from 'prop-types';
|
||||
// import { Container, Nav, Navbar } from 'react-bootstrap';
|
||||
// import { Cart2 } from 'react-bootstrap-icons';
|
||||
// import { Link, useLocation } from 'react-router-dom';
|
||||
// import './Navigation.css';
|
||||
|
||||
// const Navigation = ({ routes }) => {
|
||||
// const location = useLocation();
|
||||
// const indexPageLink = routes.filter((route) => route.index === false).shift();
|
||||
// const pages = routes.filter((route) => Object.prototype.hasOwnProperty.call(route, 'title'));
|
||||
|
||||
// return (
|
||||
// <header>
|
||||
// <Navbar expand='md' bg='dark' data-bs-theme='dark' className='my-navbar'>
|
||||
// <Container fluid>
|
||||
// <Navbar.Brand as={Link} to={indexPageLink?.path ?? '/'}>
|
||||
// <Cart2 className='d-inline-block align-top me-1 logo' />
|
||||
// My shop
|
||||
// </Navbar.Brand>
|
||||
// <Navbar.Toggle aria-controls='main-navbar' />
|
||||
// <Navbar.Collapse id='main-navbar'>
|
||||
// <Nav className='me-auto link' activeKey={location.pathname}>
|
||||
// {
|
||||
// pages.map((page) =>
|
||||
// <Nav.Link as={Link} key={page.path} eventKey={page.path} to={page.path ?? '/'}>
|
||||
// {page.title}
|
||||
// </Nav.Link>)
|
||||
// }
|
||||
// </Nav>
|
||||
// </Navbar.Collapse>
|
||||
// </Container>
|
||||
// </Navbar >
|
||||
// </header>
|
||||
// );
|
||||
// };
|
||||
|
||||
// Navigation.propTypes = {
|
||||
// routes: PropTypes.array,
|
||||
// };
|
||||
|
||||
// export default Navigation;
|
113
lab4/src/components/sidebar/Sidebar.css
Normal file
@ -0,0 +1,113 @@
|
||||
|
||||
.col-md-2.sidebar {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.col-md-2.sidebar .container {
|
||||
padding-right: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
header nav {
|
||||
height: 64px;
|
||||
}
|
||||
container-fluid nav{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.full-page-div {
|
||||
background-color: #ececec; /* Цвет фона */
|
||||
padding: 1%; /* Внутренний отступ */
|
||||
margin: 1%; /* Внешний отступ */
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
h4 {
|
||||
font-size: 1.5px;
|
||||
}
|
||||
|
||||
.card{
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
a{
|
||||
margin-bottom: 2px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.streamer-nickname {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
font-size: 26px;
|
||||
}
|
||||
.online-indicator {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
background-color: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.online-count {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* .sidebar {
|
||||
background-color: #f8f9fa;
|
||||
height: 100vh;
|
||||
} */
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.full-page-div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.container-fluid {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.btn-info{
|
||||
color:rgb(22, 9, 93);
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.modal-dialog img{
|
||||
max-width: 310px;
|
||||
max-height: 200px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
|
||||
|
123
lab4/src/components/sidebar/Sidebar.jsx
Normal file
@ -0,0 +1,123 @@
|
||||
// import React from 'react';
|
||||
import './Sidebar.css';
|
||||
|
||||
const Sidebar = () => {
|
||||
return (
|
||||
<div className="row">
|
||||
<nav className="col-md-2 bg-dark sidebar">
|
||||
<div className="d-flex flex-column align-items-center align-items-sm-start px-8 pt-3 text-white">
|
||||
<h2>Стримеры онлайн</h2>
|
||||
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col">
|
||||
<a href="channel" className="nav-link align-middle px-0">
|
||||
<i className="fs-4 bi-house"></i> <span className="ms-1 d-none d-sm-inline">Streamer1</span>
|
||||
</a>
|
||||
</div>
|
||||
<div className="col d-flex align-items-center justify-content-end">
|
||||
<div className="online-indicator">
|
||||
<div className="dot"></div>
|
||||
<div className="online-count ml-1">1000</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="row">
|
||||
<div className="col">
|
||||
<a href="channel" className="nav-link align-middle px-0">
|
||||
<i className="fs-4 bi-house"></i> <span className="ms-1 d-none d-sm-inline">Straaaa2</span>
|
||||
</a>
|
||||
</div>
|
||||
<div className="col d-flex align-items-center justify-content-end">
|
||||
<div className="online-indicator">
|
||||
<div className="dot"></div>
|
||||
<div className="online-count ml-1">1702</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="row">
|
||||
<div className="col">
|
||||
<a href="admin" className="nav-link align-middle px-0">
|
||||
<i className="fs-4 bi-house"></i> <span className="ms-1 d-none d-sm-inline">admin</span>
|
||||
</a>
|
||||
</div>
|
||||
<div className="col d-flex align-items-center justify-content-end">
|
||||
<div className="online-indicator">
|
||||
<div className="dot"></div>
|
||||
<div className="online-count ml-1">902</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr className="featurette-divider" />
|
||||
<h2>Ваши подписки</h2>
|
||||
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col">
|
||||
<a href="channel" className="nav-link align-middle px-0">
|
||||
<i className="fs-4 bi-house"></i> <span className="ms-1 d-none d-sm-inline">The best channel</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col">
|
||||
<a href="channel" className="nav-link align-middle px-0">
|
||||
<i className="fs-4 bi-house"></i> <span className="ms-1 d-none d-sm-inline">Channelv2</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Sidebar;
|
||||
|
||||
|
||||
// import { useEffect, useState } from 'react';
|
||||
// import banner1 from '../../assets/banner1.png';
|
||||
// import banner2 from '../../assets/banner2.png';
|
||||
// import banner3 from '../../assets/banner3.png';
|
||||
// import './Sidebar.css';
|
||||
|
||||
// const Banner = () => {
|
||||
// const [currentBanner, setCurrentBanner] = useState(0);
|
||||
// const banners = [banner1, banner2, banner3];
|
||||
|
||||
// const getBannerClass = (index) => {
|
||||
// return currentBanner === index ? 'banner-show' : 'banner-hide';
|
||||
// };
|
||||
|
||||
// useEffect(() => {
|
||||
// const bannerInterval = setInterval(
|
||||
// () => {
|
||||
// console.info('Banner changed');
|
||||
// let current = currentBanner + 1;
|
||||
// if (current === banners.length) {
|
||||
// current = 0;
|
||||
// }
|
||||
// setCurrentBanner(current);
|
||||
// },
|
||||
// 5000,
|
||||
// );
|
||||
// return () => clearInterval(bannerInterval);
|
||||
// });
|
||||
|
||||
// return (
|
||||
// <div id="banner" >
|
||||
// {
|
||||
// banners.map((banner, index) =>
|
||||
// <img key={index} className={getBannerClass(index)} src={banner} alt={`banner${index}`} />)
|
||||
// }
|
||||
// </div >
|
||||
// );
|
||||
// };
|
||||
|
||||
// export default Banner;
|
227
lab4/src/index.css
Normal file
@ -0,0 +1,227 @@
|
||||
header nav {
|
||||
background-color: #292828;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
header nav {
|
||||
height: 64px;
|
||||
}
|
||||
container-fluid nav{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.full-page-div {
|
||||
background-color: #ececec; /* Цвет фона */
|
||||
padding: 1%; /* Внутренний отступ */
|
||||
margin: 1%; /* Внешний отступ */
|
||||
}
|
||||
|
||||
header nav a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #9c9c9c;
|
||||
height: 32px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
h4 {
|
||||
font-size: 1.5px;
|
||||
}
|
||||
/* .container{
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
}*/
|
||||
/* .container-fluid{
|
||||
height: 100vh;
|
||||
}
|
||||
.full-page-div {
|
||||
width: 100%;
|
||||
height: calc(100vh - 56px); /* 56px - высота навигационной панели (navbar)
|
||||
overflow-y: auto; Добавляет вертикальную прокрутку, если содержимое не помещается
|
||||
|
||||
} */
|
||||
.card{
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
.circle-container {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden; /* обрезаем лишнее изображение за пределами круга */
|
||||
margin: auto; /* автоматическое выравнивание по горизонтали */
|
||||
margin-top: 20px; /* опциональное выравнивание по вертикали (если нужно) */
|
||||
}
|
||||
|
||||
.circle-container img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover; /* сохраняем соотношение сторон и обрезаем изображение, чтобы оно полностью заполнило круг */
|
||||
}
|
||||
|
||||
a{
|
||||
margin-bottom: 2px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
/* .container-main {
|
||||
flex: 1;
|
||||
} */
|
||||
|
||||
.streamer-nickname {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
font-size: 26px;
|
||||
}
|
||||
.online-indicator {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
background-color: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.online-count {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
/* .sidebar {
|
||||
background-color: #f8f9fa;
|
||||
height: 100vh;
|
||||
} */
|
||||
.video-thumbnail {
|
||||
/* width: 1920px;
|
||||
height: 1080px; */
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.embed-responsive{
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 1600px;
|
||||
height: 800px;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.btn-info{
|
||||
color:rgb(22, 9, 93);
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
.card-img-top{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 500px;
|
||||
}
|
||||
.avatar-img{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 40px;
|
||||
}
|
||||
.modal-dialog img{
|
||||
max-width: 310px;
|
||||
max-height: 200px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.fa-pencil{
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
|
||||
/* :root {
|
||||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #242424;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
background-color: #1a1a1a;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.25s;
|
||||
}
|
||||
button:hover {
|
||||
border-color: #646cff;
|
||||
}
|
||||
button:focus,
|
||||
button:focus-visible {
|
||||
outline: 4px auto -webkit-focus-ring-color;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
} */
|
79
lab4/src/main.jsx
Normal file
@ -0,0 +1,79 @@
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { RouterProvider, createBrowserRouter } from 'react-router-dom';
|
||||
import App from './App.jsx';
|
||||
import './index.css';
|
||||
import ErrorPage from './pages/ErrorPage.jsx';
|
||||
import StartPage from './pages/StartPage.jsx';
|
||||
import MainPage from './pages/MainPage.jsx';
|
||||
import SearchPage from './pages/SearchPage.jsx';
|
||||
import SubcriptionsPage from './pages/SubcriptionsPage.jsx';
|
||||
import LoginRegPage from './pages/LoginRegPage.jsx';
|
||||
import AdminPage from './pages/AdminPage.jsx';
|
||||
import ChannelPage from './pages/ChannelPage.jsx';
|
||||
import PageEdit from './pages/PageEdit.jsx';
|
||||
|
||||
|
||||
|
||||
const routes = [
|
||||
{
|
||||
index: true,
|
||||
path: '/',
|
||||
element: <StartPage />,
|
||||
title: 'Start page',
|
||||
},
|
||||
{
|
||||
path: '/main',
|
||||
element: <MainPage />,
|
||||
title: 'Main page',
|
||||
},
|
||||
{
|
||||
path: '/search',
|
||||
element: <SearchPage />,
|
||||
title: 'SearchPage',
|
||||
},
|
||||
{
|
||||
path: '/subscrptions',
|
||||
element: <SubcriptionsPage />,
|
||||
title: 'SubscriptionsPage',
|
||||
},
|
||||
{
|
||||
path: '/loginreg',
|
||||
element: <LoginRegPage />,
|
||||
title: 'LoginRegPage',
|
||||
},
|
||||
{
|
||||
path: '/channel',
|
||||
element: <ChannelPage />,
|
||||
title: 'ChannelPage',
|
||||
},
|
||||
{
|
||||
path: '/admin',
|
||||
element: <AdminPage />,
|
||||
title: 'AdminPage',
|
||||
},
|
||||
{
|
||||
path: '/page-edit',
|
||||
element: <PageEdit />,
|
||||
},
|
||||
{
|
||||
path: '/ErrorPage',
|
||||
element: <ErrorPage />,
|
||||
},
|
||||
];
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: '/',
|
||||
element: <App routes={routes} />,
|
||||
children: routes,
|
||||
errorElement: <ErrorPage />,
|
||||
},
|
||||
]);
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<RouterProvider router={router} />
|
||||
</React.StrictMode>,
|
||||
);
|
117
lab4/src/pages/AdminPage.jsx
Normal file
@ -0,0 +1,117 @@
|
||||
|
||||
|
||||
const AdminPage = () => {
|
||||
const handlePriceChange = (e) => {
|
||||
// Обработка изменения значения поля "Цена"
|
||||
console.log('Цена:', e.target.value);
|
||||
};
|
||||
|
||||
const handleCountChange = (e) => {
|
||||
// Обработка изменения значения поля "Количество"
|
||||
console.log('Количество:', e.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<div className="full-page-div">
|
||||
<div className="btn-group" role="group">
|
||||
<button id="items-add" className="btn btn-info">
|
||||
Добавить видео (диалог)
|
||||
</button>
|
||||
<a className="btn btn-success" href="/page-edit">
|
||||
Добавить видео (страница)
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<table id="items-table" className="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">№</th>
|
||||
<th scope="col" className="w-25">
|
||||
Товар
|
||||
</th>
|
||||
<th scope="col" className="w-25">
|
||||
Цена (name)
|
||||
</th>
|
||||
<th scope="col" className="w-25">
|
||||
Количество (views)
|
||||
</th>
|
||||
<th scope="col" className="w-25">
|
||||
Сумма
|
||||
</th>
|
||||
<th scope="col"></th>
|
||||
<th scope="col"></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="items-update" className="modal fade" tabIndex="-1" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||
<div className="modal-dialog">
|
||||
<form id="items-form" className="needs-validation" noValidate>
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<h1 className="modal-title fs-5" id="items-update-title"></h1>
|
||||
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<div className="text-center">
|
||||
<img id="image-preview" src="https://via.placeholder.com/200" className="rounded rounded-circle" alt="placeholder" />
|
||||
</div>
|
||||
<input id="items-line-id" type="number" hidden />
|
||||
<div className="mb-2">
|
||||
<label htmlFor="item" className="form-label">
|
||||
Товары
|
||||
</label>
|
||||
<select id="item" className="form-select" name="selected" required></select>
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label" htmlFor="price">
|
||||
Цена
|
||||
</label>
|
||||
<input id="price" name="price" className="form-control" type="text" required onChange={handlePriceChange} />
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label" htmlFor="count">
|
||||
Количество
|
||||
</label>
|
||||
<input
|
||||
id="count"
|
||||
name="count"
|
||||
className="form-control"
|
||||
type="number"
|
||||
value="0"
|
||||
min="1"
|
||||
step="1"
|
||||
required
|
||||
onChange={handleCountChange} />
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label" htmlFor="image">
|
||||
Изображение
|
||||
</label>
|
||||
<input id="image" type="file" name="image" className="form-control" accept="image/*" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button type="button" className="btn btn-secondary" data-bs-dismiss="modal">
|
||||
Закрыть
|
||||
</button>
|
||||
<button type="submit" className="btn btn-primary">
|
||||
Сохранить
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default AdminPage;
|
31
lab4/src/pages/ChannelPage.jsx
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
const ChannelPage = () => {
|
||||
return (
|
||||
<>
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<div className="full-page-div">
|
||||
{/* YouTube Player */}
|
||||
<div className="embed-responsive embed-responsive-16by9 mb-4">
|
||||
<iframe className="video-thumbnail embed-responsive-item" src="https://www.youtube.com/embed/dQw4w9WgXcQ" allowFullScreen title="YouTube Video"></iframe>
|
||||
</div>
|
||||
|
||||
<div className="row mb-4">
|
||||
<div className="col-md-4">
|
||||
<div className="circle-container m-3">
|
||||
<img src="src/assets/StreamerLogo.png" alt="Your Image" />
|
||||
</div>
|
||||
<h4 className="mt-2">Channel Name</h4>
|
||||
</div>
|
||||
<div className="col-md-8">
|
||||
<h2>Video Title</h2>
|
||||
<p>Real video description goes here...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChannelPage;
|
48
lab4/src/pages/ErrorPage.jsx
Normal file
@ -0,0 +1,48 @@
|
||||
import { Alert, Button, Container } from 'react-bootstrap';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
const ErrorPage = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
// <>
|
||||
// <Navigation routes={routes}></Navigation>
|
||||
|
||||
// <Container className='flex-container container-fluid' as="main" fluid>
|
||||
// <Container className='' as="main" fluid>
|
||||
|
||||
// <Alert variant="danger">
|
||||
// Страница не найдена
|
||||
// </Alert>
|
||||
// <Button className="w-25 mt-2" variant="primary" onClick={() => navigate(-1)}>Назад</Button>
|
||||
// </Container>
|
||||
|
||||
// </Container>
|
||||
// <Footer />
|
||||
// </>
|
||||
<>
|
||||
<Container fluid className="p-2 row justify-content-center">
|
||||
<Container className="flex-container container-fluid col-md-6">
|
||||
<Alert variant="danger" className="text-center">
|
||||
Страница не найдена
|
||||
</Alert>
|
||||
<Button className="w-100 mt-2" variant="primary" onClick={() => navigate(-1)}>
|
||||
Назад
|
||||
</Button>
|
||||
</Container>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ErrorPage;
|
||||
|
||||
|
||||
// <Container fluid className="p-2 row justify-content-center">
|
||||
// <Container className='col-md-6'>
|
||||
// <Alert variant="danger">
|
||||
// Страница не найдена
|
||||
// </Alert>
|
||||
// <Button className="w-25 mt-2" variant="primary" onClick={() => navigate(-1)}>Назад</Button>
|
||||
// </Container>
|
||||
// </Container>
|
78
lab4/src/pages/LoginRegPage.jsx
Normal file
@ -0,0 +1,78 @@
|
||||
import { useState } from 'react';
|
||||
import { Tab, Tabs, Form, Button, Col, Row } from 'react-bootstrap';
|
||||
|
||||
const LoginRegPage = () => {
|
||||
const [key, setKey] = useState('login');
|
||||
|
||||
const handleSubmit = (event) => {
|
||||
event.preventDefault();
|
||||
// логика обработки данных формы
|
||||
};
|
||||
|
||||
return (
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<Tabs id="myTab" activeKey={key} onSelect={(k) => setKey(k)} className="mb-3">
|
||||
<Tab eventKey="login" title="Логин">
|
||||
<Row className="justify-content-center">
|
||||
<Col md={6}>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<Form.Group controlId="email">
|
||||
<Form.Label>E-mail</Form.Label>
|
||||
<Form.Control type="email" placeholder="name@example.ru" required />
|
||||
</Form.Group>
|
||||
<Form.Group controlId="password">
|
||||
<Form.Label>Пароль</Form.Label>
|
||||
<Form.Control type="password" required />
|
||||
</Form.Group>
|
||||
<div className="text-center">
|
||||
<Button variant="primary" type="submit" className="w-50">
|
||||
Вход
|
||||
</Button>
|
||||
</div>
|
||||
</Form>
|
||||
</Col>
|
||||
</Row>
|
||||
</Tab>
|
||||
<Tab eventKey="register" title="Регистрация">
|
||||
<Row className="justify-content-center">
|
||||
<Col md={6}>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<Form.Group controlId="firstname">
|
||||
<Form.Label>Ник</Form.Label>
|
||||
<Form.Control type="text" required />
|
||||
</Form.Group>
|
||||
<Form.Group controlId="email">
|
||||
<Form.Label>E-mail</Form.Label>
|
||||
<Form.Control type="email" placeholder="name@example.ru" required />
|
||||
</Form.Group>
|
||||
<Form.Group controlId="password">
|
||||
<Form.Label>Пароль</Form.Label>
|
||||
<Form.Control type="password" required />
|
||||
</Form.Group>
|
||||
<Form.Group controlId="date">
|
||||
<Form.Label>Дата рождения</Form.Label>
|
||||
<Form.Control type="date" required />
|
||||
</Form.Group>
|
||||
<Form.Group controlId="gender">
|
||||
<Form.Label>Ваш пол</Form.Label>
|
||||
<Form.Select aria-label="Large select example">
|
||||
<option>М</option>
|
||||
<option>Ж</option>
|
||||
<option>Другое</option>
|
||||
</Form.Select>
|
||||
</Form.Group>
|
||||
<div className="text-center mb-md-0">
|
||||
<Button variant="primary" type="submit" className="w-50">
|
||||
Зарегистрироваться
|
||||
</Button>
|
||||
</div>
|
||||
</Form>
|
||||
</Col>
|
||||
</Row>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
|
||||
export default LoginRegPage;
|
189
lab4/src/pages/MainPage.jsx
Normal file
@ -0,0 +1,189 @@
|
||||
|
||||
const MainPage = () => {
|
||||
return (
|
||||
<div className="d-flex">
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<hr className="featurette-divider" />
|
||||
<h1 className="display-4 fs-2 fw-bold">Для вас</h1>
|
||||
<hr className="featurette-divider" />
|
||||
<div className="row mt-4">
|
||||
{/* Video Recommendation 1 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video2.png" className="card-img-top" alt="Video 1"/>
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold">Streamer1</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">CS-3</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<a className="btn btn-secondary ms-auto" href="channel">
|
||||
Subscribe
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Video Recommendation 2 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video7.png" className="card-img-top" alt="Video 2"/>
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold">Streamer2</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">DOTA0</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<a className="btn btn-secondary ms-auto" href="channel">
|
||||
Subscribe
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Video Recommendation 3 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video3.png" className="card-img-top" alt="Video 3"/>
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold">Streamer3</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">DOTA4</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<a className="btn btn-secondary ms-auto" href="channel">
|
||||
Subscribe
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr className="featurette-divider" />
|
||||
<h1 className="display-4 fs-2 fw-bold">Самые популярные</h1>
|
||||
<hr className="featurette-divider" />
|
||||
|
||||
{/* Video Recommendation 4 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video4.png" className="card-img-top" alt="Video 4"/>
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold">video4</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">CS-3</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<a className="btn btn-secondary ms-auto" href="channel">
|
||||
Subscribe
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Video Recommendation 5*/}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video5.png" className="card-img-top" alt="Video 5" />
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold">video5</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">DOTA0</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<a className="btn btn-secondary ms-auto" href="channel">
|
||||
Subscribe
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Video Recommendation 6 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video1.png" className="card-img-top" alt="Video 2" />
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold">Streamer3</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">DOTA4</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<a className="btn btn-secondary ms-auto" href="channel">
|
||||
Subscribe
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MainPage;
|
||||
|
||||
|
||||
// import { Link } from 'react-router-dom';
|
||||
// import Sidebar from '../components/sidebar/Sidebar.jsx';
|
||||
|
||||
// const Page11 = () => {
|
||||
// return (
|
||||
// <>
|
||||
// <Sidebar />
|
||||
// <>
|
||||
// <h1>Пример web-страницы.</h1>
|
||||
// <h2>1. Структурные элементы</h2>
|
||||
// <p><b>Полужирное начертание <i>курсив</i></b></p>
|
||||
// <p>Абзац 2 <Link to="/page2">Ссылка</Link></p>
|
||||
// <h3>1.1. Списки</h3>
|
||||
// <p>
|
||||
// Список маркированный:
|
||||
// </p>
|
||||
// <ul>
|
||||
// <li><a href="/page2" target="_blank">
|
||||
// Элемент списка 1</a></li>
|
||||
// <li>Элемент списка 2</li>
|
||||
// <li>...</li>
|
||||
// </ul>
|
||||
// <p>
|
||||
// Список нумерованный:
|
||||
// </p>
|
||||
// <ol>
|
||||
// <li>Элемент списка 1</li>
|
||||
// <li>Элемент списка 2</li>
|
||||
// <li>...</li>
|
||||
// </ol>
|
||||
// </>
|
||||
// </>
|
||||
// );
|
||||
// };
|
||||
|
||||
// export default Page11;
|
68
lab4/src/pages/PageEdit.jsx
Normal file
@ -0,0 +1,68 @@
|
||||
import { useState } from 'react';
|
||||
import { Button, Form } from 'react-bootstrap';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
const PageEdit = () => {
|
||||
const [validated, setValidated] = useState(false);
|
||||
const handlePriceChange = (e) => {
|
||||
// Обработка изменения значения поля "Цена"
|
||||
console.log('Цена:', e.target.value);
|
||||
};
|
||||
|
||||
const handleCountChange = (e) => {
|
||||
// Обработка изменения значения поля "Количество"
|
||||
console.log('Количество:', e.target.value);
|
||||
};
|
||||
|
||||
const handleSubmit = (event) => {
|
||||
const form = event.currentTarget;
|
||||
if (form.checkValidity() === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
setValidated(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex">
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<div className="full-page-div">
|
||||
<div className="text-center">
|
||||
<img id="image-preview" src="https://via.placeholder.com/200" className="rounded rounded-circle"
|
||||
alt="placeholder" />
|
||||
</div>
|
||||
<Form id="items-form" noValidate validated={validated} onSubmit={handleSubmit}>
|
||||
<Form.Group className="mb-2" controlId="item">
|
||||
<Form.Label>Товары</Form.Label>
|
||||
<Form.Select name='selected' required>
|
||||
</Form.Select>
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="price">
|
||||
<Form.Label>Цена</Form.Label>
|
||||
<Form.Control type="number" name="price"
|
||||
value="0.00" min="1000.00" step="0.50" required onChange={handlePriceChange} />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="count">
|
||||
<Form.Label>Количество</Form.Label>
|
||||
<Form.Control type="number" name="count"
|
||||
value="0" min="1" step="1" required onChange={handleCountChange} />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="file">
|
||||
<Form.Label>Изображение</Form.Label>
|
||||
<Form.Control type="file" name="image" accept="image/*" />
|
||||
</Form.Group>
|
||||
<Form.Group className="d-flex flex-md-row flex-column justify-content-center">
|
||||
<Button className="btn-mw me-md-3 mb-md-0 mb-2" as={Link} to="/page4" variant="secondary">Назад</Button>
|
||||
<Button className="btn-mw me-md-3" type="submit" variant="primary">Сохранить</Button>
|
||||
</Form.Group>
|
||||
</Form>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default PageEdit;
|
158
lab4/src/pages/Pages.css
Normal file
@ -0,0 +1,158 @@
|
||||
header nav {
|
||||
background-color: #292828;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
header nav {
|
||||
height: 64px;
|
||||
}
|
||||
container-fluid nav{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.full-page-div {
|
||||
background-color: #ececec; /* Цвет фона */
|
||||
padding: 1%; /* Внутренний отступ */
|
||||
margin: 1%; /* Внешний отступ */
|
||||
}
|
||||
|
||||
header nav a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #9c9c9c;
|
||||
height: 32px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
h4 {
|
||||
font-size: 1.5px;
|
||||
}
|
||||
/* .container{
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
}*/
|
||||
/* .container-fluid{
|
||||
height: 100vh;
|
||||
}
|
||||
.full-page-div {
|
||||
width: 100%;
|
||||
height: calc(100vh - 56px); /* 56px - высота навигационной панели (navbar)
|
||||
overflow-y: auto; Добавляет вертикальную прокрутку, если содержимое не помещается
|
||||
|
||||
} */
|
||||
.card{
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
.circle-container {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden; /* обрезаем лишнее изображение за пределами круга */
|
||||
margin: auto; /* автоматическое выравнивание по горизонтали */
|
||||
margin-top: 20px; /* опциональное выравнивание по вертикали (если нужно) */
|
||||
}
|
||||
|
||||
.circle-container img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover; /* сохраняем соотношение сторон и обрезаем изображение, чтобы оно полностью заполнило круг */
|
||||
}
|
||||
|
||||
a{
|
||||
margin-bottom: 2px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
/* .container-main {
|
||||
flex: 1;
|
||||
} */
|
||||
|
||||
.streamer-nickname {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
font-size: 26px;
|
||||
}
|
||||
.online-indicator {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
background-color: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.online-count {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
/* .sidebar {
|
||||
background-color: #f8f9fa;
|
||||
height: 100vh;
|
||||
} */
|
||||
.video-thumbnail {
|
||||
/* width: 1920px;
|
||||
height: 1080px; */
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.embed-responsive{
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 1600px;
|
||||
height: 800px;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.btn-info{
|
||||
color:rgb(22, 9, 93);
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
.card-img-top{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 500px;
|
||||
}
|
||||
.avatar-img{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 40px;
|
||||
}
|
||||
.modal-dialog img{
|
||||
max-width: 310px;
|
||||
max-height: 200px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.fa-pencil{
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
46
lab4/src/pages/SearchPage.jsx
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
const SearchPage = () => {
|
||||
return (
|
||||
<>
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<hr className="featurette-divider" />
|
||||
<div className="col-md-7">
|
||||
<h2 className="featurette-heading fw-normal lh-1">
|
||||
По запросу ничего не найдено. <span className="text-body-secondary"></span>
|
||||
</h2>
|
||||
<p className="lead">Убедитесь, что все слова написаны правильно, или попробуйте другие ключевые слова.</p>
|
||||
</div>
|
||||
<hr className="featurette-divider" />
|
||||
<h1 className="display-4 fs-2 fw-bold">Рекомендации</h1>
|
||||
|
||||
<div className="row mt-3">
|
||||
{[1, 2, 3, 4, 5].map((index) => (
|
||||
<div key={index} className="col-md-3 mb-3">
|
||||
<div className="card">
|
||||
<div className="circle-container m-3">
|
||||
<img src="src/assets/StreamerLogo.png" alt="Your Image" />
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-4">
|
||||
<a className="streamer-nickname m-0 text-secondary text-decoration-none text-nowrap font-italic font-weight-bold"
|
||||
href="channel">Streamer{index}</a>
|
||||
</div>
|
||||
<div className="col-md-4">{/* Add relevant content here */}</div>
|
||||
<div className="col-md-4">
|
||||
<a className="btn btn-secondary" href="channel">Subscribe</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default SearchPage;
|
158
lab4/src/pages/StartPage.jsx
Normal file
@ -0,0 +1,158 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
const StartPage = () => {
|
||||
return (
|
||||
<div className="d-flex">
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<div className="full-page-div">
|
||||
<div className="p-5 text-center">
|
||||
<h1 className="display-4 fw-bold">Welcome to our streaming service</h1>
|
||||
<p className="fs-5">Explore the whole streaming world!</p>
|
||||
<Link className="btn btn-outline-danger btn-lg" to="page2" role="button">Главная страница</Link>
|
||||
</div>
|
||||
|
||||
<div className="p-5 text-bg-dark rounded-3">
|
||||
<h2>Популярные трансляции</h2>
|
||||
<div className="row">
|
||||
{/* Video Recommendation 1 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video7.png" className="card-img-top" alt="Video 1" />
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold" href="page5channel.html">NEVER GONNA GIVE YOU UP</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">Rick Astley</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<Link className="btn btn-secondary ms-auto" to="channel">Subscribe</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Video Recommendation 2 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video2.png" className="card-img-top" alt="Video 2" />
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold" href="page5channel.html">Streamer1</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">CS-3</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<Link className="btn btn-secondary ms-auto" to="channel">Subscribe</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Video Recommendation 3 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video3.png" className="card-img-top" alt="Video 2" />
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold" href="page5channel.html">Streamer1</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">CS-3</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<Link className="btn btn-secondary ms-auto" to="channel">Subscribe</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Video Recommendation 4 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video5.png" className="card-img-top" alt="Video 4" />
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold" href="page5channel.html">WORLD FINAL CS</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">CHANNEL</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<Link className="btn btn-secondary ms-auto" to="channel">Subscribe</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Video Recommendation 5 */}
|
||||
<div className="col-md-4">
|
||||
<div className="card mb-4 shadow-sm">
|
||||
<img src="src/assets/video6.png" className="card-img-top" alt="Video 5" />
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<p className="h-4 m-0 text-nowrap font-italic font-weight-bold" href="page5channel.html">name of video</p>
|
||||
<p className="fs-5 text-nowrap text-secondary">name of channel</p>
|
||||
</div>
|
||||
<div className="col-md-6 p-3 text-nowrap align-items-end d-flex">
|
||||
<Link className="btn btn-secondary ms-auto" to="channel">Subscribe</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StartPage;
|
||||
|
||||
|
||||
// const Page11 = () => {
|
||||
// return (
|
||||
// <>
|
||||
// <Sidebar />
|
||||
// <>
|
||||
// <h1>Пример web-страницы.</h1>
|
||||
// <h2>1. Структурные элементы</h2>
|
||||
// <p><b>Полужирное начертание <i>курсив</i></b></p>
|
||||
// <p>Абзац 2 <Link to="/page2">Ссылка</Link></p>
|
||||
// <h3>1.1. Списки</h3>
|
||||
// <p>
|
||||
// Список маркированный:
|
||||
// </p>
|
||||
// <ul>
|
||||
// <li><a href="/page2" target="_blank">
|
||||
// Элемент списка 1</a></li>
|
||||
// <li>Элемент списка 2</li>
|
||||
// <li>...</li>
|
||||
// </ul>
|
||||
// <p>
|
||||
// Список нумерованный:
|
||||
// </p>
|
||||
// <ol>
|
||||
// <li>Элемент списка 1</li>
|
||||
// <li>Элемент списка 2</li>
|
||||
// <li>...</li>
|
||||
// </ol>
|
||||
// </>
|
||||
// </>
|
||||
// );
|
||||
// };
|
||||
|
||||
// export default Page11;
|
106
lab4/src/pages/SubcriptionsPage.jsx
Normal file
@ -0,0 +1,106 @@
|
||||
// <div className="d-flex">
|
||||
// <Sidebar />
|
||||
// <main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
// <div className="full-page-div">
|
||||
|
||||
// </div>
|
||||
// </main>
|
||||
// </div>
|
||||
|
||||
const SubscriptionsPage = () => {
|
||||
const streamers = [
|
||||
'Streamer1', 'Streamer2', 'Streamer3', 'Streamer4', 'Streamer5', 'Streamer6', 'Streamer7', 'Streamer8'
|
||||
];
|
||||
|
||||
return (
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<div className="row mt-4">
|
||||
<p className="fw-bold fs-5">Подписки</p>
|
||||
<hr className="featurette-divider" />
|
||||
<div className="row mt-4">
|
||||
{streamers.map((streamer, index) => (
|
||||
<div className="col-md-2 mb-2" key={index}>
|
||||
<div className="card text-center">
|
||||
<div className="circle-container m-3">
|
||||
<img src="png/StreamerLogo.png" className="card-img-top rounded-circle" alt="Streamer Image" />
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col">
|
||||
<a
|
||||
className="streamer-nickname m-0 text-secondary text-decoration-none font-italic font-weight-bold"
|
||||
href="channel">{streamer}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
export default SubscriptionsPage;
|
||||
|
||||
/*
|
||||
<div className="row justify-content-center">
|
||||
<Form className="col-md-6 m-0" noValidate validated={validated} onSubmit={handleSubmit}>
|
||||
<Form.Group className="mb-2" controlId="lastname">
|
||||
<Form.Label>Фамилия</Form.Label>
|
||||
<Form.Control type="text" name="lastname" required />
|
||||
<Form.Control.Feedback>Фамилия заполнена</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Фамилия не заполнена</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="firstname">
|
||||
<Form.Label>Имя</Form.Label>
|
||||
<Form.Control type="text" name="firstname" required />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="email">
|
||||
<Form.Label>E-mail</Form.Label>
|
||||
<Form.Control type="email" name="email" placeholder="name@example.ru" required />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="password">
|
||||
<Form.Label>Пароль</Form.Label>
|
||||
<Form.Control type="password" name="password" required />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="date">
|
||||
<Form.Label>Дата</Form.Label>
|
||||
<Form.Control type="date" name="date" required />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="disabled">
|
||||
<Form.Label>Выключенный компонент</Form.Label>
|
||||
<Form.Control type="text" name="disabled" value="Некоторое значение" disabled />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="readonly">
|
||||
<Form.Label>Компонент только для чтения</Form.Label>
|
||||
<Form.Control type="text" name="readonly" value="Некоторое значение" readOnly />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2" controlId="color">
|
||||
<Form.Label>Выбор цвета</Form.Label>
|
||||
<Form.Control type="color" name="color" defaultValue='#ff0055' />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2 d-md-flex flex-md-row">
|
||||
<Form.Check className="me-md-3" type='checkbox' name='checkbox1' label='Флажок 1' />
|
||||
<Form.Check className="me-md-3" type='checkbox' name='checkbox2' label='Флажок 2' />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2 d-md-flex flex-md-row">
|
||||
<Form.Check className="me-md-3" type='radio' name='radio1' label='Переключатель 1' />
|
||||
<Form.Check className="me-md-3" type='switch' name='radio2' label='Переключатель 2' />
|
||||
</Form.Group>
|
||||
<Form.Group className="mb-2">
|
||||
<Form.Select name='selected' required>
|
||||
<option value="" selected>Выберите значение</option>
|
||||
<option value="1">Один</option>
|
||||
<option value="2">Два</option>
|
||||
<option value="3">Три</option>
|
||||
</Form.Select>
|
||||
</Form.Group>
|
||||
<div className="text-center">
|
||||
<Button className="w-50" variant="primary" type="submit">Отправить</Button>
|
||||
</div>
|
||||
</Form>
|
||||
</div> */
|
||||
|
13
lab4/vite.config.js
Normal file
@ -0,0 +1,13 @@
|
||||
// eslint-disable import/no-extraneous-dependencies
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
build: {
|
||||
sourcemap: true,
|
||||
chunkSizeWarningLimit: 1024,
|
||||
emptyOutDir: true,
|
||||
},
|
||||
});
|
20
lab5/.eslintrc.cjs
Normal file
@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: { browser: true, es2020: true },
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react/jsx-runtime',
|
||||
'plugin:react-hooks/recommended',
|
||||
],
|
||||
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
||||
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
|
||||
settings: { react: { version: '18.2' } },
|
||||
plugins: ['react-refresh'],
|
||||
rules: {
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{ allowConstantExport: true },
|
||||
],
|
||||
},
|
||||
}
|
24
lab5/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# 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/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
15
lab5/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# 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/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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
npm install react-bootstrap
|
||||
|
67
lab5/data.json
Normal file
15
lab5/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<html lang="ru">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Streaming-video service</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root" class="h-100 d-flex flex-column"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
14
lab5/jsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"target": "ES2020",
|
||||
"jsx": "react",
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/node_modules/*"
|
||||
]
|
||||
}
|
5
lab5/json-server.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"static": "./node_modules/json-server/public",
|
||||
"port": 8081,
|
||||
"watch": "true"
|
||||
}
|
5936
lab5/package-lock.json
generated
Normal file
38
lab5/package.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "lec4",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
||||
"rest": "json-server data.json",
|
||||
"vite": "vite",
|
||||
"dev": "npm-run-all --parallel rest vite",
|
||||
"prod": "npm-run-all lint 'vite build' --parallel rest 'vite preview'"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.18.0",
|
||||
"react-hot-toast": "^2.4.1",
|
||||
"axios": "^1.6.1",
|
||||
"bootstrap": "^5.3.2",
|
||||
"react-bootstrap": "^2.9.1",
|
||||
"react-bootstrap-icons": "^1.10.3",
|
||||
"prop-types": "^15.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.15",
|
||||
"@types/react-dom": "^18.2.15",
|
||||
"@vitejs/plugin-react": "^4.0.3",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-plugin-import": "^2.29.0",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.3",
|
||||
"json-server": "^0.17.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"vite": "^4.4.5"
|
||||
}
|
||||
}
|
BIN
lab5/png/StreamerLogo.png
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
lab5/png/streamer1.png
Normal file
After Width: | Height: | Size: 986 KiB |
BIN
lab5/png/streamer2.png
Normal file
After Width: | Height: | Size: 736 KiB |
BIN
lab5/png/streamer3.jpg
Normal file
After Width: | Height: | Size: 130 KiB |
BIN
lab5/png/video4.jpg
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
lab5/png/video5.jpg
Normal file
After Width: | Height: | Size: 225 KiB |
BIN
lab5/png/video6.jpg
Normal file
After Width: | Height: | Size: 192 KiB |
BIN
lab5/png/video7.jpg
Normal file
After Width: | Height: | Size: 87 KiB |
1
lab5/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 |
217
lab5/src/App.css
Normal file
@ -0,0 +1,217 @@
|
||||
|
||||
.flex-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.col-md-9 {
|
||||
flex: 1;
|
||||
padding: 20px; /* Любой желаемый внутренний отступ для основного контента */
|
||||
}
|
||||
|
||||
|
||||
header nav {
|
||||
background-color: #292828;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
header nav {
|
||||
height: 64px;
|
||||
}
|
||||
container-fluid nav{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.full-page-div {
|
||||
background-color: #ececec; /* Цвет фона */
|
||||
padding: 1%; /* Внутренний отступ */
|
||||
margin: 1%; /* Внешний отступ */
|
||||
}
|
||||
|
||||
header nav a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #9c9c9c;
|
||||
height: 32px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
h4 {
|
||||
font-size: 1.5px;
|
||||
}
|
||||
/* .container{
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
}*/
|
||||
/* .container-fluid{
|
||||
height: 100vh;
|
||||
}
|
||||
.full-page-div {
|
||||
width: 100%;
|
||||
height: calc(100vh - 56px); /* 56px - высота навигационной панели (navbar)
|
||||
overflow-y: auto; Добавляет вертикальную прокрутку, если содержимое не помещается
|
||||
|
||||
} */
|
||||
.card{
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
.circle-container {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden; /* обрезаем лишнее изображение за пределами круга */
|
||||
margin: auto; /* автоматическое выравнивание по горизонтали */
|
||||
margin-top: 20px; /* опциональное выравнивание по вертикали (если нужно) */
|
||||
}
|
||||
|
||||
.circle-container img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover; /* сохраняем соотношение сторон и обрезаем изображение, чтобы оно полностью заполнило круг */
|
||||
}
|
||||
|
||||
a{
|
||||
margin-bottom: 2px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
/* .container-main {
|
||||
flex: 1;
|
||||
} */
|
||||
|
||||
.streamer-nickname {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
font-size: 26px;
|
||||
}
|
||||
.online-indicator {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
background-color: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.online-count {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
/* .sidebar {
|
||||
background-color: #f8f9fa;
|
||||
height: 100vh;
|
||||
} */
|
||||
.video-thumbnail {
|
||||
/* width: 1920px;
|
||||
height: 1080px; */
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.embed-responsive{
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 1600px;
|
||||
height: 800px;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.btn-info{
|
||||
color:rgb(22, 9, 93);
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
.card-img-top{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 500px;
|
||||
}
|
||||
.avatar-img{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 40px;
|
||||
}
|
||||
.modal-dialog img{
|
||||
max-width: 310px;
|
||||
max-height: 200px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.fa-pencil{
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
|
||||
/* #root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
transition: filter 300ms;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||
}
|
||||
|
||||
@keyframes logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
a:nth-of-type(2) .logo {
|
||||
animation: logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
} */
|
129
lab5/src/App.jsx
Normal file
@ -0,0 +1,129 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Container } from 'react-bootstrap';
|
||||
import { Outlet } from 'react-router-dom';
|
||||
import './App.css';
|
||||
import Footer from './components/footer/Footer.jsx';
|
||||
import Navigation from './components/navigation/Navigation.jsx';
|
||||
import Sidebar from './components/sidebar/Sidebar.jsx';
|
||||
|
||||
const App = ({ routes }) => {
|
||||
return (
|
||||
<>
|
||||
<Navigation routes={routes}></Navigation>
|
||||
|
||||
<Container className='flex-container container-fluid' as="main" fluid>
|
||||
<Sidebar />
|
||||
<Container className='' as="main" fluid>
|
||||
<Outlet />
|
||||
</Container>
|
||||
|
||||
</Container>
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
App.propTypes = {
|
||||
routes: PropTypes.array,
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
||||
{/* <div className="app-container">
|
||||
<Navigation routes={routes}></Navigation>
|
||||
|
||||
<Container fluid className="main-container">
|
||||
<div className="row">
|
||||
<Sidebar />
|
||||
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
<div className="full-page-div">
|
||||
<Outlet />
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</Container>
|
||||
|
||||
<Footer />
|
||||
</div> */}
|
||||
|
||||
|
||||
{/* <>
|
||||
<Navigation routes={routes}></Navigation>
|
||||
|
||||
<Container className='p-2' as="main" fluid>
|
||||
<Sidebar />
|
||||
|
||||
<Outlet />
|
||||
</Container>
|
||||
<Footer />
|
||||
</> */}
|
||||
|
||||
// const App = () => {
|
||||
// return (
|
||||
// <Router>
|
||||
// <div>
|
||||
// <header>
|
||||
// <nav className="navbar navbar-expand-md navbar-dark">
|
||||
// <div className="container-fluid">
|
||||
// <Link to="/" className="navbar-brand">
|
||||
// Streaming-video service
|
||||
// </Link>
|
||||
// <button
|
||||
// className="navbar-toggler"
|
||||
// type="button"
|
||||
// data-bs-toggle="collapse"
|
||||
// data-bs-target="#navbarNav"
|
||||
// aria-controls="navbarNav"
|
||||
// aria-expanded="false"
|
||||
// aria-label="Toggle navigation"
|
||||
// >
|
||||
// <span className="navbar-toggler-icon"></span>
|
||||
// </button>
|
||||
// <div className="collapse navbar-collapse justify-content-end" id="navbarNav">
|
||||
// <div className="navbar-nav">
|
||||
// <Link to="/page1" className="nav-link">
|
||||
// Главная страница
|
||||
// </Link>
|
||||
// <Link to="/page2" className="nav-link">
|
||||
// Поиск
|
||||
// </Link>
|
||||
// <Link to="/page3" className="nav-link">
|
||||
// Подписки
|
||||
// </Link>
|
||||
// <Link to="/page4" className="nav-link">
|
||||
// Вход/Регистрация
|
||||
// </Link>
|
||||
// </div>
|
||||
// <form
|
||||
// className="col-12 col-md-auto mb-2 mb-md-0 me-md-3"
|
||||
// role="search"
|
||||
// action="/page2"
|
||||
// method="get"
|
||||
// >
|
||||
// <input className="form-control" type="text" placeholder="Search" aria-label="Search" />
|
||||
// </form>
|
||||
// </div>
|
||||
// </div>
|
||||
// </nav>
|
||||
// </header>
|
||||
// <div className="container-fluid">
|
||||
// <div className="row">
|
||||
// <nav className="col-md-2 bg-dark sidebar">
|
||||
// {/* Sidebar content goes here */}
|
||||
// </nav>
|
||||
// <main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||
// <div className="full-page-div">
|
||||
// {/* Main content goes here */}
|
||||
// </div>
|
||||
// </main>
|
||||
// </div>
|
||||
// </div>
|
||||
// <footer className="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
|
||||
// Copyright ©{new Date().getFullYear()} All rights reserved
|
||||
// </footer>
|
||||
// </div>
|
||||
// </Router>
|
||||
// );
|
||||
// };
|
||||
|
||||
// export default App;
|
BIN
lab5/src/assets/StreamerLogo.png
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
lab5/src/assets/TwitchLogo2.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
1
lab5/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 |
BIN
lab5/src/assets/twitchLogo.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
BIN
lab5/src/assets/video1.png
Normal file
After Width: | Height: | Size: 1.6 MiB |
BIN
lab5/src/assets/video2.png
Normal file
After Width: | Height: | Size: 2.0 MiB |
BIN
lab5/src/assets/video3.png
Normal file
After Width: | Height: | Size: 2.2 MiB |
BIN
lab5/src/assets/video4.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
lab5/src/assets/video5.png
Normal file
After Width: | Height: | Size: 2.5 MiB |
BIN
lab5/src/assets/video6.png
Normal file
After Width: | Height: | Size: 2.1 MiB |
BIN
lab5/src/assets/video7.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
40
lab5/src/components/api/ApiClient.js
Normal file
@ -0,0 +1,40 @@
|
||||
import axios from 'axios';
|
||||
import toast from 'react-hot-toast';
|
||||
|
||||
export class HttpError extends Error {
|
||||
constructor(message = '') {
|
||||
super(message);
|
||||
this.name = 'HttpError';
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
toast.error(message, { id: 'HttpError' });
|
||||
}
|
||||
}
|
||||
|
||||
function responseHandler(response) {
|
||||
if (response.status === 200 || response.status === 201) {
|
||||
const data = response?.data;
|
||||
if (!data) {
|
||||
throw new HttpError('API Error. No data!');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
throw new HttpError(`API Error! Invalid status code ${response.status}!`);
|
||||
}
|
||||
|
||||
function responseErrorHandler(error) {
|
||||
if (error === null) {
|
||||
throw new Error('Unrecoverable error!! Error is null!');
|
||||
}
|
||||
toast.error(error.message, { id: 'AxiosError' });
|
||||
return Promise.reject(error.message);
|
||||
}
|
||||
|
||||
export const ApiClient = axios.create({
|
||||
baseURL: 'http://localhost:8081/',
|
||||
timeout: '3000',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
ApiClient.interceptors.response.use(responseHandler, responseErrorHandler);
|
29
lab5/src/components/api/ApiService.js
Normal file
@ -0,0 +1,29 @@
|
||||
import { ApiClient } from './ApiClient';
|
||||
|
||||
class ApiService {
|
||||
constructor(url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
async getAll(expand) {
|
||||
return ApiClient.get(`${this.url}${expand || ''}`);
|
||||
}
|
||||
|
||||
async get(id, expand) {
|
||||
return ApiClient.get(`${this.url}/${id}${expand || ''}`);
|
||||
}
|
||||
|
||||
async create(body) {
|
||||
return ApiClient.post(this.url, body);
|
||||
}
|
||||
|
||||
async update(id, body) {
|
||||
return ApiClient.put(`${this.url}/${id}`, body);
|
||||
}
|
||||
|
||||
async delete(id) {
|
||||
return ApiClient.delete(`${this.url}/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
export default ApiService;
|
13
lab5/src/components/footer/Footer.css
Normal file
@ -0,0 +1,13 @@
|
||||
/* .my-footer {
|
||||
background-color: #9c9c9c;
|
||||
height: 32px;
|
||||
color: #fff;
|
||||
} */
|
||||
|
||||
|
||||
footer {
|
||||
width: 100%;
|
||||
background-color: #9c9c9c;
|
||||
height: 32px;
|
||||
color: #ffffff;
|
||||
}
|
11
lab5/src/components/footer/Footer.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import './Footer.css';
|
||||
|
||||
const Footer = () => {
|
||||
return (
|
||||
<footer className="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
|
||||
Copyright ©<script>document.write(new Date().getFullYear());</script> All rights reserved
|
||||
</footer>
|
||||
);
|
||||
};
|
||||
|
||||
export default Footer;
|
23
lab5/src/components/input/Input.jsx
Normal file
@ -0,0 +1,23 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Form } from 'react-bootstrap';
|
||||
|
||||
const Input = ({
|
||||
name, label, value, onChange, className, ...rest
|
||||
}) => {
|
||||
return (
|
||||
<Form.Group className={`mb-2 ${className || ''}`} controlId={name}>
|
||||
<Form.Label>{label}</Form.Label>
|
||||
<Form.Control name={name || ''} value={value || ''} onChange={onChange} {...rest} />
|
||||
</Form.Group>
|
||||
);
|
||||
};
|
||||
|
||||
Input.propTypes = {
|
||||
name: PropTypes.string,
|
||||
label: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
className: PropTypes.string,
|
||||
};
|
||||
|
||||
export default Input;
|
29
lab5/src/components/input/Select.jsx
Normal file
@ -0,0 +1,29 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Form } from 'react-bootstrap';
|
||||
|
||||
const Select = ({
|
||||
values, name, label, value, onChange, className, ...rest
|
||||
}) => {
|
||||
return (
|
||||
<Form.Group className={`mb-2 ${className || ''}`} controlId={name}>
|
||||
<Form.Label className='form-label'>{label}</Form.Label>
|
||||
<Form.Select name={name || ''} value={value || ''} onChange={onChange} {...rest}>
|
||||
<option value=''>Выберите значение</option>
|
||||
{
|
||||
values.map((type) => <option key={type.id} value={type.id}>{type.name}</option>)
|
||||
}
|
||||
</Form.Select>
|
||||
</Form.Group>
|
||||
);
|
||||
};
|
||||
|
||||
Select.propTypes = {
|
||||
values: PropTypes.array,
|
||||
name: PropTypes.string,
|
||||
label: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
className: PropTypes.string,
|
||||
};
|
||||
|
||||
export default Select;
|
48
lab5/src/components/lines/form/LinesForm.jsx
Normal file
@ -0,0 +1,48 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Form } from 'react-bootstrap';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import useLinesItemForm from '../hooks/LinesItemFormHook';
|
||||
import LinesItemForm from './LinesItemForm.jsx';
|
||||
|
||||
const LinesForm = ({ id }) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const {
|
||||
item,
|
||||
validated,
|
||||
handleSubmit,
|
||||
handleChange,
|
||||
} = useLinesItemForm(id);
|
||||
|
||||
const onBack = () => {
|
||||
navigate(-1);
|
||||
};
|
||||
|
||||
const onSubmit = async (event) => {
|
||||
if (await handleSubmit(event)) {
|
||||
onBack();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form className='m-0 p-2' noValidate validated={validated} onSubmit={onSubmit}>
|
||||
<LinesItemForm item={item} handleChange={handleChange} />
|
||||
<Form.Group className='row justify-content-center m-0 mt-3'>
|
||||
<Button className='col-5 col-lg-2 m-0 me-2' variant='secondary' onClick={() => onBack()}>
|
||||
Назад
|
||||
</Button>
|
||||
<Button className='col-5 col-lg-2 m-0 ms-2' type='submit' variant='primary'>
|
||||
Сохранить
|
||||
</Button>
|
||||
</Form.Group>
|
||||
</Form>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
LinesForm.propTypes = {
|
||||
id: PropTypes.string,
|
||||
};
|
||||
|
||||
export default LinesForm;
|
3
lab5/src/components/lines/form/LinesItemForm.css
Normal file
@ -0,0 +1,3 @@
|
||||
#image-preview {
|
||||
width: 200px;
|
||||
}
|
34
lab5/src/components/lines/form/LinesItemForm.jsx
Normal file
@ -0,0 +1,34 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import imgPlaceholder from '../../../assets/200.png';
|
||||
import Input from '../../input/Input.jsx';
|
||||
import Select from '../../input/Select.jsx';
|
||||
import useTypes from '../../types/hooks/TypesHook';
|
||||
import './LinesItemForm.css';
|
||||
|
||||
const LinesItemForm = ({ item, handleChange }) => {
|
||||
const { types } = useTypes();
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className='text-center'>
|
||||
<img id='image-preview' className='rounded' alt='placeholder'
|
||||
src={item.image || imgPlaceholder} />
|
||||
</div>
|
||||
<Select values={types} name='typeId' label='Товары' value={item.typeId} onChange={handleChange}
|
||||
required />
|
||||
<Input name='price' label='Цена' value={item.price} onChange={handleChange}
|
||||
type='number' min='1000.0' step='0.50' required />
|
||||
<Input name='count' label='Количество' value={item.count} onChange={handleChange}
|
||||
type='number' min='1' step='1' required />
|
||||
<Input name='image' label='Изображение' onChange={handleChange}
|
||||
type='file' accept='image/*' />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
LinesItemForm.propTypes = {
|
||||
item: PropTypes.object,
|
||||
handleChange: PropTypes.func,
|
||||
};
|
||||
|
||||
export default LinesItemForm;
|
34
lab5/src/components/lines/hooks/LinesDeleteModalHook.js
Normal file
@ -0,0 +1,34 @@
|
||||
import { useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
import useModal from '../../modal/ModalHook';
|
||||
import LinesApiService from '../service/LinesApiService';
|
||||
|
||||
const useLinesDeleteModal = (linesChangeHandle) => {
|
||||
const { isModalShow, showModal, hideModal } = useModal();
|
||||
const [currentId, setCurrentId] = useState(0);
|
||||
|
||||
const showModalDialog = (id) => {
|
||||
showModal();
|
||||
setCurrentId(id);
|
||||
};
|
||||
|
||||
const onClose = () => {
|
||||
hideModal();
|
||||
};
|
||||
|
||||
const onDelete = async () => {
|
||||
await LinesApiService.delete(currentId);
|
||||
linesChangeHandle();
|
||||
toast.success('Элемент успешно удален', { id: 'LinesTable' });
|
||||
onClose();
|
||||
};
|
||||
|
||||
return {
|
||||
isDeleteModalShow: isModalShow,
|
||||
showDeleteModal: showModalDialog,
|
||||
handleDeleteConfirm: onDelete,
|
||||
handleDeleteCancel: onClose,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLinesDeleteModal;
|
28
lab5/src/components/lines/hooks/LinesFilterHook.js
Normal file
@ -0,0 +1,28 @@
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import useTypes from '../../types/hooks/TypesHook';
|
||||
|
||||
const useTypeFilter = () => {
|
||||
const filterName = 'type';
|
||||
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
|
||||
const { types } = useTypes();
|
||||
|
||||
const handleFilterChange = (event) => {
|
||||
const type = event.target.value;
|
||||
if (type) {
|
||||
searchParams.set(filterName, event.target.value);
|
||||
} else {
|
||||
searchParams.delete(filterName);
|
||||
}
|
||||
setSearchParams(searchParams);
|
||||
};
|
||||
|
||||
return {
|
||||
types,
|
||||
currentFilter: searchParams.get(filterName) || '',
|
||||
handleFilterChange,
|
||||
};
|
||||
};
|
||||
|
||||
export default useTypeFilter;
|
45
lab5/src/components/lines/hooks/LinesFormModalHook.js
Normal file
@ -0,0 +1,45 @@
|
||||
import { useState } from 'react';
|
||||
import useModal from '../../modal/ModalHook';
|
||||
import useLinesItemForm from './LinesItemFormHook';
|
||||
|
||||
const useLinesFormModal = (linesChangeHandle) => {
|
||||
const { isModalShow, showModal, hideModal } = useModal();
|
||||
const [currentId, setCurrentId] = useState(0);
|
||||
|
||||
const {
|
||||
item,
|
||||
validated,
|
||||
handleSubmit,
|
||||
handleChange,
|
||||
resetValidity,
|
||||
} = useLinesItemForm(currentId, linesChangeHandle);
|
||||
|
||||
const showModalDialog = (id) => {
|
||||
setCurrentId(id);
|
||||
resetValidity();
|
||||
showModal();
|
||||
};
|
||||
|
||||
const onClose = () => {
|
||||
setCurrentId(-1);
|
||||
hideModal();
|
||||
};
|
||||
|
||||
const onSubmit = async (event) => {
|
||||
if (await handleSubmit(event)) {
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
isFormModalShow: isModalShow,
|
||||
isFormValidated: validated,
|
||||
showFormModal: showModalDialog,
|
||||
currentItem: item,
|
||||
handleItemChange: handleChange,
|
||||
handleFormSubmit: onSubmit,
|
||||
handleFormClose: onClose,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLinesFormModal;
|
29
lab5/src/components/lines/hooks/LinesHook.js
Normal file
@ -0,0 +1,29 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import LinesApiService from '../service/LinesApiService';
|
||||
|
||||
const useLines = (typeFilter) => {
|
||||
const [linesRefresh, setLinesRefresh] = useState(false);
|
||||
const [lines, setLines] = useState([]);
|
||||
const handleLinesChange = () => setLinesRefresh(!linesRefresh);
|
||||
|
||||
const getLines = async () => {
|
||||
let expand = '?_expand=type';
|
||||
if (typeFilter) {
|
||||
expand = `${expand}&typeId=${typeFilter}`;
|
||||
}
|
||||
const data = await LinesApiService.getAll(expand);
|
||||
setLines(data ?? []);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getLines();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [linesRefresh, typeFilter]);
|
||||
|
||||
return {
|
||||
lines,
|
||||
handleLinesChange,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLines;
|
81
lab5/src/components/lines/hooks/LinesItemFormHook.js
Normal file
@ -0,0 +1,81 @@
|
||||
import { useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
import getBase64FromFile from '../../utils/Base64';
|
||||
import LinesApiService from '../service/LinesApiService';
|
||||
import useLinesItem from './LinesItemHook';
|
||||
|
||||
const useLinesItemForm = (id, linesChangeHandle) => {
|
||||
const { item, setItem } = useLinesItem(id);
|
||||
|
||||
const [validated, setValidated] = useState(false);
|
||||
|
||||
const resetValidity = () => {
|
||||
setValidated(false);
|
||||
};
|
||||
|
||||
const getLineObject = (formData) => {
|
||||
const typeId = parseInt(formData.typeId, 10);
|
||||
const price = parseFloat(formData.price).toFixed(2);
|
||||
const count = parseInt(formData.count, 10);
|
||||
const sum = parseFloat(price * count).toFixed(2);
|
||||
const image = formData.image.startsWith('data:image') ? formData.image : '';
|
||||
return {
|
||||
typeId: typeId.toString(),
|
||||
price: price.toString(),
|
||||
count: count.toString(),
|
||||
sum: sum.toString(),
|
||||
image,
|
||||
};
|
||||
};
|
||||
|
||||
const handleImageChange = async (event) => {
|
||||
const { files } = event.target;
|
||||
const file = await getBase64FromFile(files.item(0));
|
||||
setItem({
|
||||
...item,
|
||||
image: file,
|
||||
});
|
||||
};
|
||||
|
||||
const handleChange = (event) => {
|
||||
if (event.target.type === 'file') {
|
||||
handleImageChange(event);
|
||||
return;
|
||||
}
|
||||
const inputName = event.target.name;
|
||||
const inputValue = event.target.type === 'checkbox' ? event.target.checked : event.target.value;
|
||||
setItem({
|
||||
...item,
|
||||
[inputName]: inputValue,
|
||||
});
|
||||
};
|
||||
|
||||
const handleSubmit = async (event) => {
|
||||
const form = event.currentTarget;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const body = getLineObject(item);
|
||||
if (form.checkValidity()) {
|
||||
if (id === undefined) {
|
||||
await LinesApiService.create(body);
|
||||
} else {
|
||||
await LinesApiService.update(id, body);
|
||||
}
|
||||
if (linesChangeHandle) linesChangeHandle();
|
||||
toast.success('Элемент успешно сохранен', { id: 'LinesTable' });
|
||||
return true;
|
||||
}
|
||||
setValidated(true);
|
||||
return false;
|
||||
};
|
||||
|
||||
return {
|
||||
item,
|
||||
validated,
|
||||
handleSubmit,
|
||||
handleChange,
|
||||
resetValidity,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLinesItemForm;
|
34
lab5/src/components/lines/hooks/LinesItemHook.js
Normal file
@ -0,0 +1,34 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import LinesApiService from '../service/LinesApiService';
|
||||
|
||||
const useLinesItem = (id) => {
|
||||
const emptyItem = {
|
||||
id: '',
|
||||
typeId: '',
|
||||
price: '0',
|
||||
count: '0',
|
||||
image: '',
|
||||
};
|
||||
const [item, setItem] = useState({ ...emptyItem });
|
||||
|
||||
const getItem = async (itemId = undefined) => {
|
||||
if (itemId && itemId > 0) {
|
||||
const data = await LinesApiService.get(itemId);
|
||||
setItem(data);
|
||||
} else {
|
||||
setItem({ ...emptyItem });
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getItem(id);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [id]);
|
||||
|
||||
return {
|
||||
item,
|
||||
setItem,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLinesItem;
|