Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove refs to old plan types #676

Merged
merged 8 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
47 changes: 36 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
# Welcome to Pocket Portal!

### Run with Remix
<div align="center">
<h1>Grove Portal UI</h1>
<img src="https://storage.googleapis.com/grove-brand-assets/Presskit/Logo%20Joined-2.png" alt="Grove logo" width="500"/>
</div>
<br/>

# Table of Contents <!-- omit in toc -->

- [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. **Test in Staging**

### 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).
- eg. https://github.com/pokt-foundation/grove-portal/pull/660

Merge PR into "stage" branch and vercel will build to staging environment
3. **Deploy to PROD**

### PROD
- 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

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

Expand All @@ -26,7 +49,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

Expand All @@ -43,7 +68,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!
Expand Down
37 changes: 1 addition & 36 deletions app/components/AccountPlan/AccountPlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<List center icon={<LuCheck size="18px" />} size="sm" spacing="xl">
<List.Item>100,000 relays free per day</List.Item>
<List.Item>Auto-Scale at $7.456 / additional million</List.Item>
<List.Item>No throughput limit</List.Item>
<List.Item>Direct Customer support</List.Item>
<List.Item>Access all supported chains</List.Item>
<List.Item>Global region support</List.Item>
<List.Item>ETH Trace supported</List.Item>
</List>
)
}

const EnterpriseList = () => {
return (
<List center icon={<LuCheck size="18px" />} size="sm" spacing="xl">
<List.Item>Custom relays per day</List.Item>
<List.Item>Custom volume plans</List.Item>
<List.Item>No throughput limit</List.Item>
<List.Item>Direct Customer support</List.Item>
<List.Item>Access all supported chains</List.Item>
<List.Item>Global region support</List.Item>
<List.Item>ETH Trace supported</List.Item>
</List>
)
}
*/
const UnlimitedList = () => {
return (
<List center icon={<LuCheck size="18px" />} size="sm" spacing="xl">
Expand Down
2 changes: 1 addition & 1 deletion app/models/portal/portal.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion app/models/portal/queries.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ query getUserAccount(
id
name
planType
enterpriseLimit
monthlyUserLimit
notifications {
notificationType
Expand Down

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion app/routes/account.$accountId.settings.plan/route.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<RootProviders>
Expand Down
2 changes: 1 addition & 1 deletion app/routes/account.$accountId.settings/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function AccountSettingsLayoutView({
label: "Plan",
},
],
...(account.planType === PayPlanType.FreetierV0
...(account.planType === PayPlanType.PlanFree
? [
{
to: "notifications",
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/routes/account_.$accountId.create/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
)
Expand Down
22 changes: 0 additions & 22 deletions app/utils/planUtils.ts
Original file line number Diff line number Diff line change
@@ -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
}
Expand All @@ -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"
}
Expand Down
Loading