Add friend code section to user profile edit for discoverability

This commit is contained in:
Kalle 2026-03-14 14:39:48 +02:00
parent 4299a2a517
commit 7df90243f0
18 changed files with 76 additions and 2 deletions

View File

@ -19,13 +19,16 @@ export const loader = async ({ params }: LoaderFunctionArgs) => {
identifier,
true,
))!;
const preferences = await UserRepository.preferencesByUserId(user.id);
const friendCodeResult = await UserRepository.currentFriendCodeByUserId(
user.id,
);
return {
user: userProfile,
favoriteBadgeIds: userProfile.favoriteBadgeIds,
discordUniqueName: userProfile.discordUniqueName,
newProfileEnabled: preferences?.newProfileEnabled ?? false,
friendCode: friendCodeResult?.friendCode ?? null,
};
};

View File

@ -1,6 +1,9 @@
import { Trans, useTranslation } from "react-i18next";
import { Link, useLoaderData, useMatches } from "react-router";
import { SendouButton } from "~/components/elements/Button";
import { SendouDialog } from "~/components/elements/Dialog";
import { FormMessage } from "~/components/FormMessage";
import { FriendCodeInput } from "~/components/FriendCodeInput";
import { BADGE } from "~/features/badges/badges-constants";
import { SendouForm } from "~/form/SendouForm";
import { useIsMounted } from "~/hooks/useIsMounted";
@ -17,7 +20,7 @@ import { userEditProfileBaseSchema } from "../user-page-schemas";
export { loader, action };
export const handle: SendouRouteHandle = {
i18n: ["user"],
i18n: ["common", "user"],
};
export default function UserEditPage() {
@ -67,6 +70,26 @@ export default function UserEditPage() {
>
{({ FormField }) => (
<>
<SendouDialog
heading={t("common:fc.title")}
trigger={
<SendouButton variant="outlined">
{data.friendCode
? `SW-${data.friendCode}`
: t("common:fc.set")}
</SendouButton>
}
>
<div className="stack md">
<FriendCodeInput friendCode={data.friendCode} />
<FormMessage type="info">
{t("common:fc.altingWarning")}
</FormMessage>
<FormMessage type="info">
{t("common:fc.changeHelp")}
</FormMessage>
</div>
</SendouDialog>
<FormField name="customName" />
<FormField name="customUrl" />
<FormField name="inGameName" />

View File

@ -316,6 +316,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -316,6 +316,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -316,6 +316,9 @@
"fc.helpText": "Used to verify your identity for sendou.ink staff, tournament organizers, and SendouQ opponents. You must always play only on this one account.",
"fc.whereToFind": "Find your friend code on your Nintendo Switch (2)",
"fc.onceSetStaffOnly": "Once set, only a member of staff can change it",
"fc.set": "Set friend code",
"fc.altingWarning": "You must always play on the account associated with this friend code. Playing on a different account is considered alting, which is against the rules.",
"fc.changeHelp": "If you need to change your friend code, please contact the site staff on our Discord helpdesk.",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "Builds: Disable automatic ability sorting",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "Outside of your profile page, build abilities are sorted so that same abilities are next to each other. This setting allows you to see the abilities in the order they were authored everywhere.",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "Scrims: No adding to pickups by non-friends",

View File

@ -318,6 +318,9 @@
"fc.helpText": "Se usa para verificar tu identidad ante el staff de sendou.ink, organizadores de torneos y oponentes de SendouQ. Debes jugar siempre con esta misma cuenta.",
"fc.whereToFind": "Encuentra tu clave de amigo en tu Nintendo Switch (2)",
"fc.onceSetStaffOnly": "Una vez guardada, solo un miembro del staff puede modificarla.",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "Builds: Desactivar orden automático de potenciadores",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "Fuera de tu perfil, los potenciadores se agrupan. Activa esta opción para verlos siempre en el orden en que los creaste.",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "Scrims: No permitir invitaciones de usuarios no verificados",

View File

@ -318,6 +318,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -318,6 +318,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -318,6 +318,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "Sets: Désactiver le tri automatique des bonus",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "En dehors de votre profil, les bonus des sets sont triées de manière à ce que les mêmes bonus soient côte à côte. Ce paramètre vous permet de voir les bonus dans l'ordre dans lequel elles ont été créées partout.",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "Scrims: Les ajouts aux pickups peuvent êtres effectuer uniquement par des personnes de confiance",

View File

@ -317,6 +317,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -318,6 +318,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "Build: Disattiva ordinamento automatico delle abilità",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "Aldilà della tua pagina profilo, le build delle abilità sono ordinate in modo tale da rendere vicine le abilità uguali. Quest'impostazione ti permette di vedere le abilità come intese dall'autore ovunque.",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -312,6 +312,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -312,6 +312,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -316,6 +316,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -319,6 +319,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -318,6 +318,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",

View File

@ -319,6 +319,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "Сборки: Отключить автоматическую сортировку свойств",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "За исключением вашего профиля, свойства в сборках отсортированы так, что одинаковые свойства находятся друг за другом. Эта настройка позволит вам видеть свойства в сборках в порядке, который задал автор.",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "Скримы: Не добавляться в пик-апы недоверенными лицами",

View File

@ -312,6 +312,9 @@
"fc.helpText": "",
"fc.whereToFind": "",
"fc.onceSetStaffOnly": "",
"fc.set": "",
"fc.altingWarning": "",
"fc.changeHelp": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.label": "",
"settings.UPDATE_DISABLE_BUILD_ABILITY_SORTING.bottomText": "",
"settings.DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED.label": "",