Skip to content

Commit fb5ab23

Browse files
authored
Analitycs consent modal update (#1171)
* feat(onboarding): modify welcome to HyperPlay modal * feat(onboarding): update styles for welcome modal * feat(assets): add diamond SVG to the assets folder * feat(localization): update translations for the welcome modal * feat(localization): remove outdated community call-to-action from translations * fix(onboarding): removed numbers from they translation keys * fix(localization): updated keys running yarn i18n again * fix(onboarding): add new style condition to onboard modal * fix(onboarding): add compatibility layer translation key for one item missing * fix(onboarding): increase width and add top do the modal component * fix(onboarding): adjust margins and font weights to use var from our lib * fix(translations): add compatibility layer translation key * update(onboarding): update analytics copy and style * update(onboarding): update styles for analytics consent modal * feat(onboarding): add AnalyticsV2 card component for privacy policy update * feat(onboarding): add styles for AnalyticsV2 card component * feat(onboarding): integrate AnalyticsV2 component into main app * feat(onboarding): add close icon SVG for consent modal * feat(onboarding): add check-circle SVG for consent modal * feat(onboarding): add x-close SVG change * feat(onboarding): add check-circle SVG update * feat(onboarding): update and add translations for the onboad modal and card * feat(onboarding): update styles for welcome modal * fix(analytics): update component name on index * fix(analytics): change component name * fix(analytics): change component name on index * fix(analytics): yarn.lock * refactor(analytics): rename CardPrivacyPolicy import and remove unused styles * delete(assets): remove unused check-circle.svg file * delete(assets): remove unused x-close.svg file * add(assets): add check-circle.svg for consent modal * add(assets): add x-close.svg for consent modal * fix(analytics): update title text style on card * fix(analytics): update text color and font weight in privacy policy card * fix(analytics): correct import path for CardPrivacyPolicy component * fix(analytics): correct import path for CardPrivacyPolicy component * fix(translation): run yarn i18n to resolve conflicts
1 parent eac782b commit fb5ab23

File tree

10 files changed

+204
-101
lines changed

10 files changed

+204
-101
lines changed

public/locales/en/translation.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@
352352
"profile": "Profile"
353353
},
354354
"buttons": {
355-
"agree": "I agree",
356-
"noThanks": "No Thanks"
355+
"primaryButton": "I Agree",
356+
"secondaryButton": "No, Thanks"
357357
},
358358
"changeWallet": "Swap wallet account",
359359
"compatibilityLayer": "Compatibility Layer (Beta)",
@@ -374,19 +374,20 @@
374374
"linkSteamAccountDescription": "Sign in to Steam to link your HyperPlay account.",
375375
"linkSteamAccountTitle": "Link Steam Account",
376376
"logOut": "Log out",
377-
"misc": "Never",
378377
"onboarding": {
379378
"analytics": {
380-
"anonymized": "Send anonymized click & game interaction;",
381379
"body": "HyperPlay would like to gather usage data to better understand how our users interact with the application. This information helps us understand how you use the app and lets us make HyperPlay even better for you.",
380+
"bulletOne": "Always allow you to opt-out",
381+
"bulletTwo": "Send anonymized click & game interaction",
382382
"hyperplayWill": "HyperPlay will:",
383-
"neverCollectIP": " collect your full IP address;",
384-
"neverCollectPersonal": " collect keys, addresses, balances, hashes, or any personal information;",
385-
"neverSellData": " sell data for profit. Ever!",
386-
"optOut": "Always allow you to opt-out via Settings;",
383+
"paragraphOne": "HyperPlay would like to gather usage data to better understand how our users interact with the application. \n This lets us make HyperPlay even better for you.",
387384
"privacyCaption": "This data is aggregated and is therefore anonymous for the purposes of General Data Protection Regulation (EU) 2016/679. For more information in relation to our privacy practices, please see our ",
388-
"privacyPolicyHere": "Privacy Policy here.",
389-
"title": "Help Us improve HyperPlay!"
385+
"privacyPolicy": "Privacy Policy.",
386+
"text": {
387+
"externalLink": "Learn More",
388+
"title": "We’ve updated our Privacy Policy"
389+
},
390+
"titleOne": "Help Us Improve HyperPlay!"
390391
},
391392
"connectAgain": "Connect again",
392393
"connectionCanceled": {

src/frontend/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { UpdateModalController } from './components/UI/UpdateModalController'
4040
import { QuestsPage } from './screens/Quests'
4141
import { NavigateListener } from './NavigateListener'
4242
import G7Webview from './screens/G7Webview'
43+
import CardPrivacyPolicy from './screens/Onboarding/analytics/CardPrivacyPolicy'
4344

4445
function App() {
4546
const { sidebarCollapsed, isSettingsModalOpen, connectivity } =
@@ -54,6 +55,7 @@ function App() {
5455
<TopNavBar />
5556
<Sidebar />
5657
<main className="content">
58+
<CardPrivacyPolicy />
5759
<QaAuthHandler />
5860
<NavigateListener />
5961
<ExtensionHandler />
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
.root {
2+
position: fixed;
3+
bottom: 0;
4+
right: 0;
5+
z-index: 9999;
6+
display: flex;
7+
margin: var(--space-xl);
8+
width: 380px;
9+
padding: var(--space-md);
10+
flex-direction: column;
11+
align-items: flex-start;
12+
justify-content: space-between;
13+
gap: var(--space-md);
14+
border-radius: var(--space-sm);
15+
background: var(--color-neutral-700);
16+
}
17+
18+
.closeButton {
19+
background: none;
20+
border: none;
21+
position: absolute;
22+
top: 0;
23+
right: 0;
24+
padding: var(--space-xs);
25+
fill: var(--color-neutral-100);
26+
padding: var(--space-md);
27+
}
28+
29+
.text {
30+
color: var(--color-neutral-100);
31+
font-weight: var(--bold);
32+
}
33+
34+
.link {
35+
color: var(--color-primary-200) !important;
36+
&:hover {
37+
text-decoration: underline !important;
38+
}
39+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React, { useContext, useState } from 'react'
2+
import { MetricsOptInStatus } from 'common/types'
3+
import { t } from 'i18next'
4+
import ContextProvider from 'frontend/state/ContextProvider'
5+
import AnalyticsStyles from './index.module.scss'
6+
import { Link } from 'react-router-dom'
7+
import { ReactComponent as CloseIcon } from '/src/frontend/assets/hyperplay/x-close.svg'
8+
9+
// Store is visible on local storage
10+
// The user has accepted the privacy policy
11+
const storage = window.localStorage
12+
const hasAcceptedPrivacyPolicy = storage.getItem('hasAcceptedPrivacyPolicy')
13+
14+
function CardPrivacyPolicy() {
15+
const { metricsOptInStatus } = useContext(ContextProvider)
16+
const hasAcceptedV1 = metricsOptInStatus === MetricsOptInStatus.optedIn
17+
const [isVisible, setIsVisible] = useState(!hasAcceptedPrivacyPolicy)
18+
19+
if (!hasAcceptedV1 || !isVisible) {
20+
return null
21+
}
22+
23+
const handleClose = () => {
24+
setIsVisible(false)
25+
storage.setItem('hasAcceptedPrivacyPolicy', 'true')
26+
}
27+
28+
return (
29+
<div className={AnalyticsStyles.root}>
30+
<button className={AnalyticsStyles.closeButton} onClick={handleClose}>
31+
<CloseIcon />
32+
</button>
33+
<span className={AnalyticsStyles.text}>
34+
{t(
35+
'hyperplay.onboarding.analytics.text.title',
36+
`We’ve updated our Privacy Policy`
37+
)}{' '}
38+
</span>
39+
40+
<Link
41+
className={AnalyticsStyles.link}
42+
to="https://www.hyperplay.xyz/privacy-policy"
43+
target="_blank"
44+
>
45+
{t('hyperplay.onboarding.analytics.text.externalLink', `Learn More`)}
46+
</Link>
47+
</div>
48+
)
49+
}
50+
51+
export default CardPrivacyPolicy

src/frontend/screens/Onboarding/analytics/index.module.scss

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,67 @@
11
.buttonContainer {
22
display: flex;
33
flex-direction: row;
4-
margin: var(--space-lg) auto;
4+
align-items: flex-start;
5+
margin-left: 0;
6+
margin-top: var(--space-xl);
57
gap: var(--space-xs);
68
}
79

10+
.title {
11+
color: var(--color-neutral-100);
12+
margin-bottom: var(--space-xs);
13+
}
14+
815
.buttonContainer button {
9-
min-width: 188px;
16+
min-width: 120px;
1017
border-radius: var(--space-xs);
1118
}
1219

1320
.bulletPointContainer {
1421
display: flex;
1522
flex-direction: row;
23+
justify-content: start;
24+
align-items: flex-start;
1625
}
1726

1827
.bulletPointContainer > svg {
19-
padding-top: var(--space-2xs);
20-
padding-right: var(--space-sm);
21-
height: 13px;
28+
padding-right: var(--space-xs);
29+
width: 28px;
30+
height: 28px;
2231
}
2332

2433
.bulletPointContainer > body:first-word {
25-
color: var(--color-status-error);
34+
font-size: var(--body-sm);
2635
}
2736

28-
.infoText {
37+
.bullets {
2938
color: var(--color-neutral-100);
39+
font-weight: var(--bold);
40+
margin-bottom: var(--space-xs);
41+
}
42+
43+
.titleSm {
44+
color: var(--color-neutral-100);
45+
font-size: var(--body);
46+
font-weight: var(--bold);
47+
margin-bottom: var(--space-lg);
48+
}
49+
50+
.bullets {
51+
color: var(--color-neutral-400);
3052
}
3153

3254
.marginBottomLg {
3355
margin-bottom: var(--space-lg);
56+
color: var(--color-neutral-400);
3457
}
3558
.marginBottomSm {
3659
margin-bottom: var(--space-xs);
3760
}
3861

3962
.privacyCaption {
40-
color: var(--color-neutral-300);
63+
color: var(--color-neutral-400);
64+
margin-top: var(--space-lg);
4165
}
4266

4367
.privacyCaption > a {

0 commit comments

Comments
 (0)