Skip to content

Commit

Permalink
fix: name details page
Browse files Browse the repository at this point in the history
  • Loading branch information
thepiwo committed Nov 16, 2022
1 parent 1c5b0e3 commit c433090
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/components/mobile/DetailsNamePointers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
v-if="value"
class="details-name-pointers"
>
<template v-for="(pointer, idx) in value">
<template v-for="([key, id], idx) in Object.entries(value)">
<DetailsAddress
v-if="pointer.key === 'account_pubkey'"
v-if="key === 'accountPubkey'"
:key="idx"
:name="$tc('modal.confirm-transaction-sign.pointer', idx + 1)"
:address="pointer.id"
:address="id"
/>
<template v-else>
<DetailsField
:key="`${idx}-key`"
:name="$tc('modal.confirm-transaction-sign.pointer-key', idx + 1)"
:value="pointer.key"
:value="key"
/>
<DetailsRawData
:key="`${idx}-id`"
:name="$tc('modal.confirm-transaction-sign.pointer-id', idx + 1)"
:data="pointer.id"
:data="id"
/>
</template>
</template>
Expand Down
8 changes: 6 additions & 2 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@ export class DOMRect {
get bottom() { return this.top + this.height; }
}

export const getAddressByNameEntry = (nameEntry) => ((nameEntry.pointers
&& nameEntry.pointers.find(({ key }) => key === 'account_pubkey')) || {}).id;
export const getAddressByNameEntry = (nameEntry) => {
const pointer = nameEntry.info && nameEntry.info.pointers
&& Object.entries(nameEntry.info.pointers).find(([key]) => key === 'accountPubkey');

return pointer && pointer.length === 2 ? pointer[1] : null;
};
4 changes: 4 additions & 0 deletions src/pages/aens/NameDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export default {
const entry = owned && owned.names.find(({ name }) => name === this.name);
return {
...entry,
pointers: entry.info.pointers,
nameHash: entry.hash,
expiresAt: entry.info.expireHeight,
createdAtHeight: entry.info.activeFrom,
owner: entry.accountId ?? entry.info.ownership.current,
};
},
Expand Down

0 comments on commit c433090

Please sign in to comment.