From b855c547fba01106a4a8c3699fd451bdfcadcf8d Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 10 Dec 2017 18:25:44 +0100 Subject: make tables scrollable when they would overflow, make long keys expandable --- src/webex/renderHtml.tsx | 60 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 4 deletions(-) (limited to 'src/webex/renderHtml.tsx') diff --git a/src/webex/renderHtml.tsx b/src/webex/renderHtml.tsx index d4c536fa9..d225cef0c 100644 --- a/src/webex/renderHtml.tsx +++ b/src/webex/renderHtml.tsx @@ -31,6 +31,8 @@ import { ReserveCreationInfo, } from "../types"; +import { ImplicitStateComponent } from "./components"; + import * as moment from "moment"; import * as i18n from "../i18n"; @@ -131,7 +133,7 @@ function AuditorDetailsView(props: {rci: ReserveCreationInfo|null}): JSX.Element {rci.exchangeInfo.auditors.map((a) => (

Auditor {a.auditor_url}

-

Public key: {a.auditor_pub}

+

Public key:

Trusted: {rci.trustedAuditorPubs.indexOf(a.auditor_pub) >= 0 ? "yes" : "no"}

Audits {a.denomination_keys.length} of {rci.numOfferedDenoms} denominations

@@ -206,10 +208,12 @@ function FeeDetailsView(props: {rci: ReserveCreationInfo|null}): JSX.Element { return (

Overview

+

Public key:

{i18n.str`Withdrawal fees:`} {withdrawFee}

{i18n.str`Rounding loss:`} {overhead}

{i18n.str`Earliest expiration (for deposit): ${moment.unix(rci.earliestDepositExpiration).fromNow()}`}

Coin Fees

+
@@ -224,10 +228,13 @@ function FeeDetailsView(props: {rci: ReserveCreationInfo|null}): JSX.Element { {uniq.map(row)}
+

Wire Fees

- - {Object.keys(rci.wireFees.feesForType).map(wireFee)} -
+
+ + {Object.keys(rci.wireFees.feesForType).map(wireFee)} +
+
); } @@ -246,3 +253,48 @@ export function WithdrawDetailView(props: {rci: ReserveCreationInfo | null}): JS ); } + + +interface ExpanderTextProps { + text: string; +} + +export class ExpanderText extends ImplicitStateComponent { + private expanded = this.makeState(false); + private textArea: any = undefined; + + componentDidUpdate() { + if (this.expanded() && this.textArea) { + this.textArea.focus(); + this.textArea.scrollTop = 0; + } + } + + render(): JSX.Element { + if (!this.expanded()) { + return ( + { this.expanded(true); }}> + {(this.props.text.length <= 10) + ? this.props.text + : ( + + {this.props.text.substring(0, 10)} + ... + + ) + } + + ); + } + return ( + + ); + } +} + -- cgit v1.2.3