1
0
Fork 0

feat: highlight suspended/banned users

main
Lea 2023-12-05 18:10:02 +01:00
parent b79a14f00c
commit 96d5884461
Signed by: lea
GPG Key ID: 1BAFFE8347019C42
1 changed files with 11 additions and 2 deletions

View File

@ -7,13 +7,20 @@ import Link from "next/link";
import { ExternalLinkIcon } from "lucide-react"; import { ExternalLinkIcon } from "lucide-react";
export function UserCard({ user, subtitle, withLink }: { user: User; subtitle: string, withLink?: boolean }) { export function UserCard({ user, subtitle, withLink }: { user: User; subtitle: string, withLink?: boolean }) {
const gradientColour = user.flags == 1
? 'rgba(251, 146, 60, 0.6)'
: user.flags == 4
? 'rgba(239, 68, 68, 0.6)'
: 'transparent';
const gradient = `linear-gradient(to right, white, rgba(255,0,0,0)), repeating-linear-gradient(225deg, transparent, transparent 32px, ${gradientColour} 32px, ${gradientColour} 64px)`;
return ( return (
<Card <Card
className="bg-no-repeat bg-right text-left" className="bg-no-repeat bg-right text-left"
style={{ style={{
backgroundImage: user.profile?.background backgroundImage: user.profile?.background
? `linear-gradient(to right, white, rgba(255,0,0,0)), url('${AUTUMN_URL}/backgrounds/${user.profile.background._id}')` ? `${gradient}, url('${AUTUMN_URL}/backgrounds/${user.profile.background._id}')`
: "", : gradient,
backgroundSize: "75%", backgroundSize: "75%",
}} }}
> >
@ -30,6 +37,8 @@ export function UserCard({ user, subtitle, withLink }: { user: User; subtitle: s
</AvatarFallback> </AvatarFallback>
</Avatar> </Avatar>
{user.bot && <Badge className="align-middle">Bot</Badge>}{" "} {user.bot && <Badge className="align-middle">Bot</Badge>}{" "}
{user.flags == 1 && <Badge className="align-middle bg-orange-400">Suspended</Badge>}{" "}
{user.flags == 4 && <Badge className="align-middle bg-red-700">Banned</Badge>}{" "}
<div className="flex gap-2"> <div className="flex gap-2">
{user.username}#{user.discriminator} {user.display_name} {user.username}#{user.discriminator} {user.display_name}
{ {