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

Function QuestButton

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

Source from the content-addressed store, hash-verified

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