Skip to content

Commit 6cec005

Browse files
Merge pull request #56 from linked-planet/dev
Dev
2 parents 7235562 + 1072df0 commit 6cec005

File tree

4 files changed

+46
-17
lines changed

4 files changed

+46
-17
lines changed

library/src/components/timetable/TimeTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,8 @@ function moveNowBar(
566566
const tableBody = tableBodyRef.current
567567

568568
// remove the orange border from the header cell
569-
const headerTimeslotRow = tableHeader.children[1]
569+
const headerTimeslotRow =
570+
tableHeader.children[tableHeader.children.length - 1]
570571
if (!headerTimeslotRow) {
571572
setMessage?.({
572573
appearance: "danger",

library/src/components/timetable/TimeTableHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ function CustomHeaderRowCell<
369369
key={`timeheader${timeSlot.unix()}`}
370370
colSpan={2}
371371
className={`${headerCellBaseClassname} ${
372-
isLastOfDay ? "after:border-l-2" : ""
372+
isLastOfDay ? "after:border-l-2" : "after:border-l"
373373
} ${showTimeSlotHeader ? "pt-1" : ""}`}
374374
ref={ref}
375375
>

showcase/public/showcase-sources.txt

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7936,21 +7936,33 @@ function TestCustomHeaderRowTimeSlot<
79367936
viewType,
79377937
slotsArray,
79387938
entries,
7939+
tableCellRef,
79397940
}: TimeTableTypes.CustomHeadeRowTimeSlotProps<G, I>) {
79407941
const groupItems = entries[1].items
79417942

7942-
const startAndEndSlots = groupItems.map((it) =>
7943-
timeTableUtils.getStartAndEndSlot(
7944-
it,
7943+
const groupItemsOfCell: I[] = []
7944+
const startAndEndInSlow: {
7945+
status: "in" | "before" | "after"
7946+
startSlot: number
7947+
endSlot: number
7948+
}[] = []
7949+
for (let i = 0; i < groupItems.length; i++) {
7950+
const item = groupItems[i]
7951+
const startAndEnd = timeTableUtils.getStartAndEndSlot(
7952+
item,
79457953
slotsArray,
79467954
timeFrameOfDay,
79477955
timeSlotMinutes,
79487956
viewType,
7949-
),
7950-
)
7957+
)
7958+
if (slotsArray[startAndEnd.startSlot] === timeSlot) {
7959+
groupItemsOfCell.push(item)
7960+
startAndEndInSlow.push(startAndEnd)
7961+
}
7962+
}
79517963

7952-
const getLeftAndWidth = groupItems.map((it, i) => {
7953-
const startAndEnd = startAndEndSlots[i]
7964+
const leftAndWidths = groupItemsOfCell.map((it, i) => {
7965+
const startAndEnd = startAndEndInSlow[i]
79547966
if (startAndEnd.status === "before" || startAndEnd.status === "after") {
79557967
return null
79567968
}
@@ -7965,8 +7977,27 @@ function TestCustomHeaderRowTimeSlot<
79657977
)
79667978
})
79677979

7968-
console.log("GET LEFT AND WIDTH", getLeftAndWidth)
7969-
return <div>{startAndEndSlots.length}</div>
7980+
const cellWidth = tableCellRef.current?.offsetWidth ?? 70
7981+
7982+
const ret = leftAndWidths.map((it, i) =>
7983+
it ? (
7984+
<div
7985+
key={groupItemsOfCell[i].title}
7986+
className="absolute top-0 bottom-0 bg-discovery-bold whitespace-nowrap overflow-visible z-10 opacity-50"
7987+
style={{
7988+
left: `${it.left * cellWidth}px`,
7989+
width: `${it.width * cellWidth}px`,
7990+
}}
7991+
title={groupItemsOfCell[i].title}
7992+
>
7993+
<div className="truncate">{groupItemsOfCell[i].title}</div>
7994+
</div>
7995+
) : null,
7996+
)
7997+
7998+
console.log("RET", ret, leftAndWidths)
7999+
8000+
return <>{ret}</>
79708001
}
79718002

79728003
function CustomHeaderRowHeader<

showcase/src/components/showcase/wrapper/TimeTableShowcase.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,6 @@ function TestCustomHeaderRowTimeSlot<
458458
}
459459
}
460460

461-
console.log("GROUP ITEMS", groupItemsOfCell)
462-
463461
const leftAndWidths = groupItemsOfCell.map((it, i) => {
464462
const startAndEnd = startAndEndInSlow[i]
465463
if (startAndEnd.status === "before" || startAndEnd.status === "after") {
@@ -482,19 +480,18 @@ function TestCustomHeaderRowTimeSlot<
482480
it ? (
483481
<div
484482
key={groupItemsOfCell[i].title}
485-
className="absolute top-0 bottom-0 bg-warning-bold whitespace-nowrap overflow-visible truncate"
483+
className="absolute top-0 bottom-0 bg-discovery-bold whitespace-nowrap overflow-visible z-10 opacity-50"
486484
style={{
487485
left: `${it.left * cellWidth}px`,
488486
width: `${it.width * cellWidth}px`,
489487
}}
488+
title={groupItemsOfCell[i].title}
490489
>
491-
{groupItemsOfCell[i].title}
490+
<div className="truncate">{groupItemsOfCell[i].title}</div>
492491
</div>
493492
) : null,
494493
)
495494

496-
console.log("RET", ret, leftAndWidths)
497-
498495
return <>{ret}</>
499496
}
500497

0 commit comments

Comments
 (0)