Skip to content

Commit

Permalink
fix: settings page file size preview (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc authored Aug 15, 2022
1 parent 233c53f commit 91a3053
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions react/src/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,23 +167,32 @@ export function EditableField(props) {
/> {isCurrency ? 'atto' : 'bytes'}
<div className="button" onClick={save}>Save</div>
<div className="button cancel" onClick={cancel}>Cancel</div>
{ BigInt(currentVal) > oneNanoFil ? (
<span className="human">({humanFIL(BigInt(currentVal))})</span>
) : null }
<PreviewAmt currentVal={currentVal} isCurrency={isCurrency} />
</td>
) : (
<td className="val" onClick={() => setEditing(true)}>
{displayVal}
<span className="edit" />
{ BigInt(currentVal) > oneNanoFil ? (
<span className="human">({humanFIL(BigInt(currentVal))})</span>
) : null }
{ isCurrency ? <PreviewAmt currentVal={currentVal} isCurrency={isCurrency} /> : null }
</td>
)}
</tr>
)
}

function PreviewAmt({currentVal, isCurrency}) {
if (isCurrency) {
if (BigInt(currentVal) > oneNanoFil) {
return <span className="human">({humanFIL(BigInt(currentVal))})</span>
}
} else {
if (BigInt(currentVal) > BigInt(1024)) {
return <span className="human">({humanFileSize(BigInt(currentVal))})</span>
}
}
return null
}

export function SettingsMenuItem(props) {
return (
<Link key="settings" className="menu-item" to="/settings">
Expand Down

0 comments on commit 91a3053

Please sign in to comment.