import Image from "next/image";
import { signout } from "@/features/auth/actions";
import { createClient } from "@/utils/supabase/server";
import { Button } from "@/components/ui/button";
/**
* [메인 페이지 컴포넌트]
*
* 로그인한 사용자만 접근 가능 (Middleware에서 보호)
* - 사용자 정보 표시 (이메일, 프로필 아바타)
* - 로그아웃 버튼 제공
*/
export default async function Home() {
// 현재 로그인한 사용자 정보 가져오기
// Middleware에서 이미 인증을 확인했으므로 여기서는 user가 항상 존재함
const supabase = await createClient();
const {
data: { user },
} = await supabase.auth.getUser();
return (
{/* ========== 헤더: 로그인 정보 및 로그아웃 버튼 ========== */}
{/* 사용자 프로필 표시 */}
{/* 프로필 아바타: 이메일 첫 글자 표시 */}
{user?.email?.charAt(0).toUpperCase() || "U"}
{/* 이메일 및 로그인 상태 텍스트 */}
{user?.email || "사용자"}
로그인됨
{/* 로그아웃 폼 */}
{/* formAction: 서버 액션(signout)을 호출하여 로그아웃 처리 */}
To get started, edit the page.tsx file.
Looking for a starting point or more instructions? Head over to{" "}
Templates
{" "}
or the{" "}
Learning
{" "}
center.
);
}