Skip to content

Commit 30a8880

Browse files
committed
Upgraded to Next 15; Fixes: hydration warning, checkout button disabled upon logging in
1 parent 122d0f9 commit 30a8880

61 files changed

Lines changed: 1419 additions & 1262 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/web/app/(with-contexts)/(with-layout)/blog/[slug]/[id]/layout.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ import type { Metadata, ResolvingMetadata } from "next";
22
import { ReactNode } from "react";
33
import { FetchBuilder } from "@courselit/utils";
44
import { headers } from "next/headers";
5-
import { getAddressFromHeaders, getSiteInfo } from "@ui-lib/utils";
5+
import { getSiteInfo } from "@ui-lib/utils";
66
import { Course } from "@courselit/common-models";
7+
import { getAddressFromHeaders } from "@/app/actions";
78

89
export async function generateMetadata(
9-
{ params }: { params: { id: string } },
10+
props: { params: Promise<{ id: string }> },
1011
parent: ResolvingMetadata,
1112
): Promise<Metadata> {
12-
const address = getAddressFromHeaders(headers);
13+
const params = await props.params;
14+
const address = await getAddressFromHeaders(headers);
1315
const [product, siteInfo] = await Promise.all([
1416
getProduct(params.id, address),
1517
getSiteInfo(address),

apps/web/app/(with-contexts)/(with-layout)/blog/[slug]/[id]/page.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Course } from "@courselit/common-models";
22
import { Caption, Header1, Section, Text1 } from "@courselit/page-primitives";
33
import { formattedLocaleDate, getFullSiteSetup } from "@ui-lib/utils";
4-
import { getAddressFromHeaders } from "@ui-lib/utils";
4+
import { getAddressFromHeaders } from "@/app/actions";
55
import { headers } from "next/headers";
66
import { ProductWithAdminProps } from "@/hooks/use-product";
77
import { FetchBuilder } from "@courselit/utils";
@@ -19,13 +19,12 @@ import {
1919
BreadcrumbSeparator,
2020
} from "@components/ui/breadcrumb";
2121

22-
export default async function ProductPage({
23-
params,
24-
}: {
25-
params: { slug: string; id: string };
22+
export default async function ProductPage(props: {
23+
params: Promise<{ slug: string; id: string }>;
2624
course: Course;
2725
}) {
28-
const address = getAddressFromHeaders(headers);
26+
const params = await props.params;
27+
const address = await getAddressFromHeaders(headers);
2928
const [product, siteInfo] = await Promise.all([
3029
getProduct(address, params.id),
3130
getFullSiteSetup(address),

apps/web/app/(with-contexts)/(with-layout)/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { auth } from "@/auth";
22
import { SessionProvider } from "next-auth/react";
33
import HomepageLayout from "./home-page-layout";
44
import { headers } from "next/headers";
5-
import { getAddressFromHeaders, getFullSiteSetup } from "@ui-lib/utils";
5+
import { getFullSiteSetup } from "@ui-lib/utils";
6+
import { getAddressFromHeaders } from "@/app/actions";
67

78
export default async function Layout({
89
children,
910
}: {
1011
children: React.ReactNode;
1112
}) {
12-
const address = getAddressFromHeaders(headers);
13+
const address = await getAddressFromHeaders(headers);
1314
const [siteInfo, session] = await Promise.all([
1415
getFullSiteSetup(address),
1516
auth(),

apps/web/app/(with-contexts)/(with-layout)/p/[id]/page.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import { getFullSiteSetup, getPage } from "@ui-lib/utils";
2-
import { getAddressFromHeaders } from "@/ui-lib/utils";
2+
import { getAddressFromHeaders } from "@/app/actions";
33
import ClientSidePage from "./client-side-page";
44
import { headers } from "next/headers";
55
import type { Metadata, ResolvingMetadata } from "next";
66
import { Media } from "@courselit/common-models";
77
import { notFound } from "next/navigation";
88

99
type Props = {
10-
params: {
10+
params: Promise<{
1111
id: string;
12-
};
12+
}>;
1313
};
1414

1515
export async function generateMetadata(
16-
{ params }: Props,
16+
props: Props,
1717
parent: ResolvingMetadata,
1818
): Promise<Metadata> {
19-
const address = getAddressFromHeaders(headers);
19+
const params = await props.params;
20+
const address = await getAddressFromHeaders(headers);
2021
const [siteInfo, page] = await Promise.all([
2122
getFullSiteSetup(address),
2223
getPage(address, params.id),
@@ -73,8 +74,9 @@ export async function generateMetadata(
7374
};
7475
}
7576

76-
export default async function Page({ params }: Props) {
77-
const address = getAddressFromHeaders(headers);
77+
export default async function Page(props: Props) {
78+
const params = await props.params;
79+
const address = await getAddressFromHeaders(headers);
7880
const [siteInfo, page] = await Promise.all([
7981
getFullSiteSetup(address),
8082
getPage(address, params.id),

apps/web/app/(with-contexts)/(with-layout)/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getFullSiteSetup } from "@ui-lib/utils";
2-
import { getAddressFromHeaders } from "@/ui-lib/utils";
2+
import { getAddressFromHeaders } from "@/app/actions";
33
import ClientSidePage from "./p/[id]/client-side-page";
44
import { headers } from "next/headers";
55
import type { Metadata, ResolvingMetadata } from "next";
@@ -14,7 +14,7 @@ export async function generateMetadata(
1414
{ params }: Props,
1515
parent: ResolvingMetadata,
1616
): Promise<Metadata> {
17-
const address = getAddressFromHeaders(headers);
17+
const address = await getAddressFromHeaders(headers);
1818
const siteInfo = await getFullSiteSetup(address, "homepage");
1919
if (!siteInfo) {
2020
return {
@@ -62,7 +62,7 @@ export async function generateMetadata(
6262
}
6363

6464
export default async function Page() {
65-
const address = getAddressFromHeaders(headers);
65+
const address = await getAddressFromHeaders(headers);
6666
const siteInfo = await getFullSiteSetup(address, "homepage");
6767
if (!siteInfo) {
6868
return null;

apps/web/app/(with-contexts)/course/[slug]/[id]/[lesson]/page.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
22

33
import { LessonViewer } from "@components/public/lesson-viewer";
44
import { redirect } from "next/navigation";
5-
import { useContext } from "react";
5+
import { useContext, use } from "react";
66
import { ProfileContext, AddressContext } from "@components/contexts";
77
import { Profile } from "@courselit/common-models";
88

9-
export default function LessonPage({
10-
params,
11-
}: {
12-
params: {
9+
export default function LessonPage(props: {
10+
params: Promise<{
1311
slug: string;
1412
id: string;
1513
lesson: string;
16-
};
14+
}>;
1715
}) {
16+
const params = use(props.params);
1817
const { slug, id, lesson } = params;
1918
const { profile, setProfile } = useContext(ProfileContext);
2019
const address = useContext(AddressContext);

apps/web/app/(with-contexts)/course/[slug]/[id]/layout.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import { auth } from "@/auth";
22
import { SessionProvider } from "next-auth/react";
33
import { Metadata, ResolvingMetadata } from "next";
4-
import { getAddressFromHeaders, getFullSiteSetup } from "@ui-lib/utils";
4+
import { getFullSiteSetup } from "@ui-lib/utils";
55
import { headers } from "next/headers";
66
import { FetchBuilder } from "@courselit/utils";
77
import { notFound } from "next/navigation";
88
import LayoutWithSidebar from "./layout-with-sidebar";
99
import { getProduct } from "./helpers";
10+
import { getAddressFromHeaders } from "@/app/actions";
1011

1112
export async function generateMetadata(
12-
{ params }: { params: { slug: string; id: string } },
13+
props: { params: Promise<{ slug: string; id: string }> },
1314
parent: ResolvingMetadata,
1415
): Promise<Metadata> {
15-
const address = getAddressFromHeaders(headers);
16+
const params = await props.params;
17+
const address = await getAddressFromHeaders(headers);
1618
const siteInfo = await getFullSiteSetup(address);
1719

1820
if (!siteInfo) {
@@ -48,16 +50,17 @@ export async function generateMetadata(
4850
}
4951
}
5052

51-
export default async function Layout({
52-
children,
53-
params,
54-
}: {
53+
export default async function Layout(props: {
5554
children: React.ReactNode;
56-
params: { slug: string; id: string };
55+
params: Promise<{ slug: string; id: string }>;
5756
}) {
57+
const params = await props.params;
58+
59+
const { children } = props;
60+
5861
const { id } = params;
5962
const session = await auth();
60-
const address = getAddressFromHeaders(headers);
63+
const address = await getAddressFromHeaders(headers);
6164
const product = await getProduct(id, address);
6265

6366
return (

apps/web/app/(with-contexts)/course/[slug]/[id]/page.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useContext, useEffect, useState } from "react";
3+
import { useContext, useEffect, useState, use } from "react";
44
import { isEnrolled } from "@ui-lib/utils";
55
import { ArrowRight } from "@courselit/icons";
66
import { COURSE_PROGRESS_START, ENROLL_BUTTON_TEXT } from "@ui-config/strings";
@@ -22,11 +22,10 @@ import {
2222
import { getProduct } from "./helpers";
2323
const { permissions } = UIConstants;
2424

25-
export default function ProductPage({
26-
params,
27-
}: {
28-
params: { slug: string; id: string };
25+
export default function ProductPage(props: {
26+
params: Promise<{ slug: string; id: string }>;
2927
}) {
28+
const params = use(props.params);
3029
const { id } = params;
3130
const [product, setProduct] = useState<any>(null);
3231
const { profile } = useContext(ProfileContext);

apps/web/app/(with-contexts)/dashboard/(sidebar)/blog/[id]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ import {
2727
} from "@ui-config/strings";
2828
import { truncate } from "@ui-lib/utils";
2929
import { useRouter, useSearchParams } from "next/navigation";
30-
import { useContext, useState } from "react";
30+
import { useContext, useState, use } from "react";
3131

3232
const breadcrumbs = [
3333
{ label: MANAGE_BLOG_PAGE_HEADING, href: "/dashboard/blogs" },
3434
{ label: EDIT_BLOG, href: "#" },
3535
];
3636

37-
export default function Page({ params }: { params: { id: string } }) {
37+
export default function Page(props: { params: Promise<{ id: string }> }) {
38+
const params = use(props.params);
3839
const { id } = params;
3940
const searchParams = useSearchParams();
4041
const [tab, setTab] = useState(searchParams?.get("tab") || "Details");

apps/web/app/(with-contexts)/dashboard/(sidebar)/community/[id]/manage/memberships/page.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import {
66
COMMUNITY_SETTINGS,
77
} from "@ui-config/strings";
88

9-
export default function Page({
10-
params,
11-
}: {
12-
params: {
9+
export default async function Page(props: {
10+
params: Promise<{
1311
id: string;
14-
};
12+
}>;
1513
}) {
14+
const params = await props.params;
1615
const { id } = params;
1716
const breadcrumbs = [
1817
{

0 commit comments

Comments
 (0)