PromucFlow_constructor/app/client/src/pages/UserAuth/index.tsx
Ankita Kinger ce9c32cb92
chore: Improve code splitting of FE components (#26659)
## Description

Improve code splitting of FE components to avoid minimal changes needed
on EE when CE is modified.

#### PR fixes following issue(s)
Fixes [#24184](https://github.com/appsmithorg/appsmith/issues/24184)

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing

#### How Has This Been Tested?
- [x] Manual
- [ ] JUnit
- [x] Jest
- [x] Cypress

## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-28 21:07:32 +05:30

63 lines
2.3 KiB
TypeScript

import React from "react";
import { Route, Switch, useLocation, useRouteMatch } from "react-router-dom";
import Login from "pages/UserAuth/Login";
import SignUp from "pages/UserAuth/SignUp";
import ForgotPassword from "./ForgotPassword";
import ResetPassword from "./ResetPassword";
import PageNotFound from "pages/common/ErrorPages/PageNotFound";
import * as Sentry from "@sentry/react";
import { requiresUnauth } from "./requiresAuthHOC";
import { useSelector } from "react-redux";
import { getThemeDetails, ThemeMode } from "selectors/themeSelectors";
import type { AppState } from "@appsmith/reducers";
import { ThemeProvider } from "styled-components";
import VerificationPending from "./VerificationPending";
import VerifyUser from "./VerifyUser";
import VerificationError from "./VerificationError";
const SentryRoute = Sentry.withSentryRouting(Route);
export function UserAuth() {
const { path } = useRouteMatch();
const location = useLocation();
const lightTheme = useSelector((state: AppState) =>
getThemeDetails(state, ThemeMode.LIGHT),
);
return (
<ThemeProvider theme={lightTheme}>
{/* TODO: (Albin) - chnages this to ads-v2 variable once branding is sorted out. */}
<div className="absolute inset-0 flex flex-col overflow-y-auto auth-container bg-[color:var(--ads-color-background-secondary)] p-4 t--auth-container">
<Switch location={location}>
<SentryRoute component={Login} exact path={`${path}/login`} />
<SentryRoute component={SignUp} exact path={`${path}/signup`} />
<SentryRoute
component={ResetPassword}
exact
path={`${path}/resetPassword`}
/>
<SentryRoute
component={ForgotPassword}
exact
path={`${path}/forgotPassword`}
/>
<SentryRoute
component={VerificationPending}
exact
path={`${path}/verificationPending`}
/>
<SentryRoute component={VerifyUser} exact path={`${path}/verify`} />
<SentryRoute
component={VerificationError}
exact
path={`${path}/verify-error`}
/>
<SentryRoute component={PageNotFound} />
</Switch>
</div>
</ThemeProvider>
);
}
export default requiresUnauth(UserAuth);