diff --git a/src/features/binnacle/features/availability/ui/components/availability-table/absence-item/absence-item.tsx b/src/features/binnacle/features/availability/ui/components/availability-table/absence-item/absence-item.tsx index 97934ebf..47305cb6 100644 --- a/src/features/binnacle/features/availability/ui/components/availability-table/absence-item/absence-item.tsx +++ b/src/features/binnacle/features/availability/ui/components/availability-table/absence-item/absence-item.tsx @@ -22,19 +22,26 @@ export const AbsenceItem: FC = ({ absence, userName, overflowType }) => { const boxSize = isMobile ? '36px' : '48px' const durationPlusLast = duration + 1 + //The calculation of end is based on the duration of the absence plus an element to reach the end of the block, + // minus 1px for each block present due to the margin each one has, + // and subtracting the cell's padding to ensure it accounts for the same padding at the beginning and end. + if (overflowType === 'end') { - return `calc(${durationPlusLast * 100}% + ${durationPlusLast - 1}px - ${cellPadding})` + return `calc(${durationPlusLast * 100}% + ${duration}px - ${cellPadding})` } + //The calc is based in total width plus 1px for each block present due to the margin each one has if (overflowType === 'both') { - return `calc(${durationPlusLast * 100}% + ${durationPlusLast - 1}px)` + return `calc(${durationPlusLast * 100}% + ${duration}px)` } + //The calculation is based on the duration of the absence plus an element to reach the end of the block, minus 1px for each block present due to the margin each one has, and subtracting the padding that we lose at the beginning. if (overflowType === 'start') { - return `calc(${durationPlusLast * 100}%)` + return `calc(${durationPlusLast * 100}% + ${duration}px - ${cellPadding})` } - return `calc(${duration * 100}% + ${boxSize})` + //The calculation is based on the duration of the absence plus an element to reach the end of the block, minus 1px for each block present due to the margin each one has, and adding the block size without padding. + return `calc(${duration * 100}% + ${boxSize} + ${duration}px)` } const getBorderRadius = () => {