prep
This commit is contained in:
parent
d75530887e
commit
78e54b70e4
@ -73,21 +73,21 @@ export const Scheduler = () => {
|
|||||||
currentEventsIds.map((eventId: string) => {
|
currentEventsIds.map((eventId: string) => {
|
||||||
const event = document.getElementById(eventId);
|
const event = document.getElementById(eventId);
|
||||||
if (event) {
|
if (event) {
|
||||||
event.style.display = 'block';
|
event.style.backgroundColor = 'blue';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
displayEvents();
|
displayEvents();
|
||||||
}, [currentEventsIds]);
|
}, [currentEventsIds]);
|
||||||
|
|
||||||
// const handleClick = (e: React.MouseEvent) => {
|
const handleClick = (e: React.MouseEvent) => {
|
||||||
// const cellId = e.currentTarget.id;
|
const cellId = e.currentTarget.id;
|
||||||
// const column = cellId.slice(0, 1);
|
// const column = cellId.slice(0, 9);
|
||||||
// const row = cellId.slice(1);
|
// const row = cellId.slice(1);
|
||||||
// const eventId = `eventCol${column}eventRow${Math.floor(parseInt(row) / 2)}`;
|
//const eventId = `eventCol${column}eventRow${Math.floor(parseInt(row) / 2)}`;
|
||||||
|
console.log(cellId)
|
||||||
// setCurrentEventsIds((currentEventsIds) => [...currentEventsIds, eventId]);
|
setCurrentEventsIds((currentEventsIds) => [...currentEventsIds, cellId]);
|
||||||
// };
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -114,7 +114,7 @@ export const Scheduler = () => {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
<SchedulerEvents cellTop={cellTop} cellWidth={cellWidth} cellHeight={wrapperHeight / 13} />
|
<SchedulerEvents onClick={handleClick} cellTop={cellTop} cellWidth={cellWidth} cellHeight={wrapperHeight / 13}/>
|
||||||
</SchedulerWrapper>
|
</SchedulerWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -7,9 +7,10 @@ interface SchedulerEventsProps {
|
|||||||
cellTop: number;
|
cellTop: number;
|
||||||
cellWidth: number;
|
cellWidth: number;
|
||||||
cellHeight: number;
|
cellHeight: number;
|
||||||
|
onClick: (e: React.MouseEvent) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SchedulerEvents = ({ cellTop, cellWidth, cellHeight }: SchedulerEventsProps) => {
|
export const SchedulerEvents = ({ cellTop, cellWidth, cellHeight, onClick }: SchedulerEventsProps) => {
|
||||||
const { basket } = useContext(coursesContext)!;
|
const { basket } = useContext(coursesContext)!;
|
||||||
|
|
||||||
const [choosenGroupsMappedToEvents, setChoosenGroupsMappedToEvents] = useState<any>([]);
|
const [choosenGroupsMappedToEvents, setChoosenGroupsMappedToEvents] = useState<any>([]);
|
||||||
@ -50,6 +51,7 @@ export const SchedulerEvents = ({ cellTop, cellWidth, cellHeight }: SchedulerEve
|
|||||||
<div>
|
<div>
|
||||||
{[...Array(6)].map((_, index) => (
|
{[...Array(6)].map((_, index) => (
|
||||||
<SchedulerRow
|
<SchedulerRow
|
||||||
|
onClick={onClick}
|
||||||
key={index}
|
key={index}
|
||||||
groups={choosenGroupsMappedToEvents.filter((group: any) => {
|
groups={choosenGroupsMappedToEvents.filter((group: any) => {
|
||||||
return group.eventRow === index;
|
return group.eventRow === index;
|
||||||
|
@ -25,13 +25,15 @@ interface SchedulerRowProps {
|
|||||||
cellTop: number;
|
cellTop: number;
|
||||||
cellWidth: number;
|
cellWidth: number;
|
||||||
cellHeight: number;
|
cellHeight: number;
|
||||||
|
onClick: (e: React.MouseEvent) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth, cellHeight }: SchedulerRowProps) => {
|
export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth, cellHeight, onClick }: SchedulerRowProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{[...Array(5)].map((_, eventIndex) => (
|
{[...Array(5)].map((_, eventIndex) => (
|
||||||
<SchedulerEvent
|
<SchedulerEvent
|
||||||
|
onClick={onClick}
|
||||||
eventIndex={eventIndex}
|
eventIndex={eventIndex}
|
||||||
cellTop={cellTop}
|
cellTop={cellTop}
|
||||||
cellWidth={cellWidth}
|
cellWidth={cellWidth}
|
||||||
|
Loading…
Reference in New Issue
Block a user