Skip to content

The open alternative to Salesforce, designed for AI.

Improve csv import (#5753)

Félix Malfait89f914ebf846
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/components/StepNavigationButton.tsx b/packages/twenty-front/src/modules/spreadsheet-import/components/StepNavigationButton.tsx
index 41f078e3c95..85f58d92315 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/components/StepNavigationButton.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/components/StepNavigationButton.tsx
@@ -3,35 +3,40 @@ 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';
+import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
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;
+ gap: ${({ theme }) => theme.spacing(2)};
+ justify-content: space-between;
`;
type StepNavigationButtonProps = {
onClick: () => void;
title: string;
isLoading?: boolean;
+ onBack?: () => void;
};
export const StepNavigationButton = ({
onClick,
title,
isLoading,
+ onBack,
}: StepNavigationButtonProps) => (
<StyledFooter>
- <StyledButton
+ {!isUndefinedOrNull(onBack) && (
+ <MainButton
+ Icon={isLoading ? CircularProgressBar : undefined}
+ title="Back"
+ onClick={!isLoading ? onBack : undefined}
+ variant="secondary"
+ />
+ )}
+ <MainButton
Icon={isLoading ? CircularProgressBar : undefined}
title={title}
onClick={!isLoading ? onClick : undefined}
+ variant="primary"
/>
</StyledFooter>
);
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx
index cb350462572..b9f36e9697d 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx
@@ -287,11 +287,11 @@ export const MatchColumnsStep = <T extends string>({
/>
</StyledContent>
<StepNavigationButton
+ onBack={onBack}
onClick={handleOnContinue}
isLoading={isLoading}
- title="Next"
+ title="Continue"
/>
- <StepNavigationButton onClick={onBack} title="Back" />
</>
);
};
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectHeaderStep/SelectHeaderStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectHeaderStep/SelectHeaderStep.tsx
index 5f4c9e1fd40..754b3c6e4ad 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectHeaderStep/SelectHeaderStep.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectHeaderStep/SelectHeaderStep.tsx
@@ -57,10 +57,10 @@ export const SelectHeaderStep = ({
</Modal.Content>
<StepNavigationButton
onClick={handleContinue}
- title="Next"
+ onBack={onBack}
+ title="Continue"
isLoading={isLoading}
/>
- <StepNavigationButton onClick={onBack} title="Back" />
</>
);
};
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectSheetStep/SelectSheetStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectSheetStep/SelectSheetStep.tsx
index 69e38873849..713b17ff77b 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectSheetStep/SelectSheetStep.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectSheetStep/SelectSheetStep.tsx
@@ -55,17 +55,17 @@ export const SelectSheetStep = ({
<StyledRadioContainer>
<RadioGroup onValueChange={(value) => setValue(value)} value={value}>
{sheetNames.map((sheetName) => (
- <Radio value={sheetName} key={sheetName} />
+ <Radio value={sheetName} key={sheetName} label={sheetName} />
))}
</RadioGroup>
</StyledRadioContainer>
</StyledContent>
<StepNavigationButton
onClick={() => handleOnContinue(value)}
+ onBack={onBack}
isLoading={isLoading}
- title="Next"
+ title="Continue"
/>
- <StepNavigationButton onClick={onBack} title="Back" />
</>
);
};
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx
index 9873700c63f..e9b6ebe8bbf 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx
@@ -240,8 +240,11 @@ export const ValidationStep = <T extends string>({
/>
</StyledScrollContainer>
</StyledContent>
- <StepNavigationButton onClick={onContinue} title="Confirm" />
- <StepNavigationButton onClick={onBack} title="Back" />
+ <StepNavigationButton
+ onClick={onContinue}
+ onBack={onBack}
+ title="Confirm"
+ />
</>
);
};
diff --git a/packages/twenty-front/src/modules/ui/input/button/components/MainButton.tsx b/packages/twenty-front/src/modules/ui/input/button/components/MainButton.tsx
index bacd927bd8f..ab23ceeccb9 100644
--- a/packages/twenty-front/src/modules/ui/input/button/components/MainButton.tsx
+++ b/packages/twenty-front/src/modules/ui/input/button/components/MainButton.tsx
@@ -3,13 +3,13 @@ import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { IconComponent } from 'twenty-ui';
-type Variant = 'primary' | 'secondary';
+export type MainButtonVariant = 'primary' | 'secondary';
type Props = {
title: string;
fullWidth?: boolean;
width?: number;
- variant?: Variant;
+ variant?: MainButtonVariant;
soon?: boolean;
} & React.ComponentProps<'button'>;