Skip to content

Commit

Permalink
Merge pull request #326 from Aar-if/cachingLatest
Browse files Browse the repository at this point in the history
Issue #PS-000 chore: Fixed build Issue
  • Loading branch information
itsvick authored Jun 28, 2024
2 parents 6a9ed00 + 41e196e commit 311da6c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ const CreateBlockModal: React.FC<CreateBlockModalProps> = ({
);
};

export async function getStaticProps({ locale }: any) {
return {
props: {
...(await serverSideTranslations(locale, ['common'])),
// Other props you want to pass to your component
},
};
}


export default CreateBlockModal;
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import { useTheme } from '@mui/material/styles';
interface FilterModalProps {
open: boolean;
handleClose: () => void;
blocks: string[];
selectedBlocks: string[];
setSelectedBlocks: (blocks: string[]) => void;
sortOrder: string;
setSortOrder: (order: string) => void;
onApply: () => void;
Expand All @@ -33,32 +30,13 @@ interface FilterModalProps {
const FilterModal: React.FC<FilterModalProps> = ({
open,
handleClose,
blocks,
selectedBlocks,
setSelectedBlocks,
sortOrder,
setSortOrder,
onApply,
}) => {
const { t } = useTranslation();
const [searchInput, setSearchInput] = useState('');
const theme = useTheme<any>();

const handleSearchChange = (event: React.ChangeEvent<HTMLInputElement>) => {
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<any>();

const handleApplyClick = () => {
onApply();
Expand All @@ -77,10 +55,10 @@ const FilterModal: React.FC<FilterModalProps> = ({
p: 2,
borderRadius: 5,
outline: 'none',
position: 'absolute',
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)'
transform: 'translate(-50%, -50%)',
}}
>
<Box display="flex" justifyContent="space-between" mb={2}>
Expand Down Expand Up @@ -144,8 +122,11 @@ const FilterModal: React.FC<FilterModalProps> = ({
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')}
</Button>
Expand Down
12 changes: 4 additions & 8 deletions src/pages/blocks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -56,7 +54,7 @@ const Blocks: React.FC<BlocksProps> = () => {
const handleSearchChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const value = event.target.value;
setSearchInput(value);
const filtered = blocks.filter((block) =>
const filtered = blocks?.filter((block) =>
block.toLowerCase().includes(value.toLowerCase())
);
setFilteredBlocks(filtered);
Expand Down Expand Up @@ -176,9 +174,7 @@ const Blocks: React.FC<BlocksProps> = () => {
<FilterModal
open={filterModalOpen}
handleClose={handleFilterModalClose}
blocks={blocks}
selectedBlocks={selectedBlocks}
setSelectedBlocks={setSelectedBlocks}

sortOrder={sortOrder}
setSortOrder={setSortOrder}
onApply={handleApplyFilters}
Expand Down

0 comments on commit 311da6c

Please sign in to comment.