mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-26 01:09:02 -05:00
* Initial * Calendar initial * Extract EventCalendar * Events list initial * Winners * SQL fixes * List events by series * Leaderboards * Series leaderboard * Own entry peek * Edit page skeleton * RHF initial test * RHF stuff * Form etc. progress * Fix tournament series description * Fix tabs layout * Fix socials insert * Check for not removing admin * Adding series * TODOs * Allow updating org with no series * FormFieldset * Allow series without events * TextAreaFormfield accepting array syntax * Input form array field * ToggleFormField * SelectFormField * UserSearchFormField * Fetch badgeOptions * Badge editing * Progress * Use native preventScrollReset * Rename func * Fix sticky scroll * Fix translation * i18n errors * handle,meta in edit * Add ref to user search * TODOs * Done
25 lines
701 B
TypeScript
25 lines
701 B
TypeScript
import type { TFunction } from "i18next";
|
|
import { SPLATOON_3_XP_BADGE_VALUES } from "~/constants";
|
|
import type { Badge as BadgeDBType } from "~/db/types";
|
|
|
|
export function badgeExplanationText(
|
|
t: TFunction<"badges", undefined>,
|
|
badge: Pick<BadgeDBType, "displayName" | "code"> & { count?: number },
|
|
) {
|
|
if (badge.code === "patreon") return t("patreon");
|
|
if (badge.code === "patreon_plus") {
|
|
return t("patreon+");
|
|
}
|
|
if (
|
|
badge.code.startsWith("xp") ||
|
|
SPLATOON_3_XP_BADGE_VALUES.includes(Number(badge.code) as any)
|
|
) {
|
|
return t("xp", { xpText: badge.displayName });
|
|
}
|
|
|
|
return t("tournament", {
|
|
count: badge.count ?? 1,
|
|
tournament: badge.displayName,
|
|
}).replace("'", "'");
|
|
}
|