Skip to content

Commit

Permalink
feat: 🚀 improve styles and code
Browse files Browse the repository at this point in the history
  • Loading branch information
elvisscochito committed Sep 11, 2023
1 parent 9e0d095 commit f10e0a1
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 5 deletions.
25 changes: 20 additions & 5 deletions frontend/src/components/ModalCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { faCircleDot, faCircleExclamation, faCircleInfo, faCircleXmark, faClockR
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import apiUrlPrefix from '../config/apiUrlPrefix.js';
import styles from '../styles/ModalCard.module.css';
import { dateOptions, timeOptions } from '../utils/utils.js';

Expand Down Expand Up @@ -108,14 +109,19 @@ const ModalCard = ({ datetime, currentDate, setCurrentDate, room, rooms, setMeet
try {
const start = new Date(`${inputDate}T${startTime}`).toISOString();
const end = new Date(`${inputDate}T${endTime}`).toISOString();
const response = await fetch(`${apiUrlPrefix}/${room}/meeting?start=${start}&end=${end}`);
const currentDateTime = new Date().toISOString();

const data = await response.json();
if (start >= currentDateTime) {
const response = await fetch(`${apiUrlPrefix}/${room}/meeting?start=${start}&end=${end}`);
const data = await response.json();

if (data.overlap) {
setErrorTimeMessage('Ya hay una reunión programada en ese horario');
if (data.overlap) {
setErrorTimeMessage('Ya hay una reunión programada en ese horario');
} else {
setErrorTimeMessage('');
}
} else {
setErrorTimeMessage('');
setErrorTimeMessage('Selecciona una hora de inicio en el futuro');
}
} catch (error) {
console.error(error);
Expand Down Expand Up @@ -166,6 +172,15 @@ const ModalCard = ({ datetime, currentDate, setCurrentDate, room, rooms, setMeet

const handleUpdateMeeting = async (e) => {
e.preventDefault();

const startDateTime = new Date(`${inputDate}T${startTime}`);
const endDateTime = new Date(`${inputDate}T${endTime}`);

if (endDateTime <= startDateTime) {
setErrorTimeMessage('La hora de finalización debe ser posterior a la hora de inicio');
return;
}

try {
const response = await fetch(`${apiUrlPrefix}/${room}/meeting/${meeting._id}`, {
method: 'PUT',
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/styles/DateSlider.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ span.arrowButton {
/* transition: all 0.2s ease-in-out; */
}

span.arrowButton:hover {
cursor: pointer;
}

/* button.arrowButtonLeft {
position: absolute;
top: 100%;
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/styles/MeetingCard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ div.card {
/* border-left-color: var(--brand-color); */
}

div.card:hover {
cursor: pointer;
}

div.status {
display: flex;
flex-direction: row;
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/styles/Meetings.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ button.button {
/* transition: all 0.2s ease-in-out; */
}

button.button:hover {
cursor: pointer;
}

button.button:disabled {
background-color: hsla(151, 100%, 23%, 0.5);
}
4 changes: 4 additions & 0 deletions frontend/src/styles/Modal.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ button.button {
*/
}

button.button:hover {
cursor: pointer;
}

button.default {
background-color: var(--brand-color);
color: #fff;
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/styles/ModalCard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ label.roomLabel {
font-weight: 500;
}

label.roomLabel:hover {
cursor: pointer;
}

/* turn label text color into green if input radio is checked */
label.roomLabel:has(input[type="radio"].radio:checked) {
background-color: var(--brand-color);
Expand Down Expand Up @@ -176,6 +180,10 @@ button.button {
*/
}

button.button:hover {
cursor: pointer;
}

button.default {
background-color: var(--brand-color);
color: #fff;
Expand Down Expand Up @@ -290,3 +298,8 @@ button.closeWarning {
font-weight: 500;
padding: .5rem;
}

button.close,
button.closeWarning {
cursor: pointer;
}
4 changes: 4 additions & 0 deletions frontend/src/styles/RoomSwitcher.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ button.room {
border-radius: 1.875rem;
transition: all 0.2s ease-in-out;
}

button.room:hover {
cursor: pointer;
}

0 comments on commit f10e0a1

Please sign in to comment.