Fix form for adding students, update routes

This commit is contained in:
adam-skowronek 2022-06-11 19:52:35 +02:00
parent 96151d0598
commit 4f139ec137
4 changed files with 33 additions and 58 deletions

View File

@ -24,8 +24,8 @@ function App() {
<QueryClientProvider client={queryClient}>
<Routes>
<Route index element={<Login />} />
<Route path="" element={<Login />} />
<Route path="coordinator" element={<Coordinator />}>
<Route index element={<Students />} />
<Route path="groups" element={<Groups />} />
<Route path="students" element={<Students />} />
<Route path="leaders" element={<Leaders />} />

View File

@ -1,15 +1,6 @@
import { useEffect } from 'react'
import { Outlet, useNavigate } from 'react-router-dom'
import { NavLink } from 'react-router-dom'
const Login = () => {
const navigate = useNavigate()
// useEffect(() => {
// navigate('/coordinator/students')
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, [])
return (
<>
<div className="flex items-center bg-gray-300 mt-20 py-6 px-10 shadow">
@ -20,23 +11,15 @@ const Login = () => {
<label className="label" htmlFor="login">
Login
</label>
<input
className="input input-bordered"
id="login"
type="text"
/>
<input className="input input-bordered" id="login" type="text" />
</div>
<div className="form-control">
<label className="label" htmlFor="password">
Hasło
</label>
<input
className="input input-bordered"
id="password"
type="text"
/>
<input className="input input-bordered" id="password" type="text" />
</div>
<span onClick={() => navigate('/coordinator/students')} className="cursor-pointer">Koordynator</span>
<NavLink to="/coordinator/students">Koordynator</NavLink>
<span>Opiekun</span>
<span>Student</span>
</div>

View File

@ -89,18 +89,6 @@ const AddStudent = () => {
</div>
<div className="form-control gap-2">
<label className="label">Tryb studiów</label>
<div className="flex gap-2">
<input
className="radio"
id="mode-0"
type="radio"
{...register('mode', {
required: true,
})}
value="0"
/>
<label htmlFor="mode-0">Stacjonarny</label>
</div>
<div className="flex gap-2">
<input
className="radio"
@ -111,7 +99,19 @@ const AddStudent = () => {
})}
value="1"
/>
<label htmlFor="mode-1">Niestacjonarny</label>
<label htmlFor="mode-1">Stacjonarny</label>
</div>
<div className="flex gap-2">
<input
className="radio"
id="mode-0"
type="radio"
{...register('mode', {
required: true,
})}
value="0"
/>
<label htmlFor="mode-0">Niestacjonarny</label>
</div>
{errors.mode?.type === 'required' && (
<InputError>Wybierz tryb studiów</InputError>

View File

@ -1,15 +1,7 @@
import { useEffect } from 'react'
import { Outlet, useNavigate } from 'react-router-dom'
import { Outlet } from 'react-router-dom'
import TopBar from '../../components/TopBar'
const Coordinator = () => {
const navigate = useNavigate()
useEffect(() => {
navigate('/coordinator/students')
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
return (
<>
<TopBar