Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Commit 85d536d

Browse files
committed
feat(portal/schedule): add sort and current event highlight
1 parent 9f138a7 commit 85d536d

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

libs/portal/pages/schedule.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ const options = [
3333
export function SchedulePage({ data }) {
3434
const [selectedDay, setSelectedDay] = useState('2025-03-14')
3535

36-
const filteredEvents = data.filter((event) => {
37-
const eventDate = format(parseISO(event.start), 'yyyy-MM-dd')
38-
return eventDate === selectedDay
39-
})
36+
const filteredEvents = data
37+
.filter((event) => {
38+
const eventDate = format(parseISO(event.start), 'yyyy-MM-dd')
39+
return eventDate === selectedDay
40+
})
41+
.sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime())
4042

4143
return (
4244
<Layout isCompleteProfile>
@@ -96,16 +98,24 @@ export function SchedulePage({ data }) {
9698
}
9799

98100
function Event({ eventData }) {
101+
const now = new Date()
102+
const eventEndTime = new Date(eventData.end)
103+
const isOngoing = eventEndTime > now // Check if event hasn't ended
104+
99105
return (
100106
<Dialog>
101107
<DialogTrigger asChild>
102-
<GlassmorphicCard className="p-4 flex flex-col sm:flex-row cursor-pointer">
108+
<GlassmorphicCard
109+
className={cn(
110+
'p-4 flex flex-col sm:flex-row cursor-pointer',
111+
isOngoing ? '!border-3 !border-primary' : '',
112+
)}
113+
>
103114
<div className="flex-grow-1 space-y-3">
104115
<Typography variant="h5">{eventData.title}</Typography>
105116
<Typography variant="paragraph-xs">
106117
📍
107-
{' '}
108-
{ eventData.location}
118+
{eventData.location}
109119
</Typography>
110120
<Typography variant="paragraph-xs">
111121
@@ -116,22 +126,18 @@ function Event({ eventData }) {
116126
{' '}
117127
{formatTime(eventData.end)}
118128
</Typography>
119-
<Typography variant="paragraph-xs">
120-
{eventData.description}
121-
</Typography>
129+
<Typography variant="paragraph-xs">{eventData.description}</Typography>
122130
</div>
123131
<div className="flex flex-wrap p-2 w-fit my-auto gap-2">
124132
{eventData.type.map((tag, index) => {
125133
const matchedOption = options.find(option => option.value === tag)
126-
127134
return (
128135
<Badge
129136
key={index}
130137
variant="outline"
131138
className="px-4 py-1 text-sm font-thin uppercase text-center min-w-[8rem] flex justify-center"
132139
>
133140
{matchedOption ? matchedOption.label : tag}
134-
{' '}
135141
</Badge>
136142
)
137143
})}

0 commit comments

Comments
 (0)