import { Box, Divider, Stack, useTheme } from '@mui/material'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import { Link, useNavigate, useParams } from 'react-router-dom'; import { getToolsByCategory } from '../../tools'; import Hero from 'components/Hero'; import { capitalizeFirstLetter } from '@utils/string'; import { Icon } from '@iconify/react'; import { categoriesColors } from 'config/uiConfig'; import React, { useEffect } from 'react'; export default function Home() { const navigate = useNavigate(); const theme = useTheme(); const mainContentRef = React.useRef(null); const { categoryName } = useParams(); useEffect(() => { if (mainContentRef.current) { mainContentRef.current.scrollIntoView({ behavior: 'smooth' }); } }, []); return ( {`All ${capitalizeFirstLetter(categoryName)} Tools`} {getToolsByCategory() .find(({ type }) => type === categoryName) ?.tools?.map((tool, index) => ( navigate('/' + tool.path)} direction={'row'} alignItems={'center'} spacing={2} padding={2} border={`1px solid ${theme.palette.background.default}`} borderRadius={2} > {tool.name} {tool.shortDescription} ))} ); }