From 7df90243f084cd3f67db0a5405fdacbec5005e0d Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 14 Mar 2026 14:39:48 +0200 Subject: [PATCH] Add friend code section to user profile edit for discoverability --- .../loaders/u.$identifier.edit.server.ts | 5 +++- .../user-page/routes/u.$identifier.edit.tsx | 25 ++++++++++++++++++- locales/da/common.json | 3 +++ locales/de/common.json | 3 +++ locales/en/common.json | 3 +++ locales/es-ES/common.json | 3 +++ locales/es-US/common.json | 3 +++ locales/fr-CA/common.json | 3 +++ locales/fr-EU/common.json | 3 +++ locales/he/common.json | 3 +++ locales/it/common.json | 3 +++ locales/ja/common.json | 3 +++ locales/ko/common.json | 3 +++ locales/nl/common.json | 3 +++ locales/pl/common.json | 3 +++ locales/pt-BR/common.json | 3 +++ locales/ru/common.json | 3 +++ locales/zh/common.json | 3 +++ 18 files changed, 76 insertions(+), 2 deletions(-) diff --git a/app/features/user-page/loaders/u.$identifier.edit.server.ts b/app/features/user-page/loaders/u.$identifier.edit.server.ts index 5eab26665..b2fd03fcb 100644 --- a/app/features/user-page/loaders/u.$identifier.edit.server.ts +++ b/app/features/user-page/loaders/u.$identifier.edit.server.ts @@ -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, }; }; diff --git a/app/features/user-page/routes/u.$identifier.edit.tsx b/app/features/user-page/routes/u.$identifier.edit.tsx index 07abb5820..ab53b3156 100644 --- a/app/features/user-page/routes/u.$identifier.edit.tsx +++ b/app/features/user-page/routes/u.$identifier.edit.tsx @@ -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 }) => ( <> + + {data.friendCode + ? `SW-${data.friendCode}` + : t("common:fc.set")} + + } + > +
+ + + {t("common:fc.altingWarning")} + + + {t("common:fc.changeHelp")} + +
+
diff --git a/locales/da/common.json b/locales/da/common.json index 61c2aa838..c3d8cb5f5 100644 --- a/locales/da/common.json +++ b/locales/da/common.json @@ -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": "", diff --git a/locales/de/common.json b/locales/de/common.json index 2359c5486..3404f8d11 100644 --- a/locales/de/common.json +++ b/locales/de/common.json @@ -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": "", diff --git a/locales/en/common.json b/locales/en/common.json index 6fc99b748..9379a7c28 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -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", diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json index 993f9b01b..23aa4cb64 100644 --- a/locales/es-ES/common.json +++ b/locales/es-ES/common.json @@ -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", diff --git a/locales/es-US/common.json b/locales/es-US/common.json index 7e0fa5ed5..80ada239b 100644 --- a/locales/es-US/common.json +++ b/locales/es-US/common.json @@ -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": "", diff --git a/locales/fr-CA/common.json b/locales/fr-CA/common.json index 4433fc5e0..06048b88a 100644 --- a/locales/fr-CA/common.json +++ b/locales/fr-CA/common.json @@ -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": "", diff --git a/locales/fr-EU/common.json b/locales/fr-EU/common.json index e60f832fe..974ee1932 100644 --- a/locales/fr-EU/common.json +++ b/locales/fr-EU/common.json @@ -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", diff --git a/locales/he/common.json b/locales/he/common.json index db607723b..5a124e8c5 100644 --- a/locales/he/common.json +++ b/locales/he/common.json @@ -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": "", diff --git a/locales/it/common.json b/locales/it/common.json index e7717ff4d..a666c1c7b 100644 --- a/locales/it/common.json +++ b/locales/it/common.json @@ -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": "", diff --git a/locales/ja/common.json b/locales/ja/common.json index a251a8f2b..c6df4948b 100644 --- a/locales/ja/common.json +++ b/locales/ja/common.json @@ -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": "", diff --git a/locales/ko/common.json b/locales/ko/common.json index ef5aab442..bffe24907 100644 --- a/locales/ko/common.json +++ b/locales/ko/common.json @@ -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": "", diff --git a/locales/nl/common.json b/locales/nl/common.json index d12bc3f16..b35b70ec4 100644 --- a/locales/nl/common.json +++ b/locales/nl/common.json @@ -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": "", diff --git a/locales/pl/common.json b/locales/pl/common.json index 258e0c794..64a76d162 100644 --- a/locales/pl/common.json +++ b/locales/pl/common.json @@ -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": "", diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.json index ef734c70e..1959158f4 100644 --- a/locales/pt-BR/common.json +++ b/locales/pt-BR/common.json @@ -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": "", diff --git a/locales/ru/common.json b/locales/ru/common.json index 58cea67ee..e27f6e353 100644 --- a/locales/ru/common.json +++ b/locales/ru/common.json @@ -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": "Скримы: Не добавляться в пик-апы недоверенными лицами", diff --git a/locales/zh/common.json b/locales/zh/common.json index 7a3a256c7..a8dc9eb56 100644 --- a/locales/zh/common.json +++ b/locales/zh/common.json @@ -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": "",