feat: 更新评论和帖子模型,添加用户信息和原创标识,优化API请求和组件结构

This commit is contained in:
2025-07-28 06:22:07 +08:00
parent 5c20a310e3
commit d73ed493be
20 changed files with 260 additions and 181 deletions

View File

@ -1,8 +1,9 @@
'use client'
import { AnimatePresence, motion } from 'framer-motion'
import { motion } from 'framer-motion'
import { usePathname } from 'next/navigation'
import { Navbar } from '@/components/navbar'
import { BackgroundProvider } from '@/contexts/background-context'
export default function RootLayout({
children,
@ -15,22 +16,21 @@ export default function RootLayout({
<header className="fixed top-0 left-0 w-full z-50 bg-white/80 dark:bg-slate-900/80 backdrop-blur flex justify-center border-b border-slate-200 dark:border-slate-800">
<Navbar />
</header>
<AnimatePresence mode="wait">
<motion.main
key={pathname}
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 16 }}
transition={{
type: 'tween',
ease: 'easeOut',
duration: 0.18,
}}
className="pt-16"
>
{children}
</motion.main>
</AnimatePresence>
<motion.main
key={pathname}
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
transition={{
type: 'tween',
ease: 'easeOut',
duration: 0.30,
}}
className="pt-16"
>
<BackgroundProvider>
<div className='container mx-auto px-4 sm:px-6 lg:px-10 max-w-7xl'>{children}</div>
</BackgroundProvider>
</motion.main>
</>
)
}
}

View File

@ -3,6 +3,8 @@ import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { DeviceProvider } from "@/contexts/device-context";
import { NextIntlClientProvider } from 'next-intl';
import config from "@/config";
import { getUserLocales } from "@/i18n/request";
const geistSans = Geist({
variable: "--font-geist-sans",
@ -15,17 +17,17 @@ const geistMono = Geist_Mono({
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: config.metadata.name,
description: config.metadata.description,
};
export default function RootLayout({
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<html lang={(await getUserLocales())[0] || "en"} className="h-full">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>