Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@ts-rest/core": "^3.52.1",
"@types/react-tooltip": "^4.2.4",
"cva": "npm:class-variance-authority@^0.7.0",
"effect": "^3.17.13",
"effect": "^3.17.14",
"mp4box": "^0.5.2",
"posthog-js": "^1.215.3",
"solid-js": "^1.9.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/actions/videos/password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export async function verifyVideoPassword(

if (!valid) throw new Error("Invalid password");

cookies().set("x-cap-password", await encrypt(video.password));
(await cookies()).set("x-cap-password", await encrypt(video.password));

return { success: true, value: "Password verified" };
} catch (error) {
Expand Down
8 changes: 6 additions & 2 deletions apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { Check, ChevronDown, Plus } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { usePathname, useRouter } from "next/navigation";
import { cloneElement, useRef, useState } from "react";
import { cloneElement, RefObject, useRef, useState } from "react";
import { NewOrganization } from "@/components/forms/NewOrganization";
import { Tooltip } from "@/components/Tooltip";
import { UsageButton } from "@/components/UsageButton";
Expand Down Expand Up @@ -453,7 +453,11 @@ const NavItem = ({
}: {
name: string;
href: string;
icon: React.ReactElement;
icon: React.ReactElement<{
ref: RefObject<CogIconHandle | null>;
className: string;
size: number;
}>;
sidebarCollapsed: boolean;
toggleMobileNav?: () => void;
isPathActive: (path: string) => boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const SpaceDialog = ({

export interface NewSpaceFormProps {
onSpaceCreated: () => void;
formRef?: React.RefObject<HTMLFormElement>;
formRef?: React.RefObject<HTMLFormElement | null>;
setCreateLoading?: React.Dispatch<React.SetStateAction<boolean>>;
onNameChange?: (name: string) => void;
edit?: boolean;
Expand Down
7 changes: 6 additions & 1 deletion apps/web/app/(org)/dashboard/_components/Navbar/Top.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
useMemo,
useRef,
useState,
RefObject,
} from "react";
import { markAsRead } from "@/actions/notifications/mark-as-read";
import Notifications from "@/app/(org)/dashboard/_components/Notifications";
Expand Down Expand Up @@ -318,7 +319,11 @@ const User = () => {
};

interface Props {
icon: React.ReactElement;
icon: React.ReactElement<{
ref: RefObject<DownloadIconHandle | null>;
className: string;
size: number;
}>;
Comment thread
oscartbeaumont marked this conversation as resolved.
name: string;
href?: string;
onClick: () => void;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/(org)/dashboard/_components/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
import { cookies } from "next/headers";

export const setTheme = async (newTheme: "light" | "dark") => {
const cookieStore = cookies();
const cookieStore = await cookies();
cookieStore.set("theme", newTheme);
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface FoldersDropdownProps {
id: string;
setIsRenaming: (isRenaming: boolean) => void;
setConfirmDeleteFolderOpen: (open: boolean) => void;
nameRef: RefObject<HTMLTextAreaElement>;
nameRef: RefObject<HTMLTextAreaElement | null>;
parentId?: string | null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const NewFolderDialog: React.FC<Props> = ({
},
{} as Record<
(typeof FolderOptions)[number]["value"],
React.RefObject<FolderHandle>
React.RefObject<FolderHandle | null>
>,
),
);
Expand Down
7 changes: 3 additions & 4 deletions apps/web/app/(org)/dashboard/caps/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,10 @@ async function getSharedSpacesForVideos(videoIds: Video.VideoId[]) {
return sharedSpacesMap;
}

export default async function CapsPage({
searchParams,
}: {
searchParams: { [key: string]: string | string[] | undefined };
export default async function CapsPage(props: {
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
}) {
const searchParams = await props.searchParams;
const user = await getCurrentUser();
Comment thread
oscartbeaumont marked this conversation as resolved.

if (!user || !user.id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const SubfolderDialog: React.FC<Props> = ({
},
{} as Record<
(typeof FolderOptions)[number]["value"],
React.RefObject<FolderHandle>
React.RefObject<FolderHandle | null>
>,
),
);
Expand Down
5 changes: 4 additions & 1 deletion apps/web/app/(org)/dashboard/folder/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import {
} from "./components";
import FolderVideosSection from "./components/FolderVideosSection";

const FolderPage = async ({ params }: { params: { id: Folder.FolderId } }) => {
const FolderPage = async (props: {
params: Promise<{ id: Folder.FolderId }>;
}) => {
const params = await props.params;
const [childFolders, breadcrumb, videosData] = await Promise.all([
getChildFolders(params.id),
getFolderBreadcrumb(params.id),
Expand Down
6 changes: 3 additions & 3 deletions apps/web/app/(org)/dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ export default async function DashboardLayout({
user.stripeSubscriptionStatus !== "cancelled") ||
!!user.thirdPartyStripeSubscriptionId;

const theme = cookies().get("theme")?.value ?? "light";
const sidebar = cookies().get("sidebarCollapsed")?.value ?? "false";
const referClicked = cookies().get("referClicked")?.value ?? "false";
const theme = (await cookies()).get("theme")?.value ?? "light";
const sidebar = (await cookies()).get("sidebarCollapsed")?.value ?? "false";
const referClicked = (await cookies()).get("referClicked")?.value ?? "false";

return (
<UploadingProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const CustomDomainDialog = ({
const dialogRef = useRef<HTMLDivElement | null>(null);
const confettiRef = useRef<ConfettiRef>(null);

const pollInterval = useRef<NodeJS.Timeout>();
const pollInterval = useRef<NodeJS.Timeout | undefined>(undefined);

// Mutation for updating domain
const updateDomainMutation = useMutation({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Video } from "@cap/web-domain";
import { Grid, useGrid } from "@virtual-grid/react";
import React, { useEffect, useRef, useState } from "react";
import React, { RefObject, useEffect, useRef, useState } from "react";
import type { VideoData } from "./AddVideosDialogBase";
import VideoCard from "./VideoCard";

Expand Down Expand Up @@ -50,7 +50,7 @@ const VirtualizedVideoGrid = ({

// Initialize the grid with responsive column count
const grid = useGrid({
scrollRef,
scrollRef: scrollRef as RefObject<HTMLDivElement>, // React typing version mismatch
Comment thread
oscartbeaumont marked this conversation as resolved.
count: videos.length,
columns: responsiveColumnCount,
gap: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import {
} from "../../../../folder/[id]/components";
import FolderVideosSection from "../../../../folder/[id]/components/FolderVideosSection";

const FolderPage = async ({
params,
}: {
params: { spaceId: string; folderId: Folder.FolderId };
const FolderPage = async (props: {
params: Promise<{ spaceId: string; folderId: Folder.FolderId }>;
}) => {
const params = await props.params;
const user = await getCurrentUser();
if (!user) return;

Expand Down
11 changes: 5 additions & 6 deletions apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,12 @@ async function fetchOrganizationMembers(orgId: string) {
.where(eq(organizationMembers.organizationId, orgId));
}

export default async function SharedCapsPage({
params,
searchParams,
}: {
params: { spaceId: string };
searchParams: { [key: string]: string | string[] | undefined };
export default async function SharedCapsPage(props: {
params: Promise<{ spaceId: string }>;
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
}) {
const searchParams = await props.searchParams;
const params = await props.params;
const page = Number(searchParams.page) || 1;
const limit = Number(searchParams.limit) || 15;
const user = await getCurrentUser();
Expand Down
8 changes: 5 additions & 3 deletions apps/web/app/(org)/invite/[inviteId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import { notFound } from "next/navigation";
import { InviteAccept } from ".//InviteAccept";

type Props = {
params: { inviteId: string };
params: Promise<{ inviteId: string }>;
};

export async function generateMetadata({ params }: Props): Promise<Metadata> {
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params;
const inviteId = params.inviteId;
const invite = await getInviteDetails(inviteId);

Expand Down Expand Up @@ -49,7 +50,8 @@ async function getInviteDetails(inviteId: string) {
return query[0];
}

export default async function InvitePage({ params }: Props) {
export default async function InvitePage(props: Props) {
const params = await props.params;
const inviteId = params.inviteId;
const user = await getCurrentUser();
const inviteDetails = await getInviteDetails(inviteId);
Expand Down
7 changes: 3 additions & 4 deletions apps/web/app/(org)/verify-otp/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ export const metadata = {
title: "Verify Code | Cap",
};

export default async function VerifyOTPPage({
searchParams,
}: {
searchParams: { email?: string; next?: string; lastSent?: string };
export default async function VerifyOTPPage(props: {
searchParams: Promise<{ email?: string; next?: string; lastSent?: string }>;
}) {
const searchParams = await props.searchParams;
const session = await getSession();

if (session?.user) {
Expand Down
8 changes: 5 additions & 3 deletions apps/web/app/(site)/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { getMetadataBySlug } from "@/lib/seo-metadata";
import { getPageBySlug } from "@/lib/seo-pages";

type Props = {
params: { slug: string };
params: Promise<{ slug: string }>;
};

export async function generateMetadata({ params }: Props): Promise<Metadata> {
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params;
const metadata = getMetadataBySlug(params.slug);

if (!metadata) {
Expand All @@ -30,7 +31,8 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
};
}

export default function SeoPage({ params }: Props) {
export default async function SeoPage(props: Props) {
const params = await props.params;
const page = getPageBySlug(params.slug);

if (!page) {
Expand Down
14 changes: 8 additions & 6 deletions apps/web/app/(site)/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ import { calculateReadingTime } from "@/utils/readTime";
import { Share } from "../_components/Share";

interface PostProps {
params: {
params: Promise<{
slug: string;
};
}>;
}

export async function generateMetadata({
params,
}: PostProps): Promise<Metadata | undefined> {
export async function generateMetadata(
props: PostProps,
): Promise<Metadata | undefined> {
const params = await props.params;
const post = getBlogPosts().find((post) => post.slug === params.slug);
if (!post) {
return;
Expand Down Expand Up @@ -66,7 +67,8 @@ export async function generateMetadata({
};
}

export default async function PostPage({ params }: PostProps) {
export default async function PostPage(props: PostProps) {
const params = await props.params;
const post = getBlogPosts().find((post) => post.slug === params.slug);

if (!post) {
Expand Down
8 changes: 4 additions & 4 deletions apps/web/app/(site)/docs/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ type Doc = {
};

interface DocProps {
params: {
params: Promise<{
slug: string[];
};
}>;
}

export async function generateMetadata(
props: DocProps,
): Promise<Metadata | undefined> {
const { params } = props;
const params = await props.params;
if (!params?.slug) return;

const fullSlug = params.slug.join("/");
Expand Down Expand Up @@ -74,7 +74,7 @@ export async function generateMetadata(
}

export default async function DocPage(props: DocProps) {
const { params } = props;
const params = await props.params;
if (!params?.slug) notFound();

const fullSlug = params.slug.join("/");
Expand Down
14 changes: 8 additions & 6 deletions apps/web/app/(site)/docs/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import { MDXRemote } from "next-mdx-remote/rsc";
import { getDocs } from "@/utils/blog";

interface DocProps {
params: {
params: Promise<{
slug: string;
};
}>;
}

export async function generateMetadata({
params,
}: DocProps): Promise<Metadata | undefined> {
export async function generateMetadata(
props: DocProps,
): Promise<Metadata | undefined> {
const params = await props.params;
const doc = getDocs().find((doc) => doc.slug === params.slug);
if (!doc) {
return;
Expand Down Expand Up @@ -47,7 +48,8 @@ export async function generateMetadata({
};
}

export default async function DocPage({ params }: DocProps) {
export default async function DocPage(props: DocProps) {
const params = await props.params;
const doc = getDocs().find((doc) => doc.slug === params.slug);

if (!doc) {
Expand Down
3 changes: 2 additions & 1 deletion apps/web/app/(site)/download/[platform]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ export const revalidate = 0;

export async function GET(
request: NextRequest,
{ params }: { params: { platform: string } },
props: { params: Promise<{ platform: string }> },
) {
const params = await props.params;
const platform = params.platform.toLowerCase();

// Define download URLs for different platforms
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/(site)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HomePage } from "@/components/pages/HomePage";
import { getBootstrapData } from "@/utils/getBootstrapData";

export default async function Home() {
const cookieStore = cookies();
const cookieStore = await cookies();
const sessionCookie = cookieStore.get("next-auth.session-token");
const bootstrapData = await getBootstrapData();

Expand Down
Loading
Loading