Skip to content
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

chore: tracking and copy changes #500

Merged
merged 2 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/components/Banners/HomePageBanner/HomePageBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import * as React from 'react'

import { Responsive } from 'decentraland-ui'
import { T, t } from 'decentraland-dapps/dist/modules/translation/utils'
import { getAnalytics } from 'decentraland-dapps/dist/modules/analytics/utils'
import { Campaign } from 'modules/analytics/campaigns'
import Banner from 'components/Banner'

import { Props } from './HomePageBanner.types'
import './HomePageBanner.css'

export default class HomePageBanner extends React.PureComponent<Props> {
handleHomePageClick = () => {
const analytics = getAnalytics()
analytics.track('HomePage CTA', {
campaign: Campaign.DAPPER
})
}

handleMobilePageClick = () => {
const analytics = getAnalytics()
analytics.track('MobilePage CTA', {
campaign: Campaign.DAPPER
})
}

render() {
const { className } = this.props

Expand All @@ -33,7 +48,7 @@ export default class HomePageBanner extends React.PureComponent<Props> {
values={{
br: <br />,
cta: (
<a href="https://dap.pr/dclinstallp" rel="noopener noreferrer" target="_blank">
<a href="https://dap.pr/dclinstallp" rel="noopener noreferrer" target="_blank" onClick={this.handleHomePageClick}>
{t('banners.dapper_homepage_cta')}
</a>
)
Expand All @@ -50,7 +65,12 @@ export default class HomePageBanner extends React.PureComponent<Props> {
br: <br />,

cta: (
<a href="https://decentraland.org/blog/picture-frames-dapper" rel="noopener noreferrer" target="_blank">
<a
href="https://decentraland.org/blog/picture-frames-dapper"
rel="noopener noreferrer"
target="_blank"
onClick={this.handleMobilePageClick}
>
{t('banners.mobile_dapper_hompage_cta')}
</a>
)
Expand Down
12 changes: 11 additions & 1 deletion src/components/HomePage/PromoBanner/PromoBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
import React from 'react'
import { Button } from 'decentraland-ui'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { getAnalytics } from 'decentraland-dapps/dist/modules/analytics/utils'
import { Campaign } from 'modules/analytics/campaigns'

import { Props } from './PromoBanner.types'

import './PromoBanner.css'

export default class PromoBanner extends React.PureComponent<Props> {
handleCTAClick = () => {
const analytics = getAnalytics()
analytics.track('HomePage Promo CTA', {
campaign: Campaign.DAPPER
})
window.open('https://dap.pr/dclinstallp')
}

render() {
return (
<div className="PromoBanner">
<div className="bg" />
<div className="logo" />
<div className="title">{t('banners.promo_title')}</div>
<div className="subtitle">{t('banners.promo_subtitle')}</div>
<Button className="cta" href="https://dap.pr/dclinstallp" target="_blank" rel="noopener noreferrer" primary>
<Button className="cta" primary onClick={this.handleCTAClick}>
{t('banners.promo_cta')}
</Button>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/SideBar/AssetPackList/AssetPackList.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
padding: 16px 20px;
cursor: pointer;
line-height: 24px;
user-select: none;
}

.AssetPackList .promo .highlight {
Expand Down
6 changes: 6 additions & 0 deletions src/components/SideBar/AssetPackList/AssetPackList.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import React from 'react'
import { T, t } from 'decentraland-dapps/dist/modules/translation/utils'
import { getAnalytics } from 'decentraland-dapps/dist/modules/analytics/utils'
import { Campaign } from 'modules/analytics/campaigns'

import SidebarCard from '../SidebarCard'
import { Props } from './AssetPackList.types'
import './AssetPackList.css'

export default class AssetPackList extends React.PureComponent<Props> {
handlePromoClick = () => {
const analytics = getAnalytics()
analytics.track('Item catalog Dapper CTA', {
campaign: Campaign.DAPPER
})
window.open('https://dap.pr/dclinstallp')
}

Expand Down
8 changes: 8 additions & 0 deletions src/components/SideBar/ItemDrawer/ItemDrawer.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@
overflow-y: auto;
position: relative;
}

.ItemDrawer .disclaimer {
color: rgba(var(--bluish-steel-raw), 0.64);
text-align: center;
width: calc(var(--sidebar-width) - 32px);
display: block;
margin-top: 10px;
}
8 changes: 8 additions & 0 deletions src/components/SideBar/ItemDrawer/ItemDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react'
import { Loader } from 'decentraland-ui'

import { T } from 'decentraland-dapps/dist/modules/translation/utils'
import { COLLECTIBLE_ASSET_PACK_ID } from 'modules/ui/sidebar/utils'
import SidebarHeader from '../SidebarHeader'
import SidebarSearch from '../SidebarSearch'
Expand Down Expand Up @@ -48,12 +49,19 @@ export default class ItemDrawer extends React.PureComponent<Props, State> {
}

render() {
const { selectedAssetPack, isLoadingAssets, isConnected } = this.props
const isViewingCollectibles = selectedAssetPack && selectedAssetPack.id === COLLECTIBLE_ASSET_PACK_ID && isConnected && !isLoadingAssets
return (
<div className="ItemDrawer">
<SidebarHeader />
<SidebarSearch onResetScroll={this.handleResetScroll} />
<div ref={this.setDrawerContainer} className="overflow-container">
{this.renderList()}
{isViewingCollectibles && (
<span className="disclaimer">
<T id={`itemdrawer.collectible_disclaimer`} values={{ br: <br /> }} />
</span>
)}
</div>
</div>
)
Expand Down
3 changes: 3 additions & 0 deletions src/modules/analytics/campaigns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const Campaign = {
DAPPER: 'dapper'
}
18 changes: 18 additions & 0 deletions src/modules/analytics/sagas.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { takeLatest, select } from 'redux-saga/effects'
import { getAnalytics } from 'decentraland-dapps/dist/modules/analytics/utils'
import { ConnectWalletSuccessAction, CONNECT_WALLET_SUCCESS } from 'decentraland-dapps/dist/modules/wallet/actions'

import { OPEN_EDITOR, OpenEditorAction, TOGGLE_SNAP_TO_GRID, ToggleSnapToGridAction } from 'modules/editor/actions'
import { getCurrentProject, getProject } from 'modules/project/selectors'
Expand Down Expand Up @@ -28,6 +29,7 @@ export function* segmentSaga() {
yield takeLatest(SUBMIT_PROJECT_SUCCESS, handleSubmitProject)
yield takeLatest(TOGGLE_SNAP_TO_GRID, handleToggleSnapToGrid)
yield takeLatest(UPDATE_TRANSFORM, handleUpdateTransfrom)
yield takeLatest(CONNECT_WALLET_SUCCESS, handleConnectWallet)
}

const track = (event: string, params: any) => getAnalytics().track(event, params)
Expand Down Expand Up @@ -91,3 +93,19 @@ function* handleUpdateTransfrom(_: UpdateTransfromAction) {

track('Update item', { projectId: project.id })
}

function handleConnectWallet(action: ConnectWalletSuccessAction) {
const ethereum = (window as any)['ethereum']

let provider = null

if (ethereum) {
if (ethereum.isMetaMask) {
provider = 'metamask'
} else if (ethereum.isDapper) {
provider = 'dapper'
}
}

track('Connect wallet', { address: action.payload.wallet.address, provider })
}
4 changes: 2 additions & 2 deletions src/modules/common/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createStore, compose, applyMiddleware } from 'redux'
import { routerMiddleware } from 'connected-react-router'
import createSagasMiddleware from 'redux-saga'
import { createLogger } from 'redux-logger'
import createHistory from 'history/createBrowserHistory'
import { createBrowserHistory } from 'history'

import { env } from 'decentraland-commons'
import { createStorageMiddleware } from 'decentraland-dapps/dist/modules/storage/middleware'
Expand All @@ -22,7 +22,7 @@ import { rootSaga } from './sagas'
// @ts-ignore: Dev tools
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose

const history = createHistory()
const history = createBrowserHistory()
const rootReducer = createRootReducer(history)

const historyMiddleware = routerMiddleware(history)
Expand Down
7 changes: 4 additions & 3 deletions src/modules/translation/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"dapper_assetpack_banner": "Get Dapper wallet and a free {cat} for your scene!",
"dapper_homepage": "Place a picture of your CryptoKitty in your scene!{br}Don't have a CryptoKitty? Make a Dapper wallet and get a free {cta}.",
"dapper_homepage_cta": "Purrstige Cat",
"mobile_dapper_homepage": "Learn about our latest feature:{br}{cta}",
"mobile_dapper_hompage_cta": "Picture Frames + Dapper",
"promo_cta": "Install Dapper",
"promo_subtitle": "Complete the look by displaying your CryptoKitty in your scene. Don't have a CryptoKitty? Make a Dapper wallet and get a free, unique Purrstige Cat.",
"promo_title": "You’re looking Dapper today!",
"mobile_dapper_homepage": "Learn about our latest feature:{br}{cta}",
"mobile_dapper_hompage_cta": "Picture Frames + Dapper"
"promo_title": "You’re looking Dapper today!"
},
"contest": {
"banner": {
Expand Down Expand Up @@ -112,6 +112,7 @@
"upload_manually": "Upload Manually"
},
"itemdrawer": {
"collectible_disclaimer": "Don’t see all of your crypto-collectibles?{br}We are adding support for more soon!",
"empty_ground": "No Ground",
"no_results": "No results",
"results": "Results",
Expand Down
1 change: 1 addition & 0 deletions src/modules/translation/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"upload_manually": "Súbelas manualmente"
},
"itemdrawer": {
"collectible_disclaimer": "¿No ves todos tus coleccionables?{br}¡Agregaremos más próximamente!",
"empty_ground": "Sin piso",
"no_results": "Sin resultados",
"search": "Buscar objetos",
Expand Down
1 change: 1 addition & 0 deletions src/modules/translation/languages/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"upload_manually": "직접 업로드"
},
"itemdrawer": {
"collectible_disclaimer": "보유하고 계신 모든 크립토-콜렉티블이 보이지 않나요?{br}곧 지원 내역을 추가할 예정입니다!",
"empty_ground": "땅이 없습니다",
"no_results": "아이템을 찾을 수 없습니다",
"search": "아이템 검색",
Expand Down
1 change: 1 addition & 0 deletions src/modules/translation/languages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"upload_manually": "手动上传"
},
"itemdrawer": {
"collectible_disclaimer": "没看到你所有的加密收藏品?{br}我们很快就会加入支持!",
"empty_ground": "末设置地面",
"no_results": "没找到",
"search": "搜索",
Expand Down