Skip to content

Commit

Permalink
Merge branch 'develop' into feature/analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
thePeras authored Sep 3, 2024
2 parents 42c5e88 + 599f756 commit 53f57c7
Show file tree
Hide file tree
Showing 15 changed files with 394 additions and 250 deletions.
15 changes: 8 additions & 7 deletions src/@types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
enum lesson_type {
T = "T",
TP = "TP",
P = "P",
PL = "PL",
OT = "OT",
O = "O",
E = "E"
T = "T", // Ensino teórico
TP = "TP", // Ensino teórico-prático
P = "P", // Ensino prático
PL = "PL", // Ensino prático e laboratorial
OT = "OT", // Orientação tutorial
O = "O", // Outra
E = "E" // Estágio
}
// https://sigarra.up.pt/feup/pt/web_base.gera_pagina?p_pagina=h_ds_func_relatorios.querylist

/* Majors */
export type Major = {
Expand Down
22 changes: 12 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
import './app.css'
import CombinedProvider from './contexts/CombinedProvider'
import { AboutPage, TimeTableSchedulerPage, FaqsPage, NotFoundPage } from './pages'
import { getPath, config, plausible } from './utils'
import { getPath, config, dev_config, plausible } from './utils'
import Layout from './components/layout'

const configToUse = Number(import.meta.env.VITE_APP_PROD) ? config : dev_config

// Configures the path for pages.
const pages = [
{ path: getPath(config.paths.about), location: 'Sobre', element: AboutPage, liquid: true },
{ path: getPath(config.paths.planner), location: 'Horários', element: TimeTableSchedulerPage, liquid: true },
{ path: getPath(config.paths.faqs), location: 'FAQs', element: FaqsPage, liquid: true },
{ path: getPath(config.paths.notfound), location: 'NotFound', element: NotFoundPage, liquid: true },
{ path: getPath(configToUse.paths.about), location: 'Sobre', element: AboutPage, liquid: true },
{ path: getPath(configToUse.paths.planner), location: 'Horários', element: TimeTableSchedulerPage, liquid: true },
{ path: getPath(configToUse.paths.faqs), location: 'FAQs', element: FaqsPage, liquid: true },
{ path: getPath(configToUse.paths.notfound), location: 'NotFound', element: NotFoundPage, liquid: true },
]

const redirects = [
{ from: "/", to: getPath(config.paths.planner) },
{ from: config.pathPrefix, to: getPath(config.paths.planner) },
{ from: config.pathPrefix.slice(0, -1), to: getPath(config.paths.planner) },
{ from: getPath(config.paths.home), to: getPath(config.paths.about) },
{ from: "/", to: getPath(configToUse.paths.planner) },
{ from: configToUse.pathPrefix, to: getPath(configToUse.paths.planner) },
{ from: configToUse.pathPrefix.slice(0, -1), to: getPath(configToUse.paths.planner) },
{ from: getPath(configToUse.paths.home), to: getPath(configToUse.paths.about) },
]

const App = () => {
Expand Down Expand Up @@ -59,4 +61,4 @@ const App = () => {
)
}

export default App
export default App
10 changes: 7 additions & 3 deletions src/components/planner/Schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ const Schedule = () => {
}, [classes])

const slotsOrderedByDay = (slots: Array<SlotInfo>): Array<SlotInfo> => {
return slots.sort((slot1, slot2) => (
slot1.day - slot2.day
));
return slots.sort((slot1, slot2) => {
if (slot1.day === slot2.day) {
return slot1.start_time - slot2.start_time;
}

return slot1.day - slot2.day
});
}

// Bottom Bar Configurations
Expand Down
2 changes: 1 addition & 1 deletion src/components/planner/schedules/LessonBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const LessonBox = ({
const slot = classDescriptor.classInfo.slots[j];
if (schedulesConflict(slotInfo, slot)) {
// The highest severity of the all the conflicts is the overall severity
newConflictInfo.severe = conflictsSeverity(slotInfo, slot) || newConflictInfo.severe;
newConflictInfo.severe = conflictsSeverity(slotInfo, slot) == 2 || newConflictInfo.severe;
const newClassDescriptor = {
classInfo: classDescriptor.classInfo,
courseInfo: classDescriptor.courseInfo,
Expand Down
2 changes: 1 addition & 1 deletion src/components/planner/sidebar/CoursesController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Button } from '../../ui/button'


const CoursesController = () => {
const { pickedCourses,setUcsModalOpen } = useContext(CourseContext);
const { pickedCourses, setUcsModalOpen } = useContext(CourseContext);

const noCoursesPicked = pickedCourses.length === 0;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useContext, useMemo } from 'react'
import { ClassInfo } from '../../../../@types/index'
import { DropdownMenuCheckboxItem } from '../../../ui/dropdown-menu'
import { ExclamationTriangleIcon } from '@heroicons/react/20/solid'
import { schedulesConflict } from '../../../../utils'
import { conflictsSeverity, schedulesConflict } from '../../../../utils'
import MultipleOptionsContext from '../../../../contexts/MultipleOptionsContext'
import CourseContext from '../../../../contexts/CourseContext'

Expand Down Expand Up @@ -49,12 +49,7 @@ const ClassItem = ({ course_id, classInfo, displayed, checked, preview, onSelect
for (const slot1 of pickedClass.slots)
for (const slot2 of classInfo.slots)
if (schedulesConflict(slot1, slot2)) {
if (slot1.lesson_type == "TP" && slot2.lesson_type == "TP")
return 2
else if (slot1.lesson_type == "TP" || slot2.lesson_type == "TP")
return 1
else
return 0
return conflictsSeverity(slot1, slot2);
}
}, []);

Expand Down
Loading

0 comments on commit 53f57c7

Please sign in to comment.