From b6c0cb43cc64495ddfafe344b200b788cd7563fe Mon Sep 17 00:00:00 2001 From: Timothy Armes Date: Fri, 27 Sep 2024 11:09:57 +0200 Subject: [PATCH] Rebase changes --- global.d.ts | 5 ++++- src/app/[locale]/(main)/elo/TournamentResults.tsx | 3 ++- src/app/[locale]/(main)/elo/page.tsx | 14 -------------- src/messages/en.json | 6 +----- src/messages/fr.json | 6 +----- src/server/safeAction.ts | 6 +++--- 6 files changed, 11 insertions(+), 29 deletions(-) diff --git a/global.d.ts b/global.d.ts index 1be2dc9..04cdc6a 100644 --- a/global.d.ts +++ b/global.d.ts @@ -3,7 +3,10 @@ import * as L from "leaflet"; // Use type safe message keys with `next-intl` type Messages = typeof import("./src/messages/fr.json"); -declare interface IntlMessages extends Messages {} +declare global { + // Use type safe message keys with `next-intl` + interface IntlMessages extends Messages {} +} // For some reason, @types/leaflet.markercluster isn't being recognized // I'm including it here by hand diff --git a/src/app/[locale]/(main)/elo/TournamentResults.tsx b/src/app/[locale]/(main)/elo/TournamentResults.tsx index d712139..e255094 100644 --- a/src/app/[locale]/(main)/elo/TournamentResults.tsx +++ b/src/app/[locale]/(main)/elo/TournamentResults.tsx @@ -4,6 +4,7 @@ import { last } from "lodash"; import { useTranslations } from "next-intl"; import { twMerge } from "tailwind-merge"; +import { ErrorBox } from "@/components/ErrorBox"; import { TournamentResultsData } from "@/server/fetchTournamentResults"; import { SearchedTournament } from "@/server/searchTournaments"; import { TimeControl } from "@/types"; @@ -107,7 +108,7 @@ export const TournamentResults = ({ ).length; if (playerResults.estimated || playerResults.national) - return
{t("needRating")}
; + return ; return ( <> diff --git a/src/app/[locale]/(main)/elo/page.tsx b/src/app/[locale]/(main)/elo/page.tsx index 55ec3f8..377537e 100644 --- a/src/app/[locale]/(main)/elo/page.tsx +++ b/src/app/[locale]/(main)/elo/page.tsx @@ -217,20 +217,6 @@ export default function Elo() { )} - {error instanceof Error && ( -
- {error.message.startsWith("ERR_") - ? t(error.message as TranslationKey) - : t.rich("unknownError", { - contact: (chunks) => ( - - {chunks} - - ), - })} -
- )} - {!isFetching && playerOptions.length > 0 && (
diff --git a/src/messages/en.json b/src/messages/en.json index 682c7a9..b778788 100644 --- a/src/messages/en.json +++ b/src/messages/en.json @@ -213,11 +213,7 @@ "kFactorInfo3": "40 for a player new to the rating list until he has completed events with at least 30 games.", "kFactorInfo4": "20 as long as a player's rating remains under 2400.", "kFactorInfo5": "10 once a player's published rating has reached 2400 and remains at that level subsequently, even if the rating drops below 2400.", - "kFactorInfo6": "40 for all players until their 18th birthday, as long as their rating remains under 2300.", - - "unknownError": "We were unable to fetch results from this URL. Please contact us if the problem persists.", - "ERR_TOURNAMENT_NOT_FOUND": "Tournament not found", - "ERR_NO_TOURNAMENT_ID": "The link you provided is incorrect" + "kFactorInfo6": "40 for all players until their 18th birthday, as long as their rating remains under 2300." }, "Zones": { diff --git a/src/messages/fr.json b/src/messages/fr.json index 258fe3c..ff8166d 100644 --- a/src/messages/fr.json +++ b/src/messages/fr.json @@ -214,11 +214,7 @@ "kFactorInfo3": "40 pour un joueur nouvellement inscrit au classement tant qu'il n'a pas participé à des événements avec au moins 30 parties.", "kFactorInfo4": "20 tant que le classement d'un joueur reste inférieur à 2400.", "kFactorInfo5": "10 une fois que le classement publié d'un joueur a atteint 2400 et reste à ce niveau par la suite, même s'il redescend en dessous de 2400.", - "kFactorInfo6": "40 pour tous les joueurs jusqu'à leur 18e anniversaire, tant que leur classement reste inférieur à 2300.", - - "unknownError": "Nous n'avons pas pu récupérer les résultats à partir de cette URL. Veuillez nous contacter si le problème persiste.", - "ERR_TOURNAMENT_NOT_FOUND": "Tournoi introuvable", - "ERR_NO_TOURNAMENT_ID": "L'identifiant du tournoi fourni est incorrect" + "kFactorInfo6": "40 pour tous les joueurs jusqu'à leur 18e anniversaire, tant que leur classement reste inférieur à 2300." }, "Zones": { diff --git a/src/server/safeAction.ts b/src/server/safeAction.ts index 98678c7..70a1355 100644 --- a/src/server/safeAction.ts +++ b/src/server/safeAction.ts @@ -1,7 +1,7 @@ import { createSafeActionClient } from "next-safe-action"; -export const action = createSafeActionClient({ - handleReturnedServerError(error) { - return error.message; +export const actionClient = createSafeActionClient({ + handleServerError(error) { + throw error; }, });