diff --git a/apps/ai-hero/src/app/(content)/[post]/page.tsx b/apps/ai-hero/src/app/(content)/[post]/page.tsx index ae26639c..90e84e0d 100644 --- a/apps/ai-hero/src/app/(content)/[post]/page.tsx +++ b/apps/ai-hero/src/app/(content)/[post]/page.tsx @@ -14,7 +14,7 @@ import { Share } from '@/components/share' import Spinner from '@/components/spinner' import { courseBuilderAdapter } from '@/db' import type { List } from '@/lib/lists' -import { getListForPost } from '@/lib/lists-query' +import { getAllLists, getListForPost } from '@/lib/lists-query' import { type Post } from '@/lib/posts' import { getAllPosts, getPost } from '@/lib/posts-query' import { getPricingProps } from '@/lib/pricing-query' @@ -31,6 +31,7 @@ import { Button } from '@coursebuilder/ui' import { VideoPlayerOverlayProvider } from '@coursebuilder/ui/hooks/use-video-player-overlay' import PostNextUpFromListPagination from '../_components/post-next-up-from-list-pagination' +import ListPage from '../lists/[slug]/_page' import { PostPlayer } from '../posts/_components/post-player' import { PostNewsletterCta } from '../posts/_components/post-video-subscribe-form' @@ -41,11 +42,14 @@ type Props = { export async function generateStaticParams() { const posts = await getAllPosts() + const lists = await getAllLists() - return posts - .filter((post) => Boolean(post.fields?.slug)) - .map((post) => ({ - post: post.fields?.slug, + const resources = [...posts, ...lists] + + return resources + .filter((resource) => Boolean(resource.fields?.slug)) + .map((resource) => ({ + post: resource.fields?.slug, })) } @@ -147,6 +151,15 @@ export default async function PostPage(props: { const params = await props.params const post = await getPost(params.post) + if (!post) { + return ( + + ) + } + const cookieStore = await cookies() const ckSubscriber = cookieStore.has(CK_SUBSCRIBER_KEY) const { allowPurchase, pricingDataLoader, product, commerceProps } = diff --git a/apps/ai-hero/src/app/(content)/lists/[slug]/page.tsx b/apps/ai-hero/src/app/(content)/lists/[slug]/_page.tsx similarity index 97% rename from apps/ai-hero/src/app/(content)/lists/[slug]/page.tsx rename to apps/ai-hero/src/app/(content)/lists/[slug]/_page.tsx index baba04f7..7f763db6 100644 --- a/apps/ai-hero/src/app/(content)/lists/[slug]/page.tsx +++ b/apps/ai-hero/src/app/(content)/lists/[slug]/_page.tsx @@ -1,3 +1,5 @@ +// Used for root route /[post] + import * as React from 'react' import { Suspense } from 'react' import { type Metadata, type ResolvingMetadata } from 'next' @@ -136,10 +138,10 @@ export default async function ListPage(props: { {list.resources.map(({ resource }, i) => (
  • - + {i + 1} {resource.fields.title} diff --git a/apps/ai-hero/src/app/(content)/lists/_components/lists-table.tsx b/apps/ai-hero/src/app/(content)/lists/_components/lists-table.tsx index 63572138..5a4d23b1 100644 --- a/apps/ai-hero/src/app/(content)/lists/_components/lists-table.tsx +++ b/apps/ai-hero/src/app/(content)/lists/_components/lists-table.tsx @@ -4,7 +4,7 @@ import React from 'react' import Link from 'next/link' import type { List } from '@/lib/lists' import { deleteList } from '@/lib/lists-query' -import { Trash } from 'lucide-react' +import { Edit3, Trash } from 'lucide-react' import { Alert, @@ -36,7 +36,7 @@ export function ListsTable({ Description Type Resources - Actions + {canCreateContent && Actions} @@ -44,11 +44,7 @@ export function ListsTable({ {list.fields.title} @@ -59,25 +55,32 @@ export function ListsTable({ {list.fields.type} {list.resources?.length || 0} - - - + {canCreateContent && ( + + + + + )} ))} {lists.length === 0 && (