Skip to content

Commit

Permalink
fix: expiry timestamp as string
Browse files Browse the repository at this point in the history
  • Loading branch information
irisdv committed Aug 11, 2023
1 parent cef48f0 commit d567931
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions components/quests/featuredQuest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type FeaturedQuestProps = {
issuer?: Issuer;
reward?: string;
desc?: string;
expiry: number;
expiry: string | null | undefined;
};

const FeaturedQuest: FunctionComponent<FeaturedQuestProps> = ({
Expand Down Expand Up @@ -41,7 +41,7 @@ const FeaturedQuest: FunctionComponent<FeaturedQuestProps> = ({
</div>
</div>
<img src={imgSrc} className={styles.featuredQuestImage} />
<Timer expiry={expiry} />
{expiry ? <Timer expiry={Number(expiry)} /> : null}
</div>
) : !onClick && !isSmallScreen ? (
<FeaturedQuestSkeleton />
Expand Down
2 changes: 1 addition & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Quests: NextPage = () => {
}}
reward={featuredQuest?.rewards_title}
desc={featuredQuest?.desc}
expiry={Number(featuredQuest?.expiry.$date.$numberLong)}
expiry={featuredQuest?.expiry_timestamp}
/>
<h1 className={styles.title}>Accomplish your Starknet Quests</h1>
<div className={styles.questContainer}>
Expand Down
6 changes: 3 additions & 3 deletions pages/quest/[questPage].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const QuestPage: NextPage = () => {
title_card: "",
hidden: false,
disabled: false,
expiry: { $date: { $numberLong: "0" } },
expiry_timestamp: "loading",
});
const [tasks, setTasks] = useState<UserTask[]>([]);
const [rewardsEnabled, setRewardsEnabled] = useState<boolean>(false);
Expand Down Expand Up @@ -314,8 +314,8 @@ const QuestPage: NextPage = () => {
<p className="text-center max-w-lg">{quest.desc}</p>
)}
</div>
{quest?.expiry ? (
<Timer expiry={Number(quest?.expiry.$date.$numberLong)} fixed={false} />
{quest?.expiry_timestamp && quest?.expiry_timestamp !== "loading" ? (
<Timer expiry={Number(quest?.expiry_timestamp)} fixed={false} />
) : null}
<div className={styles.taskContainer}>
{tasks.length === 0 || quest.rewards_title === "loading" ? (
Expand Down
8 changes: 1 addition & 7 deletions types/backTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ type QuestDocument = {
title_card: string;
hidden: boolean;
disabled: boolean;
expiry: ExpiryObject;
};

type ExpiryObject = {
$date: {
$numberLong: string;
};
expiry_timestamp: string | null;
};

type NFTItem = {
Expand Down

0 comments on commit d567931

Please sign in to comment.