настроена маршрутизация, нужно доделать группы юзеров

This commit is contained in:
gotika 2024-09-04 08:08:13 +03:00
parent 7124f54281
commit 8579c779a0
8 changed files with 103 additions and 21 deletions

View File

@ -1,25 +1,29 @@
import logo from './logo.svg';
import './App.css';
import React from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import Users from './pages/users';
import Groups from './pages/groups';
import Migration from './pages/migration';
import GlobalMailing from './pages/GlobalMailing';
import GlobalVariables from './pages/GlobalVariables';
import PerformanceMetrics from './pages/performance';
import Navbar from './components/navbar';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
<Router>
<div>
<Navbar />
<Routes>
<Route path="/" element={<Users />} />
<Route path="/groups" element={<Groups />} />
<Route path="/migration" element={<Migration />} />
<Route path="/globalMailing" element={<GlobalMailing />} />
<Route path="/globalVariables" element={<GlobalVariables />} />
<Route path="/performance" element={<PerformanceMetrics />} />
</Routes>
</div>
</Router>
);
}
export default App;
export default App;

View File

@ -0,0 +1,19 @@
import React from 'react';
import { Link } from 'react-router-dom';
function Navbar() {
return (
<nav>
<ul>
<li><Link to="/">Users</Link></li>
<li><Link to="/groups">User Groups</Link></li>
<li><Link to="/migration">Data Migration</Link></li>
<li><Link to="/GlobalMailing">Global Mailing</Link></li>
<li><Link to="/GlobalVariables">Global Variables</Link></li>
<li><Link to="/performance">Performance Metrics</Link></li>
</ul>
</nav>
);
}
export default Navbar;

View File

@ -1,7 +1,7 @@
import React from 'react';
const Groups = () => {
const groups = ['Admins', 'Editors', 'Viewers']; //заглушка
const groups = ['Admins', 'Editors', 'Viewers']; //заглушка(потом нужно убрать и доделать)
return (
<div>

View File

@ -0,0 +1,59 @@
import React from "react";
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend
} from 'chart.js';
import { Line } from 'react-chartjs-2';
ChartJS.register(
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend
);
const PerformanceMetrics = () => {
const data = {
labels: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май'],
datasets: [
{
label: 'Производительность',
data: [65, 59, 80, 81, 56],
fill: false,
backgroundColor: 'rgb(75, 192, 192)',
borderColor: 'rgba(75, 192, 192, 0.2)',
},
],
};
const options = {
responsive: true,
plugins: {
legend: {
position: 'top',
},
title: {
display: true,
text: 'График производительности',
},
},
};
return (
<div>
<h2>Производительность</h2>
<Line data={data} options={options} />
</div>
);
};
export default PerformanceMetrics;

View File

@ -2,7 +2,7 @@ import React from 'react';
import UserActions from '../components/userActions';
const Users = () => {
const users = ['User1', 'User2', 'User3']; //заглушка(потом можно убрать)
const users = ['User1', 'User2', 'User3']; //заглушка(потом нужно убрать и доделать)
return (
<div>