Skip to content

Commit

Permalink
(#51) Refatoração do estilo da US 52 e refatoração do código para dim…
Browse files Browse the repository at this point in the history
…inuir número de requisições por minuto
  • Loading branch information
Victor-oss committed Dec 11, 2023
1 parent 7fdd094 commit 53ffaa8
Show file tree
Hide file tree
Showing 9 changed files with 405 additions and 493 deletions.
28 changes: 11 additions & 17 deletions backend/src/controllers/classPlanController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,9 @@ export default class classPlanController {
where: {
userId: userId,
},
include: {
user: {
select: {
id: true,
email: true,
name: true,
},
},
select: {
id: true,
title: true,
},
})
res.status(200).json(classPlan)
Expand All @@ -62,14 +57,12 @@ export default class classPlanController {
where: {
id: id,
},
include: {
user: {
select: {
id: true,
email: true,
name: true,
},
},
select: {
id: true,
title: true,
goals: true,
observations: true,
userId: true,
},
})
res.status(200).json(classPlan)
Expand All @@ -82,7 +75,7 @@ export default class classPlanController {
try {
const { id } = req.params

const classPlan = await prisma.classPlan.deleteMany({
const classPlan = await prisma.classPlan.delete({
where: { id },
})

Expand All @@ -92,6 +85,7 @@ export default class classPlanController {
res.status(500).json({ errors: { server: "Server error" } })
}
}

updateById = async (req: Request, res: Response) => {
try {
const id = req.params.id
Expand Down
50 changes: 49 additions & 1 deletion frontend/package-lock.json

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

8 changes: 4 additions & 4 deletions frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Link } from 'react-router-dom';
import { Icon } from '@iconify/react/dist/iconify.js';

const Header = (props: { path: string; hasReturnArrow: boolean }) => {
const Header = (props: { hasReturnArrow: boolean, changeScreenFunction: () => void }) => {
const logout = () => {
localStorage.removeItem('token');
localStorage.removeItem('user');
Expand All @@ -15,14 +14,15 @@ const Header = (props: { path: string; hasReturnArrow: boolean }) => {
>
<div className="flex flex-grow items-center justify-between py-4 px-4 shadow-2 md:px-6 2xl:px-11">
{props.hasReturnArrow ? (
<Link to={`/${props.path}`}>
<button
onClick={props.changeScreenFunction}>
<Icon
icon="ep:arrow-left-bold"
color="white"
width="25px"
className="clickableIcon"
/>
</Link>
</button>
) : (
<div></div>
)}
Expand Down
31 changes: 23 additions & 8 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ span.flatpickr-weekday,
}

.buttonsPanel {
width: 100vw;
width: 100%;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(330px, 330px));
grid-gap: 20px;
Expand Down Expand Up @@ -355,12 +355,25 @@ span.flatpickr-weekday,
padding-right: 10px;
}

.titleLayoutClassPLan {
display: flex;
flex-direction: row;
margin: auto;
width: 90%;
}

.contentDrill{
display: flex;
justify-content: space-between;
padding: 0px 15px;
}

.contentClassPlan{
display: flex;
flex-direction: column;
align-items: center;
}

#drillGraphicContainer{
margin-top: 5px;
height: 406px;
Expand Down Expand Up @@ -390,15 +403,19 @@ span.flatpickr-weekday,
background-color: #494949;
padding: 15px;
border-radius: 20px;
height: 300px;
min-height: 300px;
width: 350px;
box-sizing: content-box;
height: fit-content;
}

.pClassPlan {
color: white;
.pClassPlan{
margin: 10px auto;
background-color: #494949;
padding: 15px;
border-radius: 20px;
min-height: 300px;
box-sizing: content-box;
height: fit-content;
width: 90%;
}
Expand All @@ -423,15 +440,13 @@ span.flatpickr-weekday,
border: '1px solid black';
}

.textAreaDrill {
/* .textAreaDrill {
background-color: #494949;
border-radius: 20px;
height: 300px;
width: 250px;
height: 300px;
width: 350px;
padding: 15px;
}
} */

.drillButtonsPanel {
width: 100%;
Expand Down
20 changes: 15 additions & 5 deletions frontend/src/pages/Authentication/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { Icon } from '@iconify/react/dist/iconify.js';
import '../../index.css';
import Logo from '../../images/logoBeachTennisCoordimate.png';
import { Link } from 'react-router-dom';
import ClassPlanService from '../../service/classPlanService';

const SignIn = () => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const classPlan = new ClassPlanService();

const handleSignIn = async () => {
try {
Expand All @@ -25,11 +27,19 @@ const SignIn = () => {
if (data.status === 200) {
localStorage.setItem('token', data.data.token);
console.log(data.data);
localStorage.setItem('user', JSON.stringify(data.data));
toast.success('Login realizado com sucesso!');
setTimeout(() => {
window.location.href = '/';
}, 3000);
const data_user = JSON.stringify(data.data);
localStorage.setItem('user', data_user);
try{
const user_id = String(JSON.parse(data_user).id);
let userClassPlans = await classPlan.getManyById(user_id as string);
localStorage.setItem('userClassPlans', JSON.stringify(userClassPlans.data));
toast.success('Login realizado com sucesso!');
setTimeout(() => {
window.location.href = '/';
}, 3000);
} catch (error){

}
}
return;
}
Expand Down
Loading

0 comments on commit 53ffaa8

Please sign in to comment.