From f04ddc0e12e5572ec70e5fb99d791136e14f6bf6 Mon Sep 17 00:00:00 2001 From: Ben Goldberg Date: Tue, 26 Sep 2023 17:08:39 -0700 Subject: [PATCH] Mints Feature (#5037) * generic card * static card * stuff * more things * stuff * ui * just committing stuff * fun * stuff * for christian * dnoe ish * overlay * img stuff * img stuff * analytics * stuff * media component * Improve FeaturedMintCard accent color contrast * lots of things * refactor * tweak * english * turn on feature flag * network badges * rename index + show chain badge for mainnet * fixes * api updates * fix account switching crash * remote config * turn off local flag * fix * flashlist -> flatlist * lang * perf * remove no data state * discover layout * fix e2e * lint * fix * fix e2e * fix sizing * recent mint gif * png * rm * disable wallet switcher android * wc: use bottom sheets on android * tab bar color * avatar fix --------- Co-authored-by: Christian Baroni <7061887+christianbaroni@users.noreply.github.com> Co-authored-by: skylarbarrera --- src/analytics/event.ts | 25 ++ src/analytics/userProperties.ts | 5 + src/components/Media.tsx | 88 +++++ src/components/PromoSheet.tsx | 1 - src/components/cards/CarouselCard.tsx | 170 +++++++++ src/components/cards/FeaturedMintCard.tsx | 333 ++++++++++++++++++ .../cards/MintsCard/CollectionCell.tsx | 205 +++++++++++ src/components/cards/MintsCard/Menu.tsx | 69 ++++ src/components/cards/MintsCard/MintsCard.tsx | 105 ++++++ src/config/experimental.ts | 2 + src/graphql/queries/arc.graphql | 57 +++ src/handlers/imgix.ts | 2 +- src/helpers/utilities.ts | 20 ++ src/languages/en_US.json | 26 ++ src/model/config.ts | 5 +- src/navigation/Routes.android.tsx | 24 +- src/navigation/Routes.ios.tsx | 7 + src/navigation/config.tsx | 10 + src/navigation/effects.tsx | 4 + src/navigation/routesNames.ts | 1 + src/resources/mints.ts | 149 ++++++++ src/screens/MintsSheet/MintsSheet.tsx | 185 ++++++++++ src/screens/MintsSheet/TabBar.tsx | 152 ++++++++ src/screens/MintsSheet/card/Card.tsx | 176 +++++++++ .../MintsSheet/card/RecentMintCell.tsx | 95 +++++ src/screens/MintsSheet/utils.ts | 22 ++ .../discover/components/DiscoverHome.js | 24 +- .../discover/components/ListsSection.js | 131 +++---- 28 files changed, 2013 insertions(+), 80 deletions(-) create mode 100644 src/components/Media.tsx create mode 100644 src/components/cards/CarouselCard.tsx create mode 100644 src/components/cards/FeaturedMintCard.tsx create mode 100644 src/components/cards/MintsCard/CollectionCell.tsx create mode 100644 src/components/cards/MintsCard/Menu.tsx create mode 100644 src/components/cards/MintsCard/MintsCard.tsx create mode 100644 src/resources/mints.ts create mode 100644 src/screens/MintsSheet/MintsSheet.tsx create mode 100644 src/screens/MintsSheet/TabBar.tsx create mode 100644 src/screens/MintsSheet/card/Card.tsx create mode 100644 src/screens/MintsSheet/card/RecentMintCell.tsx create mode 100644 src/screens/MintsSheet/utils.ts diff --git a/src/analytics/event.ts b/src/analytics/event.ts index 38cec79df99..c187be4dc56 100644 --- a/src/analytics/event.ts +++ b/src/analytics/event.ts @@ -83,6 +83,12 @@ export const event = { poapsViewedOnPoap: 'Viewed POAP on poap.gallery', positionsOpenedSheet: 'Opened position Sheet', positionsOpenedExternalDapp: 'Viewed external dapp', + + mintsPressedFeaturedMintCard: 'Pressed featured mint card', + mintsPressedCollectionCell: 'Pressed collection cell in mints card', + mintsPressedMintButton: 'Pressed mint button in mints sheet', + mintsPressedViewAllMintsButton: 'Pressed view all mints button in mints card', + mintsChangedFilter: 'Changed mints filter', } as const; /** @@ -304,4 +310,23 @@ export type EventProperties = { [event.positionsOpenedSheet]: { dapp: string; }; + [event.mintsPressedFeaturedMintCard]: { + contractAddress: string; + chainId: number; + totalMints: number; + mintsLastHour: number; + priceInEth: number; + }; + [event.mintsPressedCollectionCell]: { + contractAddress: string; + chainId: number; + priceInEth: number; + }; + [event.mintsPressedMintButton]: { + contractAddress: string; + chainId: number; + priceInEth: number; + }; + [event.mintsPressedViewAllMintsButton]: undefined; + [event.mintsChangedFilter]: { filter: string }; }; diff --git a/src/analytics/userProperties.ts b/src/analytics/userProperties.ts index 490a97c0d6d..ec0521a4440 100644 --- a/src/analytics/userProperties.ts +++ b/src/analytics/userProperties.ts @@ -20,6 +20,11 @@ export interface UserProperties { nftOffersMeanOfferVariance?: number; nftOffersMedianOfferVariance?: number; + // mint.fun + numberOfMints?: number; + numberOfFreeMints?: number; + numberOfPaidMints?: number; + // ens // TODO: remove ensProfile tracking the entire object ensProfile?: Record; diff --git a/src/components/Media.tsx b/src/components/Media.tsx new file mode 100644 index 00000000000..bc1f72421fa --- /dev/null +++ b/src/components/Media.tsx @@ -0,0 +1,88 @@ +import React, { useState } from 'react'; +import { maybeSignUri } from '@/handlers/imgix'; +import { Image, ImageStyle, View } from 'react-native'; +// @ts-ignore +import Video from 'react-native-video'; +import SvgImage from './svg/SvgImage'; + +export enum MimeType { + MP4 = 'video/mp4', + GIF = 'image/gif', + PNG = 'image/png', + SVG = 'image/svg+xml', + JPG = 'image/jpeg', +} + +export function Media({ + url, + mimeType, + fallbackUrl, + style, + size, + onLayout, + onError, +}: { + url: string; + mimeType?: string; + fallbackUrl?: string; + style?: ImageStyle; + size?: number; + onLayout?: () => void; + onError?: () => void; +}) { + const [loading, setLoading] = useState(false); + + const signedUrl = maybeSignUri(url, { + // resizing breaks svg + w: mimeType === MimeType.SVG ? undefined : size, + fm: !mimeType ? 'png' : undefined, + }); + const signedFallbackUrl = maybeSignUri(fallbackUrl ?? url, { + w: size, + fm: 'png', + }); + + switch (mimeType) { + case MimeType.MP4: + return ( +