PromucFlow_constructor/app/client/src/pages/UserAuth/index.tsx
Nikhil Nandagopal d5ac05caf8
Feature/instrumentation (#708)
* bumped sentry version
modified performance monitor to use a queue internally to make synchronous logging easy
added logging for api pane close / open and various different methods

* added use effect to stop tracking on mount of entity properties

* removed open api tracking

* fixed stop tracking to pop from the end instead of the beginning
added tracking for editor mount and sidebar mount

* added tracking for entity explorer

* moved from app route to sentry app route because passing JSX to app route causes re-renders

* Fixing theme and route change issues.

Co-authored-by: Nikhil Nandagopal <nikhil@appsmith.com>
Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-09-24 21:35:18 +05:30

53 lines
1.9 KiB
TypeScript

import React from "react";
import { Switch, useRouteMatch, useLocation, Route } from "react-router-dom";
import Login from "./Login";
import Centered from "components/designSystems/appsmith/CenteredWrapper";
import { animated, useTransition } from "react-spring";
import { AuthContainer, AuthCard } from "./StyledComponents";
import SignUp from "./SignUp";
import ForgotPassword from "./ForgotPassword";
import ResetPassword from "./ResetPassword";
import PageNotFound from "pages/common/PageNotFound";
import * as Sentry from "@sentry/react";
const SentryRoute = Sentry.withSentryRouting(Route);
const AnimatedAuthCard = animated(AuthContainer);
export const UserAuth = () => {
const { path } = useRouteMatch();
const location = useLocation();
const transitions = useTransition(location, location => location.pathname, {
from: { opacity: 0, transform: "translate3d(50%,0,0)" },
enter: { opacity: 1, transform: "translate3d(0%,0,0)" },
leave: { opacity: 0, transform: "translate3d(-50%,0,0)" },
reset: true,
});
const renderTransitions = transitions.map(
({ item: location, props, key }) => (
<AnimatedAuthCard key={key} style={props}>
<Centered>
<AuthCard>
<Switch location={location}>
<SentryRoute exact path={`${path}/login`} component={Login} />
<SentryRoute exact path={`${path}/signup`} component={SignUp} />
<SentryRoute
exact
path={`${path}/resetPassword`}
component={ResetPassword}
/>
<SentryRoute
exact
path={`${path}/forgotPassword`}
component={ForgotPassword}
/>
<SentryRoute component={PageNotFound} />
</Switch>
</AuthCard>
</Centered>
</AnimatedAuthCard>
),
);
return <React.Fragment>{renderTransitions}</React.Fragment>;
};
export default UserAuth;