Skip to content

Commit c28e347

Browse files
Tony QiuTony Qiu
authored andcommitted
event svg corners fix on mobile and cleaned up date utils
1 parent 2341884 commit c28e347

File tree

7 files changed

+21
-34
lines changed

7 files changed

+21
-34
lines changed

backend/apps/core/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def confirm_email(request, token):
274274
# Redirect to frontend login page
275275
from django.http import HttpResponseRedirect
276276

277-
return HttpResponseRedirect("http://localhost:5173/auth")
277+
return HttpResponseRedirect(settings.FRONTEND_URL + "/auth")
278278
except User.DoesNotExist:
279279
return Response(
280280
{"error": "Invalid confirmation token"}, status=status.HTTP_400_BAD_REQUEST

backend/config/settings/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
# CSRF settings for development
7676
CSRF_TRUSTED_ORIGINS = [
7777
"http://localhost:5173",
78+
"https://wat2do.ca",
79+
"https://www.wat2do.ca",
7880
]
7981

8082
# CSRF settings for SPA frontend
@@ -188,7 +190,8 @@
188190
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
189191

190192
# Email confirmation settings
191-
BASE_URL = os.getenv("BASE_URL", "http://localhost:8000")
193+
BASE_URL = "https://wat2do.ca" if os.getenv("PRODUCTION") == "1" else "http://localhost:8000"
194+
FRONTEND_URL = "https://wat2do.ca" if os.getenv("PRODUCTION") == "1" else "http://localhost:5173"
192195

193196
# Global rate limiting settings
194197
RATELIMIT_VIEW = "ratelimit.views.ratelimited"

backend/utils/encryption_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import base64
88
import hashlib
9-
import hmac
109
import os
1110

1211
from cryptography.fernet import Fernet

frontend/src/features/events/components/EventsCalendar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
DollarSign,
2121
} from "lucide-react";
2222
import "@/shared/styles/calendar.css";
23-
import { formatEventDate, formatEventTimeRange, removeTimezoneInfo } from "@/shared/lib/dateUtils";
23+
import { formatEventTimeRange, removeTimezoneInfo, formatPrettyDate } from "@/shared/lib/dateUtils";
2424
import { getClubTypeColor } from "@/shared/lib/clubTypeColors";
2525
import { Event } from "@/features/events/types/events";
2626
import { Tabs, TabsList, TabsTrigger } from "@/shared/components/ui/tabs";
@@ -105,7 +105,7 @@ const EventPopup: React.FC<{
105105
<div className="space-y-2 text-sm text-gray-600 dark:text-gray-400">
106106
<div className="flex items-center gap-2">
107107
<CalendarIcon className="h-4 w-4 flex-shrink-0" />
108-
<span>{formatEventDate(event.dtstart)}</span>
108+
<span>{formatPrettyDate(event.dtstart)}</span>
109109
</div>
110110

111111
<div className="flex items-center gap-2">

frontend/src/features/events/components/EventsGrid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
} from "lucide-react";
2929
import { Event } from "@/features/events/types/events";
3030
import { memo, useState, useMemo, useEffect } from "react";
31-
import { formatEventDate, formatEventTimeRange } from "@/shared/lib/dateUtils";
31+
import { formatEventTimeRange, formatPrettyDate } from "@/shared/lib/dateUtils";
3232
import { getEventStatus, isEventNew } from "@/shared/lib/eventUtils";
3333
import { EVENTS_PER_PAGE } from "@/features/events/constants/events";
3434
import BadgeMask from "@/shared/components/ui/badge-mask";
@@ -198,7 +198,7 @@ const EventsGrid = memo(
198198
<div className="flex items-center space-x-2 text-xs text-gray-600 dark:text-gray-400">
199199
<Calendar className="h-3.5 w-3.5 flex-shrink-0" />
200200
<span className="truncate">
201-
{formatEventDate(event.dtstart)}
201+
{formatPrettyDate(event.dtstart)}
202202
</span>
203203
</div>
204204

frontend/src/shared/components/ui/badge-mask.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,39 @@ function BadgeMask({ variant, children }: BadgeMaskProps) {
1515
<div className="absolute top-0 left-0 flex flex-col">
1616
<div className="flex">
1717
<div className="pb-1 pr-1 bg-white dark:bg-gray-900 rounded-br-xl">{children}</div>
18-
<EventBadgeMaskTopLeft className="h-2 w-fit text-white dark:text-gray-900" />
18+
<EventBadgeMaskTopLeft className="h-2 w-fit text-white inline-block dark:text-gray-900" />
1919
</div>
20-
<EventBadgeMaskTopLeft className="h-2 w-fit text-white dark:text-gray-900" />
20+
<EventBadgeMaskTopLeft className="h-2 w-fit text-white inline-block dark:text-gray-900" />
2121
</div>
2222
);
2323
case "top-right":
2424
return (
2525
<div className="absolute top-0 right-0 flex flex-col">
2626
<div className="flex">
27-
<EventBadgeMaskTopRight className="h-2 w-fit text-white dark:text-gray-900" />
27+
<EventBadgeMaskTopRight className="h-2 w-fit text-white inline-block dark:text-gray-900" />
2828
<div className="pb-1 pl-1 bg-white dark:bg-gray-900 rounded-bl-xl">{children}</div>
2929
</div>
30-
<EventBadgeMaskTopRight className="h-2 w-fit ml-auto text-white dark:text-gray-900" />
30+
<EventBadgeMaskTopRight className="h-2 w-fit ml-auto text-white inline-block dark:text-gray-900" />
3131
</div>
3232
);
3333
case "bottom-left":
3434
return (
3535
<div className="absolute bottom-0 left-0 flex flex-col">
36-
<EventBadgeMaskBottomLeft className="h-2 w-fit text-white dark:text-gray-900" />
36+
<EventBadgeMaskBottomLeft className="h-2 w-fit text-white inline-block dark:text-gray-900" />
3737
<div className="flex">
3838
<div className="pt-1 pr-1 bg-white dark:bg-gray-900 rounded-tr-xl">{children}</div>
39-
<EventBadgeMaskBottomLeft className="h-2 w-fit mt-auto text-white dark:text-gray-900" />
39+
<EventBadgeMaskBottomLeft className="h-2 w-fit mt-auto text-white inline-block dark:text-gray-900" />
4040
</div>
4141
</div>
4242
);
4343
case "bottom-right":
4444
return (
4545
<div className="absolute bottom-0 right-0 flex flex-col">
4646
<div className="flex">
47-
<EventBadgeMaskBottomRight className="h-2 w-fit text-white dark:text-gray-900" />
47+
<EventBadgeMaskBottomRight className="h-2 w-fit text-white inline-block dark:text-gray-900" />
4848
<div className="pb-1 pr-1 bg-white dark:bg-gray-900 rounded-br-xl">{children}</div>
4949
</div>
50-
<EventBadgeMaskBottomRight className="h-2 w-fit ml-auto text-white dark:text-gray-900" />
50+
<EventBadgeMaskBottomRight className="h-2 w-fit ml-auto text-white inline-block dark:text-gray-900" />
5151
</div>
5252
);
5353
default:

frontend/src/shared/lib/dateUtils.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55

6-
import { toZonedTime, format } from "date-fns-tz";
6+
import { format } from "date-fns-tz";
77

88
/**
99
* Remove timezone info from ISO datetime string to treat as local time
@@ -19,8 +19,7 @@ export const removeTimezoneInfo = (dateTimeString: string): string => {
1919
*/
2020
export const formatPrettyDate = (dateString: string): string => {
2121
try {
22-
const tz = "America/New_York";
23-
const date = toZonedTime(dateString, tz);
22+
const date = new Date(removeTimezoneInfo(dateString));
2423
return format(date, "MMMM d, yyyy");
2524
} catch {
2625
return dateString // Return original string if parsing fails
@@ -76,26 +75,12 @@ export const getTodayString = (): string => {
7675
);
7776
};
7877

79-
/**
80-
* Format an ISO datetime string to a prettier date format (e.g., "August 10, 2025")
81-
*/
82-
export const formatEventDate = (isoDateTime: string): string => {
83-
return formatPrettyDate(isoDateTime);
84-
};
85-
86-
/**
87-
* Format an ISO datetime string to a prettier time format (e.g., "3pm" or "3:30pm")
88-
*/
89-
export const formatEventTime = (isoDateTime: string): string => {
90-
return formatPrettyTime(isoDateTime);
91-
};
92-
9378
/**
9479
* Format a time range from ISO datetime strings (e.g., "3pm - 8pm")
9580
*/
9681
export const formatEventTimeRange = (startDateTime: string, endDateTime: string | null): string => {
97-
const start = formatEventTime(startDateTime);
98-
const end = endDateTime ? formatEventTime(endDateTime) : null;
82+
const start = formatPrettyTime(startDateTime);
83+
const end = endDateTime ? formatPrettyTime(endDateTime) : null;
9984
return end ? `${start} - ${end}` : start;
10085
};
10186

0 commit comments

Comments
 (0)