From 84ee44f291ee0cbe00c39ab5696ad653d2046e9a Mon Sep 17 00:00:00 2001 From: darthmaim Date: Tue, 10 Dec 2024 20:15:25 +0100 Subject: [PATCH] Hide repeated login notifications on wintersday wizards vault page --- .../festival/wintersday/wizards-vault/page.tsx | 4 ++-- apps/web/components/Gw2Api/Gw2Accounts.tsx | 4 ++-- .../components/WizardsVault/WizardsVaultObjective.tsx | 7 ++++--- .../WizardsVault/WizardsVaultObjectiveTable.tsx | 9 +++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/web/app/[language]/festival/wintersday/wizards-vault/page.tsx b/apps/web/app/[language]/festival/wintersday/wizards-vault/page.tsx index 86d8aac68..2244fa285 100644 --- a/apps/web/app/[language]/festival/wintersday/wizards-vault/page.tsx +++ b/apps/web/app/[language]/festival/wintersday/wizards-vault/page.tsx @@ -31,7 +31,7 @@ const loadData = cache(async function loadData() { export default async function WintersdayAchievementsPage({ params }: PageProps) { const { language } = await params; const { objectives } = await loadData(); - await pageView('festival/wintersday/wizwards-vault'); + await pageView('festival/wintersday/wizards-vault'); return ( @@ -40,7 +40,7 @@ export default async function WintersdayAchievementsPage({ params }: PageProps)

{objectives.length > 0 ? objectives.map((objective) => ( - + )) : ( No Wizard's Vault objectives for wintersday are available in the Guild Wars 2 API yet. )} diff --git a/apps/web/components/Gw2Api/Gw2Accounts.tsx b/apps/web/components/Gw2Api/Gw2Accounts.tsx index 23ccbc860..9bac1deb1 100644 --- a/apps/web/components/Gw2Api/Gw2Accounts.tsx +++ b/apps/web/components/Gw2Api/Gw2Accounts.tsx @@ -37,7 +37,7 @@ const Gw2AccountsInternal: FC = ({ children, requiredScopes, o } if(!user) { - return ( + return loginMessage === null ? null : ( {loginMessage ?? authorizationMessage} @@ -51,7 +51,7 @@ const Gw2AccountsInternal: FC = ({ children, requiredScopes, o } if(requiredScopes.some((scope) => !accounts.scopes.includes(scope))) { - return ( + return authorizationMessage === null ? null : ( {authorizationMessage ?? loginMessage} diff --git a/apps/web/components/WizardsVault/WizardsVaultObjective.tsx b/apps/web/components/WizardsVault/WizardsVaultObjective.tsx index fb03a3d21..0fc0f09fe 100644 --- a/apps/web/components/WizardsVault/WizardsVaultObjective.tsx +++ b/apps/web/components/WizardsVault/WizardsVaultObjective.tsx @@ -8,10 +8,11 @@ import { Waypoint } from '../Waypoint/Waypoint'; interface WizardsVaultObjectiveProps { objective: Objective, - language: Language; + language: Language, + disabledLoginNotification?: boolean, } -export const WizardsVaultObjective: FC = ({ objective, language }) => { +export const WizardsVaultObjective: FC = ({ objective, language, disabledLoginNotification }) => { return (
@@ -22,7 +23,7 @@ export const WizardsVaultObjective: FC = ({ objectiv
- +
); }; diff --git a/apps/web/components/WizardsVault/WizardsVaultObjectiveTable.tsx b/apps/web/components/WizardsVault/WizardsVaultObjectiveTable.tsx index f85887977..4e6ee93c9 100644 --- a/apps/web/components/WizardsVault/WizardsVaultObjectiveTable.tsx +++ b/apps/web/components/WizardsVault/WizardsVaultObjectiveTable.tsx @@ -13,18 +13,19 @@ import { Gw2Accounts } from '../Gw2Api/Gw2Accounts'; import { SkeletonTable } from '../Skeleton/SkeletonTable'; interface WizardsVaultObjectiveTableProps { - objectiveId: number + objectiveId: number, + disabledLoginNotification?: boolean, } const requiredScopes = [Scope.GW2_Account, Scope.GW2_Progression]; -export const WizardsVaultObjectiveTable: FC = ({ objectiveId }) => { +export const WizardsVaultObjectiveTable: FC = ({ objectiveId, disabledLoginNotification }) => { return ( } - authorizationMessage="gw2treasures.com needs additional permissions to display your Wizard's Vault progress." - loginMessage="Login to show your Wizard's Vault progress." + authorizationMessage={disabledLoginNotification ? null : 'gw2treasures.com needs additional permissions to display your Wizard\'s Vault progress.'} + loginMessage={disabledLoginNotification ? null : 'Login to show your Wizard\'s Vault progress.'} > {(accounts) => (