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 ( +