only show VideoUploadModal when user subscription is active or past_due

This commit is contained in:
MarconLP 2023-04-18 10:10:45 +02:00
parent 0e7181d6cf
commit d42da7bb8c
No known key found for this signature in database
GPG key ID: A08A9C8B623F5EA5

View file

@ -31,7 +31,11 @@ const VideoList: NextPage = () => {
<div className="flex min-h-[62px] w-full items-center justify-between border-b border-solid border-b-[#E7E9EB] bg-white px-6"> <div className="flex min-h-[62px] w-full items-center justify-between border-b border-solid border-b-[#E7E9EB] bg-white px-6">
<span>Screenity</span> <span>Screenity</span>
<div className="flex flex-row items-center justify-center"> <div className="flex flex-row items-center justify-center">
<VideoUploadModal /> {["active", "past_due"].includes(
session?.user.stripeSubscriptionStatus ?? ""
) ? (
<VideoUploadModal />
) : null}
{status === "authenticated" && ( {status === "authenticated" && (
<div className="ml-4 flex items-center justify-center"> <div className="ml-4 flex items-center justify-center">
<ProfileMenu /> <ProfileMenu />
@ -40,9 +44,9 @@ const VideoList: NextPage = () => {
</div> </div>
</div> </div>
<div className="flex w-full grow items-start justify-center overflow-auto bg-[#fbfbfb] pt-14"> <div className="flex w-full grow items-start justify-center overflow-auto bg-[#fbfbfb] pt-14">
{session?.user.stripeSubscriptionStatus === null ? ( {["active", "past_due"].includes(
<Checkout /> session?.user.stripeSubscriptionStatus ?? ""
) : ( ) ? (
<div className="flex-start grid w-full max-w-[1300px] grid-cols-[repeat(auto-fill,250px)] flex-row flex-wrap items-center justify-center gap-14 px-4 pb-16"> <div className="flex-start grid w-full max-w-[1300px] grid-cols-[repeat(auto-fill,250px)] flex-row flex-wrap items-center justify-center gap-14 px-4 pb-16">
{videos && {videos &&
videos.map(({ title, id, createdAt }) => ( videos.map(({ title, id, createdAt }) => (
@ -69,6 +73,8 @@ const VideoList: NextPage = () => {
</div> </div>
) : null} ) : null}
</div> </div>
) : (
<Checkout />
)} )}
</div> </div>
</main> </main>