All files / src/components SchedulerEvents.tsx

33.33% Statements 1/3
0% Branches 0/12
0% Functions 0/2
33.33% Lines 1/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45                          1x                                                              
import React, { useContext } from 'react';
import { SchedulerRow } from './SchedulerRow';
import { coursesContext } from '../contexts/CoursesProvider';
import { selectGroupsToShow } from '../utils/index';
import { ROWS_COUNT } from '../constants';
import { SchedulerEvent } from '../types';
 
interface SchedulerEventsProps {
  cellWidth: number;
  cellHeight: number;
  schedulerEvents: Array<SchedulerEvent>;
}
 
export const SchedulerEvents = ({ cellWidth, cellHeight,schedulerEvents }: SchedulerEventsProps) => {
 
  return (
    <div>
      {[...Array(ROWS_COUNT)].map((_, index) => (
        <SchedulerRow
          key={index}
          groups={selectGroupsToShow(schedulerEvents, index)}
          indexRow={index}
          rowTop={
            index === 0
              ? cellHeight / 2
              : index === 1
              ? cellHeight * 4
              : index === 2
              ? cellHeight * 7.5
              : index === 3
              ? cellHeight * 11.5
              : index === 4
              ? cellHeight * 15
              : index === 5
              ? cellHeight * 18.5
              : 0
          }
          cellWidth={cellWidth}
          cellHeight={cellHeight}
        />
      ))}
    </div>
  );
};