Skip to content

Commit 753ae8d

Browse files
authored
chore: improve inputs and outputs lists (#388)
1 parent 725da8c commit 753ae8d

File tree

4 files changed

+63
-58
lines changed

4 files changed

+63
-58
lines changed
327 KB
Binary file not shown.

src/components/DropDetails.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ export const DropDetails = ({ title, startOpen, onToggle, children }) => {
2929

3030
return (
3131
<div className={`container-drop-div ${open ? 'container-drop-div-open' : ''}`}>
32-
<div className="container-drop-header">
32+
<div className="container-drop-header" onClick={click}>
3333
<div className="container-drop-header-title">{title}</div>
34-
<div onClick={click}>
34+
<div>
3535
<RowDown
36-
className="drop-arrow-color"
3736
width="24px"
3837
height="24px"
3938
style={{ transform: `${!open ? 'rotate(180deg)' : ''}` }}

src/components/tx/TxData.js

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -320,22 +320,17 @@ class TxData extends React.Component {
320320
};
321321

322322
const renderInputs = inputs => {
323-
return inputs.map(input => {
324-
return (
325-
<div key={`${input.tx_id}${input.index}`}>
326-
<Link to={`/transaction/${input.tx_id}`}>{helpers.getShortHash(input.tx_id)}</Link> (
327-
{input.index}){renderInputOrOutput(input, 0, false)}
328-
</div>
329-
);
330-
});
323+
const obj = inputs.map(input => (
324+
<div key={`${input.tx_id}${input.index}`}>
325+
<Link to={`/transaction/${input.tx_id}`}>{helpers.getShortHash(input.tx_id)}</Link> (
326+
{input.index}){renderInputOrOutput(input, 0, false)}
327+
</div>
328+
));
329+
return renderListWithSpacer(obj);
331330
};
332331

333332
const renderOutputToken = output => {
334-
return (
335-
<strong>
336-
{this.getOutputToken(hathorLib.tokensUtils.getTokenIndexFromData(output.token_data))}
337-
</strong>
338-
);
333+
return this.getOutputToken(hathorLib.tokensUtils.getTokenIndexFromData(output.token_data));
339334
};
340335

341336
const outputValue = output => {
@@ -367,7 +362,7 @@ class TxData extends React.Component {
367362
const renderOutputLink = idx => {
368363
if (idx in this.props.spentOutputs) {
369364
return (
370-
<span>
365+
<span className="fw-bold">
371366
{' '}
372367
(<Link to={`/transaction/${this.props.spentOutputs[idx]}`}>Spent</Link>)
373368
</span>
@@ -379,11 +374,8 @@ class TxData extends React.Component {
379374
const renderInputOrOutput = (output, idx, isOutput) => {
380375
return (
381376
<div key={idx}>
382-
<div>
383-
<span style={this.props.newUiEnabled ? { fontWeight: '600' } : null}>
384-
{outputValue(output)}
385-
</span>{' '}
386-
{renderOutputToken(output)}
377+
<div className="fw-bold">
378+
<span>{outputValue(output)}</span> {renderOutputToken(output)}
387379
</div>
388380
<div>
389381
{renderDecodedScript(output)}
@@ -394,9 +386,8 @@ class TxData extends React.Component {
394386
};
395387

396388
const renderOutputs = outputs => {
397-
return outputs.map((output, idx) => {
398-
return renderInputOrOutput(output, idx, true);
399-
});
389+
const obj = outputs.map((output, idx) => renderInputOrOutput(output, idx, true));
390+
return renderListWithSpacer(obj);
400391
};
401392

402393
const renderDecodedScript = output => {
@@ -509,14 +500,23 @@ class TxData extends React.Component {
509500
));
510501
};
511502

512-
const renderNewUiDivList = hashes => {
503+
const renderTxListWithSpacer = hashes => {
504+
const obj = hashes.map((h, key) => (
505+
<Link className="fs-14" key={key} to={`/transaction/${h}`}>
506+
{h}
507+
</Link>
508+
));
509+
return renderListWithSpacer(obj);
510+
};
511+
512+
const renderListWithSpacer = children => {
513513
return (
514514
<table className="table-details">
515515
<tbody>
516-
{hashes.map((h, index) => (
517-
<tr className="tr-details" key={h}>
518-
<td className={index === hashes.length - 1 ? 'tr-details-last-cell' : ''}>
519-
<Link to={`/transaction/${h}`}>{h}</Link>
516+
{children.map((child, index) => (
517+
<tr className="tr-details" key={index}>
518+
<td className={index === children.length - 1 ? 'tr-details-last-cell' : ''}>
519+
{child}
520520
</td>
521521
</tr>
522522
))}
@@ -760,7 +760,6 @@ class TxData extends React.Component {
760760
{this.props.transaction.parents && this.props.transaction.parents.length ? (
761761
<a className="arrow-graph" href="true">
762762
<RowDown
763-
className="drop-arrow-color"
764763
width="24px"
765764
height="24px"
766765
style={{
@@ -820,25 +819,22 @@ class TxData extends React.Component {
820819
}
821820
return <Link to={`/token_detail/${token.uid}`}>{token.uid}</Link>;
822821
};
823-
const tokens = this.state.tokens.map(token => {
824-
return (
825-
<div key={token.uid}>
822+
const obj = this.state.tokens.map(token => (
823+
// TODO I don't think we have a TokenMarker here on Figma. Remove?
824+
<div key={token.uid}>
825+
<div>
826826
<TokenMarkers token={token} />
827827
<span>
828-
{token.name} <strong>({token.symbol})</strong> | {renderTokenUID(token)}
828+
{token.name} ({token.symbol})
829829
</span>
830830
</div>
831-
);
832-
});
833-
return this.props.newUiEnabled ? (
834-
<DropDetails title="Tokens">{tokens}</DropDetails>
835-
) : (
836-
<div className="d-flex flex-column align-items-start mb-3 common-div bordered-wrapper">
837-
<div>
838-
<label>Tokens:</label>
839-
</div>
840-
{tokens}
831+
<div>{renderTokenUID(token)}</div>
841832
</div>
833+
));
834+
return (
835+
<DropDetails startOpen title="Tokens">
836+
{renderListWithSpacer(obj)}
837+
</DropDetails>
842838
);
843839
};
844840

@@ -1256,10 +1252,10 @@ class TxData extends React.Component {
12561252
{this.state.tokens.length > 0 && renderTokenList()}
12571253
<div className="tx-drop-container-div">
12581254
<DropDetails title="Parents:">
1259-
{renderNewUiDivList(this.props.transaction.parents)}
1255+
{renderTxListWithSpacer(this.props.transaction.parents)}
12601256
</DropDetails>
12611257
<DropDetails title="Children:">
1262-
{renderNewUiDivList(this.props.meta.children)}
1258+
{renderTxListWithSpacer(this.props.meta.children)}
12631259
</DropDetails>
12641260
</div>
12651261
{this.state.graphs.map((graph, index) => renderNewUiGraph(index))}

src/newUi.scss

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ $secondary-color-dark: #191c21;
9898
font-style: normal;
9999
}
100100

101+
@font-face {
102+
font-family: 'San Francisco Pro';
103+
src: url('./assets/fonts/SFPRODISPLAYBOLD.OTF') format('opentype');
104+
font-weight: bold;
105+
font-style: normal;
106+
}
107+
101108
@font-face {
102109
font-family: 'Mona Sans';
103110
src: url('./assets/fonts/Mona-Sans.woff2') format('woff2');
@@ -1128,17 +1135,19 @@ nav {
11281135
border-bottom: none !important;
11291136
}
11301137

1138+
.fs-14 {
1139+
font-size: 14px !important;
1140+
}
1141+
11311142
.table-details td {
1132-
color: var(--purple-text);
1133-
padding: 20px 10px;
1143+
padding: 20px 0px;
11341144
border-bottom: 1px solid var(--border-color);
11351145
font-family: 'San Francisco Pro', sans-serif;
1136-
font-size: 12px;
1146+
font-size: 16px;
11371147
text-align: left;
11381148
white-space: wrap;
11391149
word-break: break-word;
1140-
font-weight: 500;
1141-
line-height: 20px;
1150+
line-height: 24px;
11421151
letter-spacing: 0.03em;
11431152
}
11441153

@@ -1189,11 +1198,17 @@ nav {
11891198
gap: 16px;
11901199
}
11911200

1201+
.drop-arrow-color {
1202+
color: var(--bold-text-color);
1203+
cursor: pointer;
1204+
}
1205+
11921206
.container-drop-header {
11931207
display: flex;
11941208
flex-flow: row nowrap;
11951209
justify-content: space-between;
11961210
align-items: center;
1211+
cursor: pointer;
11971212
}
11981213

11991214
.container-drop-header-title {
@@ -2343,7 +2358,7 @@ nav {
23432358
flex-direction: row;
23442359
gap: 2px;
23452360
align-items: center;
2346-
font-size: 14px;
2361+
font-size: 16px;
23472362
font-weight: 400;
23482363
line-height: 20px;
23492364
letter-spacing: 0.03em;
@@ -3416,11 +3431,6 @@ th.sortable {
34163431
text-align: center;
34173432
}
34183433

3419-
.drop-arrow-color {
3420-
color: var(--bold-text-color);
3421-
cursor: pointer;
3422-
}
3423-
34243434
.custom-select-options ul li:hover {
34253435
background-color: var(--secondary-color);
34263436
}

0 commit comments

Comments
 (0)