Skip to content

Commit

Permalink
Redirect to oboarding page (airbytehq#6251)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamakase authored and schlattk committed Jan 4, 2022
1 parent 462cbfc commit 641e9b3
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 28 deletions.
8 changes: 4 additions & 4 deletions airbyte-webapp/src/packages/cloud/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ const MainRoutes: React.FC<{ currentWorkspaceId: string }> = ({
useGetWorkspace(currentWorkspaceId);
const { countNewSourceVersion, countNewDestinationVersion } = useConnector();
const { workspace } = useWorkspace();
const mainRedirect = workspace.displaySetupWizard
? Routes.Onboarding
: Routes.Connections;

const pageConfig = useMemo<PageConfig>(
() => ({
Expand Down Expand Up @@ -155,10 +158,7 @@ const MainRoutes: React.FC<{ currentWorkspaceId: string }> = ({
<OnboardingPage />
</Route>
)}
<Route exact path={Routes.Root}>
<SourcesPage />
</Route>
<Redirect to={Routes.Connections} />
<Redirect to={mainRedirect} />
</Switch>
);
};
Expand Down
18 changes: 8 additions & 10 deletions airbyte-webapp/src/packages/cloud/views/layout/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ const SideBar: React.FC = () => {
return (
<Bar>
<div>
<Link to={Routes.Root}>
<Link
to={
workspace.displaySetupWizard
? Routes.Onboarding
: Routes.Connections
}
>
<img src="/simpleLogo.svg" alt="logo" height={33} width={33} />
</Link>
<WorkspacePopout>
Expand Down Expand Up @@ -158,15 +164,7 @@ const SideBar: React.FC = () => {
</MenuItem>
</li>
<li>
<MenuItem
to={Routes.Root}
exact
activeClassName="active"
isActive={(_, location) =>
location.pathname === Routes.Root ||
location.pathname.startsWith(Routes.Source)
}
>
<MenuItem to={Routes.Source} activeClassName="active">
<Source />
<Text>
<FormattedMessage id="sidebar.sources" />
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/pages/OnboardingPage/OnboardingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const OnboardingPage: React.FC = () => {
const onSync = () => syncConnection(connections[0]);
const onCloseOnboarding = () => {
finishOnboarding();
push(Routes.Root);
push(Routes.Connections);
};

return (
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/pages/SourcesPage/SourcesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SourcesPage: React.FC = () => {
<SourceItemPage />
</ErrorBoundary>
</Route>
<Route path={Routes.Root} exact>
<Route path={Routes.Source} exact>
<AllSourcesPage />
</Route>
<Redirect to={Routes.Root} />
Expand Down
7 changes: 5 additions & 2 deletions airbyte-webapp/src/pages/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export enum Routes {

const MainViewRoutes = () => {
const { workspace } = useWorkspace();
const mainRedirect = workspace.displaySetupWizard
? Routes.Onboarding
: Routes.Connections;

return (
<MainView>
Expand All @@ -72,10 +75,10 @@ const MainViewRoutes = () => {
<OnboardingPage />
</Route>
)}
<Route exact path={Routes.Root}>
<Route exact path={Routes.Source}>
<SourcesPage />
</Route>
<Redirect to={Routes.Root} />
<Redirect to={mainRedirect} />
</Switch>
</Suspense>
</MainView>
Expand Down
18 changes: 8 additions & 10 deletions airbyte-webapp/src/views/layout/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@ const SideBar: React.FC = () => {
return (
<Bar>
<div>
<Link to={Routes.Root}>
<Link
to={
workspace.displaySetupWizard
? Routes.Onboarding
: Routes.Connections
}
>
<img src="/simpleLogo.svg" alt="logo" height={33} width={33} />
</Link>
<Menu>
Expand All @@ -133,15 +139,7 @@ const SideBar: React.FC = () => {
</MenuItem>
</li>
<li>
<MenuItem
to={Routes.Root}
exact
activeClassName="active"
isActive={(_, location) =>
location.pathname === Routes.Root ||
location.pathname.startsWith(Routes.Source)
}
>
<MenuItem to={Routes.Source} activeClassName="active">
<Source />
<Text>
<FormattedMessage id="sidebar.sources" />
Expand Down

0 comments on commit 641e9b3

Please sign in to comment.