mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-11 13:15:18 -05:00
* Layout initial * Add FillRosterSection component * Move tournaments to feature folder * Refactor Button props * SubmitButton * Register action * Identifier -> Id * Invite link via nanoid * Team info submit * Enter tiebreaker map list UI * Invite members to tournament team initial * Show banner if joined a team not captain of * Add back teams page * Change team roster size color when good * Delete tournament team member
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import { Link } from "@remix-run/react";
|
|
import { useTranslation } from "~/hooks/useTranslation";
|
|
import { useUser } from "~/modules/auth";
|
|
import { LOG_OUT_URL, userPage } from "~/utils/urls";
|
|
import { Avatar } from "../Avatar";
|
|
import { Button } from "../Button";
|
|
import { LogInIcon } from "../icons/LogIn";
|
|
import { LogOutIcon } from "../icons/LogOut";
|
|
import { UserIcon } from "../icons/User";
|
|
import { Popover } from "../Popover";
|
|
import { LogInButtonContainer } from "./LogInButtonContainer";
|
|
|
|
export function UserItem() {
|
|
const { t } = useTranslation();
|
|
const user = useUser();
|
|
|
|
if (user) {
|
|
return (
|
|
<Popover
|
|
buttonChildren={
|
|
<Avatar
|
|
user={user}
|
|
alt={t("header.loggedInAs", {
|
|
userName: `${user.discordName}`,
|
|
})}
|
|
className="layout__avatar"
|
|
size="sm"
|
|
/>
|
|
}
|
|
>
|
|
<div className="layout__user-popover">
|
|
<Link to={userPage(user)}>
|
|
<Button
|
|
className="w-full"
|
|
size="tiny"
|
|
variant="outlined"
|
|
icon={<UserIcon />}
|
|
>
|
|
{t("pages.myPage")}
|
|
</Button>
|
|
</Link>
|
|
<form method="post" action={LOG_OUT_URL}>
|
|
<Button
|
|
size="tiny"
|
|
variant="outlined"
|
|
icon={<LogOutIcon />}
|
|
type="submit"
|
|
className="w-full"
|
|
>
|
|
{t("header.logout")}
|
|
</Button>
|
|
</form>
|
|
</div>
|
|
</Popover>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<LogInButtonContainer>
|
|
<button type="submit" className="layout__log-in-button">
|
|
<LogInIcon /> {t("header.login")}
|
|
</button>
|
|
</LogInButtonContainer>
|
|
);
|
|
}
|