diff --git a/app/components/u/SocialLink.tsx b/app/components/u/SocialLink.tsx index 5e0fb2117..387b7be68 100644 --- a/app/components/u/SocialLink.tsx +++ b/app/components/u/SocialLink.tsx @@ -8,6 +8,8 @@ interface SocialLinkProps { type: "youtube" | "twitter" | "twitch"; identifier: string; } + +// xxx: move to route file export function SocialLink({ type, identifier, diff --git a/app/routes/u.$identifier/index.tsx b/app/routes/u.$identifier/index.tsx index 23adb81d2..cd18d77f3 100644 --- a/app/routes/u.$identifier/index.tsx +++ b/app/routes/u.$identifier/index.tsx @@ -5,6 +5,9 @@ import { Avatar } from "~/components/Avatar"; import { SocialLink } from "~/components/u/SocialLink"; import styles from "~/styles/u.css"; import type { UserPageLoaderData } from "../u.$identifier"; +import * as React from "react"; +import type { Unpacked } from "~/utils/types"; +import clsx from "clsx"; export const links: LinksFunction = () => { return [{ rel: "stylesheet", href: styles }]; @@ -46,7 +49,66 @@ export default function UserInfoPage() { ) : null} + {data.bio ? {data.bio} : null} ); } + +function BadgeContainer(props: { badges: UserPageLoaderData["badges"] }) { + const [badges, setBadges] = React.useState(props.badges); + const [bigBadge, ...smallBadges] = badges; + if (!bigBadge) return null; + + const setBadgeFirst = (badge: Unpacked) => { + setBadges( + badges.map((b, i) => { + if (i === 0) return badge; + if (b.code === badge.code) return badges[0]!; + + return b; + }) + ); + }; + + return ( + + + + {smallBadges.length > 0 ? ( + + {smallBadges.map((badge) => ( + setBadgeFirst(badge)} + width="48" + height="48" + /> + ))} + + ) : null} + + + {badgeExplanationText(bigBadge)} + + + ); +} + +function badgeExplanationText(badge: Unpacked) { + return `Awarded for winning ${badge.displayName}`; +} diff --git a/app/styles/global.css b/app/styles/global.css index 5a81b6f7e..bcd85bb7c 100644 --- a/app/styles/global.css +++ b/app/styles/global.css @@ -7,6 +7,7 @@ --bg-lighter-transparent: hsla(237.3deg 42.3% 35.6% / 50%); --bg-darker-very-transparent: hsla(237.3deg 42.3% 26.6% / 50%); --bg-darker-transparent: hsla(237.3deg 42.3% 26.6% / 90%); + --bg-badge: #000; --border: hsl(237.3deg 42.3% 45.6%); --button-text: rgb(0 0 0 / 85%); --button-text-transparent: rgb(0 0 0 / 65%); diff --git a/app/styles/u.css b/app/styles/u.css index aea070e4a..122caa94c 100644 --- a/app/styles/u.css +++ b/app/styles/u.css @@ -1,7 +1,7 @@ .u__container { display: flex; flex-direction: column; - gap: var(--s-8); + gap: var(--s-6); } .u__avatar-container { @@ -88,3 +88,27 @@ .u__bio { white-space: pre-wrap; } + +.u__badges { + display: flex; + max-width: 24rem; + padding: var(--s-2); + background-color: var(--bg-badge); + border-radius: var(--rounded); + margin-inline: auto; +} + +.u__small-badges { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + cursor: pointer; + gap: var(--s-1); +} + +.u__badge-explanation { + color: var(--text-lighter); + font-size: var(--fonts-xs); + text-align: center; +} diff --git a/public/gif/badges/lutiblue.gif b/public/gif/badges/lutiblue.gif new file mode 100644 index 000000000..d9141923c Binary files /dev/null and b/public/gif/badges/lutiblue.gif differ diff --git a/public/gif/badges/lutigreen.gif b/public/gif/badges/lutigreen.gif new file mode 100644 index 000000000..9ec77e471 Binary files /dev/null and b/public/gif/badges/lutigreen.gif differ diff --git a/public/gif/badges/lutilimegreen.gif b/public/gif/badges/lutilimegreen.gif new file mode 100644 index 000000000..6cce5d322 Binary files /dev/null and b/public/gif/badges/lutilimegreen.gif differ diff --git a/public/gif/badges/lutiorange.gif b/public/gif/badges/lutiorange.gif new file mode 100644 index 000000000..204609603 Binary files /dev/null and b/public/gif/badges/lutiorange.gif differ diff --git a/public/gif/badges/lutipink.gif b/public/gif/badges/lutipink.gif new file mode 100644 index 000000000..c1a1c058f Binary files /dev/null and b/public/gif/badges/lutipink.gif differ diff --git a/public/gif/badges/lutipurple.gif b/public/gif/badges/lutipurple.gif new file mode 100644 index 000000000..40fb2f21d Binary files /dev/null and b/public/gif/badges/lutipurple.gif differ diff --git a/public/gif/badges/lutired.gif b/public/gif/badges/lutired.gif new file mode 100644 index 000000000..a83c49ab8 Binary files /dev/null and b/public/gif/badges/lutired.gif differ diff --git a/public/gif/badges/lutitan.gif b/public/gif/badges/lutitan.gif new file mode 100644 index 000000000..34d242588 Binary files /dev/null and b/public/gif/badges/lutitan.gif differ diff --git a/public/gif/badges/lutitan2.gif b/public/gif/badges/lutitan2.gif new file mode 100644 index 000000000..34d242588 Binary files /dev/null and b/public/gif/badges/lutitan2.gif differ diff --git a/public/gif/badges/lutiyellow.gif b/public/gif/badges/lutiyellow.gif new file mode 100644 index 000000000..b8df6e1c3 Binary files /dev/null and b/public/gif/badges/lutiyellow.gif differ