Skip to content

Commit e2c2a10

Browse files
committed
fix: nft detail view fav
1 parent 15be10c commit e2c2a10

4 files changed

Lines changed: 33 additions & 50 deletions

File tree

packages/extension/src/providers/polkadot/ui/dot-update-metadata.vue

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,14 @@
66
class="common-popup__logo"
77
></sign-logo>
88
<div class="common-popup__network">
9-
<img src="@action/icons/raw/polkadot.png" />
10-
<p>Polkadot</p>
9+
<img :src="networks.polkadot.icon" />
10+
<p>{{ metadata ? metadata.chain : networks.polkadot.name_long }}</p>
1111
</div>
1212
</template>
1313

1414
<template #content>
1515
<h2>Update metadata</h2>
1616

17-
<div class="provider-verify-transaction__block">
18-
<div class="provider-verify-transaction__account">
19-
<img src="@action/icons/raw/account.png" />
20-
<div class="provider-verify-transaction__account-info">
21-
<h4>My account nickname</h4>
22-
<div>
23-
<p>
24-
{{
25-
$filters.replaceWithEllipsis(
26-
"123NUNCjWVtxQjkukJ9dCn4awhACmmjXGtA9zZt1EJm37VGf",
27-
4,
28-
4
29-
)
30-
}}
31-
</p>
32-
</div>
33-
</div>
34-
</div>
35-
</div>
36-
3717
<div class="update-metadata__block">
3818
<div class="update-metadata__block-row">
3919
<div class="update-metadata__block-row-left">From</div>
@@ -98,6 +78,7 @@ import { onBeforeMount, ref, watch } from "vue";
9878
import { MetadataDef } from "@polkadot/extension-inject/types";
9979
import MetadataStorage from "@/providers/polkadot/libs/metadata-storage";
10080
import { ProviderRequestOptions } from "@/types/provider";
81+
import networks from "../networks";
10182
10283
const windowPromise = WindowPromiseHandler(0);
10384

packages/extension/src/ui/action/views/import-account/views/import-account-private-key.vue

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,22 @@ const onInput = () => {
6767
};
6868
6969
const importAction = async () => {
70-
if (isValidKey.value) {
71-
const buffer = hexToBuffer(formattedPrivateKey.value);
72-
const wallet = new Wallet(buffer);
73-
const newAddress = `0x${wallet.getAddress().toString("hex")}`;
74-
75-
if (await keyring.accountAlreadyAdded(newAddress)) {
76-
accountAlreadyExists.value = true;
77-
return;
78-
}
70+
const buffer = hexToBuffer(formattedPrivateKey.value);
71+
const wallet = new Wallet(buffer);
72+
const newAddress = `0x${wallet.getAddress().toString("hex")}`;
7973
80-
emit("update:wallet", {
81-
privateKey: wallet.getPrivateKeyString(),
82-
publicKey: wallet.getPublicKeyString(),
83-
address: wallet.getAddressString(),
84-
name: "",
85-
signerType: SignerType.secp256k1,
86-
});
74+
if (await keyring.accountAlreadyAdded(newAddress)) {
75+
accountAlreadyExists.value = true;
76+
return;
8777
}
78+
79+
emit("update:wallet", {
80+
privateKey: wallet.getPrivateKeyString(),
81+
publicKey: wallet.getPublicKeyString(),
82+
address: wallet.getAddressString(),
83+
name: "",
84+
signerType: SignerType.secp256k1,
85+
});
8886
};
8987
</script>
9088

packages/extension/src/ui/action/views/network-nfts/components/network-nfts-item.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
<nft-detail-view
2323
v-if="isDetail"
2424
:item="item"
25+
:is-favorite="isFavorite"
2526
:link-action="openLink"
27+
v-bind="$attrs"
2628
@close:popup="toggleDetail"
2729
/>
2830
</div>

packages/extension/src/ui/action/views/nft-detail-view/index.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@
66
<close-icon />
77
</a>
88

9-
<a class="nft-detail-view__favorite" @click="favClicked(!isFavorite)">
10-
<nft-more-add-to-favorite v-if="!isFavorite" />
9+
<a
10+
class="nft-detail-view__favorite"
11+
@click="favClicked(!localIsFavorite)"
12+
>
13+
<nft-more-add-to-favorite v-if="!localIsFavorite" />
1114
<nft-more-delete-from-favorite v-else />
1215
</a>
1316

1417
<notification
1518
v-if="isFavoriteAction"
1619
:hide="toggleNotification"
17-
:text="isFavorite ? 'Added to favorites' : 'Removed from favorites'"
20+
:text="
21+
localIsFavorite ? 'Added to favorites' : 'Removed from favorites'
22+
"
1823
class="nft-detail-view__notification"
1924
/>
2025

@@ -29,7 +34,7 @@
2934
</template>
3035

3136
<script setup lang="ts">
32-
import { PropType, ref, onUpdated, onMounted } from "vue";
37+
import { onMounted, PropType, ref } from "vue";
3338
import CloseIcon from "@action/icons/common/close-icon.vue";
3439
import ActionMenu from "@action/components/action-menu/index.vue";
3540
import NftMoreAddToFavorite from "@action/icons/nft/nft-more-add-to-favorite.vue";
@@ -43,8 +48,7 @@ const imageLoadError = (img: any) => {
4348
};
4449
4550
const isFavoriteAction = ref(false);
46-
const isFavorite = ref(false);
47-
51+
const localIsFavorite = ref(false);
4852
const props = defineProps({
4953
item: {
5054
type: Object as PropType<NFTItem>,
@@ -63,22 +67,20 @@ const props = defineProps({
6367
},
6468
},
6569
});
66-
6770
onMounted(() => {
68-
isFavorite.value = props.isFavorite;
71+
localIsFavorite.value = props.isFavorite;
6972
});
70-
7173
const emit = defineEmits<{
7274
(e: "close:popup"): void;
7375
(e: "update:favClicked", isFav: boolean, item: NFTItem): void;
7476
}>();
7577
const close = () => {
78+
if (localIsFavorite.value !== props.isFavorite)
79+
emit("update:favClicked", localIsFavorite.value, props.item);
7680
emit("close:popup");
7781
};
7882
const favClicked = (isFav: boolean) => {
79-
emit("update:favClicked", isFav, props.item);
80-
isFavorite.value = isFav;
81-
83+
localIsFavorite.value = isFav;
8284
setTimeout(() => {
8385
toggleNotification();
8486
}, 100);

0 commit comments

Comments
 (0)