Spaces:
Running
Running
gpt-engineer-app[bot]
commited on
Commit
·
8596d07
1
Parent(s):
3a65378
Refactor calendar event display
Browse filesImprove overlapping event display in the calendar by stacking lines for events on the same day and allowing lines to span multiple days.
- src/pages/Calendar.tsx +12 -4
src/pages/Calendar.tsx
CHANGED
@@ -178,16 +178,24 @@ const CalendarPage = () => {
|
|
178 |
const content = (
|
179 |
<div className="relative w-full h-full flex flex-col items-center">
|
180 |
<span className="mb-1">{format(day, 'd')}</span>
|
181 |
-
<div className="absolute bottom-0 left-0 right-0 flex gap-0.5 px-1">
|
182 |
{hasDeadlines && (
|
183 |
-
<div
|
|
|
|
|
|
|
184 |
)}
|
185 |
-
{
|
|
|
|
|
|
|
|
|
186 |
const categoryColor = conf.tags?.[0] ? categoryColors[conf.tags[0]] || "bg-purple-600" : "bg-purple-600";
|
|
|
187 |
return (
|
188 |
<div
|
189 |
key={conf.id}
|
190 |
-
className={`h-0.5
|
191 |
title={conf.title}
|
192 |
/>
|
193 |
);
|
|
|
178 |
const content = (
|
179 |
<div className="relative w-full h-full flex flex-col items-center">
|
180 |
<span className="mb-1">{format(day, 'd')}</span>
|
181 |
+
<div className="absolute bottom-0 left-0 right-0 flex flex-col gap-0.5 px-1">
|
182 |
{hasDeadlines && (
|
183 |
+
<div
|
184 |
+
className="h-0.5 w-full bg-red-500"
|
185 |
+
title="Deadline"
|
186 |
+
/>
|
187 |
)}
|
188 |
+
{dayEvents.conferences.map((conf) => {
|
189 |
+
const startDate = safeParseISO(conf.start);
|
190 |
+
const endDate = safeParseISO(conf.end);
|
191 |
+
const isFirstDay = startDate && isSameDay(startDate, day);
|
192 |
+
const isLastDay = endDate && isSameDay(endDate, day);
|
193 |
const categoryColor = conf.tags?.[0] ? categoryColors[conf.tags[0]] || "bg-purple-600" : "bg-purple-600";
|
194 |
+
|
195 |
return (
|
196 |
<div
|
197 |
key={conf.id}
|
198 |
+
className={`h-0.5 w-full ${categoryColor} ${!isFirstDay && !isLastDay ? '-ml-1 -mr-1' : ''} ${!isFirstDay ? '-ml-1' : ''} ${!isLastDay ? '-mr-1' : ''}`}
|
199 |
title={conf.title}
|
200 |
/>
|
201 |
);
|