Skip to content

Commit

Permalink
fix(ui): prevent error when skipping last step
Browse files Browse the repository at this point in the history
Signed-off-by: Milan Gruner <milangruner@gmail.com>
  • Loading branch information
lemilonkh committed Sep 7, 2023
1 parent a761d65 commit d6f1934
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/src/app/[lng]/data/[step]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ export default function OnboardingSteps({
}
};

const onSkip = () => {
if (activeStep >= steps.length - 1) {
router.push("/"); // go back to dashboard until there is a confirmation page
} else {
goToNext();
}
};

return (
<div className="pt-16 w-[1090px] max-w-full mx-auto px-4">
<Button
Expand Down Expand Up @@ -303,11 +311,7 @@ export default function OnboardingSteps({
<Text color="content.tertiary" noOfLines={5}>
{source.description}
</Text>
<Link
className="underline"
mt={4}
mb={6}
>
<Link className="underline" mt={4} mb={6}>
{t("see-more-details")}
</Link>
{source.isConnected ? (
Expand Down Expand Up @@ -396,7 +400,7 @@ export default function OnboardingSteps({
</Box>
<Button
h={16}
onClick={goToNext}
onClick={onSkip}
variant="ghost"
leftIcon={<Icon as={MdOutlineSkipNext} boxSize={6} />}
size="sm"
Expand Down

0 comments on commit d6f1934

Please sign in to comment.