2023-09-11 00:40:14 -05:00
|
|
|
import UserPosts from '@/components/UserPosts';
|
|
|
|
|
import UserProfile from '@/components/UserProfile';
|
|
|
|
|
import { getConvexClient } from '@/lib/convex';
|
|
|
|
|
import { api } from '../../../../convex/_generated/api';
|
|
|
|
|
|
2023-09-10 20:37:07 -05:00
|
|
|
export default async function UserProfilePage({
|
|
|
|
|
params,
|
|
|
|
|
}: {
|
|
|
|
|
params: { id: string };
|
|
|
|
|
}) {
|
2023-09-11 00:40:14 -05:00
|
|
|
const client = await getConvexClient();
|
|
|
|
|
const user = await client.query(api.users.getUserByClerkId, {
|
|
|
|
|
clerkUserId: params.id,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (user === null) {
|
|
|
|
|
// TODO: Show real not found component
|
|
|
|
|
return <div>Not Found</div>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<main className='flex flex-col w-full h-full items-center'>
|
|
|
|
|
<div className='w-full max-w-4xl'>
|
|
|
|
|
<UserProfile user={user} />
|
|
|
|
|
<UserPosts user={user} />
|
|
|
|
|
</div>
|
|
|
|
|
</main>
|
|
|
|
|
);
|
2023-09-10 20:37:07 -05:00
|
|
|
}
|