Skip to content

Commit

Permalink
sonar hot fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Renatavl committed Nov 14, 2024
1 parent dbd4496 commit 8db779f
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/components/students-in-categories/StudentsInCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@ import EventIcon from '@mui/icons-material/Event'
import StudentsInCategoriesChart from './StudentsInCategoriesChart'
import { useTranslation } from 'react-i18next'
import { selectedCategory, years } from './StudentsInCategories.constants'
import { useCallback } from 'react'

function StudentsInCategories() {
const { t } = useTranslation()

const selectOption = useCallback(
(options: { value: number | string }[]) =>
options.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.value}
</MenuItem>
)),
[]
)
return (
<Box sx={styles.cardContainer}>
<Typography sx={styles.cardTitle}>
Expand All @@ -27,11 +38,7 @@ function StudentsInCategories() {
)}
sx={styles.select}
>
{selectedCategory.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.value}
</MenuItem>
))}
{selectOption(selectedCategory)}
</Select>

<Select
Expand All @@ -44,12 +51,9 @@ function StudentsInCategories() {
)}
sx={styles.select}
>
{years.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.value}
</MenuItem>
))}
{selectOption(years)}
</Select>

<Button sx={styles.clearAllButton} variant='text'>
{t('tutorHomePage.studentsInCategories.resetButton')}
</Button>
Expand Down

0 comments on commit 8db779f

Please sign in to comment.