Skip to content

Commit

Permalink
front turmas
Browse files Browse the repository at this point in the history
  • Loading branch information
rayenealmeida committed Sep 4, 2024
1 parent 66ef688 commit b3ff76d
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 12 deletions.
64 changes: 56 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"preview": "vite preview"
},
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"@fortawesome/react-fontawesome": "^0.2.2",
"@monaco-editor/react": "^4.6.0",
"axios": "^1.7.3",
"axios": "^1.7.7",
"exceljs": "^4.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
4 changes: 3 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import 'react-toastify/dist/ReactToastify.css';
import AtividadeDeTexto from './pages/exercicio/AtividadeDeTexto'
import AtividadeDeImagem from './pages/exercicio/AtividadeDeImagem'
import AlunoAtividades from './pages/lista-atividades/AlunoAtividades'
import AlunoGrupos from './pages/lista-grupos/AlunoGrupos'
import AlunoGrupos from './pages/lista-grupos/AlunoGrupos'
import Turmas from './pages/turmas/Turmas'


function App() {
Expand All @@ -34,6 +35,7 @@ function App() {
<Route path='/admin/dashboard' element={<AdminDashboard />} />
<Route path='/professor/grupos' element={<ProfessorDashboard />} />
<Route path='/admin/grupos' element={<ListaGrupos />} />
<Route path='/admin/turmas' element={<Turmas />} />
{/* Rotas de aluno */}
<Route path='/login/aluno' element={<LoginAluno />} />
<Route path='/primeiroacesso' element={<PrimeiroAcessoAluno />} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebar/SideBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const SideBar = ({ user_role }) => {
</li>
</Link>

<Link href="">
<Link to="/admin/turmas">
<li className='w-[15vw] md:w-auto md:pl-[30px] py-[10px] rounded-xl md:m-[10px] m-[5px] md:text-xl flex md:flex-row flex-col items-center text-[#2e3440] bg-base-100 bg-[#88c0d0] hover:bg-[#d8dee9]'>
<svg fill="#88c0d0" height="24px" width="24px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" viewBox="0 0 512 512" xmlSpace="preserve" stroke="#88c0d0"><g id="SVGRepo_bgCarrier" strokeWidth="0"></g><g id="SVGRepo_tracerCarrier" strokeLinecap="round" strokeLinejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <g> <path d="M502.724,381.172h-2.783V78.796c0-5.123-4.153-9.276-9.276-9.276H21.334c-5.123,0-9.276,4.153-9.276,9.276v302.375H9.276 c-5.123,0-9.276,4.153-9.276,9.276v42.758c0,5.123,4.153,9.276,9.276,9.276h493.448c5.123,0,9.276-4.153,9.276-9.276v-42.758 C512,385.325,507.847,381.172,502.724,381.172z M30.61,88.071h450.78v293.099H166.03v-12.371h293.712 c5.123,0,9.276-4.153,9.276-9.276V109.721c0-5.123-4.153-9.276-9.276-9.276H52.25c-5.123,0-9.276,4.153-9.276,9.276v249.804 c0,5.123,4.153,9.276,9.276,9.276h21.025v12.371H30.61V88.071z M82.551,335.943c-5.123,0-9.276,4.153-9.276,9.276v5.029H61.526 V118.997h388.941v231.252H166.03v-5.029c0-5.124-4.153-9.277-9.276-9.277H82.551z M147.478,354.495v26.676H91.827v-26.676H147.478 z M493.448,423.93H18.552v-24.206h474.897V423.93z"></path> </g> </g> </g></svg>
<p className='md:pl-[20px]'>Turmas</p>
Expand Down
73 changes: 73 additions & 0 deletions src/pages/turmas/Turmas.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React, { useState, useEffect } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPlusCircle, faPencilAlt, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
import axios from 'axios';
import NavBar from '../../components/navbar/navbar-menu/NavBarMenu';
import SideBar from '../../components/sidebar/SideBar';
import { API_BASE_URL } from '../../util/constants';
import { useAuth } from '../../context/AuthContext';

const Turmas = () => {
const { token } = useAuth();
const [turmas, setTurmas] = useState([]);

useEffect(() => {
const getTurmas = () => {
axios.get(` ${API_BASE_URL}/turma/admin `, {
headers: {
'Authorization': ` Bearer ${token} `
}
})
.then((response) => {
console.log(response.data);
setTurmas(response.data);
})
.catch((error) => {
console.error(error);
});
};

getTurmas();
}, [token]);

return (
<div className='bg-base-200'>
<NavBar />
<div className='flex justify-end pr-4'>
<div className='w-full max-w-[940px] p-4 flex flex-col gap-4 bg-base-100 rounded-xl shadow mt-[15px]'>
<div className='z-[1] md:absolute md:left-0 md:ml-[62px] mb-6'>
<SideBar user_role={'admin'} />
</div>
<div className="bg-[#2e3440] h-[25px] rounded-t-xl"></div>
<div className="bg-[#d8dee9] h-[75px] flex items-center justify-between px-4">
<div className="flex items-center">
<input
type="text"
placeholder="Pesquisar..."
className="border border-gray-300 rounded-md px-2 py-1 mr-2"
/>
</div>
<button className="bg-[#5e81ac] text-base-100 px-4 py-2 rounded-md flex items-center">
<FontAwesomeIcon icon={faPlusCircle} className="mr-2" />
Adicionar Turma
</button>
</div>

<div className='flex flex-col gap-2 p-4'>
{turmas.map((turma) => (
<div key={turma.id} className="bg-[#d8dee9] p-4 rounded-md flex justify-between items-center">
<span className="text-[#2e3440]">{turma.nome}</span>
<div className="flex items-center">
<FontAwesomeIcon icon={faPencilAlt} className="text-green-500 mr-4 cursor-pointer" />
<FontAwesomeIcon icon={faTrashAlt} className="text-red-500 cursor-pointer" />
</div>
</div>
))}
</div>
</div>
</div>
</div>
);
};

export default Turmas;
2 changes: 1 addition & 1 deletion src/util/constants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export const TURMA_ENDPOINT = import.meta.env.VITE_TURMA_ENDPOINT;
export const GRUPO_ENDPOINT = import.meta.env.VITE_GRUPO_ENDPOINT;
export const MONITOR_ENDPOINT = import.meta.env.VITE_MONITOR_ENDPOINT;
export const ATIVIDADE_ENDPOINT = import.meta.env.VITE_ATIVIDADE_ENDPOINT;
export const CODE_API_BASE_URL = import.meta.env.CODE_API_BASE_URL;
//export const CODE_API_BASE_URL = import.meta.env.CODE_API_BASE_URL;

0 comments on commit b3ff76d

Please sign in to comment.