1- import { Avatar , AvatarFallback , AvatarImage } from "@/components/ui/avatar" ;
2- import { Card , CardContent , CardDescription , CardFooter , CardHeader , CardTitle } from "@/components/ui/card" ;
3- import { FormClient } from "./client/FormClient" ;
4- import { Label } from "@/components/ui/label" ;
1+ import { FormClient } from "./form.client" ;
52import { User as SupabaseUser } from "@supabase/supabase-js" ;
63import { getProfile } from "./actions" ;
74import { getTranslations } from "next-intl/server" ;
85import { Metadata } from "next" ;
6+ import { Suspense } from "react" ;
7+ import { LoadingComponent } from "@/components/custom/Loading" ;
8+ import { Profile } from "./dynamic" ;
99
1010export const dynamic = "force-dynamic" ;
1111
@@ -22,7 +22,6 @@ export async function generateMetadata(): Promise<Metadata> {
2222
2323export default async function Page ( ) {
2424 const { data, error } = await getProfile ( ) ;
25- const t = await getTranslations ( "profile" ) ;
2625
2726 if ( error ) {
2827 throw new Error ( error . message ) ;
@@ -31,30 +30,12 @@ export default async function Page() {
3130
3231 return (
3332 < section className = 'flex flex-col space-y-2 w-[400px]' >
34- < FormClient nickname = { user ?. nickname || "" } />
35- < Card >
36- < CardHeader >
37- < CardTitle className = 'uppercase font-bold text-xl' > { t ( "title" ) } </ CardTitle >
38- < CardDescription className = 'text-muted-foreground' > { t ( "description" ) } </ CardDescription >
39- </ CardHeader >
40- < CardContent className = 'space-y-4' >
41- < div className = 'flex items-center space-x-4' >
42- < Avatar className = 'w-20 h-20' >
43- < AvatarImage src = { user ?. user_metadata . avatar_url } alt = { user ?. user_metadata . full_name } />
44- < AvatarFallback > { user ?. user_metadata . full_name ?. charAt ( 0 ) } </ AvatarFallback >
45- </ Avatar >
46- < div >
47- < h2 className = 'text-2xl font-bold' > { user ?. user_metadata . full_name } </ h2 >
48- < p className = 'text-muted-foreground' > { user ?. email } </ p >
49- </ div >
50- </ div >
51- </ CardContent >
52- < CardFooter className = 'flex justify-center' >
53- < Label className = 'uppercase font-bold text-center' >
54- { t ( "loginWith" ) } { user ?. app_metadata . provider }
55- </ Label >
56- </ CardFooter >
57- </ Card >
33+ < Suspense fallback = { < LoadingComponent /> } >
34+ < FormClient nickname = { user ?. nickname || "" } />
35+ </ Suspense >
36+ < Suspense fallback = { < LoadingComponent /> } >
37+ < Profile user = { user } />
38+ </ Suspense >
5839 </ section >
5940 ) ;
6041}
0 commit comments