Skip to content

Commit 3f6cb2f

Browse files
committed
Add PromoBox to AddressOverview
1 parent 61b2dee commit 3f6cb2f

File tree

3 files changed

+188
-2
lines changed

3 files changed

+188
-2
lines changed

src/components/layouts/AddressOverview.vue

Lines changed: 171 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,35 @@
136136
<button class="nq-button" @click="onboard" @mousedown.prevent>{{ $t('Signup') }}</button>
137137
</template>
138138

139+
<transition name="fadeY">
140+
<div class="promo-box nq-light-blue-bg flex-column" v-if="promoBoxVisible">
141+
<div class="flex-row">
142+
<EventIcon />
143+
<h2 class="nq-h2">
144+
{{ $t('You did it – time to spread the word. Promote Nimiq and get your fiat back! ') }}
145+
</h2>
146+
</div>
147+
<ul>
148+
<li>{{ $t('Tweet about your experience with a Twitter account that’s at least 1 month old.') }}</li>
149+
<li>{{ $t('Include #NimiqOASIS') }}</li>
150+
<li class="flex-row">
151+
<ArrowRightSmallIcon />
152+
{{ $t('Until end of March, 10 swaps will get their fiat back.') }}
153+
<a class="nq-button-s inverse light-blue flex-row"
154+
href="https://twitter.com/intent/tweet?hashtags=NimiqOasis"
155+
target="_blank" rel="noopener">
156+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 14">
157+
<!-- eslint-disable-next-line max-len -->
158+
<path fill="#fff" d="M15.8 3.15a.34.34 0 00-.15-.6l-.54-.13a.34.34 0 01-.23-.49l.3-.6a.34.34 0 00-.4-.49l-1.37.39a.34.34 0 01-.3-.06A3.44 3.44 0 007.6 3.92v.25a.17.17 0 01-.16.18c-1.93.22-3.78-.76-5.78-3.06a.35.35 0 00-.35-.1.34.34 0 00-.2.28 5.22 5.22 0 00.33 3.48.17.17 0 01-.2.16l-.76-.15a.34.34 0 00-.4.4 3.55 3.55 0 001.7 2.67.17.17 0 01-.07.25l-.36.14a.34.34 0 00-.18.48 3 3 0 002.2 1.7.17.17 0 01.09.27.17.17 0 01-.09.06c-.93.39-1.94.58-2.95.57a.35.35 0 10-.14.69c1.76.83 3.67 1.28 5.6 1.33 1.72.02 3.4-.45 4.83-1.38a8.6 8.6 0 003.83-7.18v-.6a.35.35 0 01.12-.26l1.13-.95z"/>
159+
</svg>
160+
{{ $t('Tweet') }}
161+
</a>
162+
</li>
163+
</ul>
164+
<CrossCloseButton @click="setPromoBoxVisible(false)"/>
165+
</div>
166+
</transition>
167+
139168
<MobileActionBar/>
140169

141170
<Portal>
@@ -148,7 +177,15 @@
148177

