Skip to content

Commit 03817d5

Browse files
committed
fix eventdetailpage time and badgemask
1 parent dab2c4e commit 03817d5

File tree

8 files changed

+20
-43
lines changed

8 files changed

+20
-43
lines changed

.github/workflows/send-newsletter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@ jobs:
6565
backend/scripts/*.log
6666
retention-days: 30
6767

68+
69+

backend/apps/events/migrations/0025_add_events_query_optimization_index.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ class Migration(migrations.Migration):
1919
),
2020
]
2121

22+
23+

backend/apps/events/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def get_event(request, event_id):
221221
# Get upcoming event dates
222222
event_data["upcoming_dates"] = list(
223223
EventDates.objects.filter(event_id=event_id, dtstart_utc__gte=timezone.now())
224-
.order_by('dtstart_utc')[:10].values("dtstart_utc", "dtend_utc")
224+
.order_by('dtstart_utc').values("dtstart_utc", "dtend_utc")
225225
)
226226

227227
return Response(event_data)

backend/tests/test_submission_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,5 @@ def test_duration_calculation(self):
138138
# Duration should be 2 hours
139139
assert result["duration"] == timedelta(hours=2)
140140

141+
142+

backend/utils/event_dates_utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,14 @@ def create_event_dates_from_event_data(event, event_data=None):
165165
event_dates_list = []
166166

167167
for occurrence in occurrences:
168-
# Calculate end time for this occurrence
169-
occurrence_utc = occurrence.astimezone(pytz.UTC)
170168
occurrence_end = calculate_end_time(dtstart, dtend, duration, occurrence)
171-
occurrence_end_utc = occurrence_end.astimezone(pytz.UTC) if occurrence_end else None
169+
170+
if not event.rrule and not event.rdate:
171+
occurrence_utc = dtstart_utc
172+
occurrence_end_utc = dtend_utc
173+
else:
174+
occurrence_utc = occurrence.astimezone(pytz.UTC)
175+
occurrence_end_utc = occurrence_end.astimezone(pytz.UTC) if occurrence_end else None
172176

173177
event_date = EventDates(
174178
event=event,

backend/utils/submission_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,5 @@ def compute_event_fields(event_data: Dict[str, Any], screenshot_url: str = None)
197197

198198
return computed_data
199199

200+
201+

frontend/src/features/events/pages/EventDetailPage.tsx

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -231,19 +231,6 @@ function EventDetailPage() {
231231
</Button>
232232
</div>
233233

234-
{/* Original Screenshot (if available for submitter/admin) */}
235-
{(event as any)?.screenshot_url && (
236-
<div className="mb-6 bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6">
237-
<h2 className="text-xl font-bold text-gray-900 dark:text-white mb-4">Original Screenshot</h2>
238-
<div className="relative w-full max-w-2xl mx-auto">
239-
<img
240-
src={(event as any).screenshot_url}
241-
alt="Original event screenshot"
242-
className="w-full h-auto rounded-lg shadow-lg"
243-
/>
244-
</div>
245-
</div>
246-
)}
247234

248235
{/* Edit Mode */}
249236
<div className="mb-6 bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6">
@@ -467,22 +454,22 @@ function EventDetailPage() {
467454
className="relative max-w-lg mx-auto"
468455
>
469456
{/* Polaroid Frame */}
470-
<div className="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl p-4">
457+
<div className="bg-white dark:bg-gray-900 rounded-xl shadow-lg dark:shadow-gray-700 p-4">
471458
{/* Image Section */}
472459
<div className="relative mb-4">
473460
{event.source_image_url ? (
474461
<div className="relative">
475462
<img
476463
src={event.source_image_url}
477464
alt={event.title}
478-
className="w-full h-48 object-cover rounded-lg shadow-lg aspect-square"
465+
className="w-full h-48 object-cover rounded-lg aspect-square"
479466
/>
480467
<EventStatusBadge event={event} />
481468
<NewEventBadge event={event} />
482469
<OrganizationBadge event={event} />
483470
</div>
484471
) : (
485-
<div className="w-full h-48 bg-gradient-to-br from-blue-100 to-purple-100 dark:from-gray-700 dark:to-gray-600 rounded-lg shadow-lg flex items-center justify-center aspect-square">
472+
<div className="w-full h-48 bg-gradient-to-br from-blue-100 to-purple-100 dark:from-gray-700 dark:to-gray-600 rounded-lg flex items-center justify-center aspect-square">
486473
<div className="text-center">
487474
<Calendar className="h-16 w-16 text-gray-400 dark:text-gray-500 mx-auto mb-4" />
488475
<p className="text-gray-500 dark:text-gray-400 text-lg">
@@ -691,29 +678,6 @@ function EventDetailPage() {
691678
</div>
692679
</div>
693680
</motion.div>
694-
695-
{/* Original Screenshot (if available for submitter/admin) */}
696-
{(event as any)?.screenshot_url && (
697-
<motion.div
698-
initial={{ opacity: 0, y: 20 }}
699-
animate={{ opacity: 1, y: 0 }}
700-
transition={{ duration: 0.5, delay: 0.2 }}
701-
className="mt-8 max-w-lg mx-auto"
702-
>
703-
<div className="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl p-4">
704-
<h3 className="text-lg font-bold text-gray-900 dark:text-white mb-4 text-center">
705-
Original Screenshot
706-
</h3>
707-
<div className="relative w-full">
708-
<img
709-
src={(event as any).screenshot_url}
710-
alt="Original event screenshot"
711-
className="w-full h-auto rounded-lg shadow-lg"
712-
/>
713-
</div>
714-
</div>
715-
</motion.div>
716-
)}
717681
</div>
718682
);
719683
}

frontend/src/shared/hooks/useAdmin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export function useAdmin() {
88
}
99

1010

11+

0 commit comments

Comments
 (0)