mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-20 14:12:01 -05:00
* Kysely initial * Badges initial * Badge routes migrated * Badges migrated * Calendar work * Fix one type problem * Calendar work * findResultsByUserId work * Calendar reworking finished * PlusSuggestions work * Migrated suggestions * Builds progress * Migrated builds * Admin migrated * Migrate articles * User search * Faster getUser * Selectable/insertable as global * Refresh prod db script + patronTier index * identifierToUserId * updateProfile * findByIdentifier * More indexes * User upsert * upsertLite * findAllPlusMembers * updateResultHighlights * updateMany * User finished migration * Fix types * Fix PlusVotingResult typing * PlusVotingRepository WIP * Migrated resultsByMonthYear * Migrated plusVotes (done with db. related migrations) * Plus code to features folder * Fix TODOs * Export * Fix range * Migrate some user pages * Move rest user routes * Move /play * Map list generator * Front page * Move map list generation logic * Move plus voting logic * Info * API * Adjust TODOs * theme * Auth * Remove TODO
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { Link } from "@remix-run/react";
|
|
import { useTranslation } from "~/hooks/useTranslation";
|
|
import { useUser } from "~/features/auth/core";
|
|
import { userPage } from "~/utils/urls";
|
|
import { Avatar } from "../Avatar";
|
|
import { LogInIcon } from "../icons/LogIn";
|
|
import { LogInButtonContainer } from "./LogInButtonContainer";
|
|
import { useRootLoaderData } from "~/hooks/useRootLoaderData";
|
|
|
|
export function UserItem() {
|
|
const data = useRootLoaderData();
|
|
const { t } = useTranslation();
|
|
const user = useUser();
|
|
|
|
if (user) {
|
|
return (
|
|
<Link to={userPage(user)} prefetch="intent">
|
|
<Avatar
|
|
user={user}
|
|
alt={t("header.loggedInAs", {
|
|
userName: `${user.discordName}`,
|
|
})}
|
|
className="layout__avatar"
|
|
size="sm"
|
|
/>
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
if (data.loginDisabled) {
|
|
return false;
|
|
}
|
|
|
|
return (
|
|
<LogInButtonContainer>
|
|
<button type="submit" className="layout__log-in-button">
|
|
<LogInIcon /> {t("header.login")}
|
|
</button>
|
|
</LogInButtonContainer>
|
|
);
|
|
}
|