Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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