sendou.ink/app/components/layout/UserItem.tsx
Kalle 68aa12414a
New front page (#1938)
* 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
2024-10-20 09:01:22 +03:00

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>
);
}