on master help sign in
Revert "formatting: restore components/ to their former glory"

This reverts commit 8767696a3ce15c6578e900fdbed60c3863a03374.

commit24f5628447f4dce0e17d5d67bf60c540bf8588c0 authorMatt Condon (shrugs) <mattgcondon@gmail.com> dateTue 11 Jun 2019, 13:41 (7 years ago) parent29279e4
8 files changed+41−43
.prettierignore−1 src/bridge/components/DropdownItem.js+1−3 src/bridge/components/Header.js+29−26 src/bridge/components/HorizontalSelector.js+1−3 src/bridge/components/OldHeader.js+2−2 src/bridge/components/RenderedPoint.js+1−1 src/bridge/components/StatelessTransaction.js+6−4 src/bridge/components/icons/Chevron.js+1−3
.prettierignore−1
@@ -1,2 +1 @@
11nockjs/
2−components/
src/bridge/components/DropdownItem.js+1−3
@@ -10,9 +10,7 @@ const DropdownItem = props => {
1010 <button
1111 disabled={props.disabled}
1212 style={props.style}
13− className={`h-10 m-0 p-0 ph-2 bg-white flex align-center items-start bs-solid brw-2 blw-2 btw-0 bbw-0 sans ${_disabled} ${
14− props.className
15− }`}
13+ className={`h-10 m-0 p-0 ph-2 bg-white flex align-center items-start bs-solid brw-2 blw-2 btw-0 bbw-0 sans ${_disabled} ${props.className}`}
1614 onClick={props.onClick}>
1715 {props.children}
1816 </button>
src/bridge/components/Header.js+29−26
@@ -1,24 +1,25 @@
11import React from 'react';
22import { Button, Chevron } from '../components/Base';
33
4−import { renderRoute } from '../lib/router';
4+import { getRouteBreadcrumb } from '../lib/router';
5+import { ROUTE_NAMES } from '../lib/routeNames';
6+import { useHistory } from '../store/history';
57import { isLast } from '../lib/lib';
68
7−const Crumbs = props => {
8− const { routeCrumbs, skipRoute } = props;
9− const history = routeCrumbs.reverse();
9+function Crumbs(props) {
10+ const history = useHistory();
1011
1112 // FIXME probably more straightforward to render them normally and just
1213 // return the reversed array of renders
13− const rendered = history.map((route, idx) => {
14+ const rendered = history.routes.map((route, idx) => {
1415 return (
1516 <div className={'flex items-center'} key={`history-${idx}`}>
1617 <Button
1718 prop-type={'link'}
1819 prop-size={'sm'}
1920 key={`history-button-${idx}`}
20− onClick={() => skipRoute(history.size - idx - 1)}>
21− {renderRoute(props, route)}
21+ onClick={() => history.pop(history.size - idx - 1)}>
22+ {getRouteBreadcrumb(props, route)}
2223 </Button>
2324
2425 {isLast(history.size, idx) ? (
@@ -31,28 +32,30 @@ const Crumbs = props => {
3132 });
3233
3334 return rendered;
34−};
35−
36−const Header = props => {
37− const crumbs = (
38− <div className={'flex items-center h-10'}>
39− <Crumbs
40− routeCrumbs={props.routeCrumbs}
41− skipRoute={props.skipRoute}
42− networkType={props.networkType}
43− wallet={props.wallet}
44− pointCursor={props.pointCursor}
45− />
46− </div>
47− );
35+}
36+
37+function Header(props) {
38+ const history = useHistory();
39+
40+ const showCrumbs = !history.includes(ROUTE_NAMES.INVITE_TICKET);
41+
42+ if (showCrumbs) {
43+ return (
44+ <div className={'flex items-center h-10'}>
45+ <Crumbs
46+ networkType={props.networkType}
47+ wallet={props.wallet}
48+ pointCursor={props.pointCursor}
49+ />
50+ </div>
51+ );
52+ }
4853
49− const noCrumbs = (
50− <h2 className="mt-9 clickable" onClick={() => props.skipRoute(1)}>
54+ return (
55+ <h2 className="mt-9 clickable" onClick={() => history.pop()}>
5156 Bridge
5257 </h2>
5358 );
54−
55− return props.showCrumbs ? crumbs : noCrumbs;
56−};
59+}
5760
5861export default Header;
src/bridge/components/HorizontalSelector.js+1−3
@@ -22,9 +22,7 @@ class HorizontalSelector extends React.Component {
2222 let active = opt.value === this.state.option ? 'btn-primary active' : '';
2323 return (
2424 <button
25− className={`btn ${active} h-10 ph-4 flex sans ${
26− this.props.className
27− }`}
25+ className={`btn ${active} h-10 ph-4 flex sans ${this.props.className}`}
2826 value={opt.value}
2927 onClick={() => this.selectOption(opt.value)}>
3028 {opt.title}
src/bridge/components/OldHeader.js+2−2
@@ -1,7 +1,7 @@
11import React from 'react';
22import { Button, Chevron } from '../components/Base';
33
4−import { renderRoute } from '../lib/router';
4+import { getRouteBreadcrumb } from '../lib/router';
55import { isLast } from '../lib/lib';
66
77const Crumbs = props => {
@@ -19,7 +19,7 @@ const Crumbs = props => {
1919 color={'black'}
2020 key={`history-button-${idx}`}
2121 onClick={() => skipRoute(history.size - idx - 1)}>
22− {`${renderRoute(props, route)}`}
22+ {`${getRouteBreadcrumb(props, route)}`}
2323 </Button>
2424
2525 {isLast(history.size, idx) ? (
src/bridge/components/RenderedPoint.js+1−1
@@ -5,7 +5,7 @@ import { Button } from './Base';
55import { pour } from 'sigil-js';
66import * as ob from 'urbit-ob';
77
8−import { ROUTE_NAMES } from '../lib/router';
8+import { ROUTE_NAMES } from '../lib/routeNames';
99import ReactSVGComponents from './ReactSVGComponents';
1010
1111const RenderedPoint = props => {
src/bridge/components/StatelessTransaction.js+6−4
@@ -9,7 +9,8 @@ import { CheckboxButton, Input, InnerLabel, InnerLabelDropdown } from './Base';
99import { Warning } from '../components/Base';
1010
1111import { BRIDGE_ERROR } from '../lib/error';
12−import { ROUTE_NAMES } from '../lib/router';
12+import { ROUTE_NAMES } from '../lib/routeNames';
13+import { withHistory } from '../store/history';
1314import * as tank from '../lib/tank';
1415
1516import {
@@ -20,6 +21,7 @@ import {
2021 renderSignedTx,
2122 signTransaction,
2223} from '../lib/txn';
24+import { withTxnConfirmations } from '../store/txnConfirmations';
2325
2426const SUBMISSION_STATES = {
2527 PROMPT: 'Send transaction',
@@ -234,14 +236,14 @@ class StatelessTransaction extends React.Component {
234236 )
235237 .then(txHash => {
236238 props.onSent(Just(Ok(txHash)), state.stx.value);
237− props.popRoute();
238239
239240 let routeData = {};
240241 if (props.networkSeed) {
241242 props.setNetworkSeedCache(props.networkSeed);
242243 routeData.promptKeyfile = true;
243244 }
244− props.pushRoute(ROUTE_NAMES.SENT_TRANSACTION, routeData);
245+
246+ props.history.popAndPush(ROUTE_NAMES.SENT_TRANSACTION, routeData);
245247 })
246248 .catch(err => {
247249 this.setState({
@@ -577,4 +579,4 @@ class StatelessTransaction extends React.Component {
577579 }
578580}
579581
580−export default StatelessTransaction;
582+export default withTxnConfirmations(withHistory(StatelessTransaction));
src/bridge/components/icons/Chevron.js+1−3
@@ -4,9 +4,7 @@ import PropTypes from 'prop-types';
44const Chevron = props => {
55 return (
66 <img
7− src={`data:image/svg+xml;utf8,<svg width="11" height="24" viewBox="0 0 11 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 12L10.387 12.3166L10.646 12L10.387 11.6833L10 12ZM0.613022 1.31662L9.61302 12.3166L10.387 11.6833L1.38698 0.68338L0.613022 1.31662ZM9.61302 11.6833L0.613021 22.6834L1.38698 23.3166L10.387 12.3166L9.61302 11.6833Z" stroke="${
8− props.color
9− }" stroke-width="${props.strokeWidth}" fill="${props.color}"/></svg>`}
7+ src={`data:image/svg+xml;utf8,<svg width="11" height="24" viewBox="0 0 11 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 12L10.387 12.3166L10.646 12L10.387 11.6833L10 12ZM0.613022 1.31662L9.61302 12.3166L10.387 11.6833L1.38698 0.68338L0.613022 1.31662ZM9.61302 11.6833L0.613021 22.6834L1.38698 23.3166L10.387 12.3166L9.61302 11.6833Z" stroke="${props.color}" stroke-width="${props.strokeWidth}" fill="${props.color}"/></svg>`}
108 alt=""
119 style={props.style}
1210 className={props.className}