Skip to content

Commit 83706e3

Browse files
committed
Display speakers on session item
1 parent 84cd2ed commit 83706e3

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

src/public/event/PublicEventSchedule.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const PublicEventSchedule = ({ eventId, event }: PublicEventScheduleProps
6969

7070
<DayTabs days={sortedDays} selectedDay={selectedDay} onDayChange={handleDayChange} />
7171

72-
<DaySchedule day={selectedDay} sessions={currentSessions} />
72+
<DaySchedule day={selectedDay} sessions={currentSessions} speakersData={event.speakers} />
7373
</Box>
7474
)
7575
}

src/public/event/components/DaySchedule.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
import * as React from 'react'
22
import { Box, Typography, Paper } from '@mui/material'
33
import { DateTime } from 'luxon'
4-
import { JsonSession } from '../../../events/actions/updateWebsiteActions/jsonTypes'
4+
import { JsonSession, JsonSpeaker } from '../../../events/actions/updateWebsiteActions/jsonTypes'
55
import { SessionItem } from './SessionItem'
66

77
type DayScheduleProps = {
88
day: string
99
sessions: JsonSession[]
10+
speakersData: JsonSpeaker[]
1011
}
1112

12-
export const DaySchedule = ({ day, sessions }: DayScheduleProps) => {
13+
export const DaySchedule = ({ day, sessions, speakersData }: DayScheduleProps) => {
14+
const sessionWithSpeakers = sessions.map((session) => ({
15+
...session,
16+
speakersData: speakersData.filter((speaker) => session.speakerIds.includes(speaker.id)),
17+
}))
1318
return (
1419
<Paper elevation={2} sx={{ p: 3 }}>
1520
<Typography variant="h4" gutterBottom>
1621
{DateTime.fromISO(day).toFormat('MMMM d, yyyy')}
1722
</Typography>
1823
<Box display="flex" flexDirection="column" gap={2}>
19-
{sessions.map((session) => (
24+
{sessionWithSpeakers.map((session) => (
2025
<SessionItem key={session.id} session={session} />
2126
))}
2227
</Box>

src/public/event/components/SessionItem.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import * as React from 'react'
2-
import { Box, Typography, Divider } from '@mui/material'
1+
import { Box, Typography, Divider, Avatar, AvatarGroup } from '@mui/material'
32
import { DateTime } from 'luxon'
4-
import { JsonSession } from '../../../events/actions/updateWebsiteActions/jsonTypes'
3+
import { JsonSession, JsonSpeaker } from '../../../events/actions/updateWebsiteActions/jsonTypes'
54

65
type SessionItemProps = {
7-
session: JsonSession
6+
session: JsonSession & { speakersData?: JsonSpeaker[] }
87
}
98

109
export const SessionItem = ({ session }: SessionItemProps) => {
@@ -16,10 +15,22 @@ export const SessionItem = ({ session }: SessionItemProps) => {
1615
</Typography>
1716
<Typography variant="h6">{session.title}</Typography>
1817
</Box>
19-
{session.abstract && (
20-
<Typography variant="body2" color="text.secondary" sx={{ mt: 1 }}>
21-
{session.abstract}
22-
</Typography>
18+
{session.speakersData && session.speakersData.length > 0 && (
19+
<Box display="flex" alignItems="center" gap={1} sx={{ mt: 2 }}>
20+
<AvatarGroup max={4}>
21+
{session.speakersData.map((speaker) => (
22+
<Avatar
23+
key={speaker.id}
24+
alt={speaker.name}
25+
src={speaker.photoUrl || undefined}
26+
sx={{ width: 32, height: 32 }}
27+
/>
28+
))}
29+
</AvatarGroup>
30+
<Typography variant="body2" color="text.secondary">
31+
{session.speakersData.map((speaker) => speaker.name).join(', ')}
32+
</Typography>
33+
</Box>
2334
)}
2435
<Divider sx={{ mt: 2 }} />
2536
</Box>

0 commit comments

Comments
 (0)