From 2813a0ed818166cc263f474dfa4a54092358eda7 Mon Sep 17 00:00:00 2001 From: Biliane Silva <61093873+biliesilva@users.noreply.github.com> Date: Thu, 16 Jan 2025 22:57:31 +0000 Subject: [PATCH] feat(quest-details): enhance QuestDetailsWrapper with game title --- src/components/QuestDetailsWrapper/index.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index 17ad55a..f9ad01f 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import React, { useState, useEffect } from 'react' import { MarkdownDescription, QuestDetails, @@ -28,6 +28,7 @@ export interface QuestDetailsWrapperProps extends QuestWrapperContextValue { ctaComponent?: React.ReactNode hideEligibilitySection?: boolean hideClaim?: boolean + gameTitle: string } export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) { @@ -35,6 +36,7 @@ export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) { selectedQuestId, trackEvent, getQuest, + gameTitle, getUserPlayStreak, logError, tOverride, @@ -52,6 +54,7 @@ export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) { hideClaim } = props + const queryClient = useQueryClient() const [warningMessage, setWarningMessage] = useState<{ @@ -59,7 +62,6 @@ export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) { message: string }>() - useTrackQuestViewed(selectedQuestId, trackEvent) const { t: tOriginal } = useTranslation() const t = tOverride || tOriginal @@ -67,6 +69,9 @@ export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) { const questResult = useGetQuest(selectedQuestId, getQuest) const questMeta = questResult.data?.data + + useTrackQuestViewed(selectedQuestId, trackEvent) + const questPlayStreakResult = useGetUserPlayStreak( selectedQuestId, getUserPlayStreak @@ -140,7 +145,8 @@ export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) { ), questType: { REPUTATION: t('quest.type.reputation', 'Reputation'), - PLAYSTREAK: t('quest.type.playstreak', 'Play Streak') + PLAYSTREAK: t('quest.type.playstreak', 'Play Streak'), + GAME: gameTitle }, sync: t('quest.sync', 'Sync'), streakProgressI18n: { @@ -191,6 +197,7 @@ export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) { onPlayClick: onPlayClickHandler, questType: questMeta.type, title: questMeta.name, + gameTitle, description: ( {questMeta.description}