* added layouts for moving teams step * added admin section for org creation step * extended org creation to also move existing teams * wip * wip * wip * further changes * Add checkout for org in onboarding * Fix ts errors * Self review feedback * Self review addressed * Fix unit tests * Fix ts error * Seans feedback addressed * feat: fix correct accounts pending * fix: unit tests for new invite member permissions * tests: org admin onboarding tests for existing user * tests: Inital user self serve flow * chore: update teamAndUserFixture to create X amount of teams * chore: add testId to card actionButton * test: add test-Id to continue or checkout button * tests: add tests for migrating existing teams * feat: match new designs * fix: isAdminCheck * chore: fix pricing copy * fix: flacky tests * Fix tests? * More test fixes * Check all checkboxes * Fix type error * Fix failing test and typescript issues * Fix unpaid org allowing auto-add users * Add self-serve flag * Skip tests --------- Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: Hariom <[email protected]> Co-authored-by: sean-brydon <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: Omar López <[email protected]>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { useRouter } from "next/navigation";
|
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import type { RouterOutputs } from "@calcom/trpc/react";
|
|
import { trpc } from "@calcom/trpc/react";
|
|
import { showToast, TopBanner } from "@calcom/ui";
|
|
|
|
export type OrgUpgradeBannerProps = {
|
|
data: RouterOutputs["viewer"]["getUserTopBanners"]["orgUpgradeBanner"];
|
|
};
|
|
|
|
export function OrgUpgradeBanner({ data }: OrgUpgradeBannerProps) {
|
|
const { t } = useLocale();
|
|
const router = useRouter();
|
|
const publishOrgMutation = trpc.viewer.organizations.publish.useMutation({
|
|
onSuccess(data) {
|
|
router.push(data.url);
|
|
},
|
|
onError: (error) => {
|
|
showToast(error.message, "error");
|
|
},
|
|
});
|
|
|
|
if (!data) return null;
|
|
const [membership] = data;
|
|
if (!membership) return null;
|
|
|
|
return (
|
|
<TopBanner
|
|
text={t("org_upgrade_banner_description", { teamName: membership.team.name })}
|
|
variant="warning"
|
|
actions={
|
|
<button
|
|
data-testid="upgrade_org_banner_button"
|
|
className="border-b border-b-black"
|
|
onClick={() => {
|
|
publishOrgMutation.mutate();
|
|
}}>
|
|
{t("upgrade_banner_action")}
|
|
</button>
|
|
}
|
|
/>
|
|
);
|
|
}
|