diff --git a/packages/web/pages/quest/[id].tsx b/packages/web/pages/quest/[id].tsx index cbd0111e..1f0267d9 100644 --- a/packages/web/pages/quest/[id].tsx +++ b/packages/web/pages/quest/[id].tsx @@ -1,4 +1,8 @@ import { + Alert, + AlertDescription, + AlertIcon, + AlertTitle, Box, Flex, Grid, @@ -7,6 +11,7 @@ import { HStack, LoadingState, MetaButton, + Text, } from '@metafam/ds'; import { httpLink } from '@metafam/utils'; import { PageContainer } from 'components/Container'; @@ -21,6 +26,7 @@ import { QuestDetailsRequirementsRewards } from 'components/Quest/QuestDetailsRe import { HeadComponent } from 'components/Seo'; import { QuestRepetition_Enum, + QuestStatus_Enum, useGetQuestWithCompletionsQuery, } from 'graphql/autogen/types'; import { getSsrClient } from 'graphql/client'; @@ -35,7 +41,7 @@ import { import { useRouter } from 'next/router'; import { SSRData } from 'next-urql'; import DefaultQuestImage from 'public/assets/QuestsDefaultImage_900x900.jpg'; -import React, { useMemo } from 'react'; +import React, { useMemo, useRef } from 'react'; import { canCompleteQuest } from 'utils/questHelpers'; type Props = InferGetStaticPropsType; @@ -65,6 +71,39 @@ export const QuestPage: React.FC = ({ quest_id }) => { // Quest image is used in QuestDetailsImage and the share image const questImage = httpLink(quest.image) ?? DefaultQuestImage.src; + // 'Quest was deleted' note + // A note is shown if we're viewing a quest that has been deleted + const isQuestSetAsDeleted = quest.status === QuestStatus_Enum.Deleted; + + // Here's the content of the Quest was deleted note, which is shown if isQuestSetAsDeleted = true + function showDeletedAlert() { + return ( + + + + + Heads up! + + + + This quest was deleted by its owner. You can view the quest + details, and try out the quest if you feel like it. + + + You won’t be able to claim the quest or get any rewards. + + + + + ); + } + return ( = ({ quest_id }) => { - + <> + {/* Show a message if the quest has been deleted */} + {isQuestSetAsDeleted && showDeletedAlert()} + +