Spaces:
Running
Running
Add clicking on a certain date
Browse files- src/pages/Calendar.tsx +83 -18
src/pages/Calendar.tsx
CHANGED
@@ -208,8 +208,20 @@ const CalendarPage = () => {
|
|
208 |
// Get deadline style
|
209 |
const hasDeadline = dayEvents.deadlines.length > 0;
|
210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
return (
|
212 |
-
<div
|
|
|
|
|
|
|
213 |
{/* Day number at the top with moderate space */}
|
214 |
<div className="h-10 flex items-center justify-center">
|
215 |
<span>{format(date, 'd')}</span>
|
@@ -252,30 +264,83 @@ const CalendarPage = () => {
|
|
252 |
|
253 |
return (
|
254 |
<div className="border-b last:border-b-0 pb-4 last:pb-0 mb-4 last:mb-0">
|
255 |
-
<
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
{deadlineDate && (
|
261 |
-
<
|
262 |
-
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
)}
|
|
|
265 |
{startDate && (
|
266 |
-
<
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
)}
|
272 |
</div>
|
273 |
-
|
|
|
274 |
{Array.isArray(conf.tags) && conf.tags.map((tag) => (
|
275 |
-
<span
|
276 |
-
|
|
|
|
|
277 |
<Tag className="h-3 w-3 mr-1" />
|
278 |
-
{tag}
|
279 |
</span>
|
280 |
))}
|
281 |
</div>
|
|
|
208 |
// Get deadline style
|
209 |
const hasDeadline = dayEvents.deadlines.length > 0;
|
210 |
|
211 |
+
const handleDayClick = (e: React.MouseEvent) => {
|
212 |
+
e.preventDefault(); // Prevent default calendar behavior
|
213 |
+
e.stopPropagation(); // Stop event propagation
|
214 |
+
setSelectedDayEvents({
|
215 |
+
date,
|
216 |
+
events: dayEvents
|
217 |
+
});
|
218 |
+
};
|
219 |
+
|
220 |
return (
|
221 |
+
<div
|
222 |
+
className="relative w-full h-full flex flex-col"
|
223 |
+
onClick={handleDayClick}
|
224 |
+
>
|
225 |
{/* Day number at the top with moderate space */}
|
226 |
<div className="h-10 flex items-center justify-center">
|
227 |
<span>{format(date, 'd')}</span>
|
|
|
264 |
|
265 |
return (
|
266 |
<div className="border-b last:border-b-0 pb-4 last:pb-0 mb-4 last:mb-0">
|
267 |
+
<div className="flex justify-between items-start">
|
268 |
+
<div>
|
269 |
+
<h3 className="font-semibold text-lg">{conf.title}</h3>
|
270 |
+
{conf.full_name && (
|
271 |
+
<p className="text-sm text-neutral-600 mb-2">{conf.full_name}</p>
|
272 |
+
)}
|
273 |
+
</div>
|
274 |
+
{conf.link && (
|
275 |
+
<a
|
276 |
+
href={conf.link}
|
277 |
+
target="_blank"
|
278 |
+
rel="noopener noreferrer"
|
279 |
+
className="text-sm text-blue-500 hover:text-blue-600 flex items-center gap-1"
|
280 |
+
>
|
281 |
+
Website
|
282 |
+
<svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
283 |
+
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
|
284 |
+
<polyline points="15 3 21 3 21 9" />
|
285 |
+
<line x1="10" y1="14" x2="21" y2="3" />
|
286 |
+
</svg>
|
287 |
+
</a>
|
288 |
+
)}
|
289 |
+
</div>
|
290 |
+
|
291 |
+
<div className="space-y-2 mt-3">
|
292 |
{deadlineDate && (
|
293 |
+
<div className="flex items-start gap-2">
|
294 |
+
<span className="text-red-500 font-medium text-sm">Deadline:</span>
|
295 |
+
<div className="text-sm">
|
296 |
+
<div>{format(deadlineDate, 'MMMM d, yyyy')}</div>
|
297 |
+
{conf.timezone && (
|
298 |
+
<div className="text-neutral-500 text-xs">
|
299 |
+
Timezone: {conf.timezone}
|
300 |
+
</div>
|
301 |
+
)}
|
302 |
+
</div>
|
303 |
+
</div>
|
304 |
)}
|
305 |
+
|
306 |
{startDate && (
|
307 |
+
<div className="flex items-start gap-2">
|
308 |
+
<span className="text-purple-600 font-medium text-sm">Date:</span>
|
309 |
+
<div className="text-sm">
|
310 |
+
<div>
|
311 |
+
{format(startDate, 'MMMM d')}
|
312 |
+
{endDate ? ` - ${format(endDate, 'MMMM d, yyyy')}` :
|
313 |
+
`, ${format(startDate, 'yyyy')}`}
|
314 |
+
</div>
|
315 |
+
</div>
|
316 |
+
</div>
|
317 |
+
)}
|
318 |
+
|
319 |
+
{conf.place && (
|
320 |
+
<div className="flex items-start gap-2">
|
321 |
+
<span className="text-neutral-600 font-medium text-sm">Location:</span>
|
322 |
+
<span className="text-sm">{conf.place}</span>
|
323 |
+
</div>
|
324 |
+
)}
|
325 |
+
|
326 |
+
{conf.note && (
|
327 |
+
<div className="flex items-start gap-2 mt-2">
|
328 |
+
<span className="text-neutral-600 font-medium text-sm">Note:</span>
|
329 |
+
<div className="text-sm text-neutral-600"
|
330 |
+
dangerouslySetInnerHTML={{ __html: conf.note }}
|
331 |
+
/>
|
332 |
+
</div>
|
333 |
)}
|
334 |
</div>
|
335 |
+
|
336 |
+
<div className="mt-3 flex flex-wrap gap-2">
|
337 |
{Array.isArray(conf.tags) && conf.tags.map((tag) => (
|
338 |
+
<span
|
339 |
+
key={tag}
|
340 |
+
className="inline-flex items-center px-2 py-1 rounded-full text-xs bg-neutral-100"
|
341 |
+
>
|
342 |
<Tag className="h-3 w-3 mr-1" />
|
343 |
+
{categoryNames[tag] || tag}
|
344 |
</span>
|
345 |
))}
|
346 |
</div>
|