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

Function QuestSection

packages/shared/src/components/quest/QuestButton.tsx:105–226  ·  view source on GitHub ↗
({
  title,
  quests,
  onClaim,
  onDestinationClick,
  showLevelSystem,
  claimingQuestId,
  animatingClaimRotationIds,
  claimedStampRotationIds,
  animatingClaimedStampRotationIds,
  deferredClaimedStampRotationIds,
  emptyLabel = 'No active quests yet.',
  layout = 'stack',
  initialVisibleCount,
  showMoreLabel = 'Show more',
  showLessLabel = 'Show less',
  headerAddon,
  onRefresh,
}: {
  title: string;
  quests: UserQuest[];
  onClaim: (
    userQuestId: string,
    questId: string,
    questType: QuestType,
    rewardSources: QuestRewardSource[],
    claimRotationId: string,
  ) => void;
  onDestinationClick: (destination: QuestDestination) => void;
  showLevelSystem: boolean;
  claimingQuestId?: string;
  animatingClaimRotationIds: Set<string>;
  claimedStampRotationIds: Set<string>;
  animatingClaimedStampRotationIds: Set<string>;
  deferredClaimedStampRotationIds: Set<string>;
  emptyLabel?: string;
  layout?: 'stack' | 'grid';
  initialVisibleCount?: number;
  showMoreLabel?: string;
  showLessLabel?: string;
  headerAddon?: ReactElement;
  onRefresh?: (quest: UserQuest) => void;
})

Source from the content-addressed store, hash-verified

103};
104
105export const QuestSection = ({
106 title,
107 quests,
108 onClaim,
109 onDestinationClick,
110 showLevelSystem,
111 claimingQuestId,
112 animatingClaimRotationIds,
113 claimedStampRotationIds,
114 animatingClaimedStampRotationIds,
115 deferredClaimedStampRotationIds,
116 emptyLabel = 'No active quests yet.',
117 layout = 'stack',
118 initialVisibleCount,
119 showMoreLabel = 'Show more',
120 showLessLabel = 'Show less',
121 headerAddon,
122 onRefresh,
123}: {
124 title: string;
125 quests: UserQuest[];
126 onClaim: (
127 userQuestId: string,
128 questId: string,
129 questType: QuestType,
130 rewardSources: QuestRewardSource[],
131 claimRotationId: string,
132 ) => void;
133 onDestinationClick: (destination: QuestDestination) => void;
134 showLevelSystem: boolean;
135 claimingQuestId?: string;
136 animatingClaimRotationIds: Set<string>;
137 claimedStampRotationIds: Set<string>;
138 animatingClaimedStampRotationIds: Set<string>;
139 deferredClaimedStampRotationIds: Set<string>;
140 emptyLabel?: string;
141 layout?: 'stack' | 'grid';
142 initialVisibleCount?: number;
143 showMoreLabel?: string;
144 showLessLabel?: string;
145 headerAddon?: ReactElement;
146 onRefresh?: (quest: UserQuest) => void;
147}): ReactElement => {
148 const [isExpanded, setIsExpanded] = useState(false);
149 const canToggleExpanded =
150 typeof initialVisibleCount === 'number' &&
151 quests.length > initialVisibleCount;
152 const visibleQuests =
153 canToggleExpanded && !isExpanded
154 ? quests.slice(0, initialVisibleCount)
155 : quests;
156
157 const titleHeading = (
158 <h4 className="font-bold text-text-primary typo-callout">{title}</h4>
159 );
160 // Only wrap the title when there is an addon to place beside it, so sections
161 // without one keep their original DOM (consumers query the heading's sibling).
162 const header = headerAddon ? (

Callers

nothing calls this directly

Calls 1

getQuestDestinationFunction · 0.90

Tested by

no test coverage detected