From 41e196ec7f63acf5f80a14d7870fc87e3fa81e4d Mon Sep 17 00:00:00 2001 From: Arif Date: Fri, 28 Jun 2024 12:28:34 +0530 Subject: [PATCH] Issue #PS-000 chore: Fixed build Issue --- .../blocks}/CreateBlockModal.tsx | 9 +--- .../blocks/FilterBlockModal.tsx} | 45 ++++--------------- src/pages/blocks/index.tsx | 12 ++--- 3 files changed, 13 insertions(+), 53 deletions(-) rename src/{pages/blocks/components => components/blocks}/CreateBlockModal.tsx (93%) rename src/{pages/blocks/components/FilterModal.tsx => components/blocks/FilterBlockModal.tsx} (73%) diff --git a/src/pages/blocks/components/CreateBlockModal.tsx b/src/components/blocks/CreateBlockModal.tsx similarity index 93% rename from src/pages/blocks/components/CreateBlockModal.tsx rename to src/components/blocks/CreateBlockModal.tsx index 8feaf26c..fce2f871 100644 --- a/src/pages/blocks/components/CreateBlockModal.tsx +++ b/src/components/blocks/CreateBlockModal.tsx @@ -110,13 +110,6 @@ const CreateBlockModal: React.FC = ({ ); }; -export async function getStaticProps({ locale }: any) { - return { - props: { - ...(await serverSideTranslations(locale, ['common'])), - // Other props you want to pass to your component - }, - }; -} + export default CreateBlockModal; diff --git a/src/pages/blocks/components/FilterModal.tsx b/src/components/blocks/FilterBlockModal.tsx similarity index 73% rename from src/pages/blocks/components/FilterModal.tsx rename to src/components/blocks/FilterBlockModal.tsx index a771f92b..c9fe130e 100644 --- a/src/pages/blocks/components/FilterModal.tsx +++ b/src/components/blocks/FilterBlockModal.tsx @@ -18,14 +18,10 @@ import { import { Search, Close } from '@mui/icons-material'; import { useTranslation } from 'next-i18next'; import { useTheme } from '@mui/material/styles'; -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; interface FilterModalProps { open: boolean; handleClose: () => void; - blocks: string[]; - selectedBlocks: string[]; - setSelectedBlocks: (blocks: string[]) => void; sortOrder: string; setSortOrder: (order: string) => void; onApply: () => void; @@ -34,32 +30,13 @@ interface FilterModalProps { const FilterModal: React.FC = ({ open, handleClose, - blocks, - selectedBlocks, - setSelectedBlocks, sortOrder, setSortOrder, onApply, }) => { const { t } = useTranslation(); - const [searchInput, setSearchInput] = useState(''); - const theme = useTheme(); - - const handleSearchChange = (event: React.ChangeEvent) => { - setSearchInput(event.target.value); - }; - - const handleBlockToggle = (block: string) => { - if (selectedBlocks.includes(block)) { - setSelectedBlocks(selectedBlocks.filter((b) => b !== block)); - } else { - setSelectedBlocks([...selectedBlocks, block]); - } - }; - const filteredBlocks = blocks.filter((block) => - block.toLowerCase().includes(searchInput.toLowerCase()) - ); + const theme = useTheme(); const handleApplyClick = () => { onApply(); @@ -78,10 +55,10 @@ const FilterModal: React.FC = ({ p: 2, borderRadius: 5, outline: 'none', - position: 'absolute', + position: 'absolute', top: '50%', left: '50%', - transform: 'translate(-50%, -50%)' + transform: 'translate(-50%, -50%)', }} > @@ -145,8 +122,11 @@ const FilterModal: React.FC = ({ color="primary" fullWidth onClick={handleApplyClick} - sx={{ mt: 2, border: 'none', - backgroundColor: theme?.palette?.primary?.main }} + sx={{ + mt: 2, + border: 'none', + backgroundColor: theme?.palette?.primary?.main, + }} > {t('COMMON.APPLY')} @@ -156,13 +136,4 @@ const FilterModal: React.FC = ({ ); }; -export async function getStaticProps({ locale }: any) { - return { - props: { - ...(await serverSideTranslations(locale, ['common'])), - // Other props you want to pass to your component - }, - }; -} - export default FilterModal; diff --git a/src/pages/blocks/index.tsx b/src/pages/blocks/index.tsx index 88f2c4eb..11bbe747 100644 --- a/src/pages/blocks/index.tsx +++ b/src/pages/blocks/index.tsx @@ -14,10 +14,8 @@ import Search from '@mui/icons-material/Search'; import { ArrowDropDown, KeyboardArrowRight } from '@mui/icons-material'; import AddIcon from '@mui/icons-material/Add'; import { useRouter } from 'next/router'; - -import CreateBlockModal from './components/CreateBlockModal'; -import FilterModal from './components/FilterModal'; - +import CreateBlockModal from '@/components/blocks/CreateBlockModal'; +import FilterModal from '@/components/blocks/FilterBlockModal'; interface BlocksProps { // Define any props if needed } @@ -56,7 +54,7 @@ const Blocks: React.FC = () => { const handleSearchChange = (event: React.ChangeEvent) => { const value = event.target.value; setSearchInput(value); - const filtered = blocks.filter((block) => + const filtered = blocks?.filter((block) => block.toLowerCase().includes(value.toLowerCase()) ); setFilteredBlocks(filtered); @@ -176,9 +174,7 @@ const Blocks: React.FC = () => {