Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
web: fix video owner pro check (#1241)
Ameer Al Ashhabd23ce3b33fdd
diff --git a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx b/apps/web/app/s/[videoId]/_components/ShareHeader.tsxindex 87e0675f5..4840992e9 100644--- a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx+++ b/apps/web/app/s/[videoId]/_components/ShareHeader.tsx@@ -129,9 +129,7 @@ export const ShareHeader = ({}};- const isUserPro = userIsPro(user);- const showUpgradeBanner =- user && data.ownerId === user.id && !userIsPro(user);+ const isVideoOwnerPro = user && data.ownerId === user.id && userIsPro(user);const handleSharingUpdated = () => {refresh();@@ -183,7 +181,7 @@ export const ShareHeader = ({return (<>- {showUpgradeBanner && (+ {user !== null && !isVideoOwnerPro && (<div className="flex sticky flex-col sm:flex-row inset-x-0 top-0 z-10 gap-4 justify-center items-center px-3 py-2 mx-auto w-[calc(100%-20px)] max-w-fit rounded-b-xl border bg-gray-4 border-gray-6"><p className="text-center text-gray-12">Shareable links are limited to 5 mins on the free plan.@@ -282,7 +280,7 @@ export const ShareHeader = ({)}</Button></div>- {user !== null && !isUserPro && (+ {!isVideoOwnerPro && (<buttontype="button"className="flex items-center mt-2 mb-3 text-sm text-gray-400 duration-200 cursor-pointer hover:text-blue-500"diff --git a/apps/web/app/s/[videoId]/_components/Sidebar.tsx b/apps/web/app/s/[videoId]/_components/Sidebar.tsxindex ab4eb2472..09ebaa1d2 100644--- a/apps/web/app/s/[videoId]/_components/Sidebar.tsx+++ b/apps/web/app/s/[videoId]/_components/Sidebar.tsx@@ -1,6 +1,6 @@import type { userSelectProps } from "@cap/database/auth/session";import type { comments as commentsSchema, videos } from "@cap/database/schema";-import { classNames } from "@cap/utils";+import { classNames, userIsPro } from "@cap/utils";import type { Video } from "@cap/web-domain";import clsx from "clsx";import { AnimatePresence, motion } from "framer-motion";@@ -141,6 +141,8 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(setActiveTab(tabId);};+ const isVideoOwnerPro = user && data.ownerId === user.id && userIsPro(user);+const renderTabContent = () => {switch (activeTab) {case "activity":@@ -181,7 +183,7 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(isSummaryDisabled={videoSettings?.disableSummary}initialAiData={aiData || undefined}aiGenerationEnabled={aiGenerationEnabled}- user={user}+ isVideoOwnerPro={isVideoOwnerPro}/>);case "transcript":diff --git a/apps/web/app/s/[videoId]/_components/tabs/Summary.tsx b/apps/web/app/s/[videoId]/_components/tabs/Summary.tsxindex 8dc2bc6ec..80aa3cdc8 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Summary.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Summary.tsx@@ -1,8 +1,7 @@"use client";-import type { userSelectProps } from "@cap/database/auth/session";import { Button } from "@cap/ui";-import { userIsPro } from "@cap/utils";+import type { Video } from "@cap/web-domain";import { faRectangleList } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { useEffect, useState } from "react";@@ -13,7 +12,7 @@ interface Chapter {}interface SummaryProps {- videoId: string;+ videoId: Video.VideoId;onSeek?: (time: number) => void;initialAiData?: {title?: string | null;@@ -22,8 +21,8 @@ interface SummaryProps {processing?: boolean;};aiGenerationEnabled?: boolean;- user: typeof userSelectProps | null;isSummaryDisabled?: boolean;+ isVideoOwnerPro: boolean | null;}const formatTime = (time: number) => {@@ -67,7 +66,7 @@ export const Summary: React.FC<SummaryProps> = ({initialAiData,isSummaryDisabled = false,aiGenerationEnabled = false,- user,+ isVideoOwnerPro,}) => {const [aiData, setAiData] = useState<{title?: string | null;@@ -95,12 +94,10 @@ export const Summary: React.FC<SummaryProps> = ({}};- const hasProAccess = userIsPro(user);-const hasExistingAiData =aiData?.summary || (aiData?.chapters && aiData.chapters.length > 0);- if (!hasProAccess && !hasExistingAiData) {+ if (!isVideoOwnerPro && !hasExistingAiData) {return (<div className="flex flex-col justify-center items-center p-8 h-full text-center"><div className="space-y-4 max-w-sm">