Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Feat: rebranding widget on dashboard (#4059)
Browse files Browse the repository at this point in the history
* Feat: rebranding widger on dashboard

* Rm mobile banner events

* Update dashboard e2e tests

* Rm unnecessary container

* Hide beamer icon

* Fix animated logo on mobile

* Add important

* style: Update banner image

Co-authored-by: Usame Algan <[email protected]>
  • Loading branch information
katspaugh and usame-algan authored Sep 1, 2022
1 parent e849047 commit 180e3ea
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 217 deletions.
12 changes: 2 additions & 10 deletions cypress/integration/smoke/dashboard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,8 @@ describe('Dashboard', () => {
cy.contains(`main a[href="/app/${SAFE}/balances/nfts"]`, 'NFTs0')
})

it('should display the mobile banner', () => {
const appStoreLink =
'https://apps.apple.com/app/apple-store/id1515759131?pt=119497694&ct=Web%20App%20Dashboard&mt=8'
cy.get(`a[href="${appStoreLink}"]`).should('exist')

cy.get('button[aria-label="Close mobile banner"]').click()
cy.contains('button', 'Already use it!')
cy.contains('button', 'Not interested').click()

cy.get(`a[href="${appStoreLink}"]`).should('not.exist')
it('should display the rebranding banner', () => {
cy.get('main .beamer-trigger').should('exist')
})

it('should display the tx queue widget', () => {
Expand Down
Binary file removed public/mobile-banner/1.png
Binary file not shown.
Binary file removed public/mobile-banner/2.png
Binary file not shown.
Binary file removed public/mobile-banner/3.png
Binary file not shown.
Binary file removed public/mobile-banner/4.png
Binary file not shown.
Binary file removed public/mobile-banner/5.png
Binary file not shown.
Binary file removed public/mobile-banner/6.png
Binary file not shown.
Binary file added public/rebranding-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/components/AppLayout/Header/components/AnimatedLogo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect, useState, ReactElement } from 'react'
import Img from 'src/components/layout/Img'
import SafeLogo from '../assets/transition-logo.gif'

const useInterval = (delay: number): number => {
Expand All @@ -20,7 +19,7 @@ const AnimatedLogo = (): ReactElement => {
const RESTART_DELAY = 2 * 60e3 // 2 minutes
const restartKey = useInterval(RESTART_DELAY)

return <Img alt="Safe" src={`${SafeLogo}?${restartKey}`} id="safe-logo" height={36} />
return <img alt="Safe" src={`${SafeLogo}?${restartKey}`} id="safe-logo" height={36} />
}

export default AnimatedLogo
8 changes: 8 additions & 0 deletions src/components/AppLayout/Header/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ const styles = () => ({
paddingLeft: md,
paddingRight: md,
},
[`@media (max-width: ${screenSm}px)`]: {
maxWidth: '95px',
overflow: 'hidden',
'& img': {
width: '72px',
height: 'auto',
},
},
'& a': {
display: 'flex',
flexDirection: 'column',
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppLayout/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const Sidebar = ({
<HelpList>
{!isDesktop && BEAMER_ID && (
<Track {...OVERVIEW_EVENTS.WHATS_NEW}>
<StyledListItem id="whats-new-button" button onClick={handleClick}>
<StyledListItem className="beamer-trigger" button onClick={handleClick}>
<ListIcon type="gift" color="secondary" size="sm" />
<StyledListItemText>What&apos;s new</StyledListItemText>
</StyledListItem>
Expand Down
173 changes: 0 additions & 173 deletions src/components/Dashboard/MobileAppBanner/index.tsx

This file was deleted.

53 changes: 53 additions & 0 deletions src/components/Dashboard/RebrandingBanner/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { ReactElement } from 'react'
import { useDispatch } from 'react-redux'
import Track from 'src/components/Track'
import { BannerCookiesType, COOKIES_KEY, COOKIE_IDS } from 'src/logic/cookies/model/cookie'
import { openCookieBanner } from 'src/logic/cookies/store/actions/openCookieBanner'
import { loadFromCookie } from 'src/logic/cookies/utils'
import styled from 'styled-components'
import { WidgetContainer, WidgetTitle } from '../styled'

// Banner + hide anything inside, incl. the Beamer icon
const StyledContainer = styled.div`
width: 474px;
height: 227px;
background: url('./rebranding-banner.png') no-repeat 0 0;
background-size: contain;
cursor: pointer;
& * {
display: none !important;
}
`

const RebrandingBanner = (): ReactElement => {
const dispatch = useDispatch()

const onClick = (): void => {
const cookiesState = loadFromCookie<BannerCookiesType>(COOKIES_KEY)
if (!cookiesState) {
dispatch(openCookieBanner({ cookieBannerOpen: true }))
return
}
if (!cookiesState.acceptedSupportAndUpdates) {
dispatch(
openCookieBanner({
cookieBannerOpen: true,
key: COOKIE_IDS.BEAMER,
}),
)
}
}

return (
<WidgetContainer>
<WidgetTitle>&nbsp;</WidgetTitle>

<Track category="rebranding" action="banner-click">
<StyledContainer onClick={onClick} className="beamer-trigger" />
</Track>
</WidgetContainer>
)
}

export default RebrandingBanner
6 changes: 4 additions & 2 deletions src/components/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import PendingTxsList from './PendingTxs/PendingTxsList'
import Overview from './Overview/Overview'
import SafeApps from './SafeApps'
import { FeaturedApps } from './FeaturedApps/FeaturedApps'
import MobileAppBanner from './MobileAppBanner'
import { DashboardTitle } from './styled'
import RebrandingBanner from './RebrandingBanner'

const Dashboard = (): ReactElement => {
return (
Expand All @@ -17,7 +17,9 @@ const Dashboard = (): ReactElement => {
<Overview />
</Grid>

<MobileAppBanner />
<Grid item xs={12} md={12} lg={6}>
<RebrandingBanner />
</Grid>

<Grid item xs={12} md={6}>
<PendingTxsList size={4} />
Expand Down
2 changes: 1 addition & 1 deletion src/utils/beamer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const loadBeamer = async (): Promise<void> => {

window.beamer_config = {
product_id: BEAMER_ID,
selector: 'whats-new-button',
selector: '.beamer-trigger',
display: 'left',
button: false,
bounce: false,
Expand Down
30 changes: 2 additions & 28 deletions src/utils/events/mobile-app-promotion.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,9 @@
import { GTM_EVENT } from '../googleTagManager'

const event = GTM_EVENT.CLICK
const category = 'mobile-app-promotion'
const surveyAction = 'dashboard-banner-survey'

const MOBILE_APP_EVENTS = {
dashboardBannerClick: {
event,
category,
action: 'dashboard-banner-click',
},
alreadyUse: {
event,
category,
action: surveyAction,
label: 'already-use',
},
notInterested: {
event,
category,
action: surveyAction,
label: 'not-interested',
},
dashboardBannerClose: {
event,
category,
action: 'dashboard-banner-close',
},
appstoreButtonClick: {
event,
category,
event: GTM_EVENT.CLICK,
category: 'mobile-app-promotion',
action: 'appstore-button-click',
},
}
Expand Down

0 comments on commit 180e3ea

Please sign in to comment.