Skip to content

Commit

Permalink
feat(quest-details): enhance QuestDetailsWrapper with game title
Browse files Browse the repository at this point in the history
  • Loading branch information
biliesilva committed Jan 16, 2025
1 parent 65a44e8 commit 2813a0e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/QuestDetailsWrapper/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react'
import React, { useState, useEffect } from 'react'
import {
MarkdownDescription,
QuestDetails,
Expand Down Expand Up @@ -28,13 +28,15 @@ export interface QuestDetailsWrapperProps extends QuestWrapperContextValue {
ctaComponent?: React.ReactNode
hideEligibilitySection?: boolean
hideClaim?: boolean
gameTitle: string
}

export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) {
const {
selectedQuestId,
trackEvent,
getQuest,
gameTitle,
getUserPlayStreak,
logError,
tOverride,
Expand All @@ -52,21 +54,24 @@ export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) {
hideClaim
} = props


const queryClient = useQueryClient()

const [warningMessage, setWarningMessage] = useState<{
title: string
message: string
}>()

useTrackQuestViewed(selectedQuestId, trackEvent)

const { t: tOriginal } = useTranslation()
const t = tOverride || tOriginal

const questResult = useGetQuest(selectedQuestId, getQuest)
const questMeta = questResult.data?.data


useTrackQuestViewed(selectedQuestId, trackEvent)

const questPlayStreakResult = useGetUserPlayStreak(
selectedQuestId,
getUserPlayStreak
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -191,6 +197,7 @@ export function QuestDetailsWrapper(props: QuestDetailsWrapperProps) {
onPlayClick: onPlayClickHandler,
questType: questMeta.type,
title: questMeta.name,
gameTitle,
description: (
<MarkdownDescription classNames={{ root: styles.markdownDescription }}>
{questMeta.description}
Expand Down

0 comments on commit 2813a0e

Please sign in to comment.