Skip to content

Commit 1871a44

Browse files
committed
Display session lang and some design adjustment
1 parent 9114438 commit 1871a44

File tree

7 files changed

+82
-14
lines changed

7 files changed

+82
-14
lines changed

bun.lockb

352 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@uiw/react-md-editor": "^4.0.1",
3939
"data-uri-to-buffer": "^6.0.2",
4040
"firebase": "^10.5.2",
41+
"flag-icons": "^7.3.2",
4142
"image-blob-reduce": "^4.1.0",
4243
"luxon": "^3.4.3",
4344
"openai": "^4.24.7",

src/public/event/PublicEventSchedule.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ export const PublicEventSchedule = ({ eventId, event }: PublicEventScheduleProps
5959
const currentSessions = sessionsByDay.get(selectedDay) || []
6060

6161
return (
62-
<Box display="flex" flexDirection="column" gap={2} p={0} mt={2}>
62+
<Box display="flex" flexDirection="column" gap={2} p={0} mt={2} justifyContent="center" alignItems="center">
6363
<ScheduleHeader
6464
eventName={event.event.name}
6565
logoUrl={event.event.logoUrl}
66-
color={event.event.color}
6766
colorBackground={event.event.colorBackground}
6867
/>
6968

src/public/event/components/DayTabs.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export const DayTabs = ({ days, selectedDay, onDayChange }: DayTabsProps) => {
1515
onChange={onDayChange}
1616
variant="scrollable"
1717
scrollButtons="auto"
18-
allowScrollButtonsMobile>
18+
allowScrollButtonsMobile
19+
sx={{ '& .MuiTab-root': { fontSize: '1.2rem' } }}>
1920
{days.map((day) => (
2021
<Tab key={day} value={day} label={DateTime.fromISO(day).toLocaleString({ weekday: 'long' })} />
2122
))}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import 'flag-icons/css/flag-icons.min.css'
2+
3+
interface LanguageFlagProps {
4+
language: string
5+
size?: 'sm' | 'md' | 'lg'
6+
className?: string
7+
}
8+
9+
const languageToCountryCode: Record<string, string> = {
10+
English: 'gb',
11+
French: 'fr',
12+
German: 'de',
13+
Spanish: 'es',
14+
Italian: 'it',
15+
Portuguese: 'pt',
16+
Russian: 'ru',
17+
Chinese: 'cn',
18+
Japanese: 'jp',
19+
Korean: 'kr',
20+
Arabic: 'sa',
21+
Hindi: 'in',
22+
Dutch: 'nl',
23+
Polish: 'pl',
24+
Turkish: 'tr',
25+
Vietnamese: 'vn',
26+
}
27+
28+
const sizeClasses = {
29+
sm: 'w-4 h-4',
30+
md: 'w-6 h-6',
31+
lg: 'w-8 h-8',
32+
}
33+
34+
export const LanguageFlag = ({ language, size = 'md', className = '' }: LanguageFlagProps) => {
35+
const countryCode = languageToCountryCode[language] || 'unknown'
36+
37+
if (countryCode === 'unknown') {
38+
return null
39+
}
40+
41+
return (
42+
<span
43+
className={`fi fi-${countryCode} rounded-sm ${sizeClasses[size]} ${className}`}
44+
title={language}
45+
role="img"
46+
aria-label={`${language} flag`}
47+
/>
48+
)
49+
}

src/public/event/components/ScheduleHeader.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import { Box, Typography } from '@mui/material'
44
type ScheduleHeaderProps = {
55
eventName: string
66
logoUrl?: string | null
7-
color?: string | null
87
colorBackground?: string | null
98
}
109

11-
export const ScheduleHeader = ({ eventName, logoUrl, color, colorBackground }: ScheduleHeaderProps) => {
10+
export const ScheduleHeader = ({ eventName, logoUrl, colorBackground }: ScheduleHeaderProps) => {
1211
return (
1312
<Box
1413
display="flex"
@@ -36,6 +35,12 @@ export const ScheduleHeader = ({ eventName, logoUrl, color, colorBackground }: S
3635
variant="h3"
3736
sx={{
3837
fontWeight: 'bold',
38+
textAlign: 'center',
39+
display: 'flex',
40+
alignItems: 'center',
41+
justifyContent: 'center',
42+
lineHeight: 1, // Set line height to 1 to prevent descenders from affecting alignment
43+
paddingTop: '0.2em', // Add slight padding to visually center text including descenders
3944
}}>
4045
{eventName}
4146
</Typography>

src/public/event/components/SessionItem.tsx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Box, Typography, Avatar, AvatarGroup, Paper, Chip } from '@mui/material'
22
import { JsonSession, JsonSpeaker } from '../../../events/actions/updateWebsiteActions/jsonTypes'
33
import { Category } from '../../../types'
4+
import { LanguageFlag } from './LanguageFlag'
45

56
type SessionItemProps = {
67
session: JsonSession & { speakersData?: JsonSpeaker[] }
@@ -48,7 +49,15 @@ export const SessionItem = ({ session, categories }: SessionItemProps) => {
4849
<Typography
4950
variant="caption"
5051
color="text.secondary"
51-
sx={{ flexGrow: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
52+
sx={{
53+
flexGrow: 1,
54+
overflow: 'hidden',
55+
display: '-webkit-box',
56+
WebkitLineClamp: 2,
57+
WebkitBoxOrient: 'vertical',
58+
lineHeight: '1.2em',
59+
maxHeight: '2.4em',
60+
}}>
5261
{session.speakersData.map((speaker) => speaker.name).join(', ')}
5362
</Typography>
5463
</Box>
@@ -59,14 +68,18 @@ export const SessionItem = ({ session, categories }: SessionItemProps) => {
5968
</Typography>
6069
)}
6170
{category && (
62-
<Chip
63-
label={category.name}
64-
size="small"
65-
sx={{
66-
bgcolor: category.color || 'primary.main',
67-
color: 'white',
68-
}}
69-
/>
71+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mt: 1 }}>
72+
<Chip
73+
label={category.name}
74+
size="small"
75+
sx={{
76+
bgcolor: category.color || 'primary.main',
77+
color: 'white',
78+
flexGrow: 1,
79+
}}
80+
/>
81+
{session.language && <LanguageFlag language={session.language} size="sm" />}
82+
</Box>
7083
)}
7184
</Paper>
7285
)

0 commit comments

Comments
 (0)