blob: 8aa723e94f0056443ac8f8c7cef281feee7c41ab (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import { redirect } from "next/navigation";
import { Separator } from "@/components/ui/separator";
import { api } from "@/server/api/client";
import { getServerAuthSession } from "@/server/auth";
import type { ZGetBookmarksRequest } from "@hoarder/trpc/types/bookmarks";
import UpdatableBookmarksGrid from "./UpdatableBookmarksGrid";
export default async function Bookmarks({
query,
header,
showDivider,
showEditorCard = false,
}: {
query: ZGetBookmarksRequest;
header: React.ReactNode;
showDivider?: boolean;
showEditorCard?: boolean;
}) {
const session = await getServerAuthSession();
if (!session) {
redirect("/");
}
const bookmarks = await api.bookmarks.getBookmarks(query);
return (
<div className="flex flex-col gap-3">
{header}
{showDivider && <Separator />}
<UpdatableBookmarksGrid
query={query}
bookmarks={bookmarks}
showEditorCard={showEditorCard}
/>
</div>
);
}
|