mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-19 05:54:06 +01:00
feat: retrive profile base on user_id
This commit is contained in:
parent
398ef2fe25
commit
ba6a785c71
@ -1,5 +1,3 @@
|
||||
// components/ProfilePage.tsx
|
||||
|
||||
import React from "react";
|
||||
import Image from "next/image";
|
||||
import { createSupabaseClient } from "@/lib/supabase/serverComponentClient";
|
||||
@ -10,22 +8,11 @@ import ReactMarkdown from "react-markdown";
|
||||
|
||||
interface Profile extends Tables<"Profiles"> {}
|
||||
|
||||
export default async function ProfilePage() {
|
||||
export default async function ProfilePage({ params }: { params: { uid: string } }) {
|
||||
const supabase = createSupabaseClient();
|
||||
const uid = params.uid;
|
||||
|
||||
const {
|
||||
data: { user },
|
||||
} = await supabase.auth.getUser();
|
||||
|
||||
if (!user) {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-screen">
|
||||
<p className="text-red-500">No user found!</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const { data: profileData, error } = await getUserProfile(supabase, user.id);
|
||||
const { data: profileData, error } = await getUserProfile(supabase, uid);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
@ -32,7 +32,7 @@ const UnAuthenticatedComponents = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const AuthenticatedComponents = () => {
|
||||
const AuthenticatedComponents = ({ uid }: { uid: string }) => {
|
||||
let notifications = 100;
|
||||
const displayValue = notifications >= 100 ? "..." : notifications;
|
||||
return (
|
||||
@ -58,7 +58,7 @@ const AuthenticatedComponents = () => {
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem>
|
||||
<Link href="/profile">Profile</Link>
|
||||
<Link href={`/profile/${uid}`}>Profile</Link>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem>Settings</DropdownMenuItem>
|
||||
@ -88,7 +88,7 @@ export function ProfileBar() {
|
||||
<>
|
||||
{sessionLoaded ? (
|
||||
user ? (
|
||||
<AuthenticatedComponents />
|
||||
<AuthenticatedComponents uid={user.id} />
|
||||
) : (
|
||||
<UnAuthenticatedComponents />
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user