Skip to content

Commit

Permalink
Use && conditional syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
willclarktech committed Jun 8, 2021
1 parent 1566f8a commit f5dbc76
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/App/components/ChannelCounterpartyData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export function CounterpartyData({ counterparty }: CounterpartyDataProps): JSX.E
return (
<div className="flex flex-col m-2 ml-0">
<span className={style.subtitle}>Counterparty</span>
{counterparty?.portId ? <span>Port ID: {counterparty.portId}</span> : null}
{counterparty?.channelId ? <span>Channel ID: {counterparty.channelId}</span> : null}
{counterparty?.portId && <span>Port ID: {counterparty.portId}</span>}
{counterparty?.channelId && <span>Channel ID: {counterparty.channelId}</span>}
</div>
);
}
4 changes: 2 additions & 2 deletions src/App/components/ConnectionCounterpartyData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export function CounterpartyData({ counterparty }: CounterpartyDataProps): JSX.E
return (
<div className="flex flex-col m-2 ml-0">
<span className={style.subtitle}>Counterparty</span>
{counterparty?.clientId ? <span>Client ID: {counterparty.clientId}</span> : null}
{counterparty?.connectionId ? <span>Connection ID: {counterparty.connectionId}</span> : null}
{counterparty?.clientId && <span>Client ID: {counterparty.clientId}</span>}
{counterparty?.connectionId && <span>Connection ID: {counterparty.connectionId}</span>}
{counterparty?.prefix?.keyPrefix?.length ? (
<span>Prefix: {toHex(counterparty?.prefix?.keyPrefix)}</span>
) : null}
Expand Down
6 changes: 3 additions & 3 deletions src/App/routes/Acknowledgement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export function Acknowledgement(): JSX.Element {
<div className="container mx-auto flex flex-col">
<Navigation />
<span className={style.title}>Data</span>
{portId ? <span>Port ID: {portId}</span> : null}
{channelId ? <span>Channel ID: {channelId}</span> : null}
{sequence ? <span>Sequence: {sequence}</span> : null}
{portId && <span>Port ID: {portId}</span>}
{channelId && <span>Channel ID: {channelId}</span>}
{sequence && <span>Sequence: {sequence}</span>}
{ackResponse?.acknowledgement ? (
<div className="flex flex-col">
<span>Proof: {ackResponse.proof?.length ? toHex(ackResponse.proof) : "–"}</span>
Expand Down
4 changes: 2 additions & 2 deletions src/App/routes/Channel/ChannelData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export function ChannelData({ portId, channelId }: ChannelDataProps): JSX.Elemen
return channelResponse?.channel ? (
<div>
<div className={style.title}>Data</div>
{portId ? <div>Port ID: {portId}</div> : null}
{channelId ? <div>Channel ID: {channelId}</div> : null}
{portId && <div>Port ID: {portId}</div>}
{channelId && <div>Channel ID: {channelId}</div>}
<div>Proof: {channelResponse.proof?.length ? toHex(channelResponse.proof) : "–"}</div>
<HeightData height={channelResponse.proofHeight} />
<div className="flex flex-col">
Expand Down
6 changes: 3 additions & 3 deletions src/App/routes/Commitment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export function Commitment(): JSX.Element {
<div className="container mx-auto flex flex-col">
<Navigation />
<span className={style.title}>Data</span>
{portId ? <span>Port ID: {portId}</span> : null}
{channelId ? <span>Channel ID: {channelId}</span> : null}
{sequence ? <span>Sequence: {sequence}</span> : null}
{portId && <span>Port ID: {portId}</span>}
{channelId && <span>Channel ID: {channelId}</span>}
{sequence && <span>Sequence: {sequence}</span>}
{commitmentResponse?.commitment ? (
<div className="flex flex-col">
<span>Proof: {commitmentResponse.proof?.length ? toHex(commitmentResponse.proof) : "–"}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/App/routes/Connection/ConnectionData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function ConnectionData({ connectionId }: ConnectionDataProps): JSX.Eleme
return connectionResponse?.connection ? (
<div>
<div className={style.title}>Data</div>
{connectionId ? <div>Connection ID: {connectionId}</div> : null}
{connectionId && <div>Connection ID: {connectionId}</div>}
<div>Proof: {connectionResponse.proof?.length ? toHex(connectionResponse.proof) : "–"}</div>
<HeightData height={connectionResponse.proofHeight} />
<div className="flex flex-col">
Expand Down

0 comments on commit f5dbc76

Please sign in to comment.