mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-19 13:40:41 -05:00
* Initial * Progress * Recent winners * Add button * Progress * Mobile nav initial * UI tweaks * Overflow * AnythingAdder links to places * Remove color for tournament showcase * Adjust SQ top banner based on if season is on right or not * Tournament participant count fixed * Log out * todo * Progress * Nav complete * Done? * Fix lint * Translate settings
36 lines
878 B
TypeScript
36 lines
878 B
TypeScript
import { Link } from "@remix-run/react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { useUser } from "~/features/auth/core/user";
|
|
import { userPage } from "~/utils/urls";
|
|
import { Avatar } from "../Avatar";
|
|
import { LogInIcon } from "../icons/LogIn";
|
|
import { LogInButtonContainer } from "./LogInButtonContainer";
|
|
|
|
export function UserItem() {
|
|
const { t } = useTranslation();
|
|
const user = useUser();
|
|
|
|
if (user) {
|
|
return (
|
|
<Link to={userPage(user)} prefetch="intent" className="layout__user-item">
|
|
<Avatar
|
|
user={user}
|
|
alt={t("header.loggedInAs", {
|
|
userName: `${user.username}`,
|
|
})}
|
|
className="layout__avatar"
|
|
size="sm"
|
|
/>
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<LogInButtonContainer>
|
|
<button type="submit" className="layout__log-in-button">
|
|
<LogInIcon /> {t("header.login")}
|
|
</button>
|
|
</LogInButtonContainer>
|
|
);
|
|
}
|