|
|
@@ -29,6 +29,10 @@ import { NewProjectFC } from "./new-project/NewProject";
|
|
|
import InfrastructureRouter from "./infrastructure/InfrastructureRouter";
|
|
|
import { overrideInfraTabEnabled } from "utils/infrastructure";
|
|
|
import NoClusterPlaceHolder from "components/NoClusterPlaceHolder";
|
|
|
+import Modal from "components/porter/Modal";
|
|
|
+import Text from "components/porter/Text";
|
|
|
+import Spacer from "components/porter/Spacer";
|
|
|
+import Button from "components/porter/Button";
|
|
|
|
|
|
// Guarded components
|
|
|
const GuardedProjectSettings = fakeGuardedRoute("settings", "", [
|
|
|
@@ -84,6 +88,7 @@ const Home: React.FC<Props> = (props) => {
|
|
|
const [handleDO, setHandleDO] = useState(false);
|
|
|
const [ghRedirect, setGhRedirect] = useState(false);
|
|
|
const [forceSidebar, setForceSidebar] = useState(true);
|
|
|
+ const [showWrongEmailModal, setShowWrongEmailModal] = useState(false);
|
|
|
|
|
|
const redirectToNewProject = () => {
|
|
|
pushFiltered(props, "/new-project", ["project_id"]);
|
|
|
@@ -206,7 +211,9 @@ const Home: React.FC<Props> = (props) => {
|
|
|
getProjects(defaultProjectId);
|
|
|
getMetadata();
|
|
|
|
|
|
- if (
|
|
|
+ if (err === "Wrong email for invite") {
|
|
|
+ setShowWrongEmailModal(true);
|
|
|
+ } else if (
|
|
|
!hasFinishedOnboarding &&
|
|
|
props.history.location.pathname &&
|
|
|
!props.history.location.pathname.includes("onboarding")
|
|
|
@@ -256,7 +263,7 @@ const Home: React.FC<Props> = (props) => {
|
|
|
.then((res) => {
|
|
|
const usage = res.data;
|
|
|
setUsage(usage);
|
|
|
- if (usage.exceeded && false) {
|
|
|
+ if (usage.exceeded) {
|
|
|
setCurrentModal("UsageWarningModal", { usage });
|
|
|
}
|
|
|
})
|
|
|
@@ -268,12 +275,16 @@ const Home: React.FC<Props> = (props) => {
|
|
|
}, [props.currentProject?.id]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ let queryString = window.location.search;
|
|
|
+ let urlParams = new URLSearchParams(queryString);
|
|
|
+ let err = urlParams.get("error");
|
|
|
if (
|
|
|
!hasFinishedOnboarding &&
|
|
|
props.history.location.pathname &&
|
|
|
!props.history.location.pathname.includes("onboarding") &&
|
|
|
!props.history.location.pathname.includes("new-project") &&
|
|
|
- !props.history.location.pathname.includes("project-settings")
|
|
|
+ !props.history.location.pathname.includes("project-settings") &&
|
|
|
+ err !== "Wrong email for invite"
|
|
|
) {
|
|
|
setCurrentModal("RedirectToOnboardingModal");
|
|
|
}
|
|
|
@@ -478,7 +489,26 @@ const Home: React.FC<Props> = (props) => {
|
|
|
/>,
|
|
|
document.body
|
|
|
)}
|
|
|
- ,
|
|
|
+ {showWrongEmailModal &&
|
|
|
+ <Modal>
|
|
|
+ <Text size={16}>
|
|
|
+ Oops! This invite link wasn't for {user?.email}
|
|
|
+ </Text>
|
|
|
+ <Spacer y={1} />
|
|
|
+ <Text color="helper">
|
|
|
+ Your account email does not match the email associated with this project invite.
|
|
|
+ Please log out and sign up again with the correct email using the invite link.
|
|
|
+ </Text>
|
|
|
+ <Spacer y={1} />
|
|
|
+ <Text color="helper">
|
|
|
+ You should reach out to the person who sent you the invite link to get the correct email.
|
|
|
+ </Text>
|
|
|
+ <Spacer y={1} />
|
|
|
+ <Button onClick={props.logOut}>
|
|
|
+ Log out
|
|
|
+ </Button>
|
|
|
+ </Modal>
|
|
|
+ }
|
|
|
</StyledHome>
|
|
|
);
|
|
|
};
|