Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
chore: improve pro check (#990)
Ameer Al Ashhabce505f29030e
diff --git a/apps/web/app/s/[videoId]/Share.tsx b/apps/web/app/s/[videoId]/Share.tsxindex 9f9d2b3a5..e554d3fc6 100644--- a/apps/web/app/s/[videoId]/Share.tsx+++ b/apps/web/app/s/[videoId]/Share.tsx@@ -43,10 +43,7 @@ type VideoWithOrganizationInfo = typeof videos.$inferSelect & {organizationId?: string;sharedOrganizations?: { id: string; name: string }[];hasPassword?: boolean;- owner?: {- stripeSubscriptionStatus: string | null;- thirdPartyStripeSubscriptionId: string | null;- } | null;+ ownerIsPro?: boolean;};interface ShareProps {diff --git a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx b/apps/web/app/s/[videoId]/_components/ShareVideo.tsxindex 01bc8c996..855604ce0 100644--- a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx+++ b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx@@ -2,7 +2,6 @@ import type { userSelectProps } from "@cap/database/auth/session";import type { comments as commentsSchema, videos } from "@cap/database/schema";import { NODE_ENV } from "@cap/env";import { Logo } from "@cap/ui";-import { userIsPro } from "@cap/utils";import { useTranscript } from "hooks/use-transcript";import {forwardRef,@@ -36,10 +35,7 @@ export const ShareVideo = forwardRef<HTMLVideoElement,{data: typeof videos.$inferSelect & {- owner?: {- stripeSubscriptionStatus: string | null;- thirdPartyStripeSubscriptionId: string | null;- } | null;+ ownerIsPro?: boolean;};user: typeof userSelectProps | null;comments: MaybePromise<CommentWithAuthor[]>;@@ -55,8 +51,6 @@ export const ShareVideo = forwardRef<const [subtitleUrl, setSubtitleUrl] = useState<string | null>(null);const [chaptersUrl, setChaptersUrl] = useState<string | null>(null);- const isVideoOwnerPro = userIsPro(data.owner);-const { data: transcriptContent, error: transcriptError } = useTranscript(data.id,data.transcriptionStatus,@@ -174,7 +168,7 @@ export const ShareVideo = forwardRef<)}</div>- {!isVideoOwnerPro && (+ {!data.ownerIsPro && (<div className="absolute top-4 left-4 z-30"><divclassName="block cursor-pointer"diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsxindex fb9be8727..ea17bfc12 100644--- a/apps/web/app/s/[videoId]/page.tsx+++ b/apps/web/app/s/[videoId]/page.tsx@@ -108,10 +108,7 @@ type VideoWithOrganization = typeof videos.$inferSelect & {sharedOrganizations?: { id: string; name: string }[];password?: string | null;hasPassword?: boolean;- owner?: {- stripeSubscriptionStatus: string | null;- thirdPartyStripeSubscriptionId: string | null;- } | null;+ ownerIsPro?: boolean;};const ALLOWED_REFERRERS = [@@ -292,11 +289,7 @@ export default async function ShareVideoPage(props: Props) {sharedOrganization: {organizationId: sharedVideos.organizationId,},- owner: {- stripeSubscriptionStatus: users.stripeSubscriptionStatus,- thirdPartyStripeSubscriptionId:- users.thirdPartyStripeSubscriptionId,- },+ ownerIsPro: sql<number>`IF(${users.stripeSubscriptionStatus} IN ('active','trialing','complete','paid') OR ${users.thirdPartyStripeSubscriptionId} IS NOT NULL, 1, 0)`,}).from(videos).leftJoin(sharedVideos, eq(videos.id, sharedVideos.videoId))@@ -350,10 +343,7 @@ async function AuthorizedContent({video: Omit<InferSelectModel<typeof videos>, "folderId" | "password"> & {sharedOrganization: { organizationId: string } | null;hasPassword: number;- owner: {- stripeSubscriptionStatus: string | null;- thirdPartyStripeSubscriptionId: string | null;- } | null;+ ownerIsPro?: number;};searchParams: { [key: string]: string | string[] | undefined };}) {@@ -451,10 +441,7 @@ async function AuthorizedContent({id: videos.id,name: videos.name,ownerId: videos.ownerId,- owner: {- stripeSubscriptionStatus: users.stripeSubscriptionStatus,- thirdPartyStripeSubscriptionId: users.thirdPartyStripeSubscriptionId,- },+ ownerIsPro: sql<number>`IF(${users.stripeSubscriptionStatus} IN ('active','trialing','complete','paid') OR ${users.thirdPartyStripeSubscriptionId} IS NOT NULL, 1, 0)`,createdAt: videos.createdAt,updatedAt: videos.updatedAt,awsRegion: videos.awsRegion,@@ -665,7 +652,8 @@ async function AuthorizedContent({const videoWithOrganizationInfo: VideoWithOrganization = {...video,- hasPassword: video.hasPassword === 1,+ hasPassword: Number(video.hasPassword) === 1,+ ownerIsPro: Number(video.ownerIsPro) === 1,organizationMembers: membersList.map((member) => member.userId),organizationId: video.sharedOrganization?.organizationId ?? undefined,sharedOrganizations: sharedOrganizations,