-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stimmy analytics, additional ui fixes (#1596)
Co-authored-by: Daniel Sinclair <[email protected]> Co-authored-by: Christopher Howard <[email protected]>
- Loading branch information
1 parent
4ddaa9a
commit 053e2cb
Showing
7 changed files
with
111 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
// these can be reported separately so they must be optional | ||
export interface UserProperties { | ||
// number of imported or generated accounts | ||
ownedAccounts?: number; | ||
// number of accounts tied to paired hardware wallets | ||
hardwareAccounts?: number; | ||
// number of watched addresses or ens | ||
watchedAccounts?: number; | ||
// number of imported or generated secret recovery phrases | ||
recoveryPhrases?: number; | ||
// number of imported secret recovery phrases | ||
importedRecoveryPhrases?: number; | ||
// number of unique private keys | ||
privateKeys?: number; | ||
// number of imported unique private keys | ||
importedPrivateKeys?: number; | ||
// number of paired trezor hardware wallets | ||
trezorDevices?: number; | ||
// number of paired ledger hardware wallets | ||
ledgerDevices?: number; | ||
// whether a recovery phrase or private key has been imported | ||
hasImported?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ import { | |
import { Address } from 'viem'; | ||
|
||
import rainbowIcon from 'static/images/[email protected]'; | ||
import { analytics } from '~/analytics'; | ||
import { event } from '~/analytics/event'; | ||
import { PointsQuery } from '~/core/graphql/__generated__/metadata'; | ||
import { i18n } from '~/core/languages'; | ||
import { useCurrentAddressStore, useCurrentCurrencyStore } from '~/core/state'; | ||
|
@@ -273,25 +275,28 @@ function TextWithMoreInfo({ children }: PropsWithChildren) { | |
); | ||
} | ||
|
||
export const copyReferralLink = (referralCode: string) => | ||
export const copyReferralLink = (referralCode: string) => { | ||
analytics.track(event.pointsReferralCopied, { type: 'link' }); | ||
copy({ | ||
value: `https://rainbow.me/points?ref=${referralCode}`, | ||
title: i18n.t('points.copied_referral_link'), | ||
description: `rainbow.me/points?ref=${referralCode}`, | ||
}); | ||
}; | ||
|
||
const formatReferralCode = (referralCode: string) => | ||
referralCode.slice(0, 3) + '-' + referralCode.slice(-3); | ||
function ReferralCode() { | ||
const { currentAddress } = useCurrentAddressStore(); | ||
const { data, isSuccess } = usePoints(currentAddress); | ||
const copyReferralCode = () => | ||
const copyReferralCode = () => { | ||
analytics.track(event.pointsReferralCopied, { type: 'code' }); | ||
copy({ | ||
value: data?.user.referralCode || '', | ||
title: i18n.t('points.copied_referral_code'), | ||
description: formatReferralCode(data?.user.referralCode || ''), | ||
}); | ||
|
||
}; | ||
return ( | ||
<Stack gap="12px"> | ||
<Text size="16pt" weight="bold" color="label"> | ||
|
@@ -716,7 +721,15 @@ function ClaimYourPointsCta({ | |
whileTap={{ scale: 0.98 }} | ||
whileFocus={{ scale: 1.02 }} | ||
whileHover={{ scale: 1.02 }} | ||
onClick={() => showClaimSheet()} | ||
onClick={() => { | ||
// TODO: Also track amount in USD | ||
analytics.track(event.pointsRewardsClaimButtonClicked, { | ||
claimAmount: Number( | ||
convertRawAmountToDecimalFormat(claimableReward, 18), | ||
), | ||
}); | ||
showClaimSheet(); | ||
}} | ||
> | ||
<RainbowText size="20pt" weight="heavy"> | ||
{i18n.t('points.rewards.claim_reward', { | ||
|
@@ -894,12 +907,6 @@ function MyEarnings({ earnings = '0' }: { earnings?: string }) { | |
{i18n.t('points.rewards.my_earnings')} | ||
</Text> | ||
</Inline> | ||
<Symbol | ||
symbol="questionmark.circle.fill" | ||
weight="heavy" | ||
size={16} | ||
color="labelQuaternary" | ||
/> | ||
</Box> | ||
<Box display="flex" justifyContent="space-between"> | ||
<Inline space="10px" alignVertical="center"> | ||
|
@@ -1101,6 +1108,14 @@ export function PointsDashboard() { | |
const [displayMode, setDisplayMode] = useState<'rewards' | 'leaderboard'>( | ||
'rewards', | ||
); | ||
useEffect(() => { | ||
if (displayMode === 'rewards') { | ||
analytics.track(event.pointsRewardsViewed); | ||
} else if (displayMode === 'leaderboard') { | ||
analytics.track(event.pointsLeaderboardViewed); | ||
} | ||
analytics.track(event.pointsViewed); | ||
}, [displayMode]); | ||
return ( | ||
<> | ||
<Stack | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters