From 4371fc7afaca35fdb6c93bba050de2d5d971d312 Mon Sep 17 00:00:00 2001 From: Piyush Kumar Date: Thu, 27 Jun 2024 12:55:56 +0530 Subject: [PATCH] - remove invite code screen from console - update devdoc documentation --- web/gql-queries-generator/doc/queries.graphql | 4 - web/lib/server/helpers/minimal-auth.ts | 4 - web/package.json | 2 +- web/pnpm-lock.yaml | 8 +- .../$environment+/new-app/app-network.tsx | 2 + web/src/apps/console/routes/_main+/_index.tsx | 8 +- web/src/apps/console/routes/invite-code.tsx | 91 ------------------- .../server/gql/queries/access-queries.ts | 15 --- web/src/generated/gql/server.ts | 8 -- 9 files changed, 8 insertions(+), 134 deletions(-) delete mode 100644 web/src/apps/console/routes/invite-code.tsx diff --git a/web/gql-queries-generator/doc/queries.graphql b/web/gql-queries-generator/doc/queries.graphql index 9b50b9d25..f8b32d672 100644 --- a/web/gql-queries-generator/doc/queries.graphql +++ b/web/gql-queries-generator/doc/queries.graphql @@ -1924,10 +1924,6 @@ mutation consoleDeleteAccountMembership($accountName: String!, $memberId: ID!) { accounts_removeAccountMembership(accountName: $accountName, memberId: $memberId) } -mutation consoleVerifyInviteCode($invitationCode: String!) { - auth_verifyInviteCode(invitationCode: $invitationCode) -} - query consoleGetCredToken($username: String!) { cr_getCredToken(username: $username) } diff --git a/web/lib/server/helpers/minimal-auth.ts b/web/lib/server/helpers/minimal-auth.ts index 7809357a5..1cc2993e9 100644 --- a/web/lib/server/helpers/minimal-auth.ts +++ b/web/lib/server/helpers/minimal-auth.ts @@ -53,10 +53,6 @@ export const minimalAuth = async (ctx: IExtRemixCtx) => { return redirect(`${authBaseUrl}/verify-email`); } - if (whoAmI.data && !whoAmI.data.approved) { - return redirect(`${consoleBaseUrl}/invite-code`); - } - ctx.authProps = (props: MapType) => { return { ...props, diff --git a/web/package.json b/web/package.json index 027606336..619a19c82 100644 --- a/web/package.json +++ b/web/package.json @@ -26,7 +26,7 @@ "@jengaicons/react": "1.6.0", "@mdx-js/react": "^2.3.0", "@monaco-editor/react": "^4.6.0", - "@oshq/react-select": "^1.4.2", + "@oshq/react-select": "^1.4.4", "@radix-ui/primitive": "^1.0.1", "@radix-ui/react-alert-dialog": "1.0.4", "@radix-ui/react-checkbox": "^1.0.4", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 275a7d09f..ba52b6d77 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -15,8 +15,8 @@ dependencies: specifier: ^4.6.0 version: 4.6.0(monaco-editor@0.49.0)(react-dom@18.3.1)(react@18.2.0) '@oshq/react-select': - specifier: ^1.4.2 - version: 1.4.2(@radix-ui/react-portal@1.0.4)(classnames@2.5.1)(framer-motion@11.2.9)(rc-virtual-list@3.14.2)(react@18.2.0) + specifier: ^1.4.4 + version: 1.4.4(@radix-ui/react-portal@1.0.4)(classnames@2.5.1)(framer-motion@11.2.9)(rc-virtual-list@3.14.2)(react@18.2.0) '@radix-ui/primitive': specifier: ^1.0.1 version: 1.0.1 @@ -2554,8 +2554,8 @@ packages: json-parse-even-better-errors: 2.3.1 dev: true - /@oshq/react-select@1.4.2(@radix-ui/react-portal@1.0.4)(classnames@2.5.1)(framer-motion@11.2.9)(rc-virtual-list@3.14.2)(react@18.2.0): - resolution: {integrity: sha512-yQwzBxFb5z2XwmuEZHLdJGmpzn1+Xo+zn5u/DV1FzvUKlRUWXo/ChQ73ZG62uN/mODTEJhsUW8SbPiP93G89iw==} + /@oshq/react-select@1.4.4(@radix-ui/react-portal@1.0.4)(classnames@2.5.1)(framer-motion@11.2.9)(rc-virtual-list@3.14.2)(react@18.2.0): + resolution: {integrity: sha512-jfMSnookesY0ge/q1amjpj16cmG09MU6YAjfHlpJ3GDxB5vjo/60I+cv9pWzTUcKNlZd1tuRZd9zKjggALz3IA==} peerDependencies: '@radix-ui/react-portal': ^1.0.4 classnames: ^2.3.2 diff --git a/web/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-network.tsx b/web/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-network.tsx index 207dd460f..e97badfb4 100644 --- a/web/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-network.tsx +++ b/web/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-network.tsx @@ -162,6 +162,7 @@ const ExposedRoute = () => { // error={!!portError} // message={portError} disableWhileLoading + createLabel="Exposed Domains" /> ); @@ -219,6 +220,7 @@ export const ExposedPorts = () => { error={!!portError} message={portError} disableWhileLoading + createLabel="Exposed ports" /> diff --git a/web/src/apps/console/routes/_main+/_index.tsx b/web/src/apps/console/routes/_main+/_index.tsx index da4852812..7c104e7ff 100644 --- a/web/src/apps/console/routes/_main+/_index.tsx +++ b/web/src/apps/console/routes/_main+/_index.tsx @@ -1,11 +1,5 @@ import { redirect } from '@remix-run/node'; -import { GQLServerHandler } from '~/root/lib/server/gql/saved-queries'; -import { IRemixCtx } from '~/root/lib/types/common'; -export const loader = async (ctx: IRemixCtx) => { - const { data } = await GQLServerHandler(ctx.request).whoAmI(); - if (data && !data.approved) { - return redirect(`/invite-code`); - } +export const loader = async () => { return redirect('/teams'); }; diff --git a/web/src/apps/console/routes/invite-code.tsx b/web/src/apps/console/routes/invite-code.tsx deleted file mode 100644 index fdf1aaf1d..000000000 --- a/web/src/apps/console/routes/invite-code.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { redirect } from '@remix-run/node'; -import { useNavigate } from '@remix-run/react'; -import { BrandLogo } from '~/components/branding/brand-logo'; -import { toast } from '~/components/molecule/toast'; -import { useConsoleApi } from '~/console/server/gql/api-provider'; -import useForm from '~/root/lib/client/hooks/use-form'; -import Yup from '~/root/lib/server/helpers/yup'; -import { IRemixCtx } from '~/root/lib/types/common'; -import { GQLServerHandler } from '~/lib/server/gql/saved-queries'; -import { Badge } from '~/components/atoms/badge'; -import TextInputLg from '~/console/components/text-input-lg'; - -const InviteCode = () => { - const api = useConsoleApi(); - const navigate = useNavigate(); - - const { values, handleChange, submit, handleSubmit } = useForm({ - initialValues: { - inviteCode: '', - }, - validationSchema: Yup.object({ - inviteCode: Yup.string().required('invite code is required'), - }), - onSubmit: async (v) => { - try { - const { errors } = await api.verifyInviteCode({ - invitationCode: v.inviteCode, - }); - if (errors) { - throw new Error(errors[0].message); - } - toast.success('Invitation code verification successful.'); - navigate('/teams'); - } catch (err) { - const errorMessage = - err instanceof Error - ? err.message - : 'An error occurred. Please try again.'; - toast.error(errorMessage); - } - }, - }); - - return ( -
- - - 🔥 Amazing curated{' '} - Open-Source{' '} - remote local envs - - - Unlock early access now! - - - Dont miss the chance to try our product. Enter your referral code now to - move up the waitlist and secure early access! - -
-
- -
-
-
- ); -}; - -export const loader = async (ctx: IRemixCtx) => { - const { data, errors } = await GQLServerHandler(ctx.request).whoAmI(); - - if (!data || errors) { - return redirect('/'); - } - - const { approved } = data || {}; - - if (approved) { - return redirect('/teams'); - } - - return {}; -}; - -export default InviteCode; diff --git a/web/src/apps/console/server/gql/queries/access-queries.ts b/web/src/apps/console/server/gql/queries/access-queries.ts index a92b83a1e..8256426dc 100644 --- a/web/src/apps/console/server/gql/queries/access-queries.ts +++ b/web/src/apps/console/server/gql/queries/access-queries.ts @@ -20,8 +20,6 @@ import { ConsoleRejectInvitationMutationVariables, ConsoleDeleteAccountMembershipMutation, ConsoleDeleteAccountMembershipMutationVariables, - ConsoleVerifyInviteCodeMutation, - ConsoleVerifyInviteCodeMutationVariables, } from '~/root/src/generated/gql/server'; export type IInvites = NN< @@ -210,17 +208,4 @@ export const accessQueries = (executor: IExecutor) => ({ vars(_: ConsoleDeleteAccountMembershipMutationVariables) {}, } ), - - verifyInviteCode: executor( - gql` - mutation Auth_verifyInviteCode($invitationCode: String!) { - auth_verifyInviteCode(invitationCode: $invitationCode) - } - `, - { - transformer: (data: ConsoleVerifyInviteCodeMutation) => - data.auth_verifyInviteCode, - vars(_: ConsoleVerifyInviteCodeMutationVariables) {}, - } - ), }); diff --git a/web/src/generated/gql/server.ts b/web/src/generated/gql/server.ts index cb06f54fe..7be9e999a 100644 --- a/web/src/generated/gql/server.ts +++ b/web/src/generated/gql/server.ts @@ -3633,14 +3633,6 @@ export type ConsoleDeleteAccountMembershipMutation = { accounts_removeAccountMembership: boolean; }; -export type ConsoleVerifyInviteCodeMutationVariables = Exact<{ - invitationCode: Scalars['String']['input']; -}>; - -export type ConsoleVerifyInviteCodeMutation = { - auth_verifyInviteCode: boolean; -}; - export type ConsoleGetCredTokenQueryVariables = Exact<{ username: Scalars['String']['input']; }>;