Skip to content

Commit e7da467

Browse files
committed
feat: improve invite links
1 parent 38a459d commit e7da467

File tree

19 files changed

+540
-52
lines changed

19 files changed

+540
-52
lines changed

src/constants/common.ts

+1
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ export const MODAL_TRANSFER_RECEIVE = 'transfer-receive';
323323
export const MODAL_TRANSFER_SEND = 'transfer-send';
324324
export const MODAL_DAPP_BROWSER_ACTIONS = 'browser-actions';
325325
export const MODAL_WARNING_DAPP_BROWSER = 'warning-dapp-browser';
326+
export const MODAL_CLAIM_GIFT_CARD = 'claim-gift-card';
326327

327328
export const POPUP_TYPE_CONNECT = 'connectConfirm';
328329
export const POPUP_TYPE_ACCOUNT_LIST = 'account-list';

src/popup/components/AccountSelector.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<Avatar
44
v-if="!avatarOnly"
55
:address="modelValue.toString()"
6+
size="lg"
67
/>
78
<div>
89
<BtnPill
@@ -39,9 +40,10 @@
3940
</BtnPill>
4041
<AddressTruncated
4142
v-if="!avatarOnly"
42-
:protocol="modelValue.protocol"
4343
show-explorer-link
44+
show-protocol-icon
4445
:address="modelValue.toString()"
46+
class="address-truncated"
4547
/>
4648
</div>
4749
</div>
@@ -108,5 +110,9 @@ export default defineComponent({
108110
margin-bottom: 0;
109111
}
110112
}
113+
114+
.address-truncated {
115+
color: $color-white;
116+
}
111117
}
112118
</style>

