Skip to content

Commit

Permalink
implemented better way to skip unused args, handleResize
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasFoydel committed Feb 19, 2023
1 parent 2bb2dc3 commit 9cdfe55
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions client/src/Pages/CoachPages/Schedule/parts/Dnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ const Dnd = ({
updateBlocks(newStartDate, newEndDate, newStartTime, endTime, recurring)
}

const handleResize = ({}, {}, refToElement) => {
let { transform, height } = refToElement.style
let elementYPosition = transform.split(', ')[1]
elementYPosition = elementYPosition.substring(0, elementYPosition.length - 3)
const start = times[elementYPosition / 50]
let elementHeight = height.substring(0, height.length - 2)
elementHeight /= 50
const handleResize = (...[, , refToElement]) => {
const { transform, height } = refToElement.style
const elementYPosition = transform.split(', ')[1]
const y = elementYPosition.substring(0, elementYPosition.length - 3)
const start = times[y / 50]
const elementHeight = +height.substring(0, height.length - 2) / 50
const startIndex = times.indexOf(start)
const newEndTime = times[startIndex + elementHeight]
if (newEndTime && newEndTime !== startTime) {
Expand Down

0 comments on commit 9cdfe55

Please sign in to comment.