mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Redirect user to checkout URL when trying to buy dashboard seats
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Emulator Test / docker (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Test / docker (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Runs E2E API Tests with external source of truth / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Mirror main branch to main-mirror-for-wdb / lint_and_build (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Emulator Test / docker (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Test / docker (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Runs E2E API Tests with external source of truth / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Mirror main branch to main-mirror-for-wdb / lint_and_build (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
This commit is contained in:
parent
361d306b10
commit
3c9fdb46ab
@ -10,7 +10,7 @@ import { strictEmailSchema, yupObject } from "@stackframe/stack-shared/dist/sche
|
||||
import { groupBy } from "@stackframe/stack-shared/dist/utils/arrays";
|
||||
import { wait } from "@stackframe/stack-shared/dist/utils/promises";
|
||||
import { stringCompare } from "@stackframe/stack-shared/dist/utils/strings";
|
||||
import { Button, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, toast, Typography } from "@stackframe/stack-ui";
|
||||
import { Button, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Typography, toast } from "@stackframe/stack-ui";
|
||||
import { UserPlus } from "lucide-react";
|
||||
import { Suspense, useEffect, useMemo, useState } from "react";
|
||||
import * as yup from "yup";
|
||||
@ -122,10 +122,13 @@ function TeamAddUserDialog(props: {
|
||||
}) {
|
||||
const users = props.team.useUsers();
|
||||
const { quantity } = props.team.useItem("dashboard_admins");
|
||||
const router = useRouter();
|
||||
|
||||
const onSubmit = async (values: yup.InferType<typeof inviteFormSchema>) => {
|
||||
if (users.length + 1 > quantity) {
|
||||
toast({ variant: "destructive", title: "You have reached the maximum number of dashboard admins. Please upgrade your plan to add more admins." });
|
||||
alert("You have reached the maximum number of dashboard admins. Please upgrade your plan to add more admins.");
|
||||
const checkoutUrl = await props.team.createCheckoutUrl("team");
|
||||
window.open(checkoutUrl, "_blank", "noopener");
|
||||
return "prevent-close-and-prevent-reset";
|
||||
}
|
||||
await props.onSubmit(values.email);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user