Skip to content

Commit

Permalink
Disable tour redirects until tools go live
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed Sep 5, 2024
1 parent 71b6102 commit c77ba6f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
19 changes: 10 additions & 9 deletions pages/accountLists.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ export const getServerSideProps = makeGetServerSideProps(async (session) => {
query: GetAccountListsDocument,
});

if (data.user.setup) {
// The user has not finished setting up, so start them on the tour
return {
redirect: {
destination: '/setup/start',
permanent: false,
},
};
}
// TODO(@canac): Uncomment this after tools go-live
// if (data.user.setup) {
// // The user has not finished setting up, so start them on the tour
// return {
// redirect: {
// destination: '/setup/start',
// permanent: false,
// },
// };
// }

if (data.accountLists.nodes.length === 1) {
return {
Expand Down
8 changes: 5 additions & 3 deletions src/components/Setup/SetupProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,21 @@ describe('SetupProvider', () => {
expect(getByText('Page content')).toBeInTheDocument();
});

it('redirects if the user needs to connect to create an account list', async () => {
// TODO(@canac): Remove this after tools go-live
/* eslint-disable jest/no-disabled-tests */
it.skip('redirects if the user needs to connect to create an account list', async () => {
render(<TestComponent setup={UserSetupStageEnum.NoAccountLists} />);

await waitFor(() => expect(push).toHaveBeenCalledWith('/setup/connect'));
});

it('redirects if the user needs to connect to an organization', async () => {
it.skip('redirects if the user needs to connect to an organization', async () => {
render(<TestComponent setup={UserSetupStageEnum.NoOrganizationAccount} />);

await waitFor(() => expect(push).toHaveBeenCalledWith('/setup/connect'));
});

it('redirects if the user needs to choose a default account', async () => {
it.skip('redirects if the user needs to choose a default account', async () => {
render(<TestComponent setup={UserSetupStageEnum.NoDefaultAccountList} />);

await waitFor(() => expect(push).toHaveBeenCalledWith('/setup/account'));
Expand Down
19 changes: 11 additions & 8 deletions src/components/Setup/SetupProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// TODO(@canac): Remove this after tools go-live
/* eslint-disable */
import { useRouter } from 'next/router';
import React, {
ReactNode,
Expand Down Expand Up @@ -41,18 +43,19 @@ export const SetupProvider: React.FC<Props> = ({ children }) => {
return;
}

// TODO(@canac): Uncomment this after tools go-live
// If the user hasn't completed crucial setup steps, take them to the tour
// to finish setting up their account. If they are on the preferences stage
// or beyond and manually typed in a URL, let them stay on the page they
// were on.
if (
data.user.setup === UserSetupStageEnum.NoAccountLists ||
data.user.setup === UserSetupStageEnum.NoOrganizationAccount
) {
push('/setup/connect');
} else if (data.user.setup === UserSetupStageEnum.NoDefaultAccountList) {
push('/setup/account');
}
// if (
// data.user.setup === UserSetupStageEnum.NoAccountLists ||
// data.user.setup === UserSetupStageEnum.NoOrganizationAccount
// ) {
// push('/setup/connect');
// } else if (data.user.setup === UserSetupStageEnum.NoDefaultAccountList) {
// push('/setup/account');
// }
}, [data]);

const settingUp = useMemo(() => {
Expand Down

0 comments on commit c77ba6f

Please sign in to comment.