Spaces:
Running
Running
Improve search bar
Browse files- src/pages/Calendar.tsx +90 -4
src/pages/Calendar.tsx
CHANGED
|
@@ -86,7 +86,8 @@ const CalendarPage = () => {
|
|
| 86 |
conf.title.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
| 87 |
(conf.full_name && conf.full_name.toLowerCase().includes(searchQuery.toLowerCase()));
|
| 88 |
|
| 89 |
-
const
|
|
|
|
| 90 |
|
| 91 |
if (!matchesSearch || !matchesTag) return false;
|
| 92 |
|
|
@@ -354,8 +355,82 @@ const CalendarPage = () => {
|
|
| 354 |
|
| 355 |
return (
|
| 356 |
<div className="min-h-screen bg-neutral-light">
|
| 357 |
-
<Header
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
<FilterBar selectedTag={selectedTag} onTagSelect={setSelectedTag} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
<div className="p-6">
|
| 360 |
<div className="max-w-7xl mx-auto">
|
| 361 |
<div className="flex flex-col items-center mb-8">
|
|
@@ -445,13 +520,20 @@ const CalendarPage = () => {
|
|
| 445 |
<DialogTitle>
|
| 446 |
Events for {selectedDayEvents.date ? format(selectedDayEvents.date, 'MMMM d, yyyy') : ''}
|
| 447 |
</DialogTitle>
|
|
|
|
|
|
|
|
|
|
| 448 |
</DialogHeader>
|
| 449 |
<div className="space-y-4">
|
| 450 |
{selectedDayEvents.events.deadlines.length > 0 && (
|
| 451 |
<div>
|
| 452 |
<h3 className="text-lg font-semibold text-red-500 mb-3">Submission Deadlines</h3>
|
| 453 |
<div className="space-y-4">
|
| 454 |
-
{selectedDayEvents.events.deadlines.map(conf =>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
</div>
|
| 456 |
</div>
|
| 457 |
)}
|
|
@@ -459,7 +541,11 @@ const CalendarPage = () => {
|
|
| 459 |
<div>
|
| 460 |
<h3 className="text-lg font-semibold text-purple-600 mb-3">Conferences</h3>
|
| 461 |
<div className="space-y-4">
|
| 462 |
-
{selectedDayEvents.events.conferences.map(conf =>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 463 |
</div>
|
| 464 |
</div>
|
| 465 |
)}
|
|
|
|
| 86 |
conf.title.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
| 87 |
(conf.full_name && conf.full_name.toLowerCase().includes(searchQuery.toLowerCase()));
|
| 88 |
|
| 89 |
+
const confTags = Array.isArray(conf.tags) ? conf.tags : [];
|
| 90 |
+
const matchesTag = selectedTag === "All" || confTags.includes(selectedTag);
|
| 91 |
|
| 92 |
if (!matchesSearch || !matchesTag) return false;
|
| 93 |
|
|
|
|
| 355 |
|
| 356 |
return (
|
| 357 |
<div className="min-h-screen bg-neutral-light">
|
| 358 |
+
<Header
|
| 359 |
+
onSearch={(query) => {
|
| 360 |
+
setSearchQuery(query);
|
| 361 |
+
// Reset selected date when searching
|
| 362 |
+
setSelectedDate(undefined);
|
| 363 |
+
}}
|
| 364 |
+
/>
|
| 365 |
<FilterBar selectedTag={selectedTag} onTagSelect={setSelectedTag} />
|
| 366 |
+
|
| 367 |
+
{/* Add a search results section when there's a search query */}
|
| 368 |
+
{searchQuery && (
|
| 369 |
+
<div className="p-6 bg-white border-b">
|
| 370 |
+
<div className="max-w-4xl mx-auto">
|
| 371 |
+
<h2 className="text-lg font-semibold mb-4">
|
| 372 |
+
Search Results for "{searchQuery}"
|
| 373 |
+
</h2>
|
| 374 |
+
<div className="space-y-4">
|
| 375 |
+
{getEvents(new Date()).map((conf: Conference) => (
|
| 376 |
+
<div
|
| 377 |
+
key={conf.id || conf.title}
|
| 378 |
+
className="p-4 border rounded-lg hover:bg-neutral-50 cursor-pointer"
|
| 379 |
+
onClick={() => {
|
| 380 |
+
const deadlineDate = safeParseISO(conf.deadline);
|
| 381 |
+
const startDate = safeParseISO(conf.start);
|
| 382 |
+
|
| 383 |
+
if (deadlineDate) {
|
| 384 |
+
setSelectedDate(deadlineDate);
|
| 385 |
+
setSelectedDayEvents({
|
| 386 |
+
date: deadlineDate,
|
| 387 |
+
events: getDayEvents(deadlineDate)
|
| 388 |
+
});
|
| 389 |
+
} else if (startDate) {
|
| 390 |
+
setSelectedDate(startDate);
|
| 391 |
+
setSelectedDayEvents({
|
| 392 |
+
date: startDate,
|
| 393 |
+
events: getDayEvents(startDate)
|
| 394 |
+
});
|
| 395 |
+
}
|
| 396 |
+
}}
|
| 397 |
+
>
|
| 398 |
+
<div className="flex justify-between items-start">
|
| 399 |
+
<div>
|
| 400 |
+
<h3 className="font-semibold">{conf.title}</h3>
|
| 401 |
+
{conf.full_name && (
|
| 402 |
+
<p className="text-sm text-neutral-600">{conf.full_name}</p>
|
| 403 |
+
)}
|
| 404 |
+
</div>
|
| 405 |
+
{conf.deadline && conf.deadline !== 'TBD' && (
|
| 406 |
+
<span className="text-sm text-red-500">
|
| 407 |
+
Deadline: {format(safeParseISO(conf.deadline)!, 'MMM d, yyyy')}
|
| 408 |
+
</span>
|
| 409 |
+
)}
|
| 410 |
+
</div>
|
| 411 |
+
{Array.isArray(conf.tags) && conf.tags.length > 0 && (
|
| 412 |
+
<div className="mt-2 flex flex-wrap gap-2">
|
| 413 |
+
{conf.tags.map(tag => (
|
| 414 |
+
<span
|
| 415 |
+
key={tag}
|
| 416 |
+
className="inline-flex items-center px-2 py-1 rounded-full text-xs bg-neutral-100"
|
| 417 |
+
>
|
| 418 |
+
<Tag className="h-3 w-3 mr-1" />
|
| 419 |
+
{categoryNames[tag] || tag}
|
| 420 |
+
</span>
|
| 421 |
+
))}
|
| 422 |
+
</div>
|
| 423 |
+
)}
|
| 424 |
+
</div>
|
| 425 |
+
))}
|
| 426 |
+
{getEvents(new Date()).length === 0 && (
|
| 427 |
+
<p className="text-neutral-600">No conferences found matching your search.</p>
|
| 428 |
+
)}
|
| 429 |
+
</div>
|
| 430 |
+
</div>
|
| 431 |
+
</div>
|
| 432 |
+
)}
|
| 433 |
+
|
| 434 |
<div className="p-6">
|
| 435 |
<div className="max-w-7xl mx-auto">
|
| 436 |
<div className="flex flex-col items-center mb-8">
|
|
|
|
| 520 |
<DialogTitle>
|
| 521 |
Events for {selectedDayEvents.date ? format(selectedDayEvents.date, 'MMMM d, yyyy') : ''}
|
| 522 |
</DialogTitle>
|
| 523 |
+
<div className="text-sm text-neutral-600">
|
| 524 |
+
View conference details and deadlines for this date.
|
| 525 |
+
</div>
|
| 526 |
</DialogHeader>
|
| 527 |
<div className="space-y-4">
|
| 528 |
{selectedDayEvents.events.deadlines.length > 0 && (
|
| 529 |
<div>
|
| 530 |
<h3 className="text-lg font-semibold text-red-500 mb-3">Submission Deadlines</h3>
|
| 531 |
<div className="space-y-4">
|
| 532 |
+
{selectedDayEvents.events.deadlines.map(conf => (
|
| 533 |
+
<div key={conf.id || conf.title}>
|
| 534 |
+
{renderEventDetails(conf)}
|
| 535 |
+
</div>
|
| 536 |
+
))}
|
| 537 |
</div>
|
| 538 |
</div>
|
| 539 |
)}
|
|
|
|
| 541 |
<div>
|
| 542 |
<h3 className="text-lg font-semibold text-purple-600 mb-3">Conferences</h3>
|
| 543 |
<div className="space-y-4">
|
| 544 |
+
{selectedDayEvents.events.conferences.map(conf => (
|
| 545 |
+
<div key={conf.id || conf.title}>
|
| 546 |
+
{renderEventDetails(conf)}
|
| 547 |
+
</div>
|
| 548 |
+
))}
|
| 549 |
</div>
|
| 550 |
</div>
|
| 551 |
)}
|