'use client' // React Imports import { useTranslations } from 'next-intl' // MUI Imports import Drawer from '@mui/material/Drawer' import Typography from '@mui/material/Typography' import Checkbox from '@mui/material/Checkbox' import FormControlLabel from '@mui/material/FormControlLabel' import List from '@mui/material/List' import ListItem from '@mui/material/ListItem' import ListItemText from '@mui/material/ListItemText' import Divider from '@mui/material/Divider' import Box from '@mui/material/Box' // Component Imports import PerfectScrollbar from 'react-perfect-scrollbar' // Config import type { RowId, CardId } from '@views/dashboards/farm/farmDashboardConfig' import { ROW_IDS } from '@views/dashboards/farm/farmDashboardConfig' type RowCardsType = Record type RowLabelsType = Record type CardLabelsType = Record type FarmDashboardSettingsDrawerProps = { open: boolean onClose: () => void disabledCardIds: string[] onToggleCard: (cardId: CardId, disabled: boolean) => void cardLabels: CardLabelsType rowLabels: RowLabelsType rowCards: RowCardsType } const FarmDashboardSettingsDrawer = (props: FarmDashboardSettingsDrawerProps) => { const t = useTranslations('farmDashboard') const { open, onClose, disabledCardIds, onToggleCard, cardLabels, rowLabels, rowCards } = props const disabledSet = new Set(disabledCardIds) return ( {t('settings.title')} {t('settings.toggleCards')} {ROW_IDS.map(rowId => ( {rowLabels[rowId]} {rowCards[rowId].map(cardId => { const isDisabled = disabledSet.has(cardId) return ( onToggleCard(cardId, !e.target.checked)} size='small' /> } label={} sx={{ m: 0, width: '100%' }} /> ) })} ))} ) } export default FarmDashboardSettingsDrawer