feat(social): follows, favorites, comments, reactions, collections, public profiles
Follow/unfollow users. Recipe favorites. Threaded comments with emoji reactions. Collections (public/private) with shared member invite. Activity feed. Public profile pages at /u/[username].
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import type { Metadata } from "next";
|
||||
import { headers } from "next/headers";
|
||||
import { auth } from "@/lib/auth/server";
|
||||
import { db, collections, eq, desc } from "@epicure/db";
|
||||
import { CollectionsPageContent } from "@/components/collections/collections-page-content";
|
||||
|
||||
export const metadata: Metadata = { title: "Collections" };
|
||||
|
||||
export default async function CollectionsPage() {
|
||||
const session = await auth.api.getSession({ headers: await headers() });
|
||||
if (!session) return null;
|
||||
|
||||
const userCollections = await db.query.collections.findMany({
|
||||
where: eq(collections.userId, session.user.id),
|
||||
orderBy: desc(collections.updatedAt),
|
||||
with: { recipes: { limit: 1 } },
|
||||
});
|
||||
|
||||
return (
|
||||
<CollectionsPageContent
|
||||
collections={userCollections.map((col) => ({
|
||||
id: col.id,
|
||||
name: col.name,
|
||||
description: col.description,
|
||||
isPublic: col.isPublic,
|
||||
recipeCount: col.recipes.length,
|
||||
}))}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user