-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(wallet): Dune stats #496
Conversation
* feat: Hero section * fix: lint * feat: add "Watch demo" play button * fix: control video play * feat: add a bottom gradient over the paused video * styles: fix border-radius on video * feat: temporarily use /wallet-new slug because page path conflct with the current version * feat: move section content back to the .json file * fix: restore CenteredTextBlock * Revert "fix: restore CenteredTextBlock" This reverts commit f6a463b.
* feat: Hero section * fix: lint * feat: add "Watch demo" play button * fix: control video play * feat: add a bottom gradient over the paused video * styles: fix border-radius on video * feat: temporarily use /wallet-new slug because page path conflct with the current version * feat: commonCMS/Marquee * feat: generic Card grid * feat: declare content in wallet.json * fix: undo unrelated change * fix: do not render the component without `items` * fix: remove conditional operator
* feat: Hero section * fix: lint * feat: add "Watch demo" play button * fix: control video play * feat: add a bottom gradient over the paused video * styles: fix border-radius on video * feat: temporarily use /wallet-new slug because page path conflct with the current version * feat: commonCMS/Marquee * feat: generic Card grid * feat: Vertical Slide * feat: display images when clicking the cards * fix: lint * fix: undo unrelated changes * feat: declare VerticalSlide content in wallet.json * styles: mobile styles * fix: extract expression to a variable
* feat: FeatureCards component * feat: ecosystem projects card * feat: rest of Featured cards * feat: cta to wallet app * Update src/components/Wallet/FeatureCards/index.tsx Co-authored-by: Aaron Cook <[email protected]> * Apply suggestions from code review Co-authored-by: Aaron Cook <[email protected]> --------- Co-authored-by: Aaron Cook <[email protected]>
* feat: common FAQ section * feat: import FAQ content from CMS * fix: undo unrelated changes
* v1.5.7 * feat: Wallet page Vertical stack * styles: apply styles * styles: adjust title wrapper width * Apply suggestions from code review Co-authored-by: Aaron Cook <[email protected]> --------- Co-authored-by: Aaron Cook <[email protected]>
* feat: "subscribe to latest" section * feat: display laptop image * fix: copy changes
* feat: scroll based animation * feat: scroll based animation in VerticalStack * fix: handle card click * fix: move sticky section to laptop view * fix: ignore TS line for testing
* styles: center play button * style: fix logos * style: address comments on sections margins * style: center Watch Demo button * fix: consistent CTA copy * style: increase card padding * fix: stretched images * fix: update starknet logo * feat: replace assets
Branch preview✅ Deployed successfully in branch deployment: |
src/hooks/useSafeStats.ts
Outdated
@@ -31,12 +34,25 @@ export const fetchTotalSafesDeployed = async (): Promise<number | null> => { | |||
.catch(() => null) | |||
} | |||
|
|||
export const fetchMonthlyActiveUsers = async (): Promise<number | null> => { | |||
return fetch(duneQueryUrlBuilder(QUERY_ID_MONTHLY_ACTIVE_USERS, DUNE_API_KEY)) | |||
.then((res) => res.json()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The res
may be erroneous. We should check that res.ok
before returning the JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to the other fetchers as well.
src/hooks/useSafeStats.ts
Outdated
return [ | ||
formattedTotalTransactions, | ||
formattedTotalBalanceUsd, | ||
formattedTotalSafesDeployed, | ||
formattedMonthlyActiveUsers, | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: it's easy to access the wrong index. What do you think about returning an object instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followed the recommendation 👍
src/pages/wallet.tsx
Outdated
const dataRoomStats = await fetchDataRoomStats() | ||
const totalBalanceUsd = await fetchTotalBalanceUsd() | ||
const monthlyActiveUsers = await fetchMonthlyActiveUsers() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could make these a single promise with Promise.all
.
src/hooks/useSafeStats.ts
Outdated
.then((data) => data.result.rows[data.result.rows.length - 1].active_users) | ||
.catch(() => null) | ||
} | ||
|
||
export const useSafeStats = (): Array<string | null> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you thought about using swr
for this hook? We'd not need a context.
What it solves
Fetches Safe numbers from Dune queries
I ended up moving the fetchers outside of the hook.