Only show alert to upgrade when applicable and fix button (#661)

Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
pull/663/head
Alex van Andel 2021-09-15 21:36:55 +01:00 committed by GitHub
parent cf7f5ae53c
commit 113d18d84e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -274,7 +274,7 @@ const EventTypesPage = (props: PageProps) => {
<CreateNewEventDialog canAddEvents={props.canAddEvents} profiles={props.profiles} />
)
}>
{props.user.plan === "FREE" && typeof window !== "undefined" && (
{props.user.plan === "FREE" && !props.canAddEvents && typeof window !== "undefined" && (
<Alert
severity="warning"
title={<>You need to upgrade your plan to have more than one active event type.</>}
@ -720,7 +720,7 @@ export async function getServerSideProps(context) {
createdDate: user.createdDate.toString(),
});
const canAddEvents = user.plan !== "FREE" || eventTypes.length < 1;
const canAddEvents = user.plan !== "FREE" || eventTypes[0].eventTypes.length < 1;
return {
props: {