feat: channel history page — published posts with search

This commit is contained in:
Alexey Pavlov
2026-06-15 10:28:07 +03:00
parent 76eb519018
commit 5be51d88f7
3 changed files with 177 additions and 1 deletions
+28
View File
@@ -0,0 +1,28 @@
import { notFound, redirect } from 'next/navigation';
import { requireUser } from '@/lib/session';
import { engine } from '@/lib/engine';
import Header from '@/components/Header';
import ChannelHistory from '@/components/ChannelHistory';
export default async function ChannelHistoryPage({ params }) {
const user = await requireUser();
if (!user) redirect('/login');
const { id } = await params;
let channel, posts;
try {
channel = await engine.getChannel(user.id, id);
posts = await engine.listUserPosts(user.id, { channel_id: id, status: 'published', limit: 100 });
} catch {
notFound();
}
if (!channel) notFound();
return (
<>
<Header user={user} />
<ChannelHistory channel={channel} posts={posts || []} />
</>
);
}