Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions apps/web/actions/videos/generate-ai-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ export async function generateAiMetadata(videoId: string, userId: string) {
metadata: {
...metadata,
aiProcessing: false,
generationError: null,
},
})
.where(eq(videos.id, videoId));

metadata.aiProcessing = false;
metadata.generationError = null;
} else {
return;
}
Expand Down Expand Up @@ -296,8 +294,6 @@ ${transcriptText}`;
metadata: {
...currentMetadata,
aiProcessing: false,
generationError:
error instanceof Error ? error.message : String(error),
},
})
.where(eq(videos.id, videoId));
Expand Down
24 changes: 12 additions & 12 deletions apps/web/actions/videos/get-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface VideoStatusResult {
aiTitle: string | null;
summary: string | null;
chapters: { title: string; start: number }[] | null;
generationError: string | null;
// generationError: string | null;
error?: string;
}

Expand Down Expand Up @@ -62,7 +62,7 @@ export async function getVideoStatus(
aiTitle: metadata.aiTitle || null,
summary: metadata.summary || null,
chapters: metadata.chapters || null,
generationError: metadata.generationError || null,
// generationError: metadata.generationError || null,
};
} catch (error) {
console.error(
Expand All @@ -75,7 +75,7 @@ export async function getVideoStatus(
aiTitle: metadata.aiTitle || null,
summary: metadata.summary || null,
chapters: metadata.chapters || null,
generationError: metadata.generationError || null,
// generationError: metadata.generationError || null,
error: "Failed to start transcription",
};
}
Expand All @@ -88,7 +88,7 @@ export async function getVideoStatus(
aiTitle: metadata.aiTitle || null,
summary: metadata.summary || null,
chapters: metadata.chapters || null,
generationError: metadata.generationError || null,
// generationError: metadata.generationError || null,
error: "Transcription failed",
};
}
Expand All @@ -110,7 +110,7 @@ export async function getVideoStatus(
metadata: {
...metadata,
aiProcessing: false,
generationError: "AI processing timed out and was reset",
// generationError: "AI processing timed out and was reset",
},
})
.where(eq(videos.id, videoId));
Expand All @@ -133,7 +133,7 @@ export async function getVideoStatus(
aiTitle: updatedMetadata.aiTitle || null,
summary: updatedMetadata.summary || null,
chapters: updatedMetadata.chapters || null,
generationError: updatedMetadata.generationError || null,
// generationError: updatedMetadata.generationError || null,
error: "AI processing timed out and was reset",
};
}
Expand All @@ -144,8 +144,8 @@ export async function getVideoStatus(
video.transcriptionStatus === "COMPLETE" &&
!metadata.aiProcessing &&
!metadata.summary &&
!metadata.chapters &&
!metadata.generationError
!metadata.chapters
// !metadata.generationError
) {
console.log(
`[Get Status] Transcription complete but no AI data, checking feature flag for video owner ${video.ownerId}`,
Expand Down Expand Up @@ -198,8 +198,8 @@ export async function getVideoStatus(
metadata: {
...currentMetadata,
aiProcessing: false,
generationError:
error instanceof Error ? error.message : String(error),
// generationError:
// error instanceof Error ? error.message : String(error),
},
})
.where(eq(videos.id, videoId));
Expand All @@ -221,7 +221,7 @@ export async function getVideoStatus(
aiTitle: metadata.aiTitle || null,
summary: metadata.summary || null,
chapters: metadata.chapters || null,
generationError: metadata.generationError || null,
// generationError: metadata.generationError || null,
};
} else {
const videoOwner = videoOwnerQuery[0];
Expand All @@ -239,6 +239,6 @@ export async function getVideoStatus(
aiTitle: metadata.aiTitle || null,
summary: metadata.summary || null,
chapters: metadata.chapters || null,
generationError: metadata.generationError || null,
// generationError: metadata.generationError || null,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ export function ClientCapCard(props: ClientCapCardProps) {
onDragEnd={handleDragEnd}
className={isDragging ? "opacity-50" : ""}
>
<CapCard {...rest} analytics={analytics} />
<CapCard
{...rest}
isLoadingAnalytics={props.isLoadingAnalytics}
analytics={analytics}
/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"use client";

import { Button } from "@cap/ui";
import type { Folder } from "@cap/web-domain";
import { faFolderPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useState } from "react";
import { SubfolderDialog } from "./SubfolderDialog";

interface NewSubfolderButtonProps {
parentFolderId: string;
parentFolderId: Folder.FolderId;
}

export const NewSubfolderButton = ({
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const FolderPage = async ({
cardType="shared"
initialVideos={videosData}
dubApiKeyEnabled={!!serverEnv().DUB_API_KEY}
userId={userId}
/>
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion apps/web/app/(org)/verify-otp/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ export function VerifyOTPForm({
{code.map((digit, index) => (
<input
key={index.toString()}
ref={(el) => (inputRefs.current[index] = el)}
ref={(el) => {
inputRefs.current[index] = el;
}}
type="text"
inputMode="numeric"
pattern="[0-9]*"
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/(site)/tools/trim/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { trimVideoContent } from "@/components/tools/content";
export const metadata: Metadata = {
title: trimVideoContent.title,
description: trimVideoContent.description,
keywords: trimVideoContent.tags.join(", "),
keywords: trimVideoContent.tags?.join(", "),
openGraph: {
title: trimVideoContent.title,
description: trimVideoContent.description,
Expand Down
3 changes: 1 addition & 2 deletions apps/web/app/api/upload/[...route]/multipart.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { db, updateIfDefined } from "@cap/database";
import { s3Buckets, videos } from "@cap/database/schema";
import type { VideoMetadata } from "@cap/database/types";
import { serverEnv } from "@cap/env";
import { zValidator } from "@hono/zod-validator";
import { eq, sql } from "drizzle-orm";
import { and, eq } from "drizzle-orm";
import { Hono } from "hono";
import { z } from "zod";
import { withAuth } from "@/app/api/utils";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/embed/[videoId]/_components/EmbedVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type CommentWithAuthor = typeof commentsSchema.$inferSelect & {
export const EmbedVideo = forwardRef<
HTMLVideoElement,
{
data: typeof videos.$inferSelect;
data: Omit<typeof videos.$inferSelect, "password">;
user: typeof userSelectProps | null;
comments: CommentWithAuthor[];
chapters?: { title: string; start: number }[];
Expand Down
7 changes: 6 additions & 1 deletion apps/web/app/embed/[videoId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { VideoMetadata } from "@cap/database/types";
import { buildEnv } from "@cap/env";
import { provideOptionalAuth, Videos, VideosPolicy } from "@cap/web-backend";
import { Policy, type Video } from "@cap/web-domain";
import { eq } from "drizzle-orm";
import { eq, sql } from "drizzle-orm";
import { Effect, Option } from "effect";
import type { Metadata } from "next";
import Link from "next/link";
Expand Down Expand Up @@ -142,6 +142,11 @@ export default async function EmbedVideoPage(props: Props) {
transcriptionStatus: videos.transcriptionStatus,
source: videos.source,
folderId: videos.folderId,
width: videos.width,
height: videos.height,
duration: videos.duration,
fps: videos.fps,
hasPassword: sql<number>`IF(${videos.password} IS NULL, 0, 1)`,
sharedOrganization: {
organizationId: sharedVideos.organizationId,
},
Expand Down
4 changes: 2 additions & 2 deletions apps/web/app/lib/compose-refs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";

type PossibleRef<T> = React.Ref<T> | undefined;
type PossibleRef<T> = React.LegacyRef<T> | React.Ref<T> | undefined;

/**
* Set a given ref to a given value
Expand All @@ -12,7 +12,7 @@ function setRef<T>(ref: PossibleRef<T>, value: T) {
}

if (ref !== null && ref !== undefined) {
ref.current = value;
(ref as any).current = value;
}
}

Expand Down
12 changes: 6 additions & 6 deletions apps/web/app/s/[videoId]/Share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import type { userSelectProps } from "@cap/database/auth/session";
import type { comments as commentsSchema, videos } from "@cap/database/schema";
import type { Video } from "@cap/web-domain";
import { useQuery } from "@tanstack/react-query";
import {
startTransition,
Expand Down Expand Up @@ -62,7 +63,7 @@ interface ShareProps {
}

const useVideoStatus = (
videoId: string,
videoId: Video.VideoId,
aiGenerationEnabled: boolean,
initialData?: {
transcriptionStatus?: string | null;
Expand Down Expand Up @@ -93,7 +94,6 @@ const useVideoStatus = (
aiTitle: initialData.aiData?.title || null,
summary: initialData.aiData?.summary || null,
chapters: initialData.aiData?.chapters || null,
generationError: null,
}
: undefined,
refetchInterval: (query) => {
Expand Down Expand Up @@ -177,7 +177,7 @@ export const Share = ({
summary: videoStatus?.summary || null,
chapters: videoStatus?.chapters || null,
processing: videoStatus?.aiProcessing || false,
generationError: videoStatus?.generationError || null,
// generationError: videoStatus?.generationError || null,
}),
[videoStatus],
);
Expand All @@ -196,9 +196,9 @@ export const Share = ({
}

if (transcriptionStatus === "COMPLETE") {
if (aiData.generationError) {
return false;
}
// if (aiData.generationError) {
// return false;
// }
if (aiData.processing === true) {
return true;
}
Expand Down
4 changes: 1 addition & 3 deletions apps/web/app/s/[videoId]/_components/ShareHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type { userSelectProps } from "@cap/database/auth/session";
import type { videos } from "@cap/database/schema";
import { buildEnv } from "@cap/env";
import { buildEnv, NODE_ENV } from "@cap/env";
import { Button } from "@cap/ui";
import { userIsPro } from "@cap/utils";
import { faChevronDown, faLock } from "@fortawesome/free-solid-svg-icons";
Expand All @@ -28,7 +28,6 @@ export const ShareHeader = ({
sharedOrganizations = [],
sharedSpaces = [],
spacesData = null,
NODE_ENV,
}: {
data: typeof videos.$inferSelect;
user: typeof userSelectProps | null;
Expand All @@ -49,7 +48,6 @@ export const ShareHeader = ({
organizationId: string;
}[];
spacesData?: Spaces[] | null;
NODE_ENV: "production" | "development" | "test";
}) => {
const { push, refresh } = useRouter();
const [isEditing, setIsEditing] = useState(false);
Expand Down
12 changes: 6 additions & 6 deletions apps/web/app/s/[videoId]/_components/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const MotionButton = motion.create(Button);
interface ToolbarProps {
data: typeof videos.$inferSelect;
user: typeof userSelectProps | null;
onOptimisticComment: (comment: CommentType) => void;
onCommentSuccess: (comment: CommentType) => void;
onOptimisticComment?: (comment: CommentType) => void;
onCommentSuccess?: (comment: CommentType) => void;
}

export const Toolbar = ({
Expand Down Expand Up @@ -68,7 +68,7 @@ export const Toolbar = ({
sending: true,
};

onOptimisticComment(optimisticComment);
onOptimisticComment?.(optimisticComment);

try {
const newCommentData = await newComment({
Expand All @@ -78,7 +78,7 @@ export const Toolbar = ({
type: "emoji",
});
startTransition(() => {
onCommentSuccess(newCommentData);
onCommentSuccess?.(newCommentData);
});
} catch (error) {
console.error("Error posting comment:", error);
Expand Down Expand Up @@ -107,7 +107,7 @@ export const Toolbar = ({
sending: true,
};

onOptimisticComment(optimisticComment);
onOptimisticComment?.(optimisticComment);

try {
const newCommentData = await newComment({
Expand All @@ -117,7 +117,7 @@ export const Toolbar = ({
type: "text",
});
startTransition(() => {
onCommentSuccess(newCommentData);
onCommentSuccess?.(newCommentData);
});
} catch (error) {
console.error("Error posting comment:", error);
Expand Down
Loading
Loading