mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-24 06:58:10 -05:00
Battlefy account
This commit is contained in:
parent
182e9b22a2
commit
af60cf3457
38
app/components/icons/Battlefy.tsx
Normal file
38
app/components/icons/Battlefy.tsx
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
export function BattlefyIcon() {
|
||||
return (
|
||||
<svg
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlnsXlink="http://www.w3.org/1999/xlink"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 1152 1152"
|
||||
enableBackground="new 0 0 1152 1152"
|
||||
xmlSpace="preserve"
|
||||
>
|
||||
<path
|
||||
display="none"
|
||||
fill="#151B27"
|
||||
d="M1152,1099.3c0,29.4-23.8,52.7-53.2,52.7H52.8c-29.4,0-52.8-23.4-52.8-52.7V53.2
|
||||
C0,23.8,23.4,0,52.8,0h1046.1c29.4,0,53.2,23.8,53.2,53.2V1099.3z"
|
||||
/>
|
||||
<g>
|
||||
<path
|
||||
fill="#DD4B5E"
|
||||
d="M222.5,399.8c1.5-18.1,79.5-154.8,99.7-166.1c20.2-11.3,211.5-22.9,211.5-22.9S368.9,346.1,331.5,555.9
|
||||
c-37.3,209.8-1.3,374.1-1.3,374.1S218.8,444.5,222.5,399.8z"
|
||||
/>
|
||||
<path
|
||||
fill="#DD4B5E"
|
||||
d="M467.6,753.3c0,0,242.8-431.4,522.1-542.6l-154,520L342.4,941.2c0,0,417.4-276.9,449.6-289.8l93.3-307.7
|
||||
C885.4,343.8,548.5,641.2,467.6,753.3z"
|
||||
/>
|
||||
<path
|
||||
fill="#DD4B5E"
|
||||
d="M672.9,400.4c0,0-203.8,193.6-257.9,351.2c0,0-26-108.8-19.5-133.2L672.9,400.4z"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ export const USER = {
|
|||
BIO_MAX_LENGTH: DISCORD_MESSAGE_MAX_LENGTH,
|
||||
CUSTOM_URL_MAX_LENGTH: 32,
|
||||
CUSTOM_NAME_MAX_LENGTH: 32,
|
||||
BATTLEFY_MAX_LENGTH: 32,
|
||||
IN_GAME_NAME_TEXT_MAX_LENGTH: 20,
|
||||
IN_GAME_NAME_DISCRIMINATOR_MAX_LENGTH: 5,
|
||||
WEAPON_POOL_MAX_SIZE: 5,
|
||||
|
|
|
|||
|
|
@ -691,6 +691,7 @@ export interface User {
|
|||
stickSens: number | null;
|
||||
twitch: string | null;
|
||||
twitter: string | null;
|
||||
battlefy: string | null;
|
||||
vc: Generated<"YES" | "NO" | "LISTEN_ONLY">;
|
||||
youtubeId: string | null;
|
||||
mapModePreferences: ColumnType<
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ export const loader = async ({ params, request }: LoaderFunctionArgs) => {
|
|||
"User.username",
|
||||
"User.discordId",
|
||||
"User.discordAvatar",
|
||||
"User.battlefy",
|
||||
"TournamentTeamMember.isOwner",
|
||||
"TournamentTeamMember.createdAt",
|
||||
])
|
||||
|
|
@ -115,6 +116,7 @@ export const loader = async ({ params, request }: LoaderFunctionArgs) => {
|
|||
return {
|
||||
userId: member.userId,
|
||||
name: member.username,
|
||||
battlefy: member.battlefy,
|
||||
discordId: member.discordId,
|
||||
avatarUrl: member.discordAvatar
|
||||
? `https://cdn.discordapp.com/avatars/${member.discordId}/${member.discordAvatar}.png`
|
||||
|
|
|
|||
|
|
@ -109,6 +109,10 @@ export type GetTournamentTeamsResponse = Array<{
|
|||
* @example "79237403620945920"
|
||||
*/
|
||||
discordId: string;
|
||||
/**
|
||||
* @example "sendouc"
|
||||
*/
|
||||
battlefy: string | null;
|
||||
/**
|
||||
* @example "https://cdn.discordapp.com/avatars/79237403620945920/6fc41a44b069a0d2152ac06d1e496c6c.png"
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ export function findByIdentifier(identifier: string) {
|
|||
"User.twitch",
|
||||
"User.twitter",
|
||||
"User.youtubeId",
|
||||
"User.battlefy",
|
||||
"User.favoriteBadgeId",
|
||||
"User.banned",
|
||||
"User.bannedReason",
|
||||
|
|
@ -409,6 +410,7 @@ type UpdateProfileArgs = Pick<
|
|||
| "motionSens"
|
||||
| "stickSens"
|
||||
| "inGameName"
|
||||
| "battlefy"
|
||||
| "css"
|
||||
| "favoriteBadgeId"
|
||||
| "showDiscordUniqueName"
|
||||
|
|
@ -450,6 +452,7 @@ export function updateProfile(args: UpdateProfileArgs) {
|
|||
stickSens: args.stickSens,
|
||||
inGameName: args.inGameName,
|
||||
css: args.css,
|
||||
battlefy: args.battlefy,
|
||||
favoriteBadgeId: args.favoriteBadgeId,
|
||||
showDiscordUniqueName: args.showDiscordUniqueName,
|
||||
commissionText: args.commissionText,
|
||||
|
|
|
|||
|
|
@ -87,6 +87,10 @@ const userEditActionSchema = z
|
|||
falsyToNull,
|
||||
z.string().trim().max(USER.CUSTOM_NAME_MAX_LENGTH).nullable(),
|
||||
),
|
||||
battlefy: z.preprocess(
|
||||
falsyToNull,
|
||||
z.string().max(USER.BATTLEFY_MAX_LENGTH).nullable(),
|
||||
),
|
||||
stickSens: z.preprocess(
|
||||
processMany(actualNumber, undefinedToNull),
|
||||
z
|
||||
|
|
@ -246,6 +250,7 @@ export default function UserEditPage() {
|
|||
<CustomUrlInput parentRouteData={parentRouteData} />
|
||||
<InGameNameInputs parentRouteData={parentRouteData} />
|
||||
<SensSelects parentRouteData={parentRouteData} />
|
||||
<BattlefyInput parentRouteData={parentRouteData} />
|
||||
<CountrySelect parentRouteData={parentRouteData} />
|
||||
<FavBadgeSelect parentRouteData={parentRouteData} />
|
||||
<WeaponPoolSelect parentRouteData={parentRouteData} />
|
||||
|
|
@ -438,6 +443,27 @@ function CountrySelect({
|
|||
);
|
||||
}
|
||||
|
||||
function BattlefyInput({
|
||||
parentRouteData,
|
||||
}: {
|
||||
parentRouteData: UserPageLoaderData;
|
||||
}) {
|
||||
const { t } = useTranslation(["user"]);
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<Label htmlFor="customName">{t("user:battlefy")}</Label>
|
||||
<Input
|
||||
name="battlefy"
|
||||
id="battlefy"
|
||||
maxLength={USER.BATTLEFY_MAX_LENGTH}
|
||||
defaultValue={parentRouteData.battlefy ?? undefined}
|
||||
/>
|
||||
<FormMessage type="info">{t("user:forms.info.battlefy")}</FormMessage>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function WeaponPoolSelect({
|
||||
parentRouteData,
|
||||
}: {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import {
|
|||
import { badgeExplanationText } from "../../badges/routes/badges.$id";
|
||||
import type { UserPageLoaderData } from "./u.$identifier";
|
||||
import { DiscordIcon } from "~/components/icons/Discord";
|
||||
import { BattlefyIcon } from "~/components/icons/Battlefy";
|
||||
|
||||
export const handle: SendouRouteHandle = {
|
||||
i18n: "badges",
|
||||
|
|
@ -58,6 +59,9 @@ export default function UserInfoPage() {
|
|||
{data.youtubeId ? (
|
||||
<SocialLink type="youtube" identifier={data.youtubeId} />
|
||||
) : null}
|
||||
{data.battlefy ? (
|
||||
<SocialLink type="battlefy" identifier={data.battlefy} />
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
<ExtraInfos />
|
||||
|
|
@ -93,7 +97,7 @@ function TeamInfo() {
|
|||
}
|
||||
|
||||
interface SocialLinkProps {
|
||||
type: "youtube" | "twitter" | "twitch";
|
||||
type: "youtube" | "twitter" | "twitch" | "battlefy";
|
||||
identifier: string;
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +105,7 @@ export function SocialLink({
|
|||
type,
|
||||
identifier,
|
||||
}: {
|
||||
type: "youtube" | "twitter" | "twitch";
|
||||
type: "youtube" | "twitter" | "twitch" | "battlefy";
|
||||
identifier: string;
|
||||
}) {
|
||||
const href = () => {
|
||||
|
|
@ -112,6 +116,8 @@ export function SocialLink({
|
|||
return `https://www.twitter.com/${identifier}`;
|
||||
case "youtube":
|
||||
return `https://www.youtube.com/channel/${identifier}`;
|
||||
case "battlefy":
|
||||
return `https://battlefy.com/users/${identifier}`;
|
||||
default:
|
||||
assertUnreachable(type);
|
||||
}
|
||||
|
|
@ -123,6 +129,7 @@ export function SocialLink({
|
|||
youtube: type === "youtube",
|
||||
twitter: type === "twitter",
|
||||
twitch: type === "twitch",
|
||||
battlefy: type === "battlefy",
|
||||
})}
|
||||
href={href()}
|
||||
>
|
||||
|
|
@ -139,6 +146,8 @@ function SocialLinkIcon({ type }: Pick<SocialLinkProps, "type">) {
|
|||
return <TwitterIcon />;
|
||||
case "youtube":
|
||||
return <YouTubeIcon />;
|
||||
case "battlefy":
|
||||
return <BattlefyIcon />;
|
||||
default:
|
||||
assertUnreachable(type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,6 +87,15 @@
|
|||
fill: #9146ff;
|
||||
}
|
||||
|
||||
.u__social-link.battlefy {
|
||||
border-color: #de4c5e;
|
||||
background-color: #de4c5e2f;
|
||||
}
|
||||
|
||||
.u__social-link.battlefy > svg {
|
||||
fill: #de4c5e;
|
||||
}
|
||||
|
||||
.u__extra-infos {
|
||||
display: flex;
|
||||
max-width: 24rem;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"weaponPool": "Weapon pool",
|
||||
"discordExplanation": "Username, profile picture, YouTube, Twitter and Twitch accounts come from your Discord account. See <1>FAQ</1> for more information.",
|
||||
"favoriteBadge": "Favorite Badge",
|
||||
"battlefy": "Battlefy account name",
|
||||
|
||||
"forms.showDiscordUniqueName": "Show Discord username",
|
||||
"forms.showDiscordUniqueName.info": "Show your unique Discord name ({{discordUniqueName}}) publicly?",
|
||||
|
|
@ -40,6 +41,7 @@
|
|||
"forms.errors.invalidCustomUrl.duplicate": "Someone is already using this custom URL",
|
||||
"forms.errors.invalidSens": "Motion sens can't be set if R-stick sens isn't",
|
||||
"forms.info.favoriteBadge": "Your favorite badge is shown as big by default on your profile.",
|
||||
"forms.info.battlefy": "Battlefy account name is used for seeding and verification in some tournaments",
|
||||
|
||||
"search.info": "Search for users by Discord, Splatoon 3 or Twitter name",
|
||||
"search.noResults": "No users found matching '{{query}}'",
|
||||
|
|
|
|||
5
migrations/063-user-battlefy.js
Normal file
5
migrations/063-user-battlefy.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export function up(db) {
|
||||
db.transaction(() => {
|
||||
db.prepare(/* sql */ `alter table "User" add "battlefy" text`).run();
|
||||
})();
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user