Skip to content

Commit

Permalink
feat: hide script item from list if its deployment info is not set (#140
Browse files Browse the repository at this point in the history
)

* feat: hide script item from list if its deployment info is not set

* refactor: remove useless ternary
  • Loading branch information
Keith-CY authored Nov 9, 2023
1 parent 984c024 commit 01495d0
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/pages/ScriptList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ const ScriptList: FC = () => {
<div className={styles.container}>
{[...scripts].map(([label, meta]) => {
const script = scriptDataList.find(s => s.tag === label)
if (!script) return null
return (
<details key={label} id={label} open={label === defaultOpenLabel}>
<summary data-deprecated={!!meta.deprecated} title={meta.deprecated ? 'Deprecated' : undefined}>
Expand All @@ -226,22 +227,19 @@ const ScriptList: FC = () => {
</a>
) : null,
)}
{script ? (
<a
href={`/script/${script.codeHashes[0]}/${script.hashType}`}
target="_blank"
rel="noopener noreferrer"
>
{t('script_list.link.detail')}
</a>
) : null}
<a
href={`/script/${script.codeHashes[0]}/${script.hashType}`}
target="_blank"
rel="noopener noreferrer"
>
{t('script_list.link.detail')}
</a>
</div>
{script ? (
<>
<h3>{`${t(`script_list.on_chain_data`)}:`}</h3>
{script.codeHashes.map((codeHash: string, idx: number) => (
<pre key={codeHash}>
{`{
<>
<h3>{`${t(`script_list.on_chain_data`)}:`}</h3>
{script.codeHashes.map((codeHash: string, idx: number) => (
<pre key={codeHash}>
{`{
"code_hash": "${codeHash}",
"hash_type": "${script.hashType}",
"out_point": {
Expand All @@ -250,10 +248,9 @@ const ScriptList: FC = () => {
},
"dep_type": "${script.depType}"
}`}
</pre>
))}
</>
) : null}
</pre>
))}
</>
</div>
</details>
)
Expand Down

0 comments on commit 01495d0

Please sign in to comment.