Skip to content

Commit

Permalink
Replace empty string with null in SchedulerComponent and adjust cell …
Browse files Browse the repository at this point in the history
…height calculation in MonthTable
  • Loading branch information
aelassas committed Jan 27, 2025
1 parent 84cc09f commit e5fb576
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/src/components/scheduler/SchedulerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const SchedulerComponent = forwardRef<SchedulerRef, unknown>((_, ref) => {
case 'day':
return <Day />
default:
return ''
return null
}
}, [view])

Expand Down
13 changes: 9 additions & 4 deletions backend/src/components/scheduler/components/month/MonthTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const MonthTable = ({ daysList, resource, eachWeekStart }: Props) => {
resourcedEvents = getResourcedEvents(events, _resource, resourceFields, fields)
}
const rows: ReactNode[] = []
const cellHeights: number[] = []

for (const startDay of eachWeekStart) {
const cells = weekDays.map((d) => {
Expand All @@ -78,13 +79,17 @@ const MonthTable = ({ daysList, resource, eachWeekStart }: Props) => {
return false
})
const isToday = isTimeZonedToday({ dateLeft: today, timeZone })
const _cellHeight = 27 + 26 * todayEvents.length + 17 + 12 + 10
cellHeights.push(_cellHeight)
// const cellHeight = Math.max(CELL_HEIGHT, ...cellHeights)
const cellHeight = CELL_HEIGHT
return (
<span style={{ height: CELL_HEIGHT }} key={d.toString()} className="rs__cell">
<span style={{ height: cellHeight }} key={d.toString()} className="rs__cell">
<Cell
start={start}
end={end}
day={selectedDate}
height={CELL_HEIGHT}
height={cellHeight}
resourceKey={field}
resourceVal={_resource ? _resource[field] : null}
cellRenderer={cellRenderer}
Expand Down Expand Up @@ -135,7 +140,7 @@ const MonthTable = ({ daysList, resource, eachWeekStart }: Props) => {
handleGotoDay(e)
}
}}
cellHeight={CELL_HEIGHT}
cellHeight={cellHeight}
/>
</>
</span>
Expand All @@ -147,7 +152,7 @@ const MonthTable = ({ daysList, resource, eachWeekStart }: Props) => {
return rows
},
[

Check warning on line 154 in backend/src/components/scheduler/components/month/MonthTable.tsx

View workflow job for this annotation

GitHub Actions / build (lts/*)

React Hook useCallback has a missing dependency: 'CELL_HEIGHT'. Either include it or remove the dependency array

Check warning on line 154 in backend/src/components/scheduler/components/month/MonthTable.tsx

View workflow job for this annotation

GitHub Actions / build (lts/*)

React Hook useCallback has a missing dependency: 'CELL_HEIGHT'. Either include it or remove the dependency array
CELL_HEIGHT,
// CELL_HEIGHT,
cellRenderer,
daysList,
disableGoToDay,
Expand Down

0 comments on commit e5fb576

Please sign in to comment.