Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feature: org settings (#1147)
Ameer Al Ashhab6da25630045d
diff --git a/apps/web/actions/organization/settings.ts b/apps/web/actions/organization/settings.tsnew file mode 100644index 000000000..212b712fb--- /dev/null+++ b/apps/web/actions/organization/settings.ts@@ -0,0 +1,44 @@+"use server";++import { db } from "@cap/database";+import { getCurrentUser } from "@cap/database/auth/session";+import { organizations } from "@cap/database/schema";+import { eq } from "drizzle-orm";+import { revalidatePath } from "next/cache";++export async function updateOrganizationSettings(settings: {+ disableSummary?: boolean;+ disableCaptions?: boolean;+ disableChapters?: boolean;+ disableReactions?: boolean;+ disableTranscript?: boolean;+ disableComments?: boolean;+}) {+ const user = await getCurrentUser();++ if (!user) {+ throw new Error("Unauthorized");+ }++ if (!settings) {+ throw new Error("Settings are required");+ }++ const [organization] = await db()+ .select()+ .from(organizations)+ .where(eq(organizations.id, user.activeOrganizationId));++ if (!organization) {+ throw new Error("Organization not found");+ }++ await db()+ .update(organizations)+ .set({ settings })+ .where(eq(organizations.id, user.activeOrganizationId));++ revalidatePath("/dashboard/caps");++ return { success: true };+}diff --git a/apps/web/actions/videos/generate-ai-metadata.ts b/apps/web/actions/videos/generate-ai-metadata.tsindex 80d987fcb..ec2f4910d 100644--- a/apps/web/actions/videos/generate-ai-metadata.ts+++ b/apps/web/actions/videos/generate-ai-metadata.ts@@ -41,7 +41,6 @@ export async function generateAiMetadata(const updatedAtTime = new Date(videoData.updatedAt).getTime();const currentTime = new Date().getTime();const tenMinutesInMs = 10 * 60 * 1000;- const minutesElapsed = Math.round((currentTime - updatedAtTime) / 60000);if (currentTime - updatedAtTime > tenMinutesInMs) {await db()diff --git a/apps/web/actions/videos/get-status.ts b/apps/web/actions/videos/get-status.tsindex eb4a0d8cd..93d2daacd 100644--- a/apps/web/actions/videos/get-status.ts+++ b/apps/web/actions/videos/get-status.ts@@ -14,8 +14,10 @@ import { generateAiMetadata } from "./generate-ai-metadata";const MAX_AI_PROCESSING_TIME = 10 * 60 * 1000;+type TranscriptionStatus = "PROCESSING" | "COMPLETE" | "ERROR" | "SKIPPED";+export interface VideoStatusResult {- transcriptionStatus: "PROCESSING" | "COMPLETE" | "ERROR" | null;+ transcriptionStatus: TranscriptionStatus | null;aiTitle: string | null;aiProcessing: boolean;summary: string | null;@@ -124,10 +126,7 @@ export async function getVideoStatus(return {transcriptionStatus:- (updatedVideo.transcriptionStatus as- | "PROCESSING"- | "COMPLETE"- | "ERROR") || null,+ (updatedVideo.transcriptionStatus as TranscriptionStatus) || null,aiProcessing: false,aiTitle: updatedMetadata.aiTitle || null,summary: updatedMetadata.summary || null,@@ -214,8 +213,7 @@ export async function getVideoStatus(return {transcriptionStatus:- (video.transcriptionStatus as "PROCESSING" | "COMPLETE" | "ERROR") ||- null,+ (video.transcriptionStatus as TranscriptionStatus) || null,aiProcessing: true,aiTitle: metadata.aiTitle || null,summary: metadata.summary || null,@@ -232,8 +230,7 @@ export async function getVideoStatus(return {transcriptionStatus:- (video.transcriptionStatus as "PROCESSING" | "COMPLETE" | "ERROR") ||- null,+ (video.transcriptionStatus as TranscriptionStatus) || null,aiProcessing: metadata.aiProcessing || false,aiTitle: metadata.aiTitle || null,summary: metadata.summary || null,diff --git a/apps/web/actions/videos/settings.ts b/apps/web/actions/videos/settings.tsnew file mode 100644index 000000000..430b50f18--- /dev/null+++ b/apps/web/actions/videos/settings.ts@@ -0,0 +1,45 @@+"use server";++import { db } from "@cap/database";+import { getCurrentUser } from "@cap/database/auth/session";+import { videos } from "@cap/database/schema";+import type { Video } from "@cap/web-domain";+import { eq } from "drizzle-orm";++export async function updateVideoSettings(+ videoId: Video.VideoId,+ videoSettings: {+ disableSummary?: boolean;+ disableCaptions?: boolean;+ disableChapters?: boolean;+ disableReactions?: boolean;+ disableTranscript?: boolean;+ disableComments?: boolean;+ },+) {+ const user = await getCurrentUser();++ if (!user || !videoId || !videoSettings) {+ throw new Error("Missing required data for updating video settings");+ }++ const [video] = await db()+ .select()+ .from(videos)+ .where(eq(videos.id, videoId));++ if (!video) {+ throw new Error("Video not found for updating video settings");+ }++ if (video.ownerId !== user.id) {+ throw new Error("You don't have permission to update this video settings");+ }++ await db()+ .update(videos)+ .set({ settings: videoSettings })+ .where(eq(videos.id, videoId));++ return { success: true };+}diff --git a/apps/web/app/(org)/dashboard/Contexts.tsx b/apps/web/app/(org)/dashboard/Contexts.tsxindex 3bd54d2b5..a8799701e 100644--- a/apps/web/app/(org)/dashboard/Contexts.tsx+++ b/apps/web/app/(org)/dashboard/Contexts.tsx@@ -6,11 +6,17 @@ import Cookies from "js-cookie";import { usePathname } from "next/navigation";import { createContext, useContext, useEffect, useState } from "react";import { UpgradeModal } from "@/components/UpgradeModal";-import type { Organization, Spaces, UserPreferences } from "./dashboard-data";+import type {+ Organization,+ OrganizationSettings,+ Spaces,+ UserPreferences,+} from "./dashboard-data";type SharedContext = {organizationData: Organization[] | null;activeOrganization: Organization | null;+ organizationSettings: OrganizationSettings | null;spacesData: Spaces[] | null;userSpaces: Spaces[] | null;sharedSpaces: Spaces[] | null;@@ -50,6 +56,7 @@ export function DashboardContexts({spacesData,user,isSubscribed,+ organizationSettings,userPreferences,anyNewNotifications,initialTheme,@@ -62,6 +69,7 @@ export function DashboardContexts({spacesData: SharedContext["spacesData"];user: SharedContext["user"];isSubscribed: SharedContext["isSubscribed"];+ organizationSettings: SharedContext["organizationSettings"];userPreferences: SharedContext["userPreferences"];anyNewNotifications: boolean;initialTheme: ITheme;@@ -154,6 +162,7 @@ export function DashboardContexts({spacesData,anyNewNotifications,userPreferences,+ organizationSettings,userSpaces,sharedSpaces,activeSpace,diff --git a/apps/web/app/(org)/dashboard/_components/MobileTab.tsx b/apps/web/app/(org)/dashboard/_components/MobileTab.tsxindex b4cd32901..b474227c5 100644--- a/apps/web/app/(org)/dashboard/_components/MobileTab.tsx+++ b/apps/web/app/(org)/dashboard/_components/MobileTab.tsx@@ -44,7 +44,7 @@ const MobileTab = () => {}});return (- <div className="flex sticky bottom-0 z-50 flex-1 justify-between items-center px-5 w-screen h-16 border-t lg:hidden border-gray-5 bg-gray-1">+ <div className="flex sticky bottom-0 z-50 flex-1 gap-5 justify-between items-center px-5 w-screen h-16 border-t lg:hidden border-gray-5 bg-gray-1"><AnimatePresence>{open && <OrgsMenu setOpen={setOpen} menuRef={menuRef} />}</AnimatePresence>diff --git a/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx b/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsxindex 2d88b13c6..560205301 100644--- a/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx+++ b/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx@@ -94,7 +94,7 @@ const AdminNavItems = ({ toggleMobileNav }: Props) => {position="right"content={activeOrg?.organization.name ?? "No organization found"}>- <PopoverTrigger asChild>+ <PopoverTrigger suppressHydrationWarning asChild><motion.divtransition={{type: "easeInOut",diff --git a/apps/web/app/(org)/dashboard/caps/Caps.tsx b/apps/web/app/(org)/dashboard/caps/Caps.tsxindex e83dd11aa..10869c80a 100644--- a/apps/web/app/(org)/dashboard/caps/Caps.tsx+++ b/apps/web/app/(org)/dashboard/caps/Caps.tsx@@ -24,7 +24,7 @@ import { CapPagination } from "./components/CapPagination";import { EmptyCapState } from "./components/EmptyCapState";import type { FolderDataType } from "./components/Folder";import Folder from "./components/Folder";-import { useUploadingContext, useUploadingStatus } from "./UploadingContext";+import { useUploadingStatus } from "./UploadingContext";export type VideoData = {id: Video.VideoId;diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsxindex 01a92ca8e..8191e4fd9 100644--- a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx+++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx@@ -1,3 +1,5 @@+"use client";+import type { VideoMetadata } from "@cap/database/types";import { buildEnv, NODE_ENV } from "@cap/env";import {@@ -13,6 +15,7 @@ import {faCopy,faDownload,faEllipsis,+ faGear,faLink,faLock,faTrash,@@ -40,6 +43,7 @@ import {import { useEffectMutation } from "@/lib/EffectRuntime";import { withRpc } from "@/lib/Rpcs";import { PasswordDialog } from "../PasswordDialog";+import { SettingsDialog } from "../SettingsDialog";import { SharingDialog } from "../SharingDialog";import { CapCardAnalytics } from "./CapCardAnalytics";import { CapCardButton } from "./CapCardButton";@@ -70,6 +74,14 @@ export interface CapCardProps extends PropsWithChildren {hasPassword?: boolean;hasActiveUpload: boolean | undefined;duration?: number;+ settings?: {+ disableComments?: boolean;+ disableSummary?: boolean;+ disableCaptions?: boolean;+ disableChapters?: boolean;+ disableReactions?: boolean;+ disableTranscript?: boolean;+ };};analytics: number;isLoadingAnalytics: boolean;@@ -111,6 +123,7 @@ export const CapCard = ({);const [copyPressed, setCopyPressed] = useState(false);const [isDragging, setIsDragging] = useState(false);+ const [isSettingsDialogOpen, setIsSettingsDialogOpen] = useState(false);const { isSubscribed, setUpgradeModalOpen } = useDashboardContext();const [confirmOpen, setConfirmOpen] = useState(false);@@ -285,6 +298,12 @@ export const CapCard = ({onSharingUpdated={handleSharingUpdated}isPublic={cap.public}/>+ <SettingsDialog+ isOpen={isSettingsDialogOpen}+ settingsData={cap.settings}+ capId={cap.id}+ onClose={() => setIsSettingsDialogOpen(false)}+ /><PasswordDialogisOpen={isPasswordDialogOpen}onClose={() => setIsPasswordDialogOpen(false)}@@ -323,6 +342,31 @@ export const CapCard = ({"top-2 right-2 flex-col gap-2 z-[51]",)}>+ {isOwner ? (+ <CapCardButton+ tooltipContent="Settings"+ onClick={(e) => {+ e.stopPropagation();+ setIsSettingsDialogOpen(true);+ }}+ className="delay-0"+ icon={() => {+ return <FontAwesomeIcon className="size-4" icon={faGear} />;+ }}+ />+ ) : (+ <CapCardButton+ tooltipContent="Download Cap"+ onClick={(e) => {+ e.stopPropagation();+ handleDownload();+ }}+ className="delay-0"+ icon={() => (+ <FontAwesomeIcon className="size-4" icon={faDownload} />+ )}+ />+ )}<CapCardButtontooltipContent="Copy link"onClick={(e) => {@@ -363,54 +407,10 @@ export const CapCard = ({);}}/>- <CapCardButton- tooltipContent="Download Cap"- onClick={(e) => {- e.stopPropagation();- handleDownload();- }}- disabled={- downloadMutation.isPending ||- (enableBetaUploadProgress && cap.hasActiveUpload)- }- className="delay-25"- icon={() => {- return downloadMutation.isPending ? (- <div className="animate-spin size-3">- <svg- className="size-3"- xmlns="http://www.w3.org/2000/svg"- fill="none"- viewBox="0 0 24 24"- aria-hidden="true"- >- <circle- className="opacity-25"- cx="12"- cy="12"- r="10"- stroke="currentColor"- strokeWidth="4"- ></circle>- <path- className="opacity-75"- fill="currentColor"- d="m2 12c0-5.523 4.477-10 10-10v3c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7c0-1.457-.447-2.808-1.208-3.926l2.4-1.6c1.131 1.671 1.808 3.677 1.808 5.526 0 5.523-4.477 10-10 10s-10-4.477-10-10z"- ></path>- </svg>- </div>- ) : (- <FontAwesomeIcon- className="text-gray-12 size-3"- icon={faDownload}- />- );- }}- />{isOwner && (<DropdownMenu modal={false} onOpenChange={setIsDropdownOpen}>- <DropdownMenuTrigger asChild>+ <DropdownMenuTrigger asChild suppressHydrationWarning><div><CapCardButtontooltipContent="More options"@@ -421,7 +421,21 @@ export const CapCard = ({/></div></DropdownMenuTrigger>- <DropdownMenuContent align="end" sideOffset={5}>+ <DropdownMenuContent+ align="end"+ sideOffset={5}+ suppressHydrationWarning+ >+ <DropdownMenuItem+ onClick={(e) => {+ e.stopPropagation();+ handleDownload();+ }}+ className="flex gap-2 items-center rounded-lg"+ >+ <FontAwesomeIcon className="size-3" icon={faDownload} />+ <p className="text-sm text-gray-12">Download</p>+ </DropdownMenuItem><DropdownMenuItemonClick={() => {toast.promise(duplicateMutation.mutateAsync(), {@@ -522,8 +536,8 @@ export const CapCard = ({href={`/s/${cap.id}`}>{imageStatus !== "success" && uploadProgress ? (- <div className="relative inset-0 w-full h-full z-20">- <div className="overflow-hidden relative mx-auto w-full h-full rounded-t-xl border-b border-gray-3 aspect-video bg-black z-5">+ <div className="relative inset-0 z-20 w-full h-full">+ <div className="overflow-hidden relative mx-auto w-full h-full bg-black rounded-t-xl border-b border-gray-3 aspect-video z-5"><div className="flex absolute inset-0 justify-center items-center rounded-t-xl">{uploadProgress.status === "failed" ? (<div className="flex flex-col items-center">diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButton.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButton.tsxindex f6e9504e8..61868a1f9 100644--- a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButton.tsx+++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButton.tsx@@ -1,3 +1,5 @@+"use client";+import { Button } from "@cap/ui";import clsx from "clsx";import type { MouseEvent, ReactNode } from "react";@@ -23,7 +25,7 @@ export const CapCardButton = ({return (<Tooltip key={tooltipContent} content={tooltipContent}><Button- onClick={(e) => onClick?.(e)}+ onClick={onClick}disabled={disabled}asChild={asChild}className={clsx(diff --git a/apps/web/app/(org)/dashboard/caps/components/SettingsDialog.tsx b/apps/web/app/(org)/dashboard/caps/components/SettingsDialog.tsxnew file mode 100644index 000000000..06226dd17--- /dev/null+++ b/apps/web/app/(org)/dashboard/caps/components/SettingsDialog.tsx@@ -0,0 +1,231 @@+import {+ Button,+ Dialog,+ DialogContent,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Switch,+} from "@cap/ui";+import { userIsPro } from "@cap/utils";+import type { Video } from "@cap/web-domain";+import { faGear } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import clsx from "clsx";+import { useCallback, useEffect, useState } from "react";+import { toast } from "sonner";+import { updateVideoSettings } from "@/actions/videos/settings";+import { useDashboardContext } from "../../Contexts";+import type { OrganizationSettings } from "../../dashboard-data";++interface SettingsDialogProps {+ isOpen: boolean;+ onClose: () => void;+ capId: Video.VideoId;+ settingsData?: OrganizationSettings;+}++const options: {+ label: string;+ value: keyof NonNullable<OrganizationSettings>;+ description: string;+ pro?: boolean;+}[] = [+ {+ label: "Enable comments",+ value: "disableComments",+ description: "Allow viewers to comment on this cap",+ },+ {+ label: "Enable summary",+ value: "disableSummary",+ description: "Show AI-generated summary (requires transcript)",+ pro: true,+ },+ {+ label: "Enable captions",+ value: "disableCaptions",+ description: "Allow viewers to use captions for this cap",+ },+ {+ label: "Enable chapters",+ value: "disableChapters",+ description: "Show AI-generated chapters (requires transcript)",+ pro: true,+ },+ {+ label: "Enable reactions",+ value: "disableReactions",+ description: "Allow viewers to react to this cap",+ },+ {+ label: "Enable transcript",+ value: "disableTranscript",+ description: "Enabling this also allows summary and chapters",+ pro: true,+ },+];++export const SettingsDialog = ({+ isOpen,+ onClose,+ capId,+ settingsData,+}: SettingsDialogProps) => {+ const { user, organizationSettings } = useDashboardContext();+ const [saveLoading, setSaveLoading] = useState(false);+ const buildSettings = useCallback(+ (data?: OrganizationSettings): OrganizationSettings => ({+ disableComments: data?.disableComments,+ disableSummary: data?.disableSummary,+ disableCaptions: data?.disableCaptions,+ disableChapters: data?.disableChapters,+ disableReactions: data?.disableReactions,+ disableTranscript: data?.disableTranscript,+ }),+ [],+ );++ const [settings, setSettings] = useState<OrganizationSettings>(+ buildSettings(settingsData),+ );++ useEffect(() => {+ if (isOpen) {+ setSettings(buildSettings(settingsData));+ }+ }, [buildSettings, isOpen, settingsData]);++ const isUserPro = userIsPro(user);++ const saveHandler = async () => {+ if (!settings) return;+ setSaveLoading(true);+ try {+ const payload = Object.fromEntries(+ Object.entries(settings).filter(([, v]) => v !== undefined),+ ) as Partial<OrganizationSettings>;+ await updateVideoSettings(capId, payload);+ toast.success("Settings updated successfully");+ onClose();+ } catch (error) {+ console.error("Error updating video settings:", error);+ toast.error("Failed to update settings");+ } finally {+ setSaveLoading(false);+ }+ };++ const toggleSettingHandler = useCallback(+ (value: string) => {+ setSettings((prev) => {+ const key = value as keyof OrganizationSettings;+ const currentValue = prev?.[key];+ const orgValue = organizationSettings?.[key] ?? false;++ const newValue = currentValue === undefined ? !orgValue : !currentValue;++ if (key === "disableTranscript" && newValue === true) {+ return {+ ...prev,+ [key]: newValue,+ disableSummary: true,+ disableChapters: true,+ };+ }++ return {+ ...prev,+ [key]: newValue,+ };+ });+ },+ [organizationSettings],+ );++ const getEffectiveValue = (key: keyof OrganizationSettings) => {+ const videoValue = settings?.[key];+ const orgValue = organizationSettings?.[key] ?? false;+ return videoValue !== undefined || videoValue === true+ ? videoValue+ : orgValue;+ };++ return (+ <Dialog open={isOpen} onOpenChange={onClose}>+ <DialogContent className="max-w-md min-w-fit">+ <DialogHeader+ description="Manage the settings for this cap"+ icon={<FontAwesomeIcon icon={faGear} className="size-3.5" />}+ >+ <DialogTitle>Settings</DialogTitle>+ </DialogHeader>+ <div className="grid grid-cols-2 gap-3 p-5">+ {options.map((option) => {+ const key = option.value as keyof OrganizationSettings;+ const effectiveValue = getEffectiveValue(key);+ const orgValue = organizationSettings?.[key] ?? false;+ return (+ <div+ key={option.value}+ className="flex gap-10 justify-between items-center p-4 rounded-xl border transition-colors min-w-fit border-gray-3 bg-gray-1"+ >+ <div+ className={clsx(+ "flex flex-col flex-1",+ option.pro && "gap-1",+ )}+ >+ <div className="flex gap-1.5 items-center flex-wrap">+ <p className="text-sm text-gray-12">{option.label}</p>+ {option.pro && (+ <p className="py-1 px-1.5 text-[10px] leading-none font-medium rounded-full text-white bg-blue-11">+ Pro+ </p>+ )}+ {effectiveValue && (+ <p className="py-1 px-1.5 text-[10px] leading-none font-medium rounded-full text-gray-11 bg-gray-5">+ Org {orgValue ? "disabled" : "enabled"}+ </p>+ )}+ </div>+ <p className="text-xs text-gray-10">{option.description}</p>+ </div>+ <Switch+ disabled={+ (option.pro && !isUserPro) ||+ ((key === "disableSummary" || key === "disableChapters") &&+ getEffectiveValue(+ "disableTranscript" as keyof OrganizationSettings,+ ))+ }+ onCheckedChange={() => toggleSettingHandler(option.value)}+ checked={!effectiveValue}+ />+ </div>+ );+ })}+ </div>+ <DialogFooter className="p-5 border-t border-gray-4">+ <Button+ variant="gray"+ size="sm"+ onClick={onClose}+ disabled={saveLoading}+ >+ Cancel+ </Button>+ <Button+ variant="dark"+ size="sm"+ onClick={saveHandler}+ spinner={saveLoading}+ disabled={saveLoading}+ >+ {saveLoading ? "Saving..." : "Save"}+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+};diff --git a/apps/web/app/(org)/dashboard/caps/page.tsx b/apps/web/app/(org)/dashboard/caps/page.tsxindex e9bd381e4..d381db2b3 100644--- a/apps/web/app/(org)/dashboard/caps/page.tsx+++ b/apps/web/app/(org)/dashboard/caps/page.tsx@@ -175,20 +175,27 @@ export default async function CapsPage(props: PageProps<"/dashboard/caps">) {hasActiveUpload: sql`${videoUploads.videoId} IS NOT NULL`.mapWith(Boolean,),+ settings: videos.settings,}).from(videos).leftJoin(comments, eq(videos.id, comments.videoId))- .leftJoin(sharedVideos, eq(videos.id, sharedVideos.videoId))- .leftJoin(organizations, eq(sharedVideos.organizationId, organizations.id))+ .leftJoin(organizations, eq(videos.orgId, organizations.id)).leftJoin(users, eq(videos.ownerId, users.id)).leftJoin(videoUploads, eq(videos.id, videoUploads.videoId))- .where(and(eq(videos.ownerId, userId), isNull(videos.folderId)))+ .where(+ and(+ eq(videos.ownerId, userId),+ eq(videos.orgId, user.activeOrganizationId),+ isNull(videos.folderId),+ ),+ ).groupBy(videos.id,videos.ownerId,videos.name,videos.createdAt,videos.metadata,+ videos.orgId,users.name,).orderBy(@@ -230,6 +237,7 @@ export default async function CapsPage(props: PageProps<"/dashboard/caps">) {...videoWithoutEffectiveDate,id: Video.VideoId.make(video.id),foldersData,+ settings: video.settings,sharedOrganizations: Array.isArray(video.sharedOrganizations)? video.sharedOrganizations.filter((organization) => organization.id !== null,diff --git a/apps/web/app/(org)/dashboard/dashboard-data.ts b/apps/web/app/(org)/dashboard/dashboard-data.tsindex c581a783d..b41b75741 100644--- a/apps/web/app/(org)/dashboard/dashboard-data.ts+++ b/apps/web/app/(org)/dashboard/dashboard-data.ts@@ -25,6 +25,10 @@ export type Organization = {totalInvites: number;};+export type OrganizationSettings = NonNullable<+ (typeof organizations.$inferSelect)["settings"]+>;+export type Spaces = Omit<typeof spaces.$inferSelect,"createdAt" | "updatedAt"@@ -40,6 +44,7 @@ export async function getDashboardData(user: typeof userSelectProps) {const organizationsWithMembers = await db().select({organization: organizations,+ settings: organizations.settings,member: organizationMembers,user: {id: users.id,@@ -79,6 +84,7 @@ export async function getDashboardData(user: typeof userSelectProps) {let anyNewNotifications = false;let spacesData: Spaces[] = [];+ let organizationSettings: OrganizationSettings | null = null;// Find active organization ID@@ -89,6 +95,7 @@ export async function getDashboardData(user: typeof userSelectProps) {if (!activeOrganizationId && organizationIds.length > 0) {activeOrganizationId = organizationIds[0];}+// Only fetch spaces for the active organizationif (activeOrganizationId) {@@ -106,6 +113,12 @@ export async function getDashboardData(user: typeof userSelectProps) {anyNewNotifications = !!notification;+ const [organizationSetting] = await db()+ .select({ settings: organizations.settings })+ .from(organizations)+ .where(eq(organizations.id, activeOrganizationId));+ organizationSettings = organizationSetting?.settings || null;+spacesData = await db().select({id: spaces.id,@@ -262,6 +275,7 @@ export async function getDashboardData(user: typeof userSelectProps) {return {organizationSelect,+ organizationSettings,spacesData,anyNewNotifications,userPreferences,@@ -273,6 +287,7 @@ export async function getDashboardData(user: typeof userSelectProps) {spacesData: [],anyNewNotifications: false,userPreferences: null,+ organizationSettings: null,};}}diff --git a/apps/web/app/(org)/dashboard/layout.tsx b/apps/web/app/(org)/dashboard/layout.tsxindex 336837c4b..99d71fdbe 100644--- a/apps/web/app/(org)/dashboard/layout.tsx+++ b/apps/web/app/(org)/dashboard/layout.tsx@@ -10,6 +10,7 @@ import { UploadingProvider } from "./caps/UploadingContext";import {getDashboardData,type Organization,+ type OrganizationSettings,type Spaces,type UserPreferences,} from "./dashboard-data";@@ -32,18 +33,21 @@ export default async function DashboardLayout({}let organizationSelect: Organization[] = [];+ let organizationSettings: OrganizationSettings | null = null;let spacesData: Spaces[] = [];let anyNewNotifications = false;let userPreferences: UserPreferences;try {const dashboardData = await getDashboardData(user);organizationSelect = dashboardData.organizationSelect;+ organizationSettings = dashboardData.organizationSettings;userPreferences = dashboardData.userPreferences?.preferences || null;spacesData = dashboardData.spacesData;anyNewNotifications = dashboardData.anyNewNotifications;} catch (error) {console.error("Failed to load dashboard data", error);organizationSelect = [];+ organizationSettings = null;spacesData = [];anyNewNotifications = false;userPreferences = null;@@ -70,6 +74,7 @@ export default async function DashboardLayout({return (<UploadingProvider><DashboardContexts+ organizationSettings={organizationSettings}organizationData={organizationSelect}activeOrganization={activeOrganization || null}spacesData={spacesData}diff --git a/apps/web/app/(org)/dashboard/settings/organization/Organization.tsx b/apps/web/app/(org)/dashboard/settings/organization/Organization.tsxindex 183e7bfb0..f7a760e67 100644--- a/apps/web/app/(org)/dashboard/settings/organization/Organization.tsx+++ b/apps/web/app/(org)/dashboard/settings/organization/Organization.tsx@@ -13,6 +13,7 @@ import { manageBilling } from "@/actions/organization/manage-billing";import { useDashboardContext } from "@/app/(org)/dashboard/Contexts";import { BillingCard } from "./components/BillingCard";+import CapSettingsCard from "./components/CapSettingsCard";import { InviteDialog } from "./components/InviteDialog";import { MembersCard } from "./components/MembersCard";import { OrganizationDetailsCard } from "./components/OrganizationDetailsCard";@@ -64,6 +65,10 @@ export const Organization = () => {<OrganizationDetailsCard /></div>+ <div>+ <CapSettingsCard />+ </div>+<MembersCardisOwner={isOwner}loading={loading}diff --git a/apps/web/app/(org)/dashboard/settings/organization/components/CapSettingsCard.tsx b/apps/web/app/(org)/dashboard/settings/organization/components/CapSettingsCard.tsxindex 337f1d7b4..ff94679ec 100644--- a/apps/web/app/(org)/dashboard/settings/organization/components/CapSettingsCard.tsx+++ b/apps/web/app/(org)/dashboard/settings/organization/components/CapSettingsCard.tsx@@ -1,142 +1,196 @@+"use client";+import { Card, CardDescription, CardHeader, CardTitle, Switch } from "@cap/ui";+import { userIsPro } from "@cap/utils";+import { useDebounce } from "@uidotdev/usehooks";import clsx from "clsx";-import { AnimatePresence, motion } from "framer-motion";-import { useState } from "react";+import { useEffect, useRef, useState } from "react";+import { toast } from "sonner";+import { updateOrganizationSettings } from "@/actions/organization/settings";+import { useDashboardContext } from "../../../Contexts";+import type { OrganizationSettings } from "../../../dashboard-data";-const VideoTabSettings = [- {- label: "5 minutes video duration",- description: "Set the default video duration",- },- {- label: "1080p resolution",- description: "Set the default video resolution",- },+const options = [{- label: "10Mbps bitrate",- description: "Set the default video bitrate",+ label: "Enable comments",+ value: "disableComments",+ description: "Allow viewers to comment on caps",},-];--const NotificationTabSettings = [{- label: "Notifications",- description: "Set the default notification settings",+ label: "Enable summary",+ value: "disableSummary",+ description: "Show AI-generated summary (requires transcript)",+ pro: true,},{- label: "Setting 1",- description: "Set the default random settings",+ label: "Enable captions",+ value: "disableCaptions",+ description: "Allow viewers to use captions for caps",},{- label: "Setting 2",- description: "Set the default random settings",+ label: "Enable chapters",+ value: "disableChapters",+ description: "Show AI-generated chapters (requires transcript)",+ pro: true,},{- label: "Setting 3",- description: "Set the default random settings",+ label: "Enable reactions",+ value: "disableReactions",+ description: "Allow viewers to react to caps",},{- label: "Setting 4",- description: "Set the default random settings",- },- {- label: "Setting 5",- description: "Set the default random settings",- },- {- label: "Setting 6",- description: "Set the default random settings",+ label: "Enable transcript",+ value: "disableTranscript",+ description: "Enabling this also allows chapters and summary",+ pro: true,},];const CapSettingsCard = () => {- const [activeTab, setActiveTab] = useState("Notifications");+ const { user, organizationSettings } = useDashboardContext();+ const [settings, setSettings] = useState<OrganizationSettings>(+ organizationSettings || {+ disableComments: false,+ disableSummary: false,+ disableCaptions: false,+ disableChapters: false,+ disableReactions: false,+ disableTranscript: false,+ },+ );++ const lastSavedSettings = useRef<OrganizationSettings>(+ organizationSettings || settings,+ );++ const isUserPro = userIsPro(user);++ const debouncedUpdateSettings = useDebounce(settings, 1000);++ useEffect(() => {+ const next = organizationSettings ?? {+ disableComments: false,+ disableSummary: false,+ disableCaptions: false,+ disableChapters: false,+ disableReactions: false,+ disableTranscript: false,+ };+ setSettings(next);+ lastSavedSettings.current = next;+ }, [organizationSettings]);++ useEffect(() => {+ if (+ debouncedUpdateSettings &&+ debouncedUpdateSettings !== lastSavedSettings.current+ ) {+ const handleUpdate = async () => {+ const changedKeys: Array<keyof OrganizationSettings> = [];+ for (const key of Object.keys(debouncedUpdateSettings) as Array<+ keyof OrganizationSettings+ >) {+ if (+ debouncedUpdateSettings[key] !== lastSavedSettings.current?.[key]+ ) {+ changedKeys.push(key);+ }+ }++ if (changedKeys.length === 0) {+ return;+ }++ try {+ await updateOrganizationSettings(debouncedUpdateSettings);++ changedKeys.forEach((changedKey) => {+ const option = options.find((opt) => opt.value === changedKey);+ const isDisabled = debouncedUpdateSettings[changedKey];+ const action = isDisabled ? "disabled" : "enabled";+ const label = option?.label.split(" ")[1] || changedKey;+ toast.success(+ `${label.charAt(0).toUpperCase()}${label.slice(1)} ${action}`,+ );+ });++ lastSavedSettings.current = debouncedUpdateSettings;+ } catch (error) {+ console.error("Error updating organization settings:", error);+ toast.error("Failed to update settings");+ if (organizationSettings) {+ setSettings(organizationSettings);+ }+ }+ };++ handleUpdate();+ }+ }, [debouncedUpdateSettings, organizationSettings]);++ const handleToggle = (key: keyof OrganizationSettings) => {+ setSettings((prev) => {+ const newValue = !prev?.[key];++ if (key === "disableTranscript" && newValue === true) {+ return {+ ...prev,+ [key]: newValue,+ disableSummary: true,+ disableChapters: true,+ };+ }++ return {+ ...prev,+ [key]: newValue,+ };+ });+ };+return (<Card className="flex relative flex-col flex-1 gap-6 w-full min-h-fit"><CardHeader><CardTitle>Cap Settings</CardTitle><CardDescription>- Enable or disable specific settings for your organization.- Notifications, videos, etc...+ Enable or disable specific settings for your organization. These+ settings will be applied as defaults for new caps.</CardDescription></CardHeader>- <div className="relative">- <div className="absolute top-0 left-0 z-[20] rounded-xl flex items-center justify-center w-full h-full backdrop-blur-md bg-zinc-900/20">- <p className="px-3 py-2 text-sm font-semibold rounded-full border text-gray-12 border-gray-3 bg-gray-3">- Coming Soon- </p>- </div>- <div className="flex gap-4 pb-4 mt-3 border-b border-gray-3">- {["Notifications", "Videos"].map((setting) => (- <motion.div- key={setting}- style={{- borderRadius: 12,- }}- onClick={() => setActiveTab(setting)}- className={clsx("relative cursor-pointer")}+ <div className="grid grid-cols-1 gap-3 md:grid-cols-2">+ {options.map((option) => (+ <div+ key={option.value}+ className="flex gap-10 justify-between items-center p-4 text-left rounded-xl border transition-colors min-w-fit border-gray-3 bg-gray-1"+ >+ <div+ className={clsx("flex flex-col flex-1", option.pro && "gap-1")}>- <p- className={clsx(- "relative z-10 text-[13px] px-2.5 py-1.5 font-medium transition-colors duration-200 text-gray-10 hover:text-gray-11",- activeTab === setting && "text-gray-12 hover:text-gray-12",+ <div className="flex gap-1.5 items-center">+ <p className="text-sm text-gray-12">{option.label}</p>+ {option.pro && (+ <p className="py-1 px-1.5 text-[10px] leading-none font-medium rounded-full text-white bg-blue-11">+ Pro+ </p>)}- >- {setting}- </p>- {/** Indicator */}- {activeTab === setting && (- <motion.div- layoutId="activeTabIndicator"- transition={{ damping: 25, stiffness: 250, type: "spring" }}- className="absolute top-0 left-0 w-full h-full rounded-xl bg-gray-3"- />- )}- </motion.div>- ))}- </div>- <div className="mt-4 space-y-3">- {activeTab === "Videos" ? (- <AnimatePresence initial={false}>- {VideoTabSettings.map((setting, index) => (- <motion.div- initial={{ opacity: 0, y: 10 }}- animate={{- opacity: 1,- y: 0,- transition: { delay: index * 0.05 },- }}- exit={{ opacity: 0, y: -10, transition: { duration: 0.2 } }}- key={index.toString() + setting.label}- className="flex justify-between items-center p-3 rounded-xl border border-gray-4"- >- <p className="text-[13px] text-gray-12">{setting.label}</p>- <Switch />- </motion.div>- ))}- </AnimatePresence>- ) : (- <AnimatePresence initial={false}>- {NotificationTabSettings.map((setting, index) => (- <motion.div- initial={{ opacity: 0, y: 10 }}- animate={{- opacity: 1,- y: 0,- transition: { delay: index * 0.05 },- }}- exit={{ opacity: 0, y: -10, transition: { duration: 0.2 } }}- key={index.toString() + setting.label}- className="flex justify-between items-center p-3 rounded-xl border border-gray-4"- >- <p className="text-[13px] text-gray-12">{setting.label}</p>- <Switch />- </motion.div>- ))}- </AnimatePresence>- )}- </div>+ </div>+ <p className="text-xs text-gray-10">{option.description}</p>+ </div>+ <Switch+ disabled={+ (option.pro && !isUserPro) ||+ ((option.value === "disableSummary" ||+ option.value === "disableChapters") &&+ settings?.disableTranscript)+ }+ onCheckedChange={() => {+ handleToggle(option.value as keyof OrganizationSettings);+ }}+ checked={!settings?.[option.value as keyof typeof settings]}+ />+ </div>+ ))}</div></Card>);diff --git a/apps/web/app/(org)/dashboard/settings/organization/page.tsx b/apps/web/app/(org)/dashboard/settings/organization/page.tsxindex 48bed4f14..b2c0e29f1 100644--- a/apps/web/app/(org)/dashboard/settings/organization/page.tsx+++ b/apps/web/app/(org)/dashboard/settings/organization/page.tsx@@ -4,7 +4,6 @@ import { organizationMembers, organizations } from "@cap/database/schema";import { and, eq } from "drizzle-orm";import type { Metadata } from "next";import { redirect } from "next/navigation";-import { getDashboardData } from "../../dashboard-data";import { Organization } from "./Organization";export const metadata: Metadata = {diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsxindex 251977466..7201e4572 100644--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx@@ -281,32 +281,38 @@ export const SharedCaps = ({</>)}- <h1 className="mb-4 text-2xl font-medium text-gray-12">Videos</h1>- <div className="grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">- {data.map((cap) => {- const isOwner = cap.ownerId === currentUserId;- return (- <SharedCapCard- key={cap.id}- cap={cap}- hideSharedStatus- isLoadingAnalytics={isLoadingAnalytics}- analytics={analytics[cap.id] || 0}- organizationName={activeOrganization?.organization.name || ""}- spaceName={spaceData?.name || ""}- userId={currentUserId}- onDragStart={() =>- setIsDraggingCap({ isOwner, isDragging: true })- }- onDragEnd={() => setIsDraggingCap({ isOwner, isDragging: false })}- />- );- })}- </div>- {(data.length > limit || data.length === limit || page !== 1) && (- <div className="mt-4">- <CapPagination currentPage={page} totalPages={totalPages} />- </div>+ {data.length > 0 && (+ <>+ <h1 className="mb-4 text-2xl font-medium text-gray-12">Videos</h1>+ <div className="grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">+ {data.map((cap) => {+ const isOwner = cap.ownerId === currentUserId;+ return (+ <SharedCapCard+ key={cap.id}+ cap={cap}+ hideSharedStatus+ isLoadingAnalytics={isLoadingAnalytics}+ analytics={analytics[cap.id] || 0}+ organizationName={activeOrganization?.organization.name || ""}+ spaceName={spaceData?.name || ""}+ userId={currentUserId}+ onDragStart={() =>+ setIsDraggingCap({ isOwner, isDragging: true })+ }+ onDragEnd={() =>+ setIsDraggingCap({ isOwner, isDragging: false })+ }+ />+ );+ })}+ </div>+ {(data.length > limit || data.length === limit || page !== 1) && (+ <div className="mt-4">+ <CapPagination currentPage={page} totalPages={totalPages} />+ </div>+ )}+ </>)}</div>);diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsxindex 943c3484a..5bfbcaf61 100644--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx@@ -1,3 +1,5 @@+"use client";+import type { VideoMetadata } from "@cap/database/types";import type { Video } from "@cap/web-domain";import { faBuilding, faUser } from "@fortawesome/free-solid-svg-icons";diff --git a/apps/web/app/(site)/Navbar.tsx b/apps/web/app/(site)/Navbar.tsxindex 7118c019e..cbeac9a58 100644--- a/apps/web/app/(site)/Navbar.tsx+++ b/apps/web/app/(site)/Navbar.tsx@@ -138,7 +138,7 @@ export const Navbar = () => {<Link passHref href="/home"><LogohideLogoName={hideLogoName}- className="transition-all duration-[0.2s] ease-out"+ className="transition-all duration-200 ease-out"viewBoxDimensions={hideLogoName ? "0 0 60 40" : "0 0 120 40"}style={{width: hideLogoName ? 45.5 : 90,diff --git a/apps/web/app/embed/[videoId]/page.tsx b/apps/web/app/embed/[videoId]/page.tsxindex ff12bcb7b..04a5550a6 100644--- a/apps/web/app/embed/[videoId]/page.tsx+++ b/apps/web/app/embed/[videoId]/page.tsx@@ -123,6 +123,7 @@ export default async function EmbedVideoPage(name: videos.name,ownerId: videos.ownerId,orgId: videos.orgId,+ settings: videos.settings,createdAt: videos.createdAt,updatedAt: videos.updatedAt,bucket: videos.bucket,@@ -182,7 +183,7 @@ export default async function EmbedVideoPage(Effect.catchTags({PolicyDenied: () =>Effect.succeed(- <div className="flex flex-col justify-center items-center min-h-screen text-center bg-black text-white">+ <div className="flex flex-col justify-center items-center min-h-screen text-center text-white bg-black"><h1 className="mb-4 text-2xl font-bold">This video is private</h1><p className="text-gray-400">If you own this video, please <Link href="/login">sign in</Link>{" "}@@ -237,7 +238,7 @@ async function EmbedContent({!user.email.endsWith(`@${organization[0].allowedEmailDomain}`)) {return (- <div className="flex flex-col justify-center items-center min-h-screen text-center bg-black text-white">+ <div className="flex flex-col justify-center items-center min-h-screen text-center text-white bg-black"><h1 className="mb-4 text-2xl font-bold">Access Restricted</h1><p className="mb-2 text-gray-300">This video is only accessible to members of this organization.@@ -284,7 +285,7 @@ async function EmbedContent({if (video.isScreenshot === true) {return (- <div className="flex items-center justify-center min-h-screen bg-black text-white">+ <div className="flex justify-center items-center min-h-screen text-white bg-black"><p>Screenshots cannot be embedded</p></div>);diff --git a/apps/web/app/s/[videoId]/Share.tsx b/apps/web/app/s/[videoId]/Share.tsxindex 9ee7cac6c..fb28603fc 100644--- a/apps/web/app/s/[videoId]/Share.tsx+++ b/apps/web/app/s/[videoId]/Share.tsx@@ -17,18 +17,12 @@ import {getVideoStatus,type VideoStatusResult,} from "@/actions/videos/get-status";+import type { OrganizationSettings } from "@/app/(org)/dashboard/dashboard-data";import { ShareVideo } from "./_components/ShareVideo";import { Sidebar } from "./_components/Sidebar";+import SummaryChapters from "./_components/SummaryChapters";import { Toolbar } from "./_components/Toolbar";-const formatTime = (time: number) => {- const minutes = Math.floor(time / 60);- const seconds = Math.floor(time % 60);- return `${minutes.toString().padStart(2, "0")}:${seconds- .toString()- .padStart(2, "0")}`;-};-type CommentWithAuthor = typeof commentsSchema.$inferSelect & {authorName: string | null;};@@ -44,6 +38,7 @@ type VideoWithOrganizationInfo = typeof videos.$inferSelect & {sharedOrganizations?: { id: string; name: string }[];hasPassword?: boolean;ownerIsPro?: boolean;+ orgSettings?: OrganizationSettings | null;};interface ShareProps {@@ -53,6 +48,7 @@ interface ShareProps {views: MaybePromise<number>;customDomain: string | null;domainVerified: boolean;+ videoSettings?: OrganizationSettings | null;userOrganizations?: { id: string; name: string }[];initialAiData?: {title?: string | null;@@ -146,6 +142,7 @@ export const Share = ({views,initialAiData,aiGenerationEnabled,+ videoSettings,}: ShareProps) => {const effectiveDate: Date = data.metadata?.customCreatedAt? new Date(data.metadata.customCreatedAt)@@ -271,6 +268,19 @@ export const Share = ({}, 100);}, []);+ const isDisabled = (setting: keyof NonNullable<OrganizationSettings>) =>+ videoSettings?.[setting] ?? data.orgSettings?.[setting] ?? false;++ const areChaptersDisabled = isDisabled("disableChapters");+ const isSummaryDisabled = isDisabled("disableSummary");+ const areCaptionsDisabled = isDisabled("disableCaptions");+ const areCommentStampsDisabled = isDisabled("disableComments");+ const areReactionStampsDisabled = isDisabled("disableReactions");+ const allSettingsDisabled =+ isDisabled("disableComments") &&+ isDisabled("disableSummary") &&+ isDisabled("disableTranscript");+return (<div className="mt-4"><div className="flex flex-col gap-4 lg:flex-row">@@ -281,6 +291,10 @@ export const Share = ({data={{ ...data, transcriptionStatus }}user={user}comments={comments}+ areChaptersDisabled={areChaptersDisabled}+ areCaptionsDisabled={areCaptionsDisabled}+ areCommentStampsDisabled={areCommentStampsDisabled}+ areReactionStampsDisabled={areReactionStampsDisabled}chapters={aiData?.chapters || []}aiProcessing={aiData?.processing || false}ref={playerRef}@@ -297,27 +311,30 @@ export const Share = ({</div></div>- <div className="flex flex-col lg:w-80">- <Sidebar- data={{- ...data,- createdAt: effectiveDate,- transcriptionStatus,- }}- user={user}- commentsData={commentsData}- setCommentsData={setCommentsData}- optimisticComments={optimisticComments}- setOptimisticComments={setOptimisticComments}- handleCommentSuccess={handleCommentSuccess}- views={views}- onSeek={handleSeek}- videoId={data.id}- aiData={aiData}- aiGenerationEnabled={aiGenerationEnabled}- ref={activityRef}- />- </div>+ {!allSettingsDisabled && (+ <div className="flex flex-col lg:w-80">+ <Sidebar+ data={{+ ...data,+ createdAt: effectiveDate,+ transcriptionStatus,+ }}+ videoSettings={videoSettings}+ user={user}+ commentsData={commentsData}+ setCommentsData={setCommentsData}+ optimisticComments={optimisticComments}+ setOptimisticComments={setOptimisticComments}+ handleCommentSuccess={handleCommentSuccess}+ views={views}+ onSeek={handleSeek}+ videoId={data.id}+ aiData={aiData}+ aiGenerationEnabled={aiGenerationEnabled}+ ref={activityRef}+ />+ </div>+ )}</div><div className="hidden mt-4 lg:block">@@ -325,6 +342,10 @@ export const Share = ({<ToolbaronOptimisticComment={handleOptimisticComment}onCommentSuccess={handleCommentSuccess}+ disableReactions={+ videoSettings?.disableReactions ??+ data.orgSettings?.disableReactions+ }data={data}user={user}/>@@ -364,45 +385,13 @@ export const Share = ({</div>)}- {!aiLoading &&- (aiData?.summary ||- (aiData?.chapters && aiData.chapters.length > 0)) && (- <div className="p-4 bg-white rounded-2xl border border-gray-3">- {aiData?.summary && (- <>- <h3 className="text-lg font-medium">Summary</h3>- <div className="mb-2">- <span className="text-xs font-semibold text-gray-8">- Generated by Cap AI- </span>- </div>- <p className="text-sm whitespace-pre-wrap">- {aiData.summary}- </p>- </>- )}-- {aiData?.chapters && aiData.chapters.length > 0 && (- <div className={aiData?.summary ? "mt-6" : ""}>- <h3 className="mb-2 text-lg font-medium">Chapters</h3>- <div className="divide-y">- {aiData.chapters.map((chapter) => (- <div- key={chapter.start}- className="flex items-center p-2 rounded transition-colors cursor-pointer hover:bg-gray-100"- onClick={() => handleSeek(chapter.start)}- >- <span className="w-16 text-xs text-gray-500">- {formatTime(chapter.start)}- </span>- <span className="ml-2 text-sm">{chapter.title}</span>- </div>- ))}- </div>- </div>- )}- </div>- )}+ <SummaryChapters+ isSummaryDisabled={isSummaryDisabled}+ areChaptersDisabled={areChaptersDisabled}+ handleSeek={handleSeek}+ aiData={aiData}+ aiLoading={aiLoading}+ /></div></div>);diff --git a/apps/web/app/s/[videoId]/_components/CapVideoPlayer.tsx b/apps/web/app/s/[videoId]/_components/CapVideoPlayer.tsxindex 957413a85..84c70eb08 100644--- a/apps/web/app/s/[videoId]/_components/CapVideoPlayer.tsx+++ b/apps/web/app/s/[videoId]/_components/CapVideoPlayer.tsx@@ -35,11 +35,14 @@ interface Props {videoId: Video.VideoId;chaptersSrc: string;captionsSrc: string;+ disableCaptions?: boolean;videoRef: React.RefObject<HTMLVideoElement | null>;mediaPlayerClassName?: string;autoplay?: boolean;enableCrossOrigin?: boolean;hasActiveUpload: boolean | undefined;+ disableCommentStamps?: boolean;+ disableReactionStamps?: boolean;comments?: Array<{id: string;timestamp: number | null;@@ -55,12 +58,15 @@ export function CapVideoPlayer({videoId,chaptersSrc,captionsSrc,+ disableCaptions,videoRef,mediaPlayerClassName,autoplay = false,enableCrossOrigin = false,hasActiveUpload,comments = [],+ disableCommentStamps = false,+ disableReactionStamps = false,onSeek,}: Props) {const [currentCue, setCurrentCue] = useState<string>("");@@ -610,11 +616,17 @@ export function CapVideoPlayer({{mainControlsVisible &&markersReady &&- comments- .filter(- (comment) => comment && comment.timestamp !== null && comment.id,- )- .map((comment) => {+ (() => {+ const filteredComments = comments.filter(+ (comment) =>+ comment &&+ comment.timestamp !== null &&+ comment.id &&+ !(disableCommentStamps && comment.type === "text") &&+ !(disableReactionStamps && comment.type === "emoji"),+ );++ return filteredComments.map((comment) => {const position = (Number(comment.timestamp) / duration) * 100;const containerPadding = 20;const availableWidth = `calc(100% - ${containerPadding * 2}px)`;@@ -631,7 +643,8 @@ export function CapVideoPlayer({hoveredComment={hoveredComment}/>);- })}+ });+ })()}<MediaPlayerControlsclassName="flex-col items-start gap-2.5"@@ -655,10 +668,12 @@ export function CapVideoPlayer({<MediaPlayerTime /></div><div className="flex gap-2 items-center">- <MediaPlayerCaptions- setToggleCaptions={setToggleCaptions}- toggleCaptions={toggleCaptions}- />+ {!disableCaptions && (+ <MediaPlayerCaptions+ setToggleCaptions={setToggleCaptions}+ toggleCaptions={toggleCaptions}+ />+ )}<MediaPlayerSettings /><MediaPlayerPiP /><MediaPlayerFullscreen />diff --git a/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx b/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsxindex f0f8ecec8..eebe6c296 100644--- a/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx+++ b/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx@@ -37,6 +37,7 @@ interface Props {captionsSrc: string;videoRef: React.RefObject<HTMLVideoElement | null>;mediaPlayerClassName?: string;+ disableCaptions?: boolean;autoplay?: boolean;hasActiveUpload?: boolean;}@@ -50,6 +51,7 @@ export function HLSVideoPlayer({mediaPlayerClassName,autoplay = false,hasActiveUpload,+ disableCaptions,}: Props) {const hlsInstance = useRef<Hls | null>(null);const [currentCue, setCurrentCue] = useState<string>("");@@ -58,18 +60,6 @@ export function HLSVideoPlayer({const [showPlayButton, setShowPlayButton] = useState(false);const [videoLoaded, setVideoLoaded] = useState(false);const [hasPlayedOnce, setHasPlayedOnce] = useState(false);- const [isMobile, setIsMobile] = useState(false);-- useEffect(() => {- const checkMobile = () => {- setIsMobile(window.innerWidth < 640);- };-- checkMobile();- window.addEventListener("resize", checkMobile);-- return () => window.removeEventListener("resize", checkMobile);- }, []);useEffect(() => {const video = videoRef.current;@@ -368,8 +358,15 @@ export function HLSVideoPlayer({playsInlineautoPlay={autoplay}>- <track default kind="chapters" src={chaptersSrc} />- <track label="English" kind="captions" srcLang="en" src={captionsSrc} />+ {chaptersSrc && <track default kind="chapters" src={chaptersSrc} />}+ {captionsSrc && (+ <track+ label="English"+ kind="captions"+ srcLang="en"+ src={captionsSrc}+ />+ )}</MediaPlayerVideo>{currentCue && toggleCaptions && (<div@@ -402,10 +399,12 @@ export function HLSVideoPlayer({<MediaPlayerTime /></div><div className="flex gap-2 items-center">- <MediaPlayerCaptions- setToggleCaptions={setToggleCaptions}- toggleCaptions={toggleCaptions}- />+ {!disableCaptions && (+ <MediaPlayerCaptions+ setToggleCaptions={setToggleCaptions}+ toggleCaptions={toggleCaptions}+ />+ )}<MediaPlayerSettings /><MediaPlayerPiP /><MediaPlayerFullscreen />diff --git a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx b/apps/web/app/s/[videoId]/_components/ShareVideo.tsxindex 30e0b7856..0b8a6ef6c 100644--- a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx+++ b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx@@ -10,6 +10,7 @@ import {useRef,useState,} from "react";+import type { OrganizationSettings } from "@/app/(org)/dashboard/dashboard-data";import { UpgradeModal } from "@/components/UpgradeModal";import { CapVideoPlayer } from "./CapVideoPlayer";import { HLSVideoPlayer } from "./HLSVideoPlayer";@@ -36,194 +37,216 @@ export const ShareVideo = forwardRef<data: typeof videos.$inferSelect & {ownerIsPro?: boolean;hasActiveUpload?: boolean;+ orgSettings?: OrganizationSettings | null;};user: typeof userSelectProps | null;comments: MaybePromise<CommentWithAuthor[]>;chapters?: { title: string; start: number }[];+ areChaptersDisabled?: boolean;+ areCaptionsDisabled?: boolean;+ areCommentStampsDisabled?: boolean;+ areReactionStampsDisabled?: boolean;aiProcessing?: boolean;}->(({ data, comments, chapters = [] }, ref) => {- const videoRef = useRef<HTMLVideoElement | null>(null);- useImperativeHandle(ref, () => videoRef.current as HTMLVideoElement, []);-- const [upgradeModalOpen, setUpgradeModalOpen] = useState(false);- const [transcriptData, setTranscriptData] = useState<TranscriptEntry[]>([]);- const [subtitleUrl, setSubtitleUrl] = useState<string | null>(null);- const [chaptersUrl, setChaptersUrl] = useState<string | null>(null);- const [commentsData, setCommentsData] = useState<CommentWithAuthor[]>([]);-- const { data: transcriptContent, error: transcriptError } = useTranscript(- data.id,- data.transcriptionStatus,- );-- // Handle comments data- useEffect(() => {- if (comments) {- if (Array.isArray(comments)) {- setCommentsData(comments);- } else {- comments.then(setCommentsData);+>(+ (+ {+ data,+ comments,+ chapters = [],+ areCaptionsDisabled,+ areChaptersDisabled,+ areCommentStampsDisabled,+ areReactionStampsDisabled,+ },+ ref,+ ) => {+ const videoRef = useRef<HTMLVideoElement | null>(null);+ useImperativeHandle(ref, () => videoRef.current as HTMLVideoElement, []);++ const [upgradeModalOpen, setUpgradeModalOpen] = useState(false);+ const [transcriptData, setTranscriptData] = useState<TranscriptEntry[]>([]);+ const [subtitleUrl, setSubtitleUrl] = useState<string | null>(null);+ const [chaptersUrl, setChaptersUrl] = useState<string | null>(null);+ const [commentsData, setCommentsData] = useState<CommentWithAuthor[]>([]);++ const { data: transcriptContent, error: transcriptError } = useTranscript(+ data.id,+ data.transcriptionStatus,+ );++ // Handle comments data+ useEffect(() => {+ if (comments) {+ if (Array.isArray(comments)) {+ setCommentsData(comments);+ } else {+ comments.then(setCommentsData);+ }}- }- }, [comments]);-- // Handle seek functionality- const handleSeek = (time: number) => {- if (videoRef.current) {- videoRef.current.currentTime = time;- }- };-- useEffect(() => {- if (transcriptContent) {- const parsed = parseVTT(transcriptContent);- setTranscriptData(parsed);- } else if (transcriptError) {- console.error(- "[Transcript] Transcript error from React Query:",- transcriptError.message,- );- }- }, [transcriptContent, transcriptError]);-- // Handle subtitle URL creation- useEffect(() => {- if (- data.transcriptionStatus === "COMPLETE" &&- transcriptData &&- transcriptData.length > 0- ) {- const vttContent = formatTranscriptAsVTT(transcriptData);- const blob = new Blob([vttContent], { type: "text/vtt" });- const newUrl = URL.createObjectURL(blob);+ }, [comments]);- // Clean up previous URL- if (subtitleUrl) {- URL.revokeObjectURL(subtitleUrl);+ // Handle seek functionality+ const handleSeek = (time: number) => {+ if (videoRef.current) {+ videoRef.current.currentTime = time;}+ };- setSubtitleUrl(newUrl);-- return () => {- URL.revokeObjectURL(newUrl);- };- } else {- // Clean up if no longer needed- if (subtitleUrl) {- URL.revokeObjectURL(subtitleUrl);- setSubtitleUrl(null);+ useEffect(() => {+ if (transcriptContent) {+ const parsed = parseVTT(transcriptContent);+ setTranscriptData(parsed);+ } else if (transcriptError) {+ console.error(+ "[Transcript] Transcript error from React Query:",+ transcriptError.message,+ );}- }- }, [data.transcriptionStatus, transcriptData]);-- // Handle chapters URL creation- useEffect(() => {- if (chapters?.length > 0) {- const vttContent = formatChaptersAsVTT(chapters);- const blob = new Blob([vttContent], { type: "text/vtt" });- const newUrl = URL.createObjectURL(blob);-- // Clean up previous URL- if (chaptersUrl) {- URL.revokeObjectURL(chaptersUrl);+ }, [transcriptContent, transcriptError]);++ // Handle subtitle URL creation+ useEffect(() => {+ if (+ data.transcriptionStatus === "COMPLETE" &&+ transcriptData &&+ transcriptData.length > 0+ ) {+ const vttContent = formatTranscriptAsVTT(transcriptData);+ const blob = new Blob([vttContent], { type: "text/vtt" });+ const newUrl = URL.createObjectURL(blob);++ // Clean up previous URL+ if (subtitleUrl) {+ URL.revokeObjectURL(subtitleUrl);+ }++ setSubtitleUrl(newUrl);++ return () => {+ URL.revokeObjectURL(newUrl);+ };+ } else {+ // Clean up if no longer needed+ if (subtitleUrl) {+ URL.revokeObjectURL(subtitleUrl);+ setSubtitleUrl(null);+ }}+ }, [data.transcriptionStatus, transcriptData]);- setChaptersUrl(newUrl);+ // Handle chapters URL creation+ useEffect(() => {+ if (chapters?.length > 0) {+ const vttContent = formatChaptersAsVTT(chapters);+ const blob = new Blob([vttContent], { type: "text/vtt" });+ const newUrl = URL.createObjectURL(blob);- return () => {- URL.revokeObjectURL(newUrl);- };- } else {- // Clean up if no longer needed- if (chaptersUrl) {- URL.revokeObjectURL(chaptersUrl);- setChaptersUrl(null);+ // Clean up previous URL+ if (chaptersUrl) {+ URL.revokeObjectURL(chaptersUrl);+ }++ setChaptersUrl(newUrl);++ return () => {+ URL.revokeObjectURL(newUrl);+ };+ } else {+ // Clean up if no longer needed+ if (chaptersUrl) {+ URL.revokeObjectURL(chaptersUrl);+ setChaptersUrl(null);+ }}+ }, [chapters]);++ let videoSrc: string;+ let enableCrossOrigin = false;++ if (data.source.type === "desktopMP4") {+ videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=mp4`;+ // Start with CORS enabled for desktopMP4, but CapVideoPlayer will dynamically disable if needed+ enableCrossOrigin = true;+ } else if (+ NODE_ENV === "development" ||+ ((data.skipProcessing === true || data.jobStatus !== "COMPLETE") &&+ data.source.type === "MediaConvert")+ ) {+ videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=master`;+ } else if (data.source.type === "MediaConvert") {+ videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=video`;+ } else {+ videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=video`;}- }, [chapters]);-- let videoSrc: string;- let enableCrossOrigin = false;-- if (data.source.type === "desktopMP4") {- videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=mp4`;- // Start with CORS enabled for desktopMP4, but CapVideoPlayer will dynamically disable if needed- enableCrossOrigin = true;- } else if (- NODE_ENV === "development" ||- ((data.skipProcessing === true || data.jobStatus !== "COMPLETE") &&- data.source.type === "MediaConvert")- ) {- videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=master`;- } else if (data.source.type === "MediaConvert") {- videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=video`;- } else {- videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=video`;- }- return (- <>- <div className="relative h-full">- {data.source.type === "desktopMP4" ? (- <CapVideoPlayer- videoId={data.id}- mediaPlayerClassName="w-full h-full max-w-full max-h-full rounded-xl"- videoSrc={videoSrc}- chaptersSrc={chaptersUrl || ""}- captionsSrc={subtitleUrl || ""}- videoRef={videoRef}- enableCrossOrigin={enableCrossOrigin}- hasActiveUpload={data.hasActiveUpload}- comments={commentsData.map((comment) => ({- id: comment.id,- type: comment.type,- timestamp: comment.timestamp,- content: comment.content,- authorName: comment.authorName,- }))}- onSeek={handleSeek}- />- ) : (- <HLSVideoPlayer- videoId={data.id}- mediaPlayerClassName="w-full h-full max-w-full max-h-full rounded-xl"- videoSrc={videoSrc}- chaptersSrc={chaptersUrl || ""}- captionsSrc={subtitleUrl || ""}- videoRef={videoRef}- hasActiveUpload={data.hasActiveUpload}- />- )}- </div>-- {!data.ownerIsPro && (- <div className="absolute top-4 left-4 z-30">- <div- className="block cursor-pointer"- onClick={(e) => {- e.stopPropagation();- setUpgradeModalOpen(true);- }}- >- <div className="relative">- <div className="opacity-50 transition-opacity hover:opacity-100 peer">- <Logo className="w-auto h-4 sm:h-8" white={true} />- </div>+ return (+ <>+ <div className="relative h-full">+ {data.source.type === "desktopMP4" ? (+ <CapVideoPlayer+ videoId={data.id}+ mediaPlayerClassName="w-full h-full max-w-full max-h-full rounded-xl"+ videoSrc={videoSrc}+ disableCaptions={areCaptionsDisabled ?? false}+ disableCommentStamps={areCommentStampsDisabled ?? false}+ disableReactionStamps={areReactionStampsDisabled ?? false}+ chaptersSrc={areChaptersDisabled ? "" : chaptersUrl || ""}+ captionsSrc={areCaptionsDisabled ? "" : subtitleUrl || ""}+ videoRef={videoRef}+ enableCrossOrigin={enableCrossOrigin}+ hasActiveUpload={data.hasActiveUpload}+ comments={commentsData.map((comment) => ({+ id: comment.id,+ type: comment.type,+ timestamp: comment.timestamp,+ content: comment.content,+ authorName: comment.authorName,+ }))}+ onSeek={handleSeek}+ />+ ) : (+ <HLSVideoPlayer+ videoId={data.id}+ mediaPlayerClassName="w-full h-full max-w-full max-h-full rounded-xl"+ videoSrc={videoSrc}+ disableCaptions={areCaptionsDisabled ?? false}+ chaptersSrc={areChaptersDisabled ? "" : chaptersUrl || ""}+ captionsSrc={areCaptionsDisabled ? "" : subtitleUrl || ""}+ videoRef={videoRef}+ hasActiveUpload={data.hasActiveUpload}+ />+ )}+ </div>- <div className="absolute left-0 top-8 transition-transform duration-300 ease-in-out origin-top scale-y-0 peer-hover:scale-y-100">- <p className="text-white text-xs font-medium whitespace-nowrap bg-black bg-opacity-50 px-2 py-0.5 rounded">- Remove watermark- </p>+ {!data.ownerIsPro && (+ <div className="absolute top-4 left-4 z-30">+ <div+ className="block cursor-pointer"+ onClick={(e) => {+ e.stopPropagation();+ setUpgradeModalOpen(true);+ }}+ >+ <div className="relative">+ <div className="opacity-50 transition-opacity hover:opacity-100 peer">+ <Logo className="w-auto h-4 sm:h-8" white={true} />+ </div>++ <div className="absolute left-0 top-8 transition-transform duration-300 ease-in-out origin-top scale-y-0 peer-hover:scale-y-100">+ <p className="text-white text-xs font-medium whitespace-nowrap bg-black bg-opacity-50 px-2 py-0.5 rounded">+ Remove watermark+ </p>+ </div></div></div></div>- </div>- )}- <UpgradeModal- open={upgradeModalOpen}- onOpenChange={setUpgradeModalOpen}- />- </>- );-});+ )}+ <UpgradeModal+ open={upgradeModalOpen}+ onOpenChange={setUpgradeModalOpen}+ />+ </>+ );+ },+);diff --git a/apps/web/app/s/[videoId]/_components/Sidebar.tsx b/apps/web/app/s/[videoId]/_components/Sidebar.tsxindex bb806ff7b..b3e15dac6 100644--- a/apps/web/app/s/[videoId]/_components/Sidebar.tsx+++ b/apps/web/app/s/[videoId]/_components/Sidebar.tsx@@ -2,8 +2,10 @@ import type { userSelectProps } from "@cap/database/auth/session";import type { comments as commentsSchema, videos } from "@cap/database/schema";import { classNames } from "@cap/utils";import type { Video } from "@cap/web-domain";+import clsx from "clsx";import { AnimatePresence, motion } from "framer-motion";import { forwardRef, Suspense, useState } from "react";+import type { OrganizationSettings } from "@/app/(org)/dashboard/dashboard-data";import { Activity } from "./tabs/Activity";import { Settings } from "./tabs/Settings";import { Summary } from "./tabs/Summary";@@ -18,6 +20,7 @@ type CommentType = typeof commentsSchema.$inferSelect & {type VideoWithOrganizationInfo = typeof videos.$inferSelect & {organizationMembers?: string[];organizationId?: string;+ orgSettings?: OrganizationSettings | null;};interface SidebarProps {@@ -30,6 +33,7 @@ interface SidebarProps {setCommentsData: React.Dispatch<React.SetStateAction<CommentType[]>>;views: MaybePromise<number>;onSeek?: (time: number) => void;+ videoSettings?: OrganizationSettings | null;videoId: Video.VideoId;aiData?: {title?: string | null;@@ -75,6 +79,7 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(handleCommentSuccess,setOptimisticComments,views,+ videoSettings,onSeek,videoId,aiData,@@ -88,16 +93,42 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(data.organizationMembers?.includes(user?.id ?? "")),);- const [activeTab, setActiveTab] = useState<TabType>("activity");- const [[page, direction], setPage] = useState([0, 0]);+ const defaultTab = !(+ videoSettings?.disableComments ?? data.orgSettings?.disableComments+ )+ ? "activity"+ : !(videoSettings?.disableSummary ?? data.orgSettings?.disableSummary)+ ? "summary"+ : !(+ videoSettings?.disableTranscript ??+ data.orgSettings?.disableTranscript+ )+ ? "transcript"+ : "activity";- const hasExistingAiData =- aiData?.summary || (aiData?.chapters && aiData.chapters.length > 0);+ const [activeTab, setActiveTab] = useState<TabType>(defaultTab);+ const [[page, direction], setPage] = useState([0, 0]);const tabs = [- { id: "activity", label: "Comments" },- { id: "summary", label: "Summary" },- { id: "transcript", label: "Transcript" },+ {+ id: "activity",+ label: "Comments",+ disabled:+ videoSettings?.disableComments ?? data.orgSettings?.disableComments,+ },+ {+ id: "summary",+ label: "Summary",+ disabled:+ videoSettings?.disableSummary ?? data.orgSettings?.disableSummary,+ },+ {+ id: "transcript",+ label: "Transcript",+ disabled:+ videoSettings?.disableTranscript ??+ data.orgSettings?.disableTranscript,+ },];const paginate = (tabId: TabType) => {@@ -125,6 +156,11 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(ref={ref}views={views}comments={commentsData}+ commentsDisabled={+ videoSettings?.disableComments ??+ data.orgSettings?.disableComments ??+ false+ }setComments={setCommentsData}user={user}optimisticComments={optimisticComments}@@ -141,6 +177,7 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(<SummaryvideoId={videoId}onSeek={onSeek}+ isSummaryDisabled={videoSettings?.disableSummary}initialAiData={aiData || undefined}aiGenerationEnabled={aiGenerationEnabled}user={user}@@ -155,42 +192,52 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(}};+ const allTabsDisabled = tabs.every((tab) => tab.disabled);+return (<div className="bg-white rounded-2xl border border-gray-5 overflow-hidden h-[calc(100vh-16rem)] lg:h-full flex flex-col lg:aspect-video"><div className="flex-none">- <div className="flex border-b border-gray-5">- {tabs.map((tab) => (- <button- key={tab.id}- onClick={() => paginate(tab.id as TabType)}- className={classNames(- "flex-1 px-5 py-3 text-sm font-medium relative transition-colors duration-200",- "hover:bg-gray-1",- activeTab === tab.id ? "bg-gray-3" : "",- )}- >- <span+ <div+ className={clsx(+ "flex border-b border-gray-5",+ allTabsDisabled && "hidden",+ )}+ >+ {tabs+ .filter((tab) => !tab.disabled)+ .map((tab) => (+ <button+ type="button"+ key={tab.id}+ onClick={() => paginate(tab.id as TabType)}className={classNames(- "relative z-10 text-sm",- activeTab === tab.id ? "text-gray-12" : "text-gray-9",+ "flex-1 px-5 py-3 text-sm font-medium relative transition-colors duration-200",+ "hover:bg-gray-1",+ activeTab === tab.id ? "bg-gray-3" : "",)}>- {tab.label}- </span>- {activeTab === tab.id && (- <motion.div- layoutId="activeTab"- className="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-500"- initial={false}- transition={{- type: "spring",- stiffness: 500,- damping: 30,- }}- />- )}- </button>- ))}+ <span+ className={classNames(+ "relative z-10 text-sm",+ activeTab === tab.id ? "text-gray-12" : "text-gray-9",+ )}+ >+ {tab.label}+ </span>+ {activeTab === tab.id && (+ <motion.div+ layoutId="activeTab"+ className="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-500"+ initial={false}+ transition={{+ type: "spring",+ stiffness: 500,+ damping: 30,+ }}+ />+ )}+ </button>+ ))}</div></div><div className="flex-1 min-h-0">diff --git a/apps/web/app/s/[videoId]/_components/SummaryChapters.tsx b/apps/web/app/s/[videoId]/_components/SummaryChapters.tsxnew file mode 100644index 000000000..bf7673c04--- /dev/null+++ b/apps/web/app/s/[videoId]/_components/SummaryChapters.tsx@@ -0,0 +1,73 @@+import { formatTimeMinutes } from "./utils/transcript-utils";++interface SummaryChaptersProps {+ isSummaryDisabled: boolean;+ areChaptersDisabled: boolean;+ handleSeek: (time: number) => void;+ aiData: {+ title: string | null;+ summary: string | null;+ chapters:+ | {+ title: string;+ start: number;+ }[]+ | null;+ processing: boolean;+ };+ aiLoading: boolean;+}++const SummaryChapters = ({+ isSummaryDisabled,+ areChaptersDisabled,+ handleSeek,+ aiData,+ aiLoading,+}: SummaryChaptersProps) => {+ const hasSummary = !isSummaryDisabled && !!aiData?.summary;+ const hasChapters =+ !areChaptersDisabled &&+ Array.isArray(aiData?.chapters) &&+ aiData.chapters.length > 0;++ if (aiLoading || (!hasSummary && !hasChapters)) return null;++ return (+ <div className="p-4 bg-white rounded-2xl border border-gray-3">+ {hasSummary && (+ <>+ <h3 className="text-lg font-medium">Summary</h3>+ <div className="mb-2">+ <span className="text-xs font-semibold text-gray-8">+ Generated by Cap AI+ </span>+ </div>+ <p className="text-sm whitespace-pre-wrap">{aiData.summary}</p>+ </>+ )}++ {hasChapters && (+ <div className={hasSummary ? "mt-6" : ""}>+ <h3 className="mb-2 text-lg font-medium">Chapters</h3>+ <div className="divide-y">+ {aiData.chapters?.map((chapter) => (+ <div+ key={chapter.start}+ className="flex items-center p-2 rounded transition-colors cursor-pointer hover:bg-gray-100"+ onClick={() => handleSeek(chapter.start)}+ >+ <span className="w-16 text-xs text-gray-500">+ {formatTimeMinutes(chapter.start)}+ </span>+ <span className="ml-2 text-sm">{chapter.title}</span>+ </div>+ ))}+ </div>+ </div>+ )}+ </div>+ );+};++export default SummaryChapters;diff --git a/apps/web/app/s/[videoId]/_components/Toolbar.tsx b/apps/web/app/s/[videoId]/_components/Toolbar.tsxindex db222c4bd..11e433613 100644--- a/apps/web/app/s/[videoId]/_components/Toolbar.tsx+++ b/apps/web/app/s/[videoId]/_components/Toolbar.tsx@@ -4,6 +4,7 @@ import { Button } from "@cap/ui";import { AnimatePresence, motion } from "motion/react";import { startTransition, useEffect, useState } from "react";import { newComment } from "@/actions/videos/new-comment";+import type { OrganizationSettings } from "@/app/(org)/dashboard/dashboard-data";import type { CommentType } from "../Share";import { AuthOverlay } from "./AuthOverlay";@@ -11,10 +12,13 @@ const MotionButton = motion.create(Button);// million-ignoreinterface ToolbarProps {- data: typeof videos.$inferSelect;+ data: typeof videos.$inferSelect & {+ orgSettings?: OrganizationSettings | null;+ };user: typeof userSelectProps | null;onOptimisticComment?: (comment: CommentType) => void;onCommentSuccess?: (comment: CommentType) => void;+ disableReactions?: boolean;}export const Toolbar = ({@@ -22,6 +26,7 @@ export const Toolbar = ({user,onOptimisticComment,onCommentSuccess,+ disableReactions,}: ToolbarProps) => {const [commentBoxOpen, setCommentBoxOpen] = useState(false);const [comment, setComment] = useState("");@@ -168,6 +173,10 @@ export const Toolbar = ({setCommentBoxOpen(true);};+ if (disableReactions) {+ return null;+ }+return (<><motion.divdiff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsxindex 03153a3b3..e636bb2de 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx@@ -1,6 +1,8 @@import type { userSelectProps } from "@cap/database/auth/session";import { Button } from "@cap/ui";import type { Video } from "@cap/web-domain";+import { faCommentSlash } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { useSearchParams } from "next/navigation";import type React from "react";import {@@ -33,6 +35,7 @@ export const Comments = Object.assign(handleCommentSuccess: (comment: CommentType) => void;onSeek?: (time: number) => void;setShowAuthOverlay: (v: boolean) => void;+ commentsDisabled: boolean;}>((props, ref) => {const {@@ -41,6 +44,7 @@ export const Comments = Object.assign(setComments,handleCommentSuccess,onSeek,+ commentsDisabled,} = props;const commentParams = useSearchParams().get("comment");const replyParams = useSearchParams().get("reply");@@ -184,12 +188,22 @@ export const Comments = Object.assign(return (<Comments.Shell- commentInputProps={{ onSubmit: handleNewComment }}+ commentInputProps={{+ onSubmit: handleNewComment,+ disabled: commentsDisabled,+ }}setShowAuthOverlay={props.setShowAuthOverlay}user={user}commentsContainerRef={commentsContainerRef}>- {rootComments.length === 0 ? (+ {commentsDisabled ? (+ <div className="p-4 space-y-6 h-full">+ <EmptyState+ icon={<FontAwesomeIcon icon={faCommentSlash} />}+ commentsDisabled={commentsDisabled}+ />+ </div>+ ) : rootComments.length === 0 ? (<EmptyState />) : (<div className="p-4 space-y-6">@@ -238,24 +252,26 @@ export const Comments = Object.assign({props.children}</div>- <div className="flex-none p-2 border-t border-gray-5 bg-gray-2">- {props.user ? (- <CommentInput- {...props.commentInputProps}- placeholder="Leave a comment"- buttonLabel="Comment"- user={props.user}- />- ) : (- <Button- className="min-w-full"- variant="primary"- onClick={() => props.setShowAuthOverlay(true)}- >- Sign in to leave a comment- </Button>- )}- </div>+ {!props.commentInputProps?.disabled && (+ <div className="flex-none p-2 border-t border-gray-5 bg-gray-2">+ {props.user ? (+ <CommentInput+ {...props.commentInputProps}+ placeholder="Leave a comment"+ buttonLabel="Comment"+ user={props.user}+ />+ ) : (+ <Button+ className="min-w-full"+ variant="primary"+ onClick={() => props.setShowAuthOverlay(true)}+ >+ Sign in to leave a comment+ </Button>+ )}+ </div>+ )}</>),Skeleton: (props: {diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/EmptyState.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/EmptyState.tsxindex 50d4452e2..4d1b09359 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Activity/EmptyState.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/EmptyState.tsx@@ -1,12 +1,30 @@import { LoadingSpinner } from "@cap/ui";+import type { FontAwesomeIconProps } from "@fortawesome/react-fontawesome";+import type { ReactElement } from "react";+import React from "react";-const EmptyState = () => (+const EmptyState = ({+ commentsDisabled,+ icon,+}: {+ commentsDisabled?: boolean;+ icon?: ReactElement<FontAwesomeIconProps>;+}) => (<div className="flex flex-col justify-center items-center p-8 h-full text-center animate-in fade-in">- <div className="space-y-2 text-gray-300">- <LoadingSpinner />- <h3 className="text-sm font-medium text-gray-12">No comments yet</h3>+ {!commentsDisabled && <LoadingSpinner />}+ {icon && (+ <div className="mb-4">+ {React.cloneElement(icon, { className: "text-gray-12 size-8" })}+ </div>+ )}+ <div className="space-y-1">+ <h3 className="text-base font-medium text-gray-12">+ {commentsDisabled ? "Disabled" : "No comments yet"}+ </h3><p className="text-sm text-gray-10">- Be the first to share your thoughts!+ {commentsDisabled+ ? "Comments are disabled for this video"+ : "Be the first to share your thoughts!"}</p></div></div>diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsxindex ef7c6c3d5..c9cce9d03 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx@@ -3,13 +3,7 @@import type { userSelectProps } from "@cap/database/auth/session";import type { Video } from "@cap/web-domain";import type React from "react";-import {- forwardRef,- type JSX,- type RefObject,- Suspense,- useState,-} from "react";+import { forwardRef, type JSX, Suspense, useState } from "react";import { CapCardAnalytics } from "@/app/(org)/dashboard/caps/components/CapCard/CapCardAnalytics";import type { CommentType } from "../../../Share";import { AuthOverlay } from "../../AuthOverlay";@@ -27,6 +21,7 @@ interface ActivityProps {optimisticComments: CommentType[];setOptimisticComments: (newComment: CommentType) => void;isOwnerOrMember: boolean;+ commentsDisabled: boolean;}export const Activity = Object.assign(@@ -41,6 +36,7 @@ export const Activity = Object.assign(optimisticComments,setOptimisticComments,setComments,+ commentsDisabled,...props},ref,@@ -71,6 +67,7 @@ export const Activity = Object.assign(videoId={videoId}setShowAuthOverlay={setShowAuthOverlay}onSeek={props.onSeek}+ commentsDisabled={commentsDisabled}/>)}</Activity.Shell>diff --git a/apps/web/app/s/[videoId]/_components/tabs/Summary.tsx b/apps/web/app/s/[videoId]/_components/tabs/Summary.tsxindex 3127b249e..8dc2bc6ec 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Summary.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Summary.tsx@@ -3,6 +3,8 @@import type { userSelectProps } from "@cap/database/auth/session";import { Button } from "@cap/ui";import { userIsPro } from "@cap/utils";+import { faRectangleList } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { useEffect, useState } from "react";interface Chapter {@@ -21,6 +23,7 @@ interface SummaryProps {};aiGenerationEnabled?: boolean;user: typeof userSelectProps | null;+ isSummaryDisabled?: boolean;}const formatTime = (time: number) => {@@ -34,24 +37,24 @@ const formatTime = (time: number) => {const SkeletonLoader = () => (<div className="p-4 space-y-6 animate-pulse"><div>- <div className="h-6 w-24 bg-gray-200 rounded mb-3"></div>- <div className="h-3 w-32 bg-gray-100 rounded mb-4"></div>+ <div className="mb-3 w-24 h-6 bg-gray-200 rounded"></div>+ <div className="mb-4 w-32 h-3 bg-gray-100 rounded"></div><div className="space-y-3">- <div className="h-4 bg-gray-200 rounded w-full"></div>- <div className="h-4 bg-gray-200 rounded w-5/6"></div>- <div className="h-4 bg-gray-200 rounded w-4/5"></div>- <div className="h-4 bg-gray-200 rounded w-full"></div>- <div className="h-4 bg-gray-200 rounded w-3/4"></div>+ <div className="w-full h-4 bg-gray-200 rounded"></div>+ <div className="w-5/6 h-4 bg-gray-200 rounded"></div>+ <div className="w-4/5 h-4 bg-gray-200 rounded"></div>+ <div className="w-full h-4 bg-gray-200 rounded"></div>+ <div className="w-3/4 h-4 bg-gray-200 rounded"></div></div></div><div>- <div className="h-6 w-24 bg-gray-200 rounded mb-4"></div>+ <div className="mb-4 w-24 h-6 bg-gray-200 rounded"></div><div className="space-y-2">{[1, 2, 3, 4].map((i) => (<div key={i} className="flex items-center p-2">- <div className="h-4 w-12 bg-gray-200 rounded mr-3"></div>- <div className="h-4 bg-gray-200 rounded flex-1"></div>+ <div className="mr-3 w-12 h-4 bg-gray-200 rounded"></div>+ <div className="flex-1 h-4 bg-gray-200 rounded"></div></div>))}</div>@@ -62,6 +65,7 @@ const SkeletonLoader = () => (export const Summary: React.FC<SummaryProps> = ({onSeek,initialAiData,+ isSummaryDisabled = false,aiGenerationEnabled = false,user,}) => {@@ -100,8 +104,8 @@ export const Summary: React.FC<SummaryProps> = ({return (<div className="flex flex-col justify-center items-center p-8 h-full text-center"><div className="space-y-4 max-w-sm">- <div className="bg-gradient-to-br from-blue-50 to-purple-50 p-6 rounded-lg border border-blue-100">- <div className="text-blue-600 mb-3">+ <div className="p-6 bg-gradient-to-br from-blue-50 to-purple-50 rounded-lg border border-blue-100">+ <div className="mb-3 text-blue-600"><svgxmlns="http://www.w3.org/2000/svg"className="mx-auto w-12 h-12"@@ -117,10 +121,10 @@ export const Summary: React.FC<SummaryProps> = ({/></svg></div>- <h3 className="text-lg font-semibold text-gray-900 mb-2">+ <h3 className="mb-2 text-lg font-semibold text-gray-900">Unlock Cap AI</h3>- <p className="text-sm text-gray-600 mb-4 leading-relaxed">+ <p className="mb-4 text-sm leading-relaxed text-gray-600">Upgrade to Cap Pro to access AI-powered features includingautomatic titles, video summaries, and intelligent chaptergeneration.@@ -139,6 +143,8 @@ export const Summary: React.FC<SummaryProps> = ({);}+ if (isSummaryDisabled) return null;+if (isLoading || aiData?.processing) {return (<div className="flex flex-col h-full">@@ -152,22 +158,12 @@ export const Summary: React.FC<SummaryProps> = ({if (!aiData?.summary && (!aiData?.chapters || aiData.chapters.length === 0)) {return (<div className="flex flex-col justify-center items-center p-8 h-full text-center">- <div className="space-y-2 text-gray-300">- <svg- xmlns="http://www.w3.org/2000/svg"- className="mx-auto w-8 h-8"- fill="none"- viewBox="0 0 24 24"- stroke="currentColor"- >- <path- strokeLinecap="round"- strokeLinejoin="round"- strokeWidth={1.5}- d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"- />- </svg>- <h3 className="text-sm font-medium text-gray-12">+ <FontAwesomeIcon+ icon={faRectangleList}+ className="mb-4 text-gray-12 size-8"+ />+ <div className="space-y-1">+ <h3 className="text-base font-medium text-gray-12">No summary available</h3><p className="text-sm text-gray-10">@@ -203,10 +199,10 @@ export const Summary: React.FC<SummaryProps> = ({{aiData.chapters.map((chapter) => (<divkey={chapter.start}- className="p-2 cursor-pointer hover:bg-gray-100 rounded transition-colors flex items-center"+ className="flex items-center p-2 rounded transition-colors cursor-pointer hover:bg-gray-100"onClick={() => handleSeek(chapter.start)}>- <span className="text-xs text-gray-500 w-16">+ <span className="w-16 text-xs text-gray-500">{formatTime(chapter.start)}</span><span className="ml-2 text-sm">{chapter.title}</span>diff --git a/apps/web/app/s/[videoId]/_components/utils/transcript-utils.ts b/apps/web/app/s/[videoId]/_components/utils/transcript-utils.tsindex dba8952c5..d24b1cd5b 100644--- a/apps/web/app/s/[videoId]/_components/utils/transcript-utils.ts+++ b/apps/web/app/s/[videoId]/_components/utils/transcript-utils.ts@@ -20,6 +20,14 @@ export const formatTime = (seconds: number): string => {.padStart(3, "0")}`;};+export const formatTimeMinutes = (time: number) => {+ const minutes = Math.floor(time / 60);+ const seconds = Math.floor(time % 60);+ return `${minutes.toString().padStart(2, "0")}:${seconds+ .toString()+ .padStart(2, "0")}`;+};+/*** Formats transcript entries as VTT format for subtitles*/diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsxindex be76d9dca..246736232 100644--- a/apps/web/app/s/[videoId]/page.tsx+++ b/apps/web/app/s/[videoId]/page.tsx@@ -25,7 +25,10 @@ import Link from "next/link";import { notFound } from "next/navigation";import { generateAiMetadata } from "@/actions/videos/generate-ai-metadata";import { getVideoAnalytics } from "@/actions/videos/get-analytics";-import { getDashboardData } from "@/app/(org)/dashboard/dashboard-data";+import {+ getDashboardData,+ type OrganizationSettings,+} from "@/app/(org)/dashboard/dashboard-data";import { createNotification } from "@/lib/Notification";import * as EffectRuntime from "@/lib/server";import { transcribeVideo } from "@/lib/transcribe";@@ -91,11 +94,6 @@ async function getSharedSpacesForVideo(videoId: Video.VideoId) {return sharedSpaces;}-type Props = {- params: Promise<{ [key: string]: string | string[] | undefined }>;- searchParams: Promise<{ [key: string]: string | string[] | undefined }>;-};-type VideoWithOrganization = typeof videos.$inferSelect & {sharedOrganization?: {organizationId: string;@@ -106,6 +104,7 @@ type VideoWithOrganization = typeof videos.$inferSelect & {password?: string | null;hasPassword?: boolean;ownerIsPro?: boolean;+ orgSettings?: OrganizationSettings | null;};const ALLOWED_REFERRERS = [@@ -282,6 +281,7 @@ export default async function ShareVideoPage(props: PageProps<"/s/[videoId]">) {skipProcessing: videos.skipProcessing,transcriptionStatus: videos.transcriptionStatus,source: videos.source,+ videoSettings: videos.settings,width: videos.width,height: videos.height,duration: videos.duration,@@ -290,6 +290,7 @@ export default async function ShareVideoPage(props: PageProps<"/s/[videoId]">) {sharedOrganization: {organizationId: sharedVideos.organizationId,},+ orgSettings: organizations.settings,ownerIsPro:sql`${users.stripeSubscriptionStatus} IN ('active','trialing','complete','paid') OR ${users.thirdPartyStripeSubscriptionId} IS NOT NULL`.mapWith(Boolean,@@ -302,6 +303,7 @@ export default async function ShareVideoPage(props: PageProps<"/s/[videoId]">) {.leftJoin(sharedVideos, eq(videos.id, sharedVideos.videoId)).leftJoin(users, eq(videos.ownerId, users.id)).leftJoin(videoUploads, eq(videos.id, videoUploads.videoId))+ .leftJoin(organizations, eq(videos.orgId, organizations.id)).where(eq(videos.id, videoId)),).pipe(Policy.withPublicPolicy(videosPolicy.canView(videoId)));@@ -348,10 +350,15 @@ async function AuthorizedContent({video,searchParams,}: {- video: Omit<InferSelectModel<typeof videos>, "folderId" | "password"> & {+ video: Omit<+ InferSelectModel<typeof videos>,+ "folderId" | "password" | "settings"+ > & {sharedOrganization: { organizationId: string } | null;hasPassword: boolean;ownerIsPro?: boolean;+ orgSettings?: OrganizationSettings | null;+ videoSettings?: OrganizationSettings | null;};searchParams: { [key: string]: string | string[] | undefined };}) {@@ -470,10 +477,13 @@ async function AuthorizedContent({sharedOrganization: {organizationId: sharedVideos.organizationId,},+ orgSettings: organizations.settings,+ videoSettings: videos.settings,}).from(videos).leftJoin(sharedVideos, eq(videos.id, sharedVideos.videoId)).leftJoin(users, eq(videos.ownerId, users.id))+ .leftJoin(organizations, eq(videos.orgId, organizations.id)).where(eq(videos.id, videoId)).execute();@@ -666,6 +676,8 @@ async function AuthorizedContent({sharedOrganizations: sharedOrganizations,password: null,folderId: null,+ orgSettings: video.orgSettings || null,+ settings: video.videoSettings || null,};return (@@ -691,6 +703,7 @@ async function AuthorizedContent({<Sharedata={videoWithOrganizationInfo}+ videoSettings={videoWithOrganizationInfo.settings}user={user}comments={commentsPromise}views={viewsPromise}diff --git a/apps/web/lib/transcribe.ts b/apps/web/lib/transcribe.tsindex 7451d692c..0a3be8cfa 100644--- a/apps/web/lib/transcribe.ts+++ b/apps/web/lib/transcribe.ts@@ -1,11 +1,11 @@import { db } from "@cap/database";-import { s3Buckets, videos } from "@cap/database/schema";+import { organizations, s3Buckets, videos } from "@cap/database/schema";import { serverEnv } from "@cap/env";import { S3Buckets } from "@cap/web-backend";import type { Video } from "@cap/web-domain";import { createClient } from "@deepgram/sdk";import { eq } from "drizzle-orm";-import { Effect, Option } from "effect";+import { Option } from "effect";import { generateAiMetadata } from "@/actions/videos/generate-ai-metadata";import { runPromise } from "./server";@@ -38,9 +38,12 @@ export async function transcribeVideo(.select({video: videos,bucket: s3Buckets,+ settings: videos.settings,+ orgSettings: organizations.settings,}).from(videos).leftJoin(s3Buckets, eq(videos.bucket, s3Buckets.id))+ .leftJoin(organizations, eq(videos.orgId, organizations.id)).where(eq(videos.id, videoId));if (query.length === 0) {@@ -58,6 +61,31 @@ export async function transcribeVideo(return { success: false, message: "Video information is missing" };}+ if (+ video.settings?.disableTranscript ??+ result.orgSettings?.disableTranscript+ ) {+ console.log(+ `[transcribeVideo] Transcription disabled for video ${videoId}`,+ );+ try {+ await db()+ .update(videos)+ .set({ transcriptionStatus: "SKIPPED" })+ .where(eq(videos.id, videoId));+ } catch (err) {+ console.error(`[transcribeVideo] Failed to mark as skipped:`, err);+ return {+ success: false,+ message: "Transcription disabled, but failed to update status",+ };+ }+ return {+ success: true,+ message: "Transcription disabled for video — skipping transcription",+ };+ }+if (video.transcriptionStatus === "COMPLETE" ||video.transcriptionStatus === "PROCESSING"@@ -119,6 +147,15 @@ export async function transcribeVideo(// Note: Empty transcription is valid for silent videos (just contains "WEBVTT\n\n")if (transcription === "") {+ if (serverEnv().NODE_ENV === "development") {+ console.log(+ "[transcribeVideo] Development mode, skipping transcription",+ );+ return {+ success: true,+ message: "Transcription skipped in development mode",+ };+ }throw new Error("Failed to transcribe audio");}@@ -247,6 +284,12 @@ function formatTimestamp(seconds: number): string {}async function transcribeAudio(videoUrl: string): Promise<string> {+ //if dev - don't transcribe+ if (serverEnv().NODE_ENV === "development") {+ console.log("[transcribeAudio] Development mode, skipping transcription");+ return "";+ }+console.log("[transcribeAudio] Starting transcription for URL:", videoUrl);const deepgram = createClient(serverEnv().DEEPGRAM_API_KEY as string);diff --git a/apps/web/package.json b/apps/web/package.jsonindex 14555f865..4f5bc1c26 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -53,7 +53,7 @@"@radix-ui/react-dropdown-menu": "^2.0.6","@radix-ui/react-select": "^2.2.5","@radix-ui/react-slider": "^1.3.5",- "@radix-ui/react-slot": "^1.0.2",+ "@radix-ui/react-slot": "^1.2.3","@radix-ui/react-tooltip": "^1.2.6","@react-email/components": "^0.1.0","@react-email/render": "1.1.2",diff --git a/package.json b/package.jsonindex 1fd394ce4..96ff28d22 100644--- a/package.json+++ b/package.json@@ -30,6 +30,7 @@"@clack/prompts": "^0.10.0","@effect/language-service": "^0.34.0","dotenv-cli": "latest",+ "prettier": "^3.5.3","turbo": "^2.3.4","typescript": "^5.8.3"},diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.jsonindex 808fe48f7..f3efe3fbd 100644--- a/packages/database/migrations/meta/_journal.json+++ b/packages/database/migrations/meta/_journal.json@@ -57,6 +57,13 @@"when": 1754314124918,"tag": "0007_cheerful_rocket_raccoon","breakpoints": true+ },+ {+ "idx": 8,+ "version": "5",+ "when": 1759139970377,+ "tag": "0008_condemned_gamora",+ "breakpoints": true}]}diff --git a/packages/database/schema.ts b/packages/database/schema.tsindex ca6f2c285..035e895ad 100644--- a/packages/database/schema.ts+++ b/packages/database/schema.ts@@ -159,6 +159,14 @@ export const organizations = mysqlTable(allowedEmailDomain: varchar("allowedEmailDomain", { length: 255 }),customDomain: varchar("customDomain", { length: 255 }),domainVerified: timestamp("domainVerified"),+ settings: json("settings").$type<{+ disableSummary?: boolean;+ disableCaptions?: boolean;+ disableChapters?: boolean;+ disableReactions?: boolean;+ disableTranscript?: boolean;+ disableComments?: boolean;+ }>(),iconUrl: varchar("iconUrl", { length: 1024 }),createdAt: timestamp("createdAt").notNull().defaultNow(),updatedAt: timestamp("updatedAt").notNull().defaultNow().onUpdateNow(),@@ -260,8 +268,16 @@ export const videos = mysqlTable(fps: int("fps"),metadata: json("metadata").$type<VideoMetadata>(),public: boolean("public").notNull().default(true),+ settings: json("settings").$type<{+ disableSummary?: boolean;+ disableCaptions?: boolean;+ disableChapters?: boolean;+ disableReactions?: boolean;+ disableTranscript?: boolean;+ disableComments?: boolean;+ }>(),transcriptionStatus: varchar("transcriptionStatus", { length: 255 }).$type<- "PROCESSING" | "COMPLETE" | "ERROR"+ "PROCESSING" | "COMPLETE" | "ERROR" | "SKIPPED">(),source: json("source").$type<diff --git a/packages/ui/src/components/Switch.tsx b/packages/ui/src/components/Switch.tsxindex 61bf461ed..950853b91 100644--- a/packages/ui/src/components/Switch.tsx+++ b/packages/ui/src/components/Switch.tsx@@ -14,7 +14,7 @@ const Switch = React.forwardRef<"w-11 h-6 p-[0.125rem]","bg-gray-5 data-[state=checked]:bg-blue-500","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",- "disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-gray-200",+ "disabled:cursor-not-allowed disabled:opacity-40 disabled:bg-gray-4",className,)}{...props}diff --git a/packages/web-api-contract-effect/src/index.ts b/packages/web-api-contract-effect/src/index.tsindex c5b583daa..34a896bca 100644--- a/packages/web-api-contract-effect/src/index.ts+++ b/packages/web-api-contract-effect/src/index.ts@@ -4,12 +4,16 @@ import {HttpApiError,HttpApiGroup,HttpApiMiddleware,- HttpServerError,} from "@effect/platform";import { Context, Data } from "effect";import * as Schema from "effect/Schema";-const TranscriptionStatus = Schema.Literal("PROCESSING", "COMPLETE", "ERROR");+const TranscriptionStatus = Schema.Literal(+ "PROCESSING",+ "COMPLETE",+ "ERROR",+ "SKIPPED",+);const OSType = Schema.Literal("macos", "windows");const LicenseType = Schema.Literal("yearly", "lifetime");diff --git a/packages/web-domain/src/Video.ts b/packages/web-domain/src/Video.tsindex 5dc1b4cc7..8da3c5b1f 100644--- a/packages/web-domain/src/Video.ts+++ b/packages/web-domain/src/Video.ts@@ -28,7 +28,7 @@ export class Video extends Schema.Class<Video>("Video")({bucketId: Schema.OptionFromNullOr(S3BucketId),folderId: Schema.OptionFromNullOr(FolderId),transcriptionStatus: Schema.OptionFromNullOr(- Schema.Literal("PROCESSING", "COMPLETE", "ERROR"),+ Schema.Literal("PROCESSING", "COMPLETE", "ERROR", "SKIPPED"),),width: Schema.OptionFromNullOr(Schema.Number),height: Schema.OptionFromNullOr(Schema.Number),diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 79a8921fc..942d6ee14 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -23,6 +23,9 @@ importers:dotenv-cli:specifier: latestversion: 10.0.0+ prettier:+ specifier: ^3.5.3+ version: 3.5.3turbo:specifier: ^2.3.4version: 2.5.3@@ -553,7 +556,7 @@ importers:specifier: ^1.3.5version: 1.3.5(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])'@radix-ui/react-slot':- specifier: ^1.0.2+ specifier: ^1.2.3version: 1.2.3(@types/[email protected])([email protected])'@radix-ui/react-tooltip':specifier: ^1.2.6@@ -692,7 +695,7 @@ importers:version: 15.5.4(@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])next-auth:specifier: ^4.24.5- version: 4.24.11([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected])+ version: 4.24.11([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected])next-contentlayer2:specifier: ^0.5.3version: 0.5.8([email protected])([email protected]([email protected])([email protected]))([email protected])([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])@@ -994,7 +997,7 @@ importers:version: 15.5.4(@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])next-auth:specifier: ^4.24.5- version: 4.24.11([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected])+ version: 4.24.11([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected])react-email:specifier: ^4.0.16version: 4.0.16(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])@@ -5992,10 +5995,10 @@ packages:react-dom:optional: true- '@storybook/[email protected]':- resolution: {integrity: sha512-KlIdcmvjbB9WgrjSml9vmCDKqnLu6s88K9V/BsTklfKr71Nh0LEiltpiIsVabXmk8FcxWsVbvecoui0NcawWtA==}+ '@storybook/[email protected]':+ resolution: {integrity: sha512-R8nSDRWr9eFOF+Bi9+wfJA6jjXGcLCrbgBt2bLebzfXhCNmfHCMaqRG2ZaNdEV4u9KJyakKdzKEotvAkaPONUA==}peerDependencies:- storybook: ^10.0.0-beta.8+ storybook: ^10.0.0-beta.9vite: ^5.0.0 || ^6.0.0 || ^7.0.0'@storybook/[email protected]':@@ -6006,12 +6009,12 @@ packages:prettier:optional: true- '@storybook/[email protected]':- resolution: {integrity: sha512-nwMQ51ZTI8bPy15iar49frYByW9Fwq+UM6RkF0ExoPaDqV32VPZW46ChhTGVaKH6mHmZR7sNAXdboxulXGTP0Q==}+ '@storybook/[email protected]':+ resolution: {integrity: sha512-0PfoiNKNJGNaWZBc31sevMOfhzX0VqrrKqE98DCMyEvZLUPnKy4t7iCE5TNFH+rUd5D7MdVzwgAmJ+CdtlmHIQ==}peerDependencies:esbuild: '*'rollup: '*'- storybook: ^10.0.0-beta.8+ storybook: ^10.0.0-beta.9vite: '*'webpack: '*'peerDependenciesMeta:@@ -19554,9 +19557,9 @@ snapshots:react: 19.1.1react-dom: 19.1.1([email protected])- '@storybook/[email protected]([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))':+ '@storybook/[email protected]([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))':dependencies:- '@storybook/csf-plugin': 10.0.0-beta.8([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))+ '@storybook/csf-plugin': 10.0.0-beta.9([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))storybook: 8.6.12([email protected])ts-dedent: 2.2.0@@ -19586,7 +19589,7 @@ snapshots:- supports-color- utf-8-validate- '@storybook/[email protected]([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))':+ '@storybook/[email protected]([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))':dependencies:storybook: 8.6.12([email protected])unplugin: 2.3.10@@ -22823,8 +22826,8 @@ snapshots:eslint: 9.30.1([email protected])eslint-import-resolver-node: 0.3.9- eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))- eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))+ eslint-import-resolver-typescript: 3.10.1([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected]))+ eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))eslint-plugin-react: 7.37.5([email protected]([email protected]))eslint-plugin-react-hooks: 5.2.0([email protected]([email protected]))@@ -22852,33 +22855,33 @@ snapshots:transitivePeerDependencies:- supports-color+ [email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])):dependencies:'@nolyfill/is-core-module': 1.0.39debug: 4.4.0([email protected])- eslint: 8.57.1+ eslint: 9.30.1([email protected])get-tsconfig: 4.10.0is-bun-module: 2.0.0stable-hash: 0.0.5tinyglobby: 0.2.13unrs-resolver: 1.7.2optionalDependencies:- eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])+ eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))transitivePeerDependencies:- supports-colordependencies:'@nolyfill/is-core-module': 1.0.39debug: 4.4.0([email protected])- eslint: 9.30.1([email protected])+ eslint: 8.57.1get-tsconfig: 4.10.0is-bun-module: 2.0.0stable-hash: 0.0.5tinyglobby: 0.2.13unrs-resolver: 1.7.2optionalDependencies:- eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))+ eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])transitivePeerDependencies:- supports-color@@ -22904,14 +22907,14 @@ snapshots:transitivePeerDependencies:- supports-color- [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected]([email protected])):+ [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected])):dependencies:debug: 3.2.7optionalDependencies:eslint: 9.30.1([email protected])eslint-import-resolver-node: 0.3.9- eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))+ eslint-import-resolver-typescript: 3.10.1([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected]))transitivePeerDependencies:- supports-color@@ -22973,7 +22976,7 @@ snapshots:- eslint-import-resolver-webpack- supports-color- [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected])):+ [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected])):dependencies:'@rtsao/scc': 1.1.0array-includes: 3.1.8@@ -22984,7 +22987,7 @@ snapshots:doctrine: 2.1.0eslint: 9.30.1([email protected])eslint-import-resolver-node: 0.3.9- eslint-module-utils: 2.12.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected]([email protected]))+ eslint-module-utils: 2.12.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))hasown: 2.0.2is-core-module: 2.16.1is-glob: 4.0.3@@ -25946,7 +25949,7 @@ snapshots:p-wait-for: 5.0.2qs: 6.14.0- [email protected]([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected]):+ [email protected]([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected]):dependencies:'@babel/runtime': 7.27.1'@panva/hkdf': 1.2.1@@ -28002,7 +28005,7 @@ snapshots:[email protected](@storybook/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected](@testing-library/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected])):dependencies:- '@storybook/builder-vite': 10.0.0-beta.8([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))+ '@storybook/builder-vite': 10.0.0-beta.9([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))'@storybook/types': 9.0.0-alpha.1([email protected]([email protected]))magic-string: 0.30.17solid-js: 1.9.6@@ -28817,7 +28820,7 @@ snapshots:scule: 1.3.0strip-literal: 3.0.0tinyglobby: 0.2.13- unplugin: 2.3.2+ unplugin: 2.3.10unplugin-utils: 0.2.4