Fixed: In CSV import now users are able to come back to the previous step. (#5625)

Users now can make a back transition from the current step state.

- Added a `BackButton` component to `spreadsheet-import` in order to use
it within the step state components.
- Used the prebuilt `prevStep` from `useStepBar` and passed it as a prop
to the `Uploadflow` to get the previous state as activestep.
- Added a `previousState` to set the previous state with the required
key data.
- Added a `handleOnBack` function in `Uploadflow` to set the correct
state and call the `prevStep` function to make the transition.
- Added a callback function `onBack` and passed it as props to each step
state component.

fixes: #5564 



https://github.com/twentyhq/twenty/assets/140178357/be7e1a0a-0fb8-41f2-a207-dfc3208ca6f0

---------

Co-authored-by: Thomas Trompette <thomas.trompette@sfr.fr>
This commit is contained in:
Shashank Vishwakarma
2024-05-30 22:13:56 +05:30
committed by GitHub
parent a12c1aad5e
commit c7f2150ac7
11 changed files with 60 additions and 21 deletions

View File

@ -0,0 +1,37 @@
import styled from '@emotion/styled';
import { CircularProgressBar } from '@/ui/feedback/progress-bar/components/CircularProgressBar';
import { MainButton } from '@/ui/input/button/components/MainButton';
import { Modal } from '@/ui/layout/modal/components/Modal';
const StyledFooter = styled(Modal.Footer)`
height: 60px;
justify-content: center;
padding: 0px;
padding-left: ${({ theme }) => theme.spacing(30)};
padding-right: ${({ theme }) => theme.spacing(30)};
`;
const StyledButton = styled(MainButton)`
width: 200px;
`;
type StepNavigationButtonProps = {
onClick: () => void;
title: string;
isLoading?: boolean;
};
export const StepNavigationButton = ({
onClick,
title,
isLoading,
}: StepNavigationButtonProps) => (
<StyledFooter>
<StyledButton
Icon={isLoading ? CircularProgressBar : undefined}
title={title}
onClick={!isLoading ? onClick : undefined}
/>
</StyledFooter>
);