diff --git a/assets/images/simple-illustrations/simple-illustration__syncusers.svg b/assets/images/simple-illustrations/simple-illustration__syncusers.svg new file mode 100644 index 000000000000..6611d1d7c46b --- /dev/null +++ b/assets/images/simple-illustrations/simple-illustration__syncusers.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/GustoSyncResultsModal.tsx b/src/components/GustoSyncResultsModal.tsx new file mode 100644 index 000000000000..7f771b4bdb3c --- /dev/null +++ b/src/components/GustoSyncResultsModal.tsx @@ -0,0 +1,112 @@ +import React, {useState} from 'react'; +import {View} from 'react-native'; +import {useMemoizedLazyExpensifyIcons, useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; +import useLocalize from '@hooks/useLocalize'; +import useTheme from '@hooks/useTheme'; +import useThemeStyles from '@hooks/useThemeStyles'; +import type {GustoSyncResult} from '@libs/API/GustoSyncResult'; +import CONST from '@src/CONST'; +import Button from './Button'; +import FixedFooter from './FixedFooter'; +import HeaderWithBackButton from './HeaderWithBackButton'; +import Icon from './Icon'; +import Modal from './Modal'; +import type {ModalProps} from './Modal/Global/ModalContext'; +import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; +import ScrollView from './ScrollView'; +import Text from './Text'; + +type GustoSyncResultsModalProps = ModalProps & { + /** Sync result returned by the completed Gusto sync job */ + result: GustoSyncResult; +}; + +function GustoSyncResultsModal({result, closeModal}: GustoSyncResultsModalProps) { + const {translate} = useLocalize(); + const theme = useTheme(); + const styles = useThemeStyles(); + const icons = useMemoizedLazyExpensifyIcons(['DownArrow']); + const illustrations = useMemoizedLazyIllustrations(['SyncUsers']); + const [isSkippedSectionExpanded, setIsSkippedSectionExpanded] = useState(false); + + const addedCount = result.addedEmployeesCount ?? 0; + const removedCount = result.removedEmployeesCount ?? 0; + const skippedCount = result.skippedEmployees?.length ?? 0; + const closeResultsModal = () => closeModal(); + + const renderResultSummary = (label: string, count: number) => ( + + {label} + {translate('workspace.hr.gusto.syncResults.employeeCount', {count})} + + ); + + return ( + + + + + + + + {translate('workspace.hr.gusto.syncResults.successTitle')} + {renderResultSummary(translate('workspace.hr.gusto.syncResults.added'), addedCount)} + {renderResultSummary(translate('workspace.hr.gusto.syncResults.removed'), removedCount)} + setIsSkippedSectionExpanded((isExpanded) => !isExpanded)} + style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter]} + > + + {translate('workspace.hr.gusto.syncResults.skipped')} + {translate('workspace.hr.gusto.syncResults.employeeCount', {count: skippedCount})} + + + + {isSkippedSectionExpanded && + result.skippedEmployees?.map((employee) => ( + + {employee.name} + {employee.reason} + + ))} + + +