mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-30 23:27:55 -05:00
Tournament teams UI tweak
This commit is contained in:
@@ -7,6 +7,8 @@ import type { TournamentDataTeam } from "~/features/tournament-bracket/core/Tour
|
||||
import { userPage } from "~/utils/urls";
|
||||
import { useTournament, useTournamentFriendCodes } from "../routes/to.$id";
|
||||
import { databaseTimestampToDate } from "~/utils/dates";
|
||||
import { useUser } from "~/features/auth/core/user";
|
||||
import { accountCreatedInTheLastSixMonths } from "~/utils/users";
|
||||
|
||||
export function TeamWithRoster({
|
||||
team,
|
||||
@@ -21,6 +23,7 @@ export function TeamWithRoster({
|
||||
teamPageUrl?: string;
|
||||
activePlayers?: User["id"][];
|
||||
}) {
|
||||
const user = useUser();
|
||||
const tournament = useTournament();
|
||||
const friendCodes = useTournamentFriendCodes();
|
||||
|
||||
@@ -86,7 +89,12 @@ export function TeamWithRoster({
|
||||
</Link>
|
||||
</div>
|
||||
{friendCode ? (
|
||||
<div className="text-xs text-lighter">SW-{friendCode}</div>
|
||||
<div className="text-xs text-lighter">
|
||||
{tournament.isOrganizer(user) ? (
|
||||
<FreshAccountEmoji discordId={member.discordId} />
|
||||
) : null}
|
||||
SW-{friendCode}
|
||||
</div>
|
||||
) : null}
|
||||
</li>
|
||||
);
|
||||
@@ -98,6 +106,19 @@ export function TeamWithRoster({
|
||||
);
|
||||
}
|
||||
|
||||
function FreshAccountEmoji({ discordId }: { discordId: string }) {
|
||||
if (!accountCreatedInTheLastSixMonths(discordId)) return null;
|
||||
|
||||
return (
|
||||
<span
|
||||
className="text-md mr-2"
|
||||
title="Discord account created in the last 6 months"
|
||||
>
|
||||
👶
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function TeamMapPool({
|
||||
mapPool,
|
||||
}: {
|
||||
|
||||
@@ -65,3 +65,9 @@ export function userDiscordIdIsAged(user: { discordId: string }) {
|
||||
|
||||
return Date.now() - timestamp > AGED_CRITERIA;
|
||||
}
|
||||
|
||||
export function accountCreatedInTheLastSixMonths(discordId: string) {
|
||||
const timestamp = convertSnowflakeToDate(discordId).getTime();
|
||||
|
||||
return Date.now() - timestamp < 1000 * 60 * 60 * 24 * 30 * 6;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user