feat: complete v0.3 reading and discovery experience

This commit is contained in:
2026-07-19 03:16:18 +08:00
parent 5b5129fad5
commit 9ab09159e3
23 changed files with 1829 additions and 26 deletions
+4 -2
View File
@@ -1,8 +1,10 @@
import "./styles.css";
import Link from "next/link";
import { getSession } from "@/lib/auth";
export const metadata = { title: "Mebbling", description: "Your Memos hub" };
import { db } from "@/lib/db";
export const metadata = { title: "Mebbling", description: "聚合朋友公開筆記的 Memos Hub", alternates: { types: { "application/rss+xml": [{ url: "/rss.xml", title: "Mebbling RSS" }], "application/atom+xml": [{ url: "/atom.xml", title: "Mebbling Atom" }] } }, openGraph: { title: "Mebbling", description: "聚合朋友公開筆記的 Memos Hub", type: "website" } };
export default async function RootLayout({ children }: { children: React.ReactNode }) {
const user = await getSession();
return <html lang="zh-Hant"><body><header><Link href="/" className="brand">Mebbling</Link><nav><Link href="/"></Link>{user ? <><Link href="/dashboard"></Link><Link href="/account"></Link>{user.role === "admin" && <Link href="/admin"></Link>}<form action="/api/auth/logout" method="post"><button></button></form></> : <><Link href="/login"></Link><Link href="/register"></Link></>}</nav></header><main>{children}</main></body></html>;
const unread = user ? Number((db.prepare("SELECT count(*) count FROM notifications WHERE user_id=? AND read_at IS NULL").get(user.id) as { count: number }).count) : 0;
return <html lang="zh-Hant"><body><header><Link href="/" className="brand">Mebbling</Link><nav><Link href="/"></Link>{user ? <><Link href="/reading"></Link><Link href="/notifications">{unread ? ` (${unread})` : ""}</Link><Link href="/dashboard"></Link><Link href="/account"></Link>{user.role === "admin" && <Link href="/admin"></Link>}<form action="/api/auth/logout" method="post"><button></button></form></> : <><Link href="/login"></Link><Link href="/register"></Link></>}</nav></header><main>{children}</main></body></html>;
}