Skip to content

Commit

Permalink
Merge pull request #311 from NIAEFEUP/fix/collab-session-duplicate-de…
Browse files Browse the repository at this point in the history
…finition

fix: collab session duplicate definition
  • Loading branch information
tomaspalma authored Sep 22, 2024
2 parents 8db09ed + 7076ccb commit 7fe89f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/planner/schedules/SlotBoxes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const SlotBoxes = ({ slots, classes, hiddenLessonsTypes }: Props) => {
return (
<>
{
filteredSlots.map((slot: SlotInfo) => {
filteredSlots.map((slot: SlotInfo, idx: number) => {
const classDescriptor = classes.find((classDescriptor) => (
classDescriptor.classInfo.slots.filter((otherSlot) => otherSlot.id === slot.id).length > 0
))

if (!classDescriptor) return <></>;

return <SlotBox
key={`${classDescriptor.courseInfo.id}-${classDescriptor.classInfo.id}`}
key={`${classDescriptor.courseInfo.id}-${classDescriptor.classInfo.id}-${idx}`}
courseInfo={classDescriptor.courseInfo}
classInfo={classDescriptor.classInfo}
classes={classes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useContext, useState, useEffect, Fragment } from 'react';
import { Dialog, Transition } from '@headlessui/react';
import { XMarkIcon } from '@heroicons/react/24/solid';
import CollabPickSession from './CollabPickSession';
import CollabSession from './CollabSession';
import CollabSessionModal from './CollabSessionModal';
import CollabSessionContext from '../../../../contexts/CollabSessionContext';

const PICK_SESSION = 'PICK_SESSION';
Expand Down Expand Up @@ -125,7 +125,7 @@ const CollabModal = ({ isOpen, closeModal }: Props) => {
)}

{currentView === SESSION && currentSession && (
<CollabSession
<CollabSessionModal
session={currentSession}
onExitSession={handleExitSession}
onUpdateUser={handleUpdateUser}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Props = {
onUpdateUser: (arg: string) => void
}

const CollabSession = ({ session, onExitSession, onUpdateUser }: Props) => {
const CollabSessionModal = ({ session, onExitSession, onUpdateUser }: Props) => {
const { toast } = useToast();
const [copied, setCopied] = useState(false);
const [lastValidUser, setLastValidUser] = useState(session.currentUser);
Expand Down Expand Up @@ -130,4 +130,4 @@ const CollabSession = ({ session, onExitSession, onUpdateUser }: Props) => {
);
};

export default CollabSession;
export default CollabSessionModal;

0 comments on commit 7fe89f1

Please sign in to comment.