Skip to content

Commit

Permalink
[explorer] Update content (MystenLabs#1799)
Browse files Browse the repository at this point in the history
  • Loading branch information
666lcz authored May 5, 2022
1 parent 48f7a69 commit d693d4f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
29 changes: 21 additions & 8 deletions explorer/client/src/pages/object-result/ObjectLoaded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ function ObjectLoaded({ data }: { data: DataType }) {
.filter(([key, _]) => !/name/i.test(key))
.filter(([_, value]) => checkIsPropertyType(value));

const descriptionTitle =
data.objType === 'Move Package' ? 'Package Description' : 'Description';

const detailsTitle =
data.objType === 'Move Package'
? 'Disassembled Bytecode'
: 'Properties';

return (
<>
<div className={styles.resultbox}>
Expand All @@ -206,7 +214,7 @@ function ObjectLoaded({ data }: { data: DataType }) {
className={styles.clickableheader}
onClick={clickSetShowDescription}
>
Description {showDescription ? '' : '+'}
{descriptionTitle} {showDescription ? '' : '+'}
</h2>
{showDescription && (
<div
Expand Down Expand Up @@ -322,7 +330,7 @@ function ObjectLoaded({ data }: { data: DataType }) {
className={styles.clickableheader}
onClick={clickSetShowProperties}
>
Properties {showProperties ? '' : '+'}
{detailsTitle} {showProperties ? '' : '+'}
</h2>
{showProperties && (
<div className={styles.propertybox}>
Expand All @@ -336,12 +344,17 @@ function ObjectLoaded({ data }: { data: DataType }) {
)}
</>
)}
<h2
className={styles.clickableheader}
onClick={clickSetShowConnectedEntities}
>
Owned Objects {showConnectedEntities ? '' : '+'}
</h2>
{}
{data.objType !== 'Move Package' ? (
<h2
className={styles.clickableheader}
onClick={clickSetShowConnectedEntities}
>
Child Objects {showConnectedEntities ? '' : '+'}
</h2>
) : (
<></>
)}
{showConnectedEntities && <OwnedObjects id={data.id} />}
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions explorer/client/src/pages/object-result/ObjectResultType.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { getMovePackageContent, getObjectContent, getObjectType } from 'sui.js';
import { getMovePackageContent, getObjectContent } from 'sui.js';

import { type AddressOwner } from '../../utils/api/DefaultRpcClient';
import { parseObjectType } from '../../utils/objectUtils';

import type {
GetObjectInfoResponse,
Expand Down Expand Up @@ -55,7 +56,7 @@ export function translate(o: GetObjectInfoResponse): DataType {
return {
id: objectId,
version: version.toString(),
objType: getObjectType(o)!,
objType: parseObjectType(details as ObjectExistsInfo)!,
owner: parseOwner(owner),
data: {
contents:
Expand Down

0 comments on commit d693d4f

Please sign in to comment.