From 1a600aee7796c28e575946b9c57404e594bdd50d Mon Sep 17 00:00:00 2001 From: chavda-bhavik Date: Tue, 3 Sep 2024 16:02:36 +0530 Subject: [PATCH 1/3] feat: Added design for find & replace --- .../widget/Phases/Phase3/Phase3.tsx | 33 +++++++++++--- .../modals/FindReplace/FindReplaceModal.tsx | 43 +++++++++++++++++++ .../widget/modals/FindReplace/index.ts | 1 + .../src/design-system/Select/Select.styles.ts | 28 +++++------- .../src/design-system/Select/Select.tsx | 3 ++ apps/widget/src/global.d.ts | 5 +++ apps/widget/src/hooks/Phase3/usePhase3.tsx | 8 ++++ libs/shared/src/config/texts.config.ts | 18 +++++++- 8 files changed, 113 insertions(+), 26 deletions(-) create mode 100644 apps/widget/src/components/widget/modals/FindReplace/FindReplaceModal.tsx create mode 100644 apps/widget/src/components/widget/modals/FindReplace/index.ts diff --git a/apps/widget/src/components/widget/Phases/Phase3/Phase3.tsx b/apps/widget/src/components/widget/Phases/Phase3/Phase3.tsx index e00639067..4147c5492 100644 --- a/apps/widget/src/components/widget/Phases/Phase3/Phase3.tsx +++ b/apps/widget/src/components/widget/Phases/Phase3/Phase3.tsx @@ -1,4 +1,4 @@ -import { Badge, Flex, Stack } from '@mantine/core'; +import { Badge, Flex, Group, Stack } from '@mantine/core'; import { useRef, useState, useEffect } from 'react'; import HotTableClass from '@handsontable/react/hotTableClass'; @@ -16,6 +16,7 @@ import { Pagination } from '@ui/Pagination'; import { LoadingOverlay } from '@ui/LoadingOverlay'; import { SegmentedControl } from '@ui/SegmentedControl'; import { ConfirmModal } from 'components/widget/modals/ConfirmModal'; +import { FindReplaceModal } from 'components/widget/modals/FindReplace'; interface IPhase3Props { onNextClick: (uploadData: IUpload, importedData?: Record[]) => void; @@ -29,6 +30,7 @@ export function Phase3(props: IPhase3Props) { const { page, type, + columns, headings, columnDefs, totalPages, @@ -49,10 +51,12 @@ export function Phase3(props: IPhase3Props) { isDoReviewLoading, isReviewDataLoading, selectedRowsCountRef, + showFindReplaceModal, showAllDataValidModal, isDeleteRecordLoading, isConfirmReviewLoading, showDeleteConfirmModal, + setShowFindReplaceModal, setShowAllDataValidModal, setShowDeleteConfirmModal, } = usePhase3({ onNext: onNextClick }); @@ -108,12 +112,19 @@ export function Phase3(props: IPhase3Props) { }, ]} /> - + + + + + setShowFindReplaceModal(false)} + cancelLabel={texts.COMMON.CANCEL} + replaceLabel={texts.PHASE3.REPLACE} + /> ); } diff --git a/apps/widget/src/components/widget/modals/FindReplace/FindReplaceModal.tsx b/apps/widget/src/components/widget/modals/FindReplace/FindReplaceModal.tsx new file mode 100644 index 000000000..621271f1e --- /dev/null +++ b/apps/widget/src/components/widget/modals/FindReplace/FindReplaceModal.tsx @@ -0,0 +1,43 @@ +import { WIDGET_TEXTS } from '@impler/shared'; +import { Checkbox, Flex, FocusTrap, Modal as MantineModal, Stack, TextInput } from '@mantine/core'; + +import { Button } from '@ui/Button'; +import { Select } from '@ui/Select'; + +interface IFindReplaceModalProps { + opened: boolean; + columns: IOption[]; + cancelLabel: string; + onClose: () => void; + replaceLabel: string; + texts: typeof WIDGET_TEXTS; +} + +export function FindReplaceModal(props: IFindReplaceModalProps) { + const { opened, onClose, replaceLabel, cancelLabel, columns, texts } = props; + + return ( + + + + + + - - - - - - - +
+ + + + ( +