Skip to content

Commit

Permalink
feat: fix filter options, don't display none values, make ipfs metada…
Browse files Browse the repository at this point in the history
…ta a link

Signed-off-by: Tim Schmidt <tim@launchbadge.com>
  • Loading branch information
Sheng-Long committed Oct 11, 2023
1 parent 787b5bf commit 3f04587
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/transaction/TransactionFilterSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ export function makeFilterValues(nftFilter: boolean): string[] {
.sort((a, b) => {
return makeTypeLabel(a as TransactionType) < makeTypeLabel(b as TransactionType) ? -1 : 1;
})
if(nftFilter) {
if (nftFilter) {
result = result.filter(el => {
return el === "CRYPTOTRANSFER" || el.startsWith("TOKEN");
return el === "CRYPTOTRANSFER" || el === "TOKENMINT" || el === "CRYPTOAPPROVEALLOWANCE" || el === "CRYPTODELETEALLOWANCE" || el === "TOKENWIPE" || el === "TOKENBURN" || el === "TOKENDELETION";
})
}
result.splice(0, 0, "")
Expand Down
11 changes: 10 additions & 1 deletion src/components/values/BlobValue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<template>
<a v-if="isURL && blobValue" v-bind:href="blobValue">{{ blobValue }}</a>
<a v-else-if="ipfsAddress" :href="ipfsAddress">{{ decodedValue }}</a>
<div v-else-if="jsonValue"
class="h-is-json is-inline-block has-text-left is-family-monospace h-is-text-size-3">{{ jsonValue }}</div>
<template v-else-if="blobValue">
Expand Down Expand Up @@ -122,6 +123,13 @@ export default defineComponent({
return result
})
const ipfsAddress = computed(() => {
if (decodedValue.value.startsWith("ipfs://") && decodedValue.value.length > 7) {
return `https://ipfs.io/ipfs/${decodedValue.value.substring(7)}`
}
return null
})
const initialLoading = inject(initialLoadingKey, ref(false))
return {
Expand All @@ -130,7 +138,8 @@ export default defineComponent({
isURL,
jsonValue,
decodedValue,
initialLoading
initialLoading,
ipfsAddress
}
}
})
Expand Down
12 changes: 6 additions & 6 deletions src/pages/NftDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
<template #value>
<AccountLink
:account-id="nftInfo?.account_id"
:show-none="true"
:show-none="false"
/>
</template>
</Property>
<Property id="createdTimestamp">
<template #name>Created Timestamp</template>
<template #value>
<TimestampValue
:show-none="true"
:show-none="false"
:timestamp="nftInfo?.created_timestamp"
/>
</template>
Expand All @@ -75,7 +75,7 @@
<template #value>
<AccountLink
:account-id="nftInfo?.delegating_spender"
:show-none="true"
:show-none="false"
/>
</template>
</Property>
Expand All @@ -85,7 +85,7 @@
<BlobValue
:base64="true"
:blob-value="nftInfo?.metadata"
:show-none="true"
:show-none="false"
/>
</template>
</Property>
Expand All @@ -94,7 +94,7 @@
<template #value>
<TimestampValue
:timestamp="nftInfo?.modified_timestamp"
:show-none="true"
:show-none="false"
/>
</template>
</Property>
Expand All @@ -103,7 +103,7 @@
<template #value>
<AccountLink
:account-id="nftInfo?.spender_id"
:show-none="true"
:show-none="false"
/>
</template>
</Property>
Expand Down

0 comments on commit 3f04587

Please sign in to comment.