149178
<script lang="ts">
150179
import { defineComponent, ref, watch, computed } from '@vue/composition-api';
151-
import { Identicon, GearIcon, Copyable, ArrowRightSmallIcon, ArrowLeftIcon, MenuDotsIcon } from '@nimiq/vue-components';
180+
import {
181+
Identicon,
182+
GearIcon,
183+
Copyable,
184+
ArrowRightSmallIcon,
185+
ArrowLeftIcon,
186+
MenuDotsIcon,
187+
CrossIcon,
188+
} from '@nimiq/vue-components';
152189
// @ts-expect-error missing types for this package
153190
import { Portal } from '@linusborg/vue-simple-portal';
154191
// @ts-expect-error missing types for this package
@@ -171,13 +208,17 @@ import { onboard, rename } from '../../hub';
171208
import { useWindowSize } from '../../composables/useWindowSize';
172209
import { BTC_ADDRESS_GAP, CryptoCurrency } from '../../lib/Constants';
173210
import { checkHistory } from '../../electrum';
211+
import EventIcon from '../icons/EventIcon.vue';
212+
import { useSwapsStore } from '../../stores/Swaps';
213+
import CrossCloseButton from '../CrossCloseButton.vue';
174214
175215
export default defineComponent({
176216
name: 'address-overview',
177217
setup() {
178218
const { activeAccountId, activeCurrency } = useAccountStore();
179219
const { activeAddressInfo, activeAddress } = useAddressStore();
180220
const { accountBalance: btcAccountBalance } = useBtcAddressStore();
221+
const { promoBoxVisible, setPromoBoxVisible } = useSwapsStore();
181222
182223
const searchString = ref('');
183224
@@ -237,6 +278,8 @@ export default defineComponent({
237278
addressMaskedWidth,
238279
btcAccountBalance,
239280
CryptoCurrency,
281+
promoBoxVisible,
282+
setPromoBoxVisible,
240283
};
241284
},
242285
components: {
@@ -256,6 +299,9 @@ export default defineComponent({
256299
MenuDotsIcon,
257300
MobileActionBar,
258301
Portal,
302+
EventIcon,
303+
CrossIcon,
304+
CrossCloseButton,
259305
},
260306
directives: {
261307
responsive: ResponsiveDirective,
@@ -624,6 +670,125 @@ export default defineComponent({
624670
flex-grow: 1;
625671
}
626672
673+
.promo-box {
674+
position: absolute;
675+
bottom: 3rem;
676+
right: 3rem;
677+
border-radius: 0.75rem;
678+
width: 48rem;
679+
padding: 2.25rem;
680+
681+
.flex-row {
682+
align-items: center;
683+
684+
.nq-h2 {
685+
font-size: 16px;
686+
margin: 0;
687+
line-height: 130%;
688+
}
689+
690+
svg {
691+
width: 29px;
692+
height: 29px;
693+
flex-shrink: 0;
694+
margin-right: 1.5rem;
695+
}
696+
}
697+
698+
ul {
699+
padding-left: 2.25rem;
700+
margin: 0;
701+
702+
li {
703+
padding-top: 1.5rem;
704+
font-size: 14px;
705+
color: rgba(white, 0.8);
706+
font-weight: 600;
707+
708+
&.flex-row {
709+
margin-left: -2.25rem;
710+
list-style-type: none;
711+
position: relative;
712+
align-items: flex-start;
713+
714+
.nq-icon {
715+
opacity: .7;
716+
width: 12px;
717+
height: auto;
718+
padding-top: 6px;
719+
}
720+
721+
.nq-button-s {
722+
font-size: 14px;
723+
line-height: 18px;
724+
margin-left: 2rem;
725+
726+
&:hover,
727+
&:focus,
728+
&:active {
729+
color: white;
730+
}
731+
732+
svg {
733+
width: 15px;
734+
height: auto;
735+
}
736+
}
737+
}
738+
739+
&::marker {
740+
color: rgba(white, .7);
741+
transform: translateX(2px);
742+
font-size: 12px;
743+
}
744+
}
745+
}
746+
747+
.cross-close-button {
748+
height: 12px;
749+
width: 12px;
750+
opacity: .7;
751+
position: absolute;
752+
top: 12px;
753+
right: 12px;
754+
padding: 0;
755+
}
756+
757+
&.fadeY-enter-active, &.fadeY-leave-active {
758+
will-change: opacity, transform;
759+
transition: {
760+
property: opacity, transform;
761+
duration: 200ms;
762+
timing-function: cubic-bezier(0.5, 0, 0.15, 1);
763+
}
764+
}
765+
766+
&.fadeY-leave-active {
767+
position: absolute;
768+
width: 100%;
769+
}
770+
771+
&.fadeY-enter-active {
772+
transition-delay: 50ms;
773+
}
774+
775+
&.fadeY-leave,
776+
&.fadeY-enter-to {
777+
transform: translateY(0);
778+
}
779+
780+
&.fadeY-enter {
781+
opacity: 0;
782+
transform: translateY(1rem);
783+
}
784+
785+
&.fadeY-leave-to {
786+
opacity: 0;
787+
transform: translateY(-1rem);
788+
}
789+
790+
}
791+
627792
@media (max-width: 700px) { // Full mobile breakpoint
628793
.address-overview {
629794
position: relative;
@@ -709,5 +874,10 @@ export default defineComponent({
709874
0px 0px 32.0004px rgba(31, 35, 72, 0.058643),
710875
0px 0px 80px rgba(31, 35, 72, 0.07);
711876
}
877+
878+
.promo-box {
879+
width: 90%;
880+
bottom: 10rem;
881+
}
712882
}
713883
</style>

src/components/swap/SwapNotification.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ enum SwapError {
6868
6969
export default defineComponent({
7070
setup(props, context) {
71-
const { activeSwap, setActiveSwap, addFundingData, userBank } = useSwapsStore();
71+
const {
72+
activeSwap,
73+
setActiveSwap,
74+
addFundingData,
75+
userBank,
76+
setPromoBoxVisible,
77+
promoBoxVisible,
78+
} = useSwapsStore();
7279
7380
const swapIsComplete = computed(() => !!activeSwap.value && activeSwap.value.state === SwapState.COMPLETE);
7481
const swapIsExpired = computed(() => !!activeSwap.value && activeSwap.value.state === SwapState.EXPIRED);
@@ -466,6 +473,9 @@ export default defineComponent({
466473
currentError.value = null;
467474
}
468475
case SwapState.COMPLETE: {
476+
if (activeSwap.value!.from.asset === SwapAsset.EUR) {
477+
setPromoBoxVisible(true);
478+
}
469479
setTimeout(() => {
470480
// Hide notification after a timeout, if not in the SwapModal.
471481
if (['swap', 'buy-crypto'].includes(context.root.$route.name!)) return;

src/stores/Swaps.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export type SwapsState = {
9999
swapByTransaction: { [transactionHash: string]: string },
100100
activeSwap: ActiveSwap | null,
101101
userBank: BankInfos | null,
102+
promoBoxVisible: boolean,
102103
};
103104

104105
export const useSwapsStore = createStore({
@@ -108,6 +109,7 @@ export const useSwapsStore = createStore({
108109
swapByTransaction: {},
109110
activeSwap: null,
110111
userBank: null,
112+
promoBoxVisible: false,
111113
}),
112114
getters: {
113115
getSwap: (state): ((hash: string) => Swap | undefined) => (hash: string): Readonly<Swap> =>
@@ -120,6 +122,7 @@ export const useSwapsStore = createStore({
120122
},
121123
activeSwap: (state): Readonly<ActiveSwap | null> => state.activeSwap,
122124
userBank: (state): Readonly<BankInfos | null> => state.userBank,
125+
promoBoxVisible: (state): Readonly<boolean> => state.promoBoxVisible,
123126
},
124127
actions: {
125128
setSwap(hash: string, swap: Swap) {
@@ -155,5 +158,8 @@ export const useSwapsStore = createStore({
155158
setUserBank(bank: BankInfos) {
156159
this.state.userBank = bank;
157160
},
161+
setPromoBoxVisible(visible: boolean) {
162+
this.state.promoBoxVisible = visible;
163+
},
158164
},
159165
});

0 commit comments

Comments
 (0)