src/popup/components/AddressTruncated.vue

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<template>
22
<div class="address-truncated">
3+
<ProtocolIcon
4+
v-if="showProtocolIcon"
5+
:protocol="protocol"
6+
class="protocol-icon"
7+
/>
38
<div class="address-truncated-chunks">
49
<span class="address-chunk">{{ truncatedAddress[0] }}</span>
510
<span class="dots">
@@ -32,17 +37,20 @@ import { PROTOCOL_AETERNITY } from '@/constants';
3237
import { ProtocolAdapterFactory } from '@/lib/ProtocolAdapterFactory';
3338
3439
import ExternalLinkIcon from '@/icons/external-link.svg?vue-component';
40+
import ProtocolIcon from './ProtocolIcon.vue';
3541
import LinkButton from './LinkButton.vue';
3642
3743
export default defineComponent({
3844
components: {
45+
ProtocolIcon,
3946
LinkButton,
4047
ExternalLinkIcon,
4148
},
4249
props: {
4350
address: { type: String, required: true },
44-
protocol: { type: String as PropType<Protocol>, default: PROTOCOL_AETERNITY },
4551
showExplorerLink: Boolean,
52+
showProtocolIcon: Boolean,
53+
protocol: { type: String as PropType<Protocol>, default: PROTOCOL_AETERNITY },
4654
},
4755
setup(props) {
4856
const truncatedAddress = computed(() => truncateAddress(props.address));
@@ -69,6 +77,10 @@ export default defineComponent({
6977
align-items: center;
7078
user-select: none;
7179
80+
.protocol-icon {
81+
margin-right: 4px;
82+
}
83+
7284
&-chunks {
7385
@extend %face-mono-12-medium;
7486

src/popup/components/Header.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default defineComponent({
129129
address: () => t('pages.titles.address'),
130130
signMessage: () => t('pages.titles.signMessage'),
131131
signTransaction: () => t('pages.titles.signTransaction'),
132-
invite: () => t('pages.titles.invite'),
132+
giftCards: () => t('pages.titles.giftCards'),
133133
txDetails: () => t('pages.titles.txDetails'),
134134
tokenDetails: () => t('pages.titles.tokenDetails'),
135135
coinDetails: () => t('pages.titles.coinDetails'),

src/popup/components/InputField.vue

-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ export default defineComponent({
339339
.message {
340340
@extend %face-sans-14-regular;
341341
342-
min-height: 24px;
343342
line-height: 20px;
344343
display: flex;
345344
align-items: center;

src/popup/components/InviteItem.vue

+10-6
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
</template>
7272

7373
<script lang="ts">
74-
import nacl from 'tweetnacl';
7574
import {
7675
computed,
7776
defineComponent,
@@ -83,11 +82,12 @@ import { Field } from 'vee-validate';
8382
import {
8483
AE_AMOUNT_FORMATS,
8584
encode,
86-
getAddressFromPriv,
8785
Encoding,
8886
} from '@aeternity/aepp-sdk';
8987
import { useStore } from 'vuex';
9088
import { useRouter } from 'vue-router';
89+
90+
import { getAccountFromSecret } from '@/protocols/aeternity/helpers';
9191
import type { IFormModel } from '@/types';
9292
import { formatDate } from '@/utils';
9393
import {
@@ -96,6 +96,7 @@ import {
9696
} from '@/constants';
9797
import { ROUTE_INVITE_CLAIM } from '@/popup/router/routeNames';
9898
import {
99+
useAccounts,
99100
useBalances,
100101
useMaxAmount,
101102
useAeSdk,
@@ -127,6 +128,7 @@ export default defineComponent({
127128
const { marketData } = useCurrencies({ store });
128129
const { getAeSdk } = useAeSdk({ store });
129130
const { balance } = useBalances({ store });
131+
const { getLastActiveProtocolAccount } = useAccounts({ store });
130132
131133
const formModel = ref<IFormModel>({
132134
amount: '',
@@ -150,9 +152,7 @@ export default defineComponent({
150152
);
151153
});
152154
153-
const address = computed(() => getAddressFromPriv(
154-
nacl.sign.keyPair.fromSeed(Buffer.from(props.secretKey)).secretKey,
155-
));
155+
const address = computed(() => getAccountFromSecret(props.secretKey).address);
156156
157157
function deleteItem() {
158158
store.commit('invites/delete', props.secretKey);
@@ -172,7 +172,11 @@ export default defineComponent({
172172
async function claim() {
173173
emit('loading', true);
174174
try {
175-
await store.dispatch('invites/claim', Buffer.from(props.secretKey));
175+
await store.dispatch('invites/claim', {
176+
secretKey: Buffer.from(props.secretKey),
177+
recipientId: getLastActiveProtocolAccount(PROTOCOL_AETERNITY)?.address,
178+
isMax: true,
179+
});
176180
await updateBalance();
177181
} catch (error) {
178182
if (await store.dispatch('invites/handleNotEnoughFoundsError', { error, isInviteError: true })) {

src/popup/components/Modal.vue

+11-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
'no-padding': noPadding,
1616
dense,
1717
'semi-dense': semiDense,
18-
'blur-bg': !(IS_FIREFOX && IS_EXTENSION)
18+
'blur-bg': !(IS_FIREFOX && IS_EXTENSION),
19+
'min-height': minHeight
1920
}"
2021
>
2122
<div class="container">
@@ -100,6 +101,7 @@ export default defineComponent({
100101
noPadding: Boolean,
101102
centered: Boolean,
102103
bodyWithoutPaddingBottom: Boolean,
104+
minHeight: Boolean,
103105
header: { type: String, default: null },
104106
},
105107
emits: ['close', 'open'],
@@ -196,6 +198,8 @@ export default defineComponent({
196198
.body {
197199
@extend %face-sans-15-regular;
198200
201+
display: flex;
202+
flex-direction: column;
199203
padding: var(--screen-padding-x);
200204
color: variables.$color-grey-light;
201205
word-break: break-word;
@@ -218,6 +222,12 @@ export default defineComponent({
218222
inset: 0;
219223
}
220224
225+
&.min-height {
226+
.container {
227+
min-height: 480px;
228+
}
229+
}
230+
221231
&.full-screen,
222232
&.from-bottom {
223233
--footer-padding-bottom: 24px;

0 commit comments

Comments
 (0)