From ca627538fd011bef6df316f0fba781ebe61fff87 Mon Sep 17 00:00:00 2001 From: Pascal van Leeuwen Date: Thu, 12 Sep 2024 17:04:18 +0100 Subject: [PATCH 1/6] fix: remove references to old plans --- .github/workflows/validate.yml | 4 - app/components/AccountPlan/AccountPlan.tsx | 37 +----- app/models/portal/portal.data.ts | 2 +- app/models/portal/queries.graphqls | 1 - .../AutoScalePlanOverviewCard.tsx | 106 ------------------ .../AutoScalePlanOverviewCard/index.ts | 3 - .../route.test.tsx | 2 +- .../account.$accountId.settings/view.tsx | 2 +- app/utils/planUtils.ts | 22 ---- 9 files changed, 4 insertions(+), 175 deletions(-) delete mode 100644 app/routes/account.$accountId.settings.plan/components/AutoScalePlanOverviewCard/AutoScalePlanOverviewCard.tsx delete mode 100644 app/routes/account.$accountId.settings.plan/components/AutoScalePlanOverviewCard/index.ts diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index bf6b7c205..90add29c9 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -63,7 +63,3 @@ jobs: - name: ⚡ Run vitest run: pnpm run test:unit:run - - - name: "Post test coverage" - if: always() # Also generate the report if tests are failing - uses: davelosert/vitest-coverage-report-action@v1 diff --git a/app/components/AccountPlan/AccountPlan.tsx b/app/components/AccountPlan/AccountPlan.tsx index 6efcc088a..0186e3de4 100644 --- a/app/components/AccountPlan/AccountPlan.tsx +++ b/app/components/AccountPlan/AccountPlan.tsx @@ -12,46 +12,11 @@ import { import { LuCheck } from "react-icons/lu" import { PayPlanType } from "~/models/portal/sdk" -// TODO_TECHDEBT: Remove all references to PayAsYouGoV0 and FreetierV0` after its live type AccountPlanProps = { - type: - | PayPlanType.PayAsYouGoV0 - | PayPlanType.FreetierV0 - | PayPlanType.Enterprise - | PayPlanType.PlanUnlimited - | PayPlanType.PlanFree + type: PayPlanType.Enterprise | PayPlanType.PlanUnlimited | PayPlanType.PlanFree onContinue?: () => void disableFree?: boolean } -/* -const AutoScaleList = () => { - return ( - } size="sm" spacing="xl"> - 100,000 relays free per day - Auto-Scale at $7.456 / additional million - No throughput limit - Direct Customer support - Access all supported chains - Global region support - ETH Trace supported - - ) -} - -const EnterpriseList = () => { - return ( - } size="sm" spacing="xl"> - Custom relays per day - Custom volume plans - No throughput limit - Direct Customer support - Access all supported chains - Global region support - ETH Trace supported - - ) -} -*/ const UnlimitedList = () => { return ( } size="sm" spacing="xl"> diff --git a/app/models/portal/portal.data.ts b/app/models/portal/portal.data.ts index d72dc83d6..4b5a12d2e 100644 --- a/app/models/portal/portal.data.ts +++ b/app/models/portal/portal.data.ts @@ -57,7 +57,7 @@ export const app: PortalApp = { firstDateSurpassed: "0001-01-01T00:00:00Z", legacyFields: { // @ts-ignore - planType: "FREETIER_V0", + planType: "PLAN_FREE", dailyLimit: 250000, customLimit: 0, requestTimeout: 2000, diff --git a/app/models/portal/queries.graphqls b/app/models/portal/queries.graphqls index 216f8e52a..e2cbfc6cb 100644 --- a/app/models/portal/queries.graphqls +++ b/app/models/portal/queries.graphqls @@ -49,7 +49,6 @@ query getUserAccount( id name planType - enterpriseLimit monthlyUserLimit notifications { notificationType diff --git a/app/routes/account.$accountId.settings.plan/components/AutoScalePlanOverviewCard/AutoScalePlanOverviewCard.tsx b/app/routes/account.$accountId.settings.plan/components/AutoScalePlanOverviewCard/AutoScalePlanOverviewCard.tsx deleted file mode 100644 index bbcb5d6b0..000000000 --- a/app/routes/account.$accountId.settings.plan/components/AutoScalePlanOverviewCard/AutoScalePlanOverviewCard.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import { Divider, Button, Group, Text, Stack, Box, Grid, SimpleGrid } from "@mantine/core" -import { Form, useLocation } from "@remix-run/react" -import React from "react" -import { LuArrowUpRight, LuStopCircle } from "react-icons/lu" -import { TitledCard } from "~/components/TitledCard" -import { Account, RoleName } from "~/models/portal/sdk" -import { Stripe } from "~/models/stripe/stripe.server" -import useSubscriptionModals from "~/routes/account.$accountId.settings.plan/hooks/useSubscriptionModals" -import { AnalyticActions, AnalyticCategories, trackEvent } from "~/utils/analytics" -import { formatTimestampShort } from "~/utils/dayjs" -import { getPlanName } from "~/utils/planUtils" -import { capitalizeFirstLetter } from "~/utils/utils" - -interface AutoScalePlanOverviewCardProps { - account: Account - userRole: RoleName - subscription?: Stripe.Subscription -} - -export default function AutoScalePlanOverviewCard({ - account, - userRole, - subscription, -}: AutoScalePlanOverviewCardProps) { - const location = useLocation() - const { openStopSubscriptionModal } = useSubscriptionModals() - - const accountPlanType = account.planType - - return ( - Current plan}> - - - - - Plan Type {getPlanName(accountPlanType)} - - - {subscription && ( - <> - - Subscription {subscription.id} - - - - Start date - {formatTimestampShort(subscription.start_date)} - - - - )} - - - - - Your role {capitalizeFirstLetter(userRole)} - - - - Free Daily Relays 100,000 - - - - - - {userRole !== "MEMBER" && ( - -
- - - - - - - - - -
-
- )} -
-
- ) -} diff --git a/app/routes/account.$accountId.settings.plan/components/AutoScalePlanOverviewCard/index.ts b/app/routes/account.$accountId.settings.plan/components/AutoScalePlanOverviewCard/index.ts deleted file mode 100644 index 0d2984a0e..000000000 --- a/app/routes/account.$accountId.settings.plan/components/AutoScalePlanOverviewCard/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import AutoScalePlanOverviewCard from "./AutoScalePlanOverviewCard" -export * from "./AutoScalePlanOverviewCard" -export default AutoScalePlanOverviewCard diff --git a/app/routes/account.$accountId.settings.plan/route.test.tsx b/app/routes/account.$accountId.settings.plan/route.test.tsx index 622a73795..359689720 100644 --- a/app/routes/account.$accountId.settings.plan/route.test.tsx +++ b/app/routes/account.$accountId.settings.plan/route.test.tsx @@ -18,7 +18,7 @@ const accountAppsRelaysData: AccountAppRelays = { } describe("account/$accountId/settings/plan", () => { - it("renders upgrade screen for freetier plan", async () => { + it("renders upgrade screen for free plan", async () => { function SettingsOutLetContext() { return ( diff --git a/app/routes/account.$accountId.settings/view.tsx b/app/routes/account.$accountId.settings/view.tsx index c37c54357..4f9fa94f2 100644 --- a/app/routes/account.$accountId.settings/view.tsx +++ b/app/routes/account.$accountId.settings/view.tsx @@ -29,7 +29,7 @@ export default function AccountSettingsLayoutView({ label: "Plan", }, ], - ...(account.planType === PayPlanType.FreetierV0 + ...(account.planType === PayPlanType.PlanFree ? [ { to: "notifications", diff --git a/app/utils/planUtils.ts b/app/utils/planUtils.ts index a5b0922db..7eb8e147f 100644 --- a/app/utils/planUtils.ts +++ b/app/utils/planUtils.ts @@ -1,14 +1,6 @@ import { PayPlanType } from "~/models/portal/sdk" export const FREE_TIER_MAX_RELAYS = 100_000 -export function isFreePlan(planType: PayPlanType) { - return planType === PayPlanType.FreetierV0 -} - -export function isPaidPlan(planType: PayPlanType) { - return planType === PayPlanType.PayAsYouGoV0 -} - export function isEnterprisePlan(planType: PayPlanType) { return planType === PayPlanType.Enterprise } @@ -21,22 +13,8 @@ export function isFree(planType: PayPlanType) { return planType === PayPlanType.PlanFree } -export function isLegacyPlan(planType: PayPlanType) { - return ( - planType === PayPlanType.PayAsYouGoV0 || - planType === PayPlanType.FreetierV0 || - planType === PayPlanType.Enterprise - ) -} - export const getPlanName = (planType: PayPlanType) => { switch (planType) { - case PayPlanType.FreetierV0: { - return "Starter" - } - case PayPlanType.PayAsYouGoV0: { - return "Auto-Scale" - } case PayPlanType.Enterprise: { return "Enterprise" } From de49573c13cfa0142df199dc34c5f0ce72132427 Mon Sep 17 00:00:00 2001 From: Pascal van Leeuwen Date: Thu, 12 Sep 2024 17:14:54 +0100 Subject: [PATCH 2/6] chore: update README.md --- README.md | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3e8701081..636d0c305 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,41 @@ -# Welcome to Pocket Portal! - -### Run with Remix +
+

Grove Portal UI

+Grove logo +
+
+ +# Table of Contents + +- [Run with **Remix**](#run-with-remix) +- [Deployment](#deployment) +- [Development](#development) + - [Env](#env) + - [Node Version](#node-version) + - [Frontend](#frontend) + - [Stripe Webhook Forwarding](#stripe-webhook-forwarding) + - [Environment Variables](#environment-variables) + - [Backend](#backend) + +## Run with **Remix** - [Remix Docs](https://remix.run/docs) ## Deployment -### PR / DEV +1. **Test Locally** + + - Test your changes locally before creating a PR. -Create PR and vercel will create a preview build based on the PR +2. **PR / STAGE** -### STAGE + - Create a PR into the "staging" branch. Continuous Deployment (CD) will automatically deploy to [https://staging.portal.grove.city](https://staging.portal.grove.city). -Merge PR into "stage" branch and vercel will build to staging environment +3. **PROD** -### PROD + - Create a PR from "staging" into "main". CD will automatically deploy to [https://portal.grove.city/](https://portal.grove.city). -Merge PR from "stage" to "main" and vercel will build to prod environment +4. **Test in Main** + - Test your changes in the main environment to ensure everything is working as expected. ## Development @@ -26,7 +45,9 @@ Make sure to get the `.env` from [1password](https://start.1password.com/open/i? ### Node Version -Ensure you're using node 18 (not 22). +--- + +**Ensure you're using Node v18 (not 22).** ### Frontend @@ -43,7 +64,7 @@ pnpm build Afterwards, start the Remix development server like so: ```sh -pnpm run dev +pnpm dev ``` Open up [http://localhost:3000](http://localhost:3000) and you should be ready to go! From 9ed111d7654a0801bac8bfce7e2a0069f80c6198 Mon Sep 17 00:00:00 2001 From: Pascal van Leeuwen Date: Thu, 12 Sep 2024 17:18:58 +0100 Subject: [PATCH 3/6] fix: redirect to stripe on new portal app creation for unlimited plan --- .../AccountPlansContainer/AccountPlansContainer.tsx | 4 ++-- app/routes/account_.$accountId.create/route.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/routes/account_.$accountId.create/components/AccountPlansContainer/AccountPlansContainer.tsx b/app/routes/account_.$accountId.create/components/AccountPlansContainer/AccountPlansContainer.tsx index c68d284b7..60dfc1ab7 100644 --- a/app/routes/account_.$accountId.create/components/AccountPlansContainer/AccountPlansContainer.tsx +++ b/app/routes/account_.$accountId.create/components/AccountPlansContainer/AccountPlansContainer.tsx @@ -1,9 +1,9 @@ import { Box, Center, Flex, Text } from "@mantine/core" +import { useParams } from "@remix-run/react" import { AccountPlan } from "~/components/AccountPlan" -import { PayPlanType } from "~/models/portal/sdk" import RouteModal from "~/components/RouteModal" -import { useParams } from "@remix-run/react" +import { PayPlanType } from "~/models/portal/sdk" type AccountPlansContainerProps = { onPlanSelected: (plan: PayPlanType.PlanFree | PayPlanType.PlanUnlimited) => void diff --git a/app/routes/account_.$accountId.create/route.tsx b/app/routes/account_.$accountId.create/route.tsx index ed651f630..7daf8fdea 100644 --- a/app/routes/account_.$accountId.create/route.tsx +++ b/app/routes/account_.$accountId.create/route.tsx @@ -146,7 +146,7 @@ export const action: ActionFunction = async ({ request, params }) => { subscription && typeof subscription === "string", "account subscription not found", ) - if (subscription === PayPlanType.PayAsYouGoV0) { + if (subscription === PayPlanType.PlanUnlimited) { return redirect( `/api/stripe/checkout-session?account-id=${accountId}&app-id=${newApp.id}&referral-id=${referral}`, ) From d7e2d71d8dfd4ebe7132a5fac72924d232ee172c Mon Sep 17 00:00:00 2001 From: Pascal van Leeuwen <47662958+commoddity@users.noreply.github.com> Date: Fri, 13 Sep 2024 07:34:21 +0100 Subject: [PATCH 4/6] Apply suggestions from code review Applied suggestions but unclear what the example links should point to. Co-authored-by: Daniel Olshansky --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 636d0c305..1643c414b 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,18 @@ - Test your changes locally before creating a PR. -2. **PR / STAGE** +2. **Test in Staging** - - Create a PR into the "staging" branch. Continuous Deployment (CD) will automatically deploy to [https://staging.portal.grove.city](https://staging.portal.grove.city). + - Create a PR into the `stage` branch. + - Continuous Deployment (CD) will automatically deploy it to [staging.portal.grove.city](https://staging.portal.grove.city) after it is merged. + - E.g. -3. **PROD** +3. **Deploy to PROD** - - Create a PR from "staging" into "main". CD will automatically deploy to [https://portal.grove.city/](https://portal.grove.city). + - Create a PR from the `stage` branch into the `main` branch + - CD will automatically deploy to [portal.grove.city](https://portal.grove.city). + - E.g. + 4. **Test in Main** - Test your changes in the main environment to ensure everything is working as expected. From 85ede9b0602353ba75d7c076d5902f2db5cb8668 Mon Sep 17 00:00:00 2001 From: Pascal van Leeuwen Date: Tue, 17 Sep 2024 16:27:13 +0100 Subject: [PATCH 5/6] chore: update readme.md --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 636d0c305..f1fa66080 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,16 @@ 2. **PR / STAGE** - - Create a PR into the "staging" branch. Continuous Deployment (CD) will automatically deploy to [https://staging.portal.grove.city](https://staging.portal.grove.city). + - Create a PR into the "staging" branch. + - Continuous Deployment (CD) will automatically deploy to [https://staging.portal.grove.city](https://staging.portal.grove.city). + - eg. https://github.com/pokt-foundation/grove-portal/pull/660 3. **PROD** - - Create a PR from "staging" into "main". CD will automatically deploy to [https://portal.grove.city/](https://portal.grove.city). - + - Create a PR from "staging" into "main". + - CD will automatically deploy to [https://portal.grove.city/](https://portal.grove.city). + - eg. https://github.com/pokt-foundation/grove-portal/pull/662 + 4. **Test in Main** - Test your changes in the main environment to ensure everything is working as expected. From eeb5f403d7ee9b7a01842a4be269d6dd2e0e56cf Mon Sep 17 00:00:00 2001 From: Pascal van Leeuwen Date: Tue, 17 Sep 2024 16:31:46 +0100 Subject: [PATCH 6/6] chore: update readme.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f1fa66080..af0edbb72 100644 --- a/README.md +++ b/README.md @@ -28,16 +28,16 @@ 2. **PR / STAGE** - - Create a PR into the "staging" branch. + - Create a PR into the "staging" branch. - Continuous Deployment (CD) will automatically deploy to [https://staging.portal.grove.city](https://staging.portal.grove.city). - eg. https://github.com/pokt-foundation/grove-portal/pull/660 3. **PROD** - - Create a PR from "staging" into "main". + - Create a PR from "staging" into "main". - CD will automatically deploy to [https://portal.grove.city/](https://portal.grove.city). - eg. https://github.com/pokt-foundation/grove-portal/pull/662 - + 4. **Test in Main** - Test your changes in the main environment to ensure everything is working as expected.