MCPcopy Create free account
hub / github.com/dailydotdev/apps / QuestButton

Function QuestButton

packages/shared/src/components/quest/QuestButton.tsx:592–1233  ·  view source on GitHub ↗
({
  compact = false,
  shell = false,
  panelOnly = false,
}: QuestButtonProps)

Source from the content-addressed store, hash-verified

590};
591
592export const QuestButton = ({
593 compact = false,
594 shell = false,
595 panelOnly = false,
596}: QuestButtonProps): ReactElement => {
597 const router = useRouter();
598 const { optOutLevelSystem } = useSettingsContext();
599 const { user } = useAuthContext();
600 const { data, isPending, isError } = useQuestDashboard();
601 const {
602 mutate: claimQuestReward,
603 isPending: isClaimPending,
604 variables,
605 } = useClaimQuestReward();
606
607 const level = data?.level?.level ?? 1;
608 const levelProgress = data?.level ? getLevelProgress(data.level) : 0;
609 const showLevelSystem = !optOutLevelSystem;
610 const claimableCount = useMemo(() => getClaimableQuestCount(data), [data]);
611 const claimingQuestId = isClaimPending ? variables?.userQuestId : undefined;
612 const [rewardFlightLayers, setRewardFlightLayers] = useState<
613 QuestRewardFlightLayerState[]
614 >([]);
615 const [levelFireworkParticles, setLevelFireworkParticles] = useState<
616 QuestLevelFireworkParticle[]
617 >([]);
618 const [animatedLevel, setAnimatedLevel] = useState<number | null>(null);
619 const [animatedLevelProgress, setAnimatedLevelProgress] = useState<
620 number | null
621 >(null);
622 const [animatingClaimRotationIds, setAnimatingClaimRotationIds] = useState<
623 string[]
624 >([]);
625 const [claimedStampRotationIds, setClaimedStampRotationIds] = useState<
626 string[]
627 >([]);
628 const [
629 animatingClaimedStampRotationIds,
630 setAnimatingClaimedStampRotationIds,
631 ] = useState<string[]>([]);
632 const [deferredClaimedStampRotationIds, setDeferredClaimedStampRotationIds] =
633 useState<string[]>([]);
634 const progressTimersRef = useRef<number[]>([]);
635 const claimedStampTimersRef = useRef<number[]>([]);
636 const currentProgressAnimationRotationIdRef = useRef<string | null>(null);
637 const renderedLevel = animatedLevel ?? level;
638 const renderedLevelProgress = animatedLevelProgress ?? levelProgress;
639 const triggerTooltipContent = data?.level
640 ? `Total XP: ${data.level.totalXp.toLocaleString('de-DE')}`
641 : 'Quests';
642 const triggerButtonSize = compact ? ButtonSize.Small : ButtonSize.Medium;
643 const triggerButtonVariant = compact
644 ? ButtonVariant.Tertiary
645 : ButtonVariant.Float;
646 const compactVisualSize = shell ? 38 : 32;
647 const triggerVisualSize = compact
648 ? compactVisualSize
649 : QUEST_LEVEL_PROGRESS_SIZE;

Callers

nothing calls this directly

Calls 14

useSettingsContextFunction · 0.90
useAuthContextFunction · 0.90
useQuestDashboardFunction · 0.90
useClaimQuestRewardFunction · 0.90
getClaimableQuestCountFunction · 0.90
useIsPhoneFunction · 0.90
useScrollFadeFunction · 0.90
getQuestRewardHitAtFunction · 0.90
getQuestDestinationUrlFunction · 0.90
getLevelProgressFunction · 0.85
completeLevelAnimationFunction · 0.85

Tested by

no test coverage detected