-
Notifications
You must be signed in to change notification settings - Fork 103
/
TokenInformationPopup.svelte
130 lines (122 loc) · 4.42 KB
/
TokenInformationPopup.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<script lang="ts">
import { localize } from '@core/i18n'
import {
TokenStandard,
IAsset,
resetNewTokenTransactionDetails,
updateNewTransactionDetails,
unverifyAsset,
verifyAsset,
NotVerifiedStatus,
VerifiedStatus,
NewTransactionType,
} from '@core/wallet'
import { openPopup, PopupId, updatePopupProps } from '@auxiliary/popup'
import { AssetIcon, Button, Text, TextHint, AssetActionsButton, KeyValueBox, FontWeight } from 'shared/components'
export let asset: IAsset
export let activityId: string = undefined
function onSkipClick(): void {
unverifyAsset(asset.id, NotVerifiedStatus.Skipped)
if (activityId) {
openPopup({
id: PopupId.ActivityDetails,
props: { activityId },
})
} else {
updatePopupProps({
asset: { ...asset, verification: { verified: false, status: NotVerifiedStatus.Skipped } },
})
}
}
function onVerifyClick(): void {
verifyAsset(asset.id, VerifiedStatus.SelfVerified)
if (activityId) {
openPopup({
id: PopupId.ActivityDetails,
props: { activityId },
})
} else {
updatePopupProps({
asset: { ...asset, verification: { verified: true, status: VerifiedStatus.SelfVerified } },
})
}
}
function onSendClick(): void {
resetNewTokenTransactionDetails()
updateNewTransactionDetails({
type: NewTransactionType.TokenTransfer,
assetId: asset.id,
disableAssetSelection: true,
})
openPopup({
id: PopupId.SendForm,
overflow: true,
})
}
</script>
<div class="space-y-6">
<div class="flex flex-row justify-between items-center space-x-3 mr-8">
<Text
type="h4"
fontSize="18"
lineHeight="6"
fontWeight={FontWeight.semibold}
classes="overflow-hidden whitespace-nowrap overflow-ellipsis"
>
{asset?.verification?.status === NotVerifiedStatus.New
? localize('popups.tokenInformation.newTokenTitle')
: asset?.metadata?.name}
</Text>
{#if asset?.standard === TokenStandard.Irc30}
<AssetActionsButton {asset} />
{/if}
</div>
<div class="space-y-3 flex flex-col items-center justify-center">
<AssetIcon {asset} large showVerifiedBadgeOnly />
<Text type="h2" fontWeight={FontWeight.bold}>
{asset?.metadata?.tickerSymbol ?? asset?.metadata?.unit}
</Text>
</div>
<div class="space-y-4 flex flex-col items-center justify-center">
{#if !asset?.verification?.verified}
<TextHint warning text={localize('popups.tokenInformation.verificationWarning')} />
{/if}
<div class="w-full flex flex-col space-y-2">
<KeyValueBox
keyText={localize('popups.tokenInformation.tokenMetadata.standard')}
valueText={asset?.standard}
/>
<KeyValueBox
keyText={localize('popups.tokenInformation.tokenMetadata.name')}
valueText={asset?.metadata?.name}
/>
<KeyValueBox
keyText={localize('popups.tokenInformation.tokenMetadata.tokenId')}
valueText={asset?.id}
isCopyable={asset?.standard === TokenStandard.Irc30}
copyValue={asset?.id}
/>
{#if asset?.metadata?.url}
<KeyValueBox
keyText={localize('popups.tokenInformation.tokenMetadata.url')}
valueText={asset?.metadata?.url}
isCopyable
/>
{/if}
</div>
</div>
<div class="flex flex-row flex-nowrap w-full space-x-4">
{#if asset?.verification?.status === NotVerifiedStatus.New}
<Button outline classes="w-full" onClick={onSkipClick}>
{localize('actions.skip')}
</Button>
<Button classes="w-full" onClick={onVerifyClick}>
{localize('popups.tokenInformation.buttons.verifyToken')}
</Button>
{:else}
<Button classes="w-full" onClick={onSendClick}>
{localize('actions.send')}
</Button>
{/if}
</div>
</div>