Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide repeated login notifications on wintersday wizards vault page #1850

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<PageLayout>
Expand All @@ -40,7 +40,7 @@ export default async function WintersdayAchievementsPage({ params }: PageProps)
<p><Trans id="festival.wintersday.wizards-vault.description"/></p>

{objectives.length > 0 ? objectives.map((objective) => (
<WizardsVaultObjective key={objective.id} objective={objective} language={language}/>
<WizardsVaultObjective key={objective.id} objective={objective} language={language} disabledLoginNotification/>
)) : (
<Notice>No Wizard&apos;s Vault objectives for wintersday are available in the Guild Wars 2 API yet.</Notice>
)}
Expand Down
4 changes: 2 additions & 2 deletions apps/web/components/Gw2Api/Gw2Accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Gw2AccountsInternal: FC<Gw2AccountsProps> = ({ children, requiredScopes, o
}

if(!user) {
return (
return loginMessage === null ? null : (
<Gw2AccountLoginNotice requiredScopes={requiredScopes} optionalScopes={optionalScopes}>
{loginMessage ?? authorizationMessage}
</Gw2AccountLoginNotice>
Expand All @@ -51,7 +51,7 @@ const Gw2AccountsInternal: FC<Gw2AccountsProps> = ({ children, requiredScopes, o
}

if(requiredScopes.some((scope) => !accounts.scopes.includes(scope))) {
return (
return authorizationMessage === null ? null : (
<Gw2AccountAuthorizationNotice scopes={accounts.scopes} requiredScopes={requiredScopes} optionalScopes={optionalScopes}>
{authorizationMessage ?? loginMessage}
</Gw2AccountAuthorizationNotice>
Expand Down
7 changes: 4 additions & 3 deletions apps/web/components/WizardsVault/WizardsVaultObjective.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import { Waypoint } from '../Waypoint/Waypoint';

interface WizardsVaultObjectiveProps {
objective: Objective,
language: Language;
language: Language,
disabledLoginNotification?: boolean,
}

export const WizardsVaultObjective: FC<WizardsVaultObjectiveProps> = ({ objective, language }) => {
export const WizardsVaultObjective: FC<WizardsVaultObjectiveProps> = ({ objective, language, disabledLoginNotification }) => {
return (
<div className={styles.wrapper}>
<div className={styles.objective}>
Expand All @@ -22,7 +23,7 @@ export const WizardsVaultObjective: FC<WizardsVaultObjectiveProps> = ({ objectiv
<div className={styles.aa}><AstralAcclaim value={objective.acclaim}/></div>
</div>

<WizardsVaultObjectiveTable objectiveId={objective.id}/>
<WizardsVaultObjectiveTable objectiveId={objective.id} disabledLoginNotification={disabledLoginNotification}/>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -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<WizardsVaultObjectiveTableProps> = ({ objectiveId }) => {
export const WizardsVaultObjectiveTable: FC<WizardsVaultObjectiveTableProps> = ({ objectiveId, disabledLoginNotification }) => {
return (
<Gw2Accounts
requiredScopes={requiredScopes}
loading={<SkeletonTable columns={['Account', 'Progress']} rows={1}/>}
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) => (
<Table>
Expand Down
Loading