Skip to content

Commit b41c4c2

Browse files
committed
Add hours on schedule every quarter
1 parent 42d3d59 commit b41c4c2

1 file changed

Lines changed: 44 additions & 3 deletions

File tree

src/app/views/Schedule.tsx

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ const Schedule: FC<ScheduleProps> = ({ events }) => {
175175
})}
176176
</div>
177177

178-
<div className="overflow-x-auto mr-8">
178+
<div className="overflow-x-auto mr-8 md:mr-24">
179179
<div className="flex" style={{ width: `${totalWidth}px` }}>
180180
{/* Date and time labels */}
181181
<div className="w-12 flex-shrink-0 bg-black h-full">
@@ -246,8 +246,49 @@ const Schedule: FC<ScheduleProps> = ({ events }) => {
246246
)}
247247
</div>
248248

249+
{/* Quarter, Half, and Three-Quarter Hour labels */}
250+
{[0.25, 0.5, 0.75].map((position) => (
251+
<div key={position} className="absolute top-0 bottom-0" style={{ left: `${position * 100}%` }}>
252+
{Array.from({ length: TOTAL_DAYS }).map((_, dayIndex) =>
253+
Array.from({ length: HOURS_PER_DAY }).map((_, hour) => {
254+
const date = BerlinDate.from(START_DATE);
255+
date.setDate(date.getDate() + dayIndex);
256+
const displayHour = hour + DAY_START_HOUR;
257+
258+
return (
259+
<div
260+
key={`${dayIndex}-${hour}`}
261+
className="absolute text-[9px] sm:text-xs text-gray-500"
262+
style={{
263+
top: `${(dayIndex * CHUNKS_PER_DAY + hour * 4) * CHUNK_HEIGHT}px`,
264+
transform: "translateY(-50%)",
265+
}}
266+
>
267+
{hour === 0 ? (
268+
<span
269+
className={`flex flex-col justify-center items-center text-center ${
270+
dayIndex === 0 ? "mt-16" : ""
271+
}`}
272+
>
273+
<span className="text-gray-400 text-[9px] sm:text-xs">
274+
{date.toLocaleDateString("en-US", { weekday: "short" })}
275+
</span>
276+
<span className=" text-gray-400 text-xs">
277+
{date.toLocaleDateString("en-US", { month: "short", day: "numeric" })}
278+
</span>
279+
</span>
280+
) : (
281+
`${displayHour.toString().padStart(2, "0")}:00`
282+
)}
283+
</div>
284+
);
285+
})
286+
)}
287+
</div>
288+
))}
289+
249290
{/* Right Hour labels */}
250-
<div className="absolute -right-2 top-0 bottom-0">
291+
<div className="absolute right-0 top-0 bottom-0">
251292
{Array.from({ length: TOTAL_DAYS }).map((_, dayIndex) =>
252293
Array.from({ length: HOURS_PER_DAY }).map((_, hour) => {
253294
const date = BerlinDate.from(START_DATE);
@@ -267,7 +308,7 @@ const Schedule: FC<ScheduleProps> = ({ events }) => {
267308
}}
268309
>
269310
{hour === 0 ? (
270-
<span className={`flex flex-col items-start text-left ${dayIndex === 0 ? "mt-16" : ""}`}>
311+
<span className={`flex flex-col items-end text-right ${dayIndex === 0 ? "mt-16" : ""}`}>
271312
<span className="text-gray-400 text-[9px] sm:text-xs">
272313
{date.toLocaleDateString("en-US", { weekday: "short" })}
273314
</span>

0 commit comments

Comments
 (0)