From 23aaadc4bb03f5155376c7bc51aa8f430726bea0 Mon Sep 17 00:00:00 2001 From: Ben Odom Date: Tue, 19 Nov 2024 16:44:53 -0600 Subject: [PATCH 1/2] remove hosting page --- src/app/router.tsx | 17 +-- src/ui/layouts/auth-required.tsx | 26 +--- src/ui/pages/hosting.tsx | 222 ------------------------------- src/ui/pages/index.ts | 1 - 4 files changed, 3 insertions(+), 263 deletions(-) delete mode 100644 src/ui/pages/hosting.tsx diff --git a/src/app/router.tsx b/src/app/router.tsx index 1075b4d2e..f0db6bf02 100644 --- a/src/app/router.tsx +++ b/src/app/router.tsx @@ -90,11 +90,9 @@ import { ForgotPassVerifyPage, GetStartedPage, HomePage, - HostingPage, ImpersonatePage, LoginPage, LogoutPage, - NewUserToOnboarding, NotFoundPage, OpDetailLayout, OpDetailPage, @@ -525,11 +523,7 @@ export const appRoutes: RouteObject[] = [ children: [ { index: true, - element: ( - - - - ), + element: , }, { @@ -723,15 +717,6 @@ export const appRoutes: RouteObject[] = [ element: , }, - { - path: routes.HOSTING_PATH, - element: ( - - - - ), - }, - { path: routes.PLANS_PATH, element: ( diff --git a/src/ui/layouts/auth-required.tsx b/src/ui/layouts/auth-required.tsx index 388e74f79..43953af6a 100644 --- a/src/ui/layouts/auth-required.tsx +++ b/src/ui/layouts/auth-required.tsx @@ -1,17 +1,10 @@ import { selectBillingDetail, selectHasPaymentMethod } from "@app/billing"; import { FETCH_REQUIRED_DATA } from "@app/bootup"; import { createLog } from "@app/debug"; -import { fetchEnvironments, selectEnvironmentsAsList } from "@app/deploy"; -import { - useDispatch, - useLoader, - useLoaderSuccess, - useSelector, -} from "@app/react"; +import { useDispatch, useSelector } from "@app/react"; import { setRedirectPath } from "@app/redirect-path"; import { homeUrl, - hostingUrl, loginUrl, logoutUrl, plansUrl, @@ -22,7 +15,7 @@ import { schema } from "@app/schema"; import { selectAccessToken } from "@app/token"; import { selectCurrentUser, selectIsUserVerified } from "@app/users"; import { useEffect } from "react"; -import { Navigate, Outlet, useLocation, useNavigate } from "react-router-dom"; +import { Navigate, Outlet, useLocation } from "react-router-dom"; import { Loading } from "../shared"; const log = createLog("auth-required"); @@ -34,21 +27,6 @@ const denyList = [ verifyEmailRequestUrl(), ]; -export const NewUserToOnboarding = ({ - children, -}: { children?: React.ReactNode }) => { - const navigate = useNavigate(); - const loader = useLoader(fetchEnvironments); - const envs = useSelector(selectEnvironmentsAsList); - useLoaderSuccess(loader, () => { - if (envs.length === 0) { - navigate(hostingUrl()); - } - }); - - return children ? children : ; -}; - export const VerifyEmailRequired = ({ children, }: { children?: React.ReactNode }) => { diff --git a/src/ui/pages/hosting.tsx b/src/ui/pages/hosting.tsx deleted file mode 100644 index 7875fd377..000000000 --- a/src/ui/pages/hosting.tsx +++ /dev/null @@ -1,222 +0,0 @@ -import { fetchEnvironments, selectEnvironments } from "@app/deploy"; -import { useDispatch, useLoader, useSelector } from "@app/react"; -import { resetRedirectPath, selectRedirectPath } from "@app/redirect-path"; -import { environmentsUrl, getStartedUrl, logoutUrl } from "@app/routes"; -import { tunaEvent } from "@app/tuna"; -import { selectCurrentUser } from "@app/users"; -import { useEffect, useState } from "react"; -import { useNavigate } from "react-router"; -import { Link } from "react-router-dom"; -import { HeroBgLayout } from "../layouts"; -import { - Banner, - Box, - Button, - CheckBox, - Code, - Group, - HelpTextAccordion, - IconArrowRight, - Loading, - tokens, -} from "../shared"; - -const SELF_HOSTED_USER_KEY = "self-hosted-user-id"; - -const TUNA_EVENT_PREFIX = "feedback.hosting"; -const hostingTunaEvent = (event: string, data: any = null) => { - tunaEvent(`${TUNA_EVENT_PREFIX}.${event}`, data); -}; - -export const HostingPage = () => { - const dispatch = useDispatch(); - const navigate = useNavigate(); - const user = useSelector(selectCurrentUser); - const environmentsLoader = useLoader(fetchEnvironments); - const environments = useSelector(selectEnvironments); - const redirectPath = useSelector(selectRedirectPath); - - const [selfHostedChecked, setSelfHostedChecked] = useState(false); - const hasEnvironments = Object.keys(environments).length > 0; - - const deployNowClick = (event: React.SyntheticEvent) => { - event.preventDefault(); - hostingTunaEvent("aptible_hosted"); - navigate(redirectPath || getStartedUrl()); - dispatch(resetRedirectPath()); - }; - - useEffect(() => { - if (hasEnvironments) { - navigate(redirectPath || environmentsUrl()); - dispatch(resetRedirectPath()); - } - }, [hasEnvironments]); - - useEffect(() => { - setSelfHostedChecked( - user.id === localStorage.getItem(SELF_HOSTED_USER_KEY), - ); - }, [user]); - - useEffect(() => { - // Wait until the page has loaded - if (environmentsLoader.isInitialLoading) { - return; - } - - // Persist user ID to localStorage if the box is checked so that if they - // log in as another user the option is still available. It's not perfect - // but it's sufficient for the task of gauging intereset in self-hosted. - if (selfHostedChecked) { - localStorage.setItem(SELF_HOSTED_USER_KEY, user.id); - hostingTunaEvent("self_hosted_waitlist.true"); - } else { - localStorage.removeItem(SELF_HOSTED_USER_KEY); - hostingTunaEvent("self_hosted_waitlist.false"); - } - }, [selfHostedChecked]); - - if (environmentsLoader.isInitialLoading || hasEnvironments) { - return ( -
- -
- ); - } - - return ( - - -

Choose an Option

- - {selfHostedChecked ? ( - - Successfully added to Early Access! Someone from Aptible will reach - out to connect. - - ) : null} - -
- - - - AVAILABLE NOW - -

- Launch a new project -

-
- Use Aptible to deploy apps and managed databases{" "} - hosted on Aptible. Your invoice is based on how much - infrastructure you use. -
- - -
-
- - - - COMING SOON - -

- Launch a platform on your existing infrastructure -

-
- Use Aptible to analyze and standardize infrastructure already - running in your own cloud account. Your invoice is based - on services managed by Aptible and team size. -
- setSelfHostedChecked(e.currentTarget.checked)} - /> - -
-
-
- -
-

FAQ

-
- -
- - hostingTunaEvent(`faq.difference.${open ? "open" : "close"}`) - } - > - -

- Hundreds of the fastest growing startups and scaling companies - have used Aptible’s hosted platform for a decade. In this - option, Aptible hosts and manages your resources, abstracting - away all the complexity of interacting with an underlying - cloud provider and ensuring resources are provisioned - properly. -

-

- Aptible also manages existing resources hosted in your own - cloud account. This means that you integrate Aptible with your - cloud accounts and Aptible helps your platform engineering - team create a platform on top of the infrastructure you - already have. In this option, you control and pay for your own - cloud accounts, while Aptible helps you analyze and - standardize your cloud resources. -

-
-
- - hostingTunaEvent(`faq.free_trial.${open ? "open" : "close"}`) - } - > - -

- Yes. There is a 30 day free trial for launching a new project - on Aptible hosted resources. -

-

- At this time, we are accepting requests for Early Access to - use Aptible to launch a platform in your existing cloud - accounts. Early Access customers will get Proof of - Concept/Value periods. -

-
-
- - hostingTunaEvent( - `faq.early_access_request.${open ? "open" : "close"}`, - ) - } - > -

- Customer feedback is central to everything Aptible has ever - released. As we are aggressively expanding our ability to manage - existing cloud infrastructure, we’ve decided to offer white - glove onboarding to select customers interested in using us to - manage their existing resources. The catch? We’re looking for - feedback so we’ll expect you to help us set our roadmap and - rapidly improve our functionality. -

-
-
-
- - - Log Out - -
-
- ); -}; diff --git a/src/ui/pages/index.ts b/src/ui/pages/index.ts index 131a9e00c..dc81d76ac 100644 --- a/src/ui/pages/index.ts +++ b/src/ui/pages/index.ts @@ -69,7 +69,6 @@ export * from "./forgot-pass"; export * from "./billing-method"; export * from "./impersonate"; export * from "./plans"; -export * from "./hosting"; export * from "./sso"; export * from "./activity"; export * from "./deployments"; From ca84d9394f4fecb7f7e46aa5e7ece7d027aaa272 Mon Sep 17 00:00:00 2001 From: Ben Odom Date: Tue, 19 Nov 2024 22:25:38 -0600 Subject: [PATCH 2/2] fix test related to hosting page --- src/ui/pages/verify-email.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/pages/verify-email.test.tsx b/src/ui/pages/verify-email.test.tsx index 774e95bd8..fcd5a684c 100644 --- a/src/ui/pages/verify-email.test.tsx +++ b/src/ui/pages/verify-email.test.tsx @@ -43,8 +43,8 @@ describe("Verify email page", () => { render(); await screen.findByRole("heading", { - level: 1, - name: /Choose an Option/, + level: 2, + name: /Environments/, }); }); });