-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpage.tsx
More file actions
43 lines (39 loc) · 1.39 KB
/
page.tsx
File metadata and controls
43 lines (39 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { getUserByUsername } from "@/backend/services/user.action";
import _t from "@/i18n/_t";
import { markdocParser } from "@/lib/markdown/markdoc-parser";
import Markdown from "@/lib/markdown/Markdown";
import Image from "next/image";
import React from "react";
interface UserProfilePageProps {
params: Promise<{ username: string }>;
}
const UserProfilePage: React.FC<UserProfilePageProps> = async ({ params }) => {
const _params = await params;
const username = _params?.username?.startsWith("%40")
? _params.username.replaceAll("%40", "").toLowerCase()
: _params.username.toLowerCase();
const profile = await getUserByUsername(username, ["profile_readme"]);
return (
<main className="border rounded-bl-2xl rounded-br-2xl md:col-span-9 col-span-full">
{profile?.profile_readme ? (
<div className="p-3 content-typography">
<Markdown content={profile?.profile_readme} />
</div>
) : (
<div className="py-10 flex flex-col items-center justify-center gap-4">
<Image
src="/images/robots-drones-artificial-intelligence-1.png"
alt="Error"
width={300}
height={300}
className="mx-auto"
/>
<h1 className="text-2xl font-semibold">
{_t("No profile readme found")}
</h1>
</div>
)}
</main>
);
};
export default UserProfilePage;