-
Notifications
You must be signed in to change notification settings - Fork 31
Issue feat: Fix landing page issues #2969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat-landing-page
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -359,8 +359,8 @@ | |||||
| > | ||||||
| {t('LANDING.HOW_WOULD_YOU_LIKE_TO_GET_STARTED')} | ||||||
| </Typography> | ||||||
| <Grid container spacing={3}> | ||||||
| <Grid item xs={12} md={6}> | ||||||
| <Grid container spacing={3} justifyContent="center"> | ||||||
| <Grid item xs={12} sm={5} md={4}> | ||||||
| <RoleCard | ||||||
| icon={<MenuBookOutlinedIcon fontSize="inherit" />} | ||||||
| title={t('LANDING.ARE_YOU_HERE_TO_LEARN')} | ||||||
|
|
@@ -369,7 +369,7 @@ | |||||
| onClick={handleScrollToLearner} | ||||||
| /> | ||||||
| </Grid> | ||||||
| <Grid item xs={12} md={6}> | ||||||
| <Grid item xs={12} sm={5} md={4}> | ||||||
| <RoleCard | ||||||
| icon={<FavoriteBorderIcon fontSize="inherit" />} | ||||||
| title={t('LANDING.ARE_YOU_HERE_TO_VOLUNTEER')} | ||||||
|
|
@@ -417,32 +417,32 @@ | |||||
| <Box sx={{ py: 4, textAlign: 'center' }}> | ||||||
| <Typography>{t('LANDING.LOADING_PROGRAMS')}</Typography> | ||||||
| </Box> | ||||||
| ) : learnerPrograms.length === 0 ? ( | ||||||
| <Box sx={{ py: 4, textAlign: 'center' }}> | ||||||
| <Typography>{t('LANDING.NO_PROGRAMS_AVAILABLE')}</Typography> | ||||||
| </Box> | ||||||
| ) : ( | ||||||
| <Grid container spacing={3}> | ||||||
| <Grid container spacing={3} justifyContent="center"> | ||||||
| {learnerPrograms.map((program, index) => { | ||||||
| const imageItem = program.programImages?.[0]; | ||||||
| const image = | ||||||
| typeof imageItem === 'string' | ||||||
| ? imageItem | ||||||
| : (imageItem as any)?.description || '/images/default.png'; | ||||||
| return ( | ||||||
| <Grid item xs={12} sm={6} md={4} key={program.tenantId || index}> | ||||||
| <Grid item xs={12} sm={6} md={3} key={program.tenantId || index}> | ||||||
| <ProgramCard | ||||||
| image={image} | ||||||
| title={program.name} | ||||||
| description={program.description} | ||||||
| buttonColor={PROGRAM_CARD_COLORS[index % PROGRAM_CARD_COLORS.length]} | ||||||
| onExplore={() => router.push(`/programs/${program.tenantId}`)} | ||||||
| onExplore={() => router.push(`/${encodeURIComponent(program.name)}`)} | ||||||
| /> | ||||||
| </Grid> | ||||||
| ); | ||||||
| })} | ||||||
| </Grid> | ||||||
| )} | ||||||
|
Check warning on line 445 in apps/learner-web-app/src/app/landing/page.tsx
|
||||||
| </Container> | ||||||
| </Box> | ||||||
|
|
||||||
|
|
@@ -484,21 +484,21 @@ | |||||
| <Typography>{t('LANDING.LOADING_PROGRAMS')}</Typography> | ||||||
| </Box> | ||||||
| ) : ( | ||||||
| <Grid container spacing={3}> | ||||||
| <Grid container spacing={3} justifyContent="center"> | ||||||
| {volunteerPrograms.map((program, index) => { | ||||||
| const imageItem = program.programImages?.[0]; | ||||||
| const image = | ||||||
| typeof imageItem === 'string' | ||||||
| ? imageItem | ||||||
| : (imageItem as any)?.description || '/images/default.png'; | ||||||
| return ( | ||||||
| <Grid item xs={12} sm={6} md={4} key={program.tenantId || index}> | ||||||
| <Grid item xs={12} sm={6} md={3} key={program.tenantId || index}> | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
|
||||||
| <ProgramCard | ||||||
| image={image} | ||||||
| title={program.name} | ||||||
| description={program.description} | ||||||
| buttonColor={VOLUNTEER_CARD_COLORS[index % VOLUNTEER_CARD_COLORS.length]} | ||||||
| onExplore={() => router.push(`/programs/${program.tenantId}`)} | ||||||
| onExplore={() => router.push(`/${encodeURIComponent(program.name)}`)} | ||||||
| /> | ||||||
| </Grid> | ||||||
| ); | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
program.tenantId || indexas a key is potentially problematic. IftenantIdis present but not unique across programs (e.g., if multiple programs belong to the same tenant), React will encounter duplicate keys, which can lead to rendering bugs and performance issues. IftenantIdis guaranteed to be unique for each program, the fallback toindexis redundant. If it is not guaranteed to be unique, consider using a more stable and unique identifier if available.