From 8677e943ec52e87a171258a2a44439b72f10be30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Fri, 8 Nov 2024 18:23:43 -0400 Subject: [PATCH] tech(quest-detail): make claimed toast observer --- .../UI/QuestRewardClaimedToast/index.tsx | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/frontend/components/UI/QuestRewardClaimedToast/index.tsx b/src/frontend/components/UI/QuestRewardClaimedToast/index.tsx index 1a24ab937..96814da7a 100644 --- a/src/frontend/components/UI/QuestRewardClaimedToast/index.tsx +++ b/src/frontend/components/UI/QuestRewardClaimedToast/index.tsx @@ -3,48 +3,48 @@ import { ToastQuest } from '@hyperplay/ui' import Draggable from 'react-draggable' import { useTranslation } from 'react-i18next' import claimedRewardToastState from 'frontend/state/ClaimedRewardToastState' +import { observer } from 'mobx-react-lite' type QuestRewardClaimedToastProps = { draggable?: boolean className?: string } -export function QuestRewardClaimedToast({ - draggable = true, - className -}: QuestRewardClaimedToastProps) { - const { t } = useTranslation() +export const QuestRewardClaimedToast = observer( + ({ draggable = true, className }: QuestRewardClaimedToastProps) => { + const { t } = useTranslation() - if (!claimedRewardToastState.claimedReward) { - return null - } + if (!claimedRewardToastState.claimedReward) { + return null + } - const toast = ( -
- claimedRewardToastState.clearReward()} - status="claimed" - /> -
- ) + const toast = ( +
+ claimedRewardToastState.clearReward()} + status="claimed" + /> +
+ ) - return draggable ? {toast} : toast -} + return draggable ? {toast} : toast + } +)