Skip to content

Commit 3108efb

Browse files
committed
devop: merge
2 parents a60e4d4 + c0b090a commit 3108efb

6 files changed

Lines changed: 171 additions & 8 deletions

File tree

packages/extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@enkryptcom/extension",
3-
"version": "2.11.1",
3+
"version": "2.12.0",
44
"private": true,
55
"type": "module",
66
"scripts": {

packages/extension/src/libs/banners-state/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default class BannersState {
1919
const newState: IState = {
2020
isHideSolanStakingBanner: false,
2121
isHideNetworkAssetSolanStakingBanner: false,
22+
isHideSurveyPopup: false,
2223
};
2324
await this.storage.set(StorageKeys.bannersInfo, newState);
2425
return newState;
@@ -28,6 +29,7 @@ export default class BannersState {
2829
const state = await this.getOrInitializeState();
2930
state.isHideNetworkAssetSolanStakingBanner = false;
3031
state.isHideSolanStakingBanner = false;
32+
state.isHideSurveyPopup = false;
3133
await this.storage.set(StorageKeys.bannersInfo, state);
3234
}
3335

@@ -52,4 +54,15 @@ export default class BannersState {
5254
state.isHideSolanStakingBanner = true;
5355
await this.storage.set(StorageKeys.bannersInfo, state);
5456
}
57+
58+
async showSurveyPopup(): Promise<boolean> {
59+
const state = await this.getOrInitializeState();
60+
return !state.isHideSurveyPopup;
61+
}
62+
63+
async hideSurveyPopup() {
64+
const state = await this.getOrInitializeState();
65+
state.isHideSurveyPopup = true;
66+
await this.storage.set(StorageKeys.bannersInfo, state);
67+
}
5568
}

packages/extension/src/libs/banners-state/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export enum StorageKeys {
55
export type IState = {
66
isHideSolanStakingBanner: boolean;
77
isHideNetworkAssetSolanStakingBanner: boolean;
8+
isHideSurveyPopup: boolean;
89
};

packages/extension/src/ui/action/components/app-menu/components/solana-staking-banner.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const close = () => {
3131
emit('close');
3232
};
3333
const openStakingLink = async () => {
34-
trackSolanaStakingBanner(SolanaStakingBannerEvents.SolanaWalletClicked);
34+
trackSolanaStakingBanner(SolanaStakingBannerEvents.NetworkListClicked);
3535
setTimeout(() => {
3636
openLink('https://staking.enkrypt.com');
3737
}, 1000);
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<template>
2+
<div class="survey-popup">
3+
<div class="survey-popup__content">
4+
<h5>Help us improve Enkrypt</h5>
5+
<p>Please take a quick survey. We appreciate you!</p>
6+
<a href="javascript:void(0);" @click="openSurveyLink" class="button"
7+
><span>Click here</span></a
8+
>
9+
</div>
10+
11+
<a class="survey-popup__close" @click="close">
12+
<close-icon />
13+
</a>
14+
</div>
15+
</template>
16+
17+
<script setup lang="ts">
18+
import CloseIcon from '@action/icons/common/close-icon.vue';
19+
import { openLink } from '@action/utils/browser';
20+
21+
const emit = defineEmits<{
22+
(e: 'close'): void;
23+
}>();
24+
25+
const close = () => {
26+
emit('close');
27+
};
28+
const openSurveyLink = async () => {
29+
openLink('https://tally.so/r/nGMpdL');
30+
close();
31+
};
32+
</script>
33+
34+
<style lang="less">
35+
@import '@action/styles/theme.less';
36+
37+
.survey-popup {
38+
position: absolute;
39+
width: 324px;
40+
left: 8px;
41+
bottom: 8px;
42+
background: #ffffff;
43+
box-shadow:
44+
0px 8px 16px -6px rgba(0, 0, 0, 0.12),
45+
0px 6px 8px -6px rgba(0, 0, 0, 0.12);
46+
border-radius: 12px;
47+
padding: 12px;
48+
box-sizing: border-box;
49+
overflow: hidden;
50+
z-index: 2;
51+
52+
&__content {
53+
display: flex;
54+
align-items: center;
55+
flex-direction: column;
56+
h5 {
57+
font-size: 16px;
58+
font-style: normal;
59+
font-weight: 700;
60+
line-height: 20px;
61+
text-align: center;
62+
/* 125% */
63+
letter-spacing: 0.15px;
64+
color: @primaryLabel;
65+
margin: 0;
66+
background: linear-gradient(to left, #14f195, #64abf2, #9945ff);
67+
-webkit-background-clip: text;
68+
background-clip: text;
69+
-webkit-text-fill-color: transparent;
70+
}
71+
p {
72+
text-align: center;
73+
}
74+
75+
.button {
76+
text-decoration: none;
77+
width: auto;
78+
width: 163px;
79+
height: 32px;
80+
font-size: 12px;
81+
line-height: 32px;
82+
margin-left: auto;
83+
margin-right: auto;
84+
}
85+
}
86+
87+
&__close {
88+
position: absolute;
89+
top: 0;
90+
right: 0;
91+
cursor: pointer;
92+
transition: opacity 300ms ease-in-out;
93+
opacity: 1;
94+
font-size: 0;
95+
width: 32px;
96+
height: 32px;
97+
98+
svg {
99+
width: 32px;
100+
height: 32px;
101+
}
102+
103+
&:hover {
104+
opacity: 0.7;
105+
}
106+
}
107+
}
108+
</style>

packages/extension/src/ui/action/components/app-menu/index.vue

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,19 @@
158158
</div>
159159

160160
<!-- Banners -->
161-
<solana-staking-banner
162-
v-if="isSolanaStakingBanner && isExpanded"
163-
@close="closeSolanaStakingBanner"
164-
/>
161+
<Transition name="slide-fade">
162+
<solana-staking-banner
163+
v-if="isSolanaStakingBanner && isExpanded"
164+
key="solana-banner"
165+
@close="closeSolanaStakingBanner"
166+
/>
167+
168+
<survey-popup
169+
v-else-if="isSurveyPopup && isExpanded"
170+
key="survey-popup"
171+
@close="closeSurveyPopup"
172+
/>
173+
</Transition>
165174
</div>
166175
</template>
167176

@@ -207,6 +216,7 @@ import SearchIcon from '@action/icons/common/search.vue';
207216
import { useMenuStore } from '@action/store/menu-store';
208217
import SolanaStakingBanner from './components/solana-staking-banner.vue';
209218
import BannersState from '@/libs/banners-state';
219+
import SurveyPopup from './components/survey-popup.vue';
210220
211221
const appMenuRef = ref(null);
212222
@@ -268,8 +278,9 @@ onMounted(async () => {
268278
newNetworksWithTags.value.swap = newSwaps.filter(
269279
net => !usedNetworks.swap.includes(net),
270280
);
271-
if (await bannersState.showSolanaStakingBanner()) {
272-
isSolanaStakingBanner.value = true;
281+
isSolanaStakingBanner.value = await bannersState.showSolanaStakingBanner();
282+
if (!isSolanaStakingBanner.value) {
283+
openSurveyPopup();
273284
}
274285
});
275286
@@ -542,17 +553,47 @@ const updateGradient = (newGradient: string) => {
542553
* Banners
543554
------------------*/
544555
const isSolanaStakingBanner = ref(false);
556+
const isSurveyPopup = ref(false);
557+
545558
const bannersState = new BannersState();
546559
560+
const openSurveyPopup = async () => {
561+
if (await bannersState.showSurveyPopup()) {
562+
setTimeout(() => {
563+
isSurveyPopup.value = true;
564+
}, 4000);
565+
}
566+
};
567+
568+
const closeSurveyPopup = () => {
569+
isSurveyPopup.value = false;
570+
bannersState.hideSurveyPopup();
571+
};
572+
547573
const closeSolanaStakingBanner = () => {
548574
isSolanaStakingBanner.value = false;
549575
bannersState.hideSolanaStakingBanner();
576+
openSurveyPopup();
550577
};
551578
</script>
552579

553580
<style lang="less">
554581
@import '@action/styles/theme.less';
555582
583+
.slide-fade-enter-active {
584+
transition: all 0.3s ease-out;
585+
}
586+
587+
.slide-fade-leave-active {
588+
transition: all 0.1s cubic-bezier(1, 0.5, 0.8, 1);
589+
}
590+
591+
.slide-fade-enter-from,
592+
.slide-fade-leave-to {
593+
transform: translateX(20px);
594+
opacity: 0;
595+
}
596+
556597
.expand-menu {
557598
width: 340px;
558599
}

0 commit comments

Comments
 (0)