feat: update
This commit is contained in:
@@ -3,6 +3,7 @@ import { Anuphan, Geist_Mono } from "next/font/google";
|
||||
|
||||
import { DeploymentUpdateNotifier } from "@/components/deployment-update-notifier";
|
||||
import { PageProgress } from "@/components/page-progress";
|
||||
import { SiteEntryPrompt } from "@/components/site-entry-prompt";
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
import { siteUrl } from "@/lib/site-url";
|
||||
|
||||
@@ -27,6 +28,8 @@ export const metadata: Metadata = {
|
||||
},
|
||||
description: "ไกด์ตัวละครจากช่องเกนชินไม่ใช่เกมมือถือ",
|
||||
keywords: ["เกนชิน", "เกนชินไม่ใช่เกมมือถือ", "Buzz", "ไกด์", "สุดหล่อ"],
|
||||
icons: { apple: "/icon-192.png" },
|
||||
appleWebApp: { capable: true, title: "Buzz Guide" },
|
||||
};
|
||||
|
||||
export const viewport: Viewport = {
|
||||
@@ -45,6 +48,7 @@ export default function RootLayout({ children }: LayoutProps<"/">) {
|
||||
<body className="flex min-h-full flex-col">
|
||||
<PageProgress />
|
||||
{children}
|
||||
<SiteEntryPrompt />
|
||||
<DeploymentUpdateNotifier deploymentId={deploymentId} />
|
||||
<Toaster
|
||||
richColors
|
||||
|
||||
+10
-2
@@ -8,11 +8,15 @@ import { AdminHeader } from "@/components/admin/admin-header";
|
||||
import { ProfileForm } from "@/components/auth/profile-form";
|
||||
import { isAuthorizedAdmin } from "@/lib/auth/authorization";
|
||||
import { getCustomerSession } from "@/lib/auth/server";
|
||||
import { safeAuthReturnPath } from "@/lib/auth/return-path";
|
||||
|
||||
export const instant = false;
|
||||
|
||||
export default async function ProfilePage() {
|
||||
export default async function ProfilePage({ searchParams }: PageProps<"/profile">) {
|
||||
await connection();
|
||||
const { setup, next, upload } = await searchParams;
|
||||
const nextPath = safeAuthReturnPath(next);
|
||||
const setupNextPath = nextPath === "/profile" || nextPath.startsWith("/profile?") ? "/" : nextPath;
|
||||
const session = await getCustomerSession();
|
||||
if (!session) redirect("/login?next=%2Fprofile");
|
||||
const [user] = await getDb().select({ name: users.name, email: users.email, image: users.image })
|
||||
@@ -21,7 +25,11 @@ export default async function ProfilePage() {
|
||||
return <div className="min-h-svh">{isAuthorizedAdmin(session.user) ? <AdminHeader /> : <SiteHeader />}
|
||||
<main className="mx-auto max-w-xl p-4 py-10 sm:p-8">
|
||||
<h1 className="mb-6 font-heading text-3xl font-semibold">โปรไฟล์ของฉัน</h1>
|
||||
<ProfileForm {...user} />
|
||||
{setup === "1" && <p className="mb-6 text-muted-foreground">
|
||||
{upload === "failed" ? "สร้างบัญชีแล้ว แต่บันทึกรูปโปรไฟล์ไม่สำเร็จ กรุณาลองอีกครั้งหรือข้ามไปก่อน" :
|
||||
"เพิ่มรูปโปรไฟล์หรือแก้ชื่อที่แสดงก่อนเริ่มใช้งาน"}
|
||||
</p>}
|
||||
<ProfileForm {...user} nextPath={setup === "1" ? setupNextPath : undefined} />
|
||||
</main>
|
||||
</div>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user