Skip to content

Commit 75d0894

Browse files
committed
refactor: styles fix and update to keys and string
s
1 parent 57fc2b6 commit 75d0894

File tree

6 files changed

+64
-24
lines changed

6 files changed

+64
-24
lines changed

src/app.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
TIMESTAMP_KEY,
2626
WORDS_TEMP_KEY,
2727
TIMESTAMP_STRING_KEY,
28+
COMPLETE_KEY,
2829
} from './constants/keys';
2930

3031
// Styles
@@ -85,10 +86,6 @@ export class App extends PureComponent {
8586
}
8687
}
8788

88-
handleBitcoinClick = () => this.setState(prevState => ({
89-
isBitcoinAddrOpened: !prevState.isBitcoinAddrOpened,
90-
}));
91-
9289
handleQRCode = () => this.setState(prevState => ({
9390
isQRCodeOpened: !prevState.isQRCodeOpened
9491
}))
@@ -140,10 +137,13 @@ export class App extends PureComponent {
140137

141138
const invoiceDetails = Object.keys(decodedInvoice)
142139
.map((key) => {
140+
console.log(key);
143141
switch (key) {
144-
case WORDS_TEMP_KEY:
145-
case TIMESTAMP_KEY:
142+
case COMPLETE_KEY:
146143
return null;
144+
// case WORDS_TEMP_KEY:
145+
// case TIMESTAMP_KEY:
146+
// return null;
147147
case TAGS_KEY:
148148
return this.renderInvoiceInnerItem(key);
149149
case TIMESTAMP_STRING_KEY:
@@ -173,7 +173,7 @@ export class App extends PureComponent {
173173
) ? renderNestedTag(tag) : renderNormalTag(tag);
174174

175175
const renderNestedTag = (tag) => (
176-
<div className='invoice__item invoice__item--nested'>
176+
<div key={tag.data.key} className='invoice__item invoice__item--nested'>
177177
<div className='invoice__item-title'>
178178
{formatDetailsKey(tag.tagName)}
179179
</div>
@@ -187,7 +187,7 @@ export class App extends PureComponent {
187187
{formatDetailsKey(key)}
188188
</div>
189189
<div className='invoice__nested-value'>
190-
{`${tag.data[key]}`}
190+
{`${tag.data[key] || '--'}`}
191191
</div>
192192
</div>
193193
))}
@@ -196,12 +196,12 @@ export class App extends PureComponent {
196196
);
197197

198198
const renderNormalTag = (tag) => (
199-
<div className='invoice__item'>
199+
<div key={tag.data.key} className='invoice__item'>
200200
<div className='invoice__item-title'>
201201
{formatDetailsKey(tag.tagName)}
202202
</div>
203203
<div className='invoice__item-value'>
204-
{`${tag.data}`}
204+
{`${tag.data || '--'}`}
205205
</div>
206206
</div>
207207
)
@@ -211,6 +211,7 @@ export class App extends PureComponent {
211211

212212
renderInvoiceItem = (key, valuePropFormat) => {
213213
const { decodedInvoice } = this.state;
214+
console.log({decodedInvoice})
214215

215216
let value = `${decodedInvoice[key]}`;
216217
if (

src/assets/styles/modules/app.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
$container-width: 700px;
22

33
// App Layout
4+
body {
5+
background: $app-background;
6+
}
7+
48
.app {
59
background: $app-background;
610
display: flex;
@@ -32,9 +36,7 @@ $container-width: 700px;
3236
@include larger-than(mobile) {
3337
width: 100%;
3438
max-width: $container-width;
35-
margin-bottom: 2 * $base-spacing;
3639
flex-direction: row;
37-
margin-left: 4 * $base-spacing;
3840
}
3941
}
4042

src/assets/styles/modules/error.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
color: $text-primary;
1616
font-size: $font-extra-small-size;
1717
font-weight: $font-weight-bold;
18-
overflow-x: scroll;
1918

2019
@include larger-than(mobile) {
2120
font-size: $font-small-size;

src/assets/styles/modules/invoice.scss

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@
55
width: 100%;
66

77
margin: 0 auto;
8-
overflow-x: scroll;
98
padding: ($base-spacing / 2) 0;
109
opacity: 0;
1110
visibility: hidden;
1211
border: $border;
12+
margin-bottom: 20px;
13+
1314
&--opened {
1415
opacity: 1;
1516
visibility: visible;
1617
}
1718

1819
&__item {
19-
padding: ($base-spacing / 2) 25px;
20+
padding: ($base-spacing / 2) 20px;
2021
display: flex;
21-
flex-direction: row;
22+
flex-direction: column;
23+
24+
@include larger-than(mobile) {
25+
flex-direction: row;
26+
}
2227

2328
&--nested {
2429
flex-direction: column;
@@ -29,12 +34,18 @@
2934
color: $text-secondary;
3035
font-weight: $font-weight-bold;
3136
min-width: 200px;
37+
padding-bottom: 5px;
38+
39+
@include larger-than(mobile) {
40+
padding-bottom: 0;
41+
}
3242
}
3343

3444
&__item-value {
3545
font-weight: $font-weight-bold;
3646
color: $text-primary;
3747
width: 100%;
48+
word-break: break-all;
3849

3950
&--nested {
4051
padding: ($base-spacing / 2) 0;

src/constants/keys.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const PAYMENT_REQUEST_KEY = 'paymentRequest';
66
export const PREFIX_KEY = 'prefix';
77
export const RECOVERY_FLAG_KEY = 'recoveryFlag';
88
export const SATOSHIS_KEY = 'satoshis';
9+
export const MILLISATOSHIS_KEY = 'millisatoshis';
910
export const SIGNATURE_KEY = 'signature';
1011
export const TIMESTAMP_KEY = 'timestamp';
1112
export const TIMESTAMP_STRING_KEY = 'timestampString';
@@ -18,4 +19,12 @@ export const CODE_KEY = 'code';
1819
export const ADDRESS_KEY = 'address';
1920
export const ADDRESS_HASH_KEY = 'addressHash';
2021
export const DESCRIPTION_KEY = 'description';
21-
export const EXPIRY_HTLC = 'min_final_cltv_expiry';
22+
export const EXPIRE_TIME = 'expire_time';
23+
export const EXPIRY_HTLC = 'expiry_htlc';
24+
export const MIN_FINAL_CLTV_EXPIRY = 'min_final_cltv_expiry';
25+
export const TIME_EXPIRE_DATE_STRING = 'timeExpireDateString';
26+
export const TIME_EXPIRE_DATE = 'timeExpireDate';
27+
export const timeExpireDate = 'min_final_cltv_expiry';
28+
// export const EXPIRY_HTLC = 'min_final_cltv_expiry';
29+
// export const EXPIRY_HTLC = 'min_final_cltv_expiry';
30+
// export const EXPIRY_HTLC = 'min_final_cltv_expiry';

src/utils/keys.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Key Formatting Utilities
22
import {
33
COIN_TYPE_KEY,
4-
COMPLETE_KEY,
54
PAYEE_NODE_KEY,
65
PAYMENT_REQUEST_KEY,
76
PREFIX_KEY,
87
TIMESTAMP_STRING_KEY,
8+
TIMESTAMP_KEY,
99
SATOSHIS_KEY,
1010
SIGNATURE_KEY,
1111
RECOVERY_FLAG_KEY,
@@ -14,31 +14,41 @@ import {
1414
FALLBACK_ADDRESS_KEY,
1515
ADDRESS_HASH_KEY,
1616
ADDRESS_KEY,
17+
MILLISATOSHIS_KEY,
1718
CODE_KEY,
1819
DESCRIPTION_KEY,
1920
EXPIRY_HTLC,
21+
TIME_EXPIRE_DATE,
22+
WORDS_TEMP_KEY,
23+
EXPIRE_TIME,
24+
TIME_EXPIRE_DATE_STRING,
25+
MIN_FINAL_CLTV_EXPIRY,
2026
} from '../constants/keys';
2127

2228
export const formatDetailsKey = (key: string) => {
2329
switch (key) {
2430
case COIN_TYPE_KEY:
2531
return 'Chain';
26-
case COMPLETE_KEY:
27-
return 'Tx Complete?';
2832
case PAYEE_NODE_KEY:
2933
return 'Payee Pub Key';
34+
case EXPIRE_TIME:
35+
return 'Expire Time';
3036
case PAYMENT_REQUEST_KEY:
31-
return 'Payment Request';
37+
return 'Invoice';
3238
case PREFIX_KEY:
3339
return 'Prefix';
3440
case RECOVERY_FLAG_KEY:
3541
return 'Recovery Flag';
3642
case SATOSHIS_KEY:
37-
return 'Payment Amount';
43+
return 'Amount (Satoshis)';
44+
case MILLISATOSHIS_KEY:
45+
return 'Amount (Millisatoshis)';
3846
case SIGNATURE_KEY:
39-
return 'Tx Signature';
47+
return 'Transaction Signature';
4048
case TIMESTAMP_STRING_KEY:
41-
return 'Timestamp';
49+
return 'Timestamp String';
50+
case WORDS_TEMP_KEY:
51+
return 'Words Temp';
4252
case COMMIT_HASH_KEY:
4353
return 'Commit Hash';
4454
case PAYMENT_HASH_KEY:
@@ -55,6 +65,14 @@ export const formatDetailsKey = (key: string) => {
5565
return 'Description';
5666
case EXPIRY_HTLC:
5767
return 'Expiry CLTV';
68+
case TIME_EXPIRE_DATE_STRING:
69+
return 'Time Expire Date String';
70+
case TIME_EXPIRE_DATE:
71+
return 'Time Expire Date';
72+
case TIMESTAMP_KEY:
73+
return 'Timestamp';
74+
case MIN_FINAL_CLTV_EXPIRY:
75+
return 'Minimum Final CLTV Expiry';
5876
default:
5977
break;
6078
}

0 commit comments

Comments
 (0)