2023-10-23 23:33:39 +02:00
|
|
|
import Image from "next/image"
|
|
|
|
import date from "date-and-time"
|
|
|
|
import useTranslation from "next-translate/useTranslation"
|
2021-10-24 06:09:43 +02:00
|
|
|
|
2023-10-23 23:33:39 +02:00
|
|
|
import type { UserPublic } from "../../../models/User"
|
|
|
|
import type { Guild } from "../../../models/Guild"
|
2021-10-24 06:09:43 +02:00
|
|
|
|
|
|
|
export interface UserProfileProps {
|
|
|
|
className?: string
|
|
|
|
user: UserPublic
|
2022-02-19 23:20:33 +01:00
|
|
|
guilds: Guild[]
|
2021-10-24 06:09:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export const UserProfile: React.FC<UserProfileProps> = (props) => {
|
2022-03-16 12:18:09 +01:00
|
|
|
const { user } = props
|
2021-10-24 06:09:43 +02:00
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
return (
|
2023-10-23 23:33:39 +02:00
|
|
|
<div className="relative flex h-full flex-col items-center justify-center">
|
|
|
|
<div className="transition">
|
|
|
|
<div className="max-w-[1000px] px-12">
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
<div className="flex w-max flex-col items-center gap-7 md:flex-row">
|
|
|
|
<div className="relative flex items-center justify-center overflow-hidden rounded-full shadow-lg transition-all">
|
2022-12-13 22:31:32 +01:00
|
|
|
<Image
|
|
|
|
quality={100}
|
2023-10-23 23:33:39 +02:00
|
|
|
className="rounded-full"
|
2022-12-13 22:31:32 +01:00
|
|
|
src={
|
|
|
|
user.logo != null
|
|
|
|
? user.logo
|
2023-10-23 23:33:39 +02:00
|
|
|
: "/images/data/user-default.png"
|
2022-12-13 22:31:32 +01:00
|
|
|
}
|
2023-10-23 23:33:39 +02:00
|
|
|
alt="Profil Picture"
|
|
|
|
draggable="false"
|
2022-12-13 22:31:32 +01:00
|
|
|
height={125}
|
|
|
|
width={125}
|
|
|
|
/>
|
|
|
|
</div>
|
2023-10-23 23:33:39 +02:00
|
|
|
<div className="ml-10 flex flex-col">
|
|
|
|
<div className="mb-2 flex items-center">
|
2022-12-13 22:31:32 +01:00
|
|
|
<p
|
2023-10-23 23:33:39 +02:00
|
|
|
className="space text-dark text-3xl font-bold tracking-wide dark:text-white"
|
|
|
|
data-cy="user-name"
|
2022-12-13 22:31:32 +01:00
|
|
|
>
|
|
|
|
{user.name}
|
|
|
|
</p>
|
|
|
|
<p
|
2023-10-23 23:33:39 +02:00
|
|
|
className="ml-8 select-none text-sm tracking-widest text-white opacity-40"
|
|
|
|
data-cy="user-createdAt"
|
2022-12-13 22:31:32 +01:00
|
|
|
>
|
2023-10-23 23:33:39 +02:00
|
|
|
{date.format(new Date(user.createdAt), "DD/MM/YYYY")}
|
2022-12-13 22:31:32 +01:00
|
|
|
</p>
|
2022-01-14 23:15:51 +01:00
|
|
|
</div>
|
2023-10-23 23:33:39 +02:00
|
|
|
<div className="my-2 text-left">
|
2022-12-13 22:31:32 +01:00
|
|
|
{user.email != null && (
|
2023-10-23 23:33:39 +02:00
|
|
|
<p className="font-bold">
|
|
|
|
Email:{" "}
|
2022-12-13 22:31:32 +01:00
|
|
|
<a
|
|
|
|
href={`mailto:${user.email}`}
|
2023-10-23 23:33:39 +02:00
|
|
|
target="_blank"
|
|
|
|
className="relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:bottom-[-1px] after:left-0 after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white"
|
|
|
|
rel="noreferrer"
|
|
|
|
data-cy="user-email"
|
2022-12-13 22:31:32 +01:00
|
|
|
>
|
|
|
|
{user.email}
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
)}
|
|
|
|
{user.website != null && (
|
2023-10-23 23:33:39 +02:00
|
|
|
<p className="font-bold">
|
|
|
|
{t("application:website")}:{" "}
|
2022-12-13 22:31:32 +01:00
|
|
|
<a
|
2023-10-23 23:33:39 +02:00
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer"
|
2022-12-13 22:31:32 +01:00
|
|
|
href={user.website}
|
2023-10-23 23:33:39 +02:00
|
|
|
className="relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:bottom-[-2px] after:left-0 after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white"
|
2022-12-13 22:31:32 +01:00
|
|
|
>
|
|
|
|
{user.website}
|
|
|
|
</a>
|
2022-01-14 23:15:51 +01:00
|
|
|
</p>
|
2022-12-13 22:31:32 +01:00
|
|
|
)}
|
|
|
|
{user.status != null && (
|
2023-10-23 23:33:39 +02:00
|
|
|
<p className="flex font-bold">
|
|
|
|
{t("application:status")}:{" "}
|
|
|
|
<span className="ml-2 font-normal tracking-wide">
|
2022-12-13 22:31:32 +01:00
|
|
|
{user.status}
|
|
|
|
</span>
|
2022-01-14 23:15:51 +01:00
|
|
|
</p>
|
2022-12-13 22:31:32 +01:00
|
|
|
)}
|
2022-01-14 23:15:51 +01:00
|
|
|
</div>
|
2021-10-24 06:09:43 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-12-13 22:31:32 +01:00
|
|
|
{user.biography != null && (
|
2023-10-23 23:33:39 +02:00
|
|
|
<div className="mt-7 text-center">
|
2022-12-13 22:31:32 +01:00
|
|
|
<p>{user.biography}</p>
|
|
|
|
</div>
|
|
|
|
)}
|
2021-10-24 06:09:43 +02:00
|
|
|
</div>
|
2022-01-14 23:15:51 +01:00
|
|
|
</div>
|
2022-12-13 22:31:32 +01:00
|
|
|
</div>
|
2021-10-24 06:09:43 +02:00
|
|
|
)
|
|
|
|
}
|