Skip to content

Commit

Permalink
v0.5.1 (#28)
Browse files Browse the repository at this point in the history
v0.5.1
  • Loading branch information
andrerfneves authored Nov 8, 2019
2 parents 6baa2bf + 3665828 commit 6c3bde5
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 28 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lightning-decoder",
"version": "0.5.0",
"version": "0.5.1",
"author": {
"email": "andrerfneves@protonmail.com",
"name": "André Neves",
Expand Down Expand Up @@ -31,7 +31,7 @@
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"now-start": "cd build && serve --single"
"deploy": "yarn build && cd build && now"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
18 changes: 6 additions & 12 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ import {
} from './constants/app';
import {
TAGS_KEY,
TIMESTAMP_KEY,
WORDS_TEMP_KEY,
TIMESTAMP_STRING_KEY,
COMPLETE_KEY,
} from './constants/keys';

// Styles
Expand Down Expand Up @@ -85,10 +84,6 @@ export class App extends PureComponent {
}
}

handleBitcoinClick = () => this.setState(prevState => ({
isBitcoinAddrOpened: !prevState.isBitcoinAddrOpened,
}));

handleQRCode = () => this.setState(prevState => ({
isQRCodeOpened: !prevState.isQRCodeOpened
}))
Expand Down Expand Up @@ -141,8 +136,7 @@ export class App extends PureComponent {
const invoiceDetails = Object.keys(decodedInvoice)
.map((key) => {
switch (key) {
case WORDS_TEMP_KEY:
case TIMESTAMP_KEY:
case COMPLETE_KEY:
return null;
case TAGS_KEY:
return this.renderInvoiceInnerItem(key);
Expand Down Expand Up @@ -173,7 +167,7 @@ export class App extends PureComponent {
) ? renderNestedTag(tag) : renderNormalTag(tag);

const renderNestedTag = (tag) => (
<div className='invoice__item invoice__item--nested'>
<div key={tag.data.key} className='invoice__item invoice__item--nested'>
<div className='invoice__item-title'>
{formatDetailsKey(tag.tagName)}
</div>
Expand All @@ -187,7 +181,7 @@ export class App extends PureComponent {
{formatDetailsKey(key)}
</div>
<div className='invoice__nested-value'>
{`${tag.data[key]}`}
{`${tag.data[key] || '--'}`}
</div>
</div>
))}
Expand All @@ -196,12 +190,12 @@ export class App extends PureComponent {
);

const renderNormalTag = (tag) => (
<div className='invoice__item'>
<div key={tag.data.key} className='invoice__item'>
<div className='invoice__item-title'>
{formatDetailsKey(tag.tagName)}
</div>
<div className='invoice__item-value'>
{`${tag.data}`}
{`${tag.data || '--'}`}
</div>
</div>
)
Expand Down
6 changes: 4 additions & 2 deletions src/assets/styles/modules/app.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
$container-width: 700px;

// App Layout
body {
background: $app-background;
}

.app {
background: $app-background;
display: flex;
Expand Down Expand Up @@ -32,9 +36,7 @@ $container-width: 700px;
@include larger-than(mobile) {
width: 100%;
max-width: $container-width;
margin-bottom: 2 * $base-spacing;
flex-direction: row;
margin-left: 4 * $base-spacing;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/assets/styles/modules/error.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
color: $text-primary;
font-size: $font-extra-small-size;
font-weight: $font-weight-bold;
overflow-x: scroll;

@include larger-than(mobile) {
font-size: $font-small-size;
Expand Down
17 changes: 14 additions & 3 deletions src/assets/styles/modules/invoice.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@
width: 100%;

margin: 0 auto;
overflow-x: scroll;
padding: ($base-spacing / 2) 0;
opacity: 0;
visibility: hidden;
border: $border;
margin-bottom: 20px;

&--opened {
opacity: 1;
visibility: visible;
}

&__item {
padding: ($base-spacing / 2) 25px;
padding: ($base-spacing / 2) 20px;
display: flex;
flex-direction: row;
flex-direction: column;

@include larger-than(mobile) {
flex-direction: row;
}

&--nested {
flex-direction: column;
Expand All @@ -29,12 +34,18 @@
color: $text-secondary;
font-weight: $font-weight-bold;
min-width: 200px;
padding-bottom: 5px;

@include larger-than(mobile) {
padding-bottom: 0;
}
}

&__item-value {
font-weight: $font-weight-bold;
color: $text-primary;
width: 100%;
word-break: break-all;

&--nested {
padding: ($base-spacing / 2) 0;
Expand Down
8 changes: 7 additions & 1 deletion src/constants/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const PAYMENT_REQUEST_KEY = 'paymentRequest';
export const PREFIX_KEY = 'prefix';
export const RECOVERY_FLAG_KEY = 'recoveryFlag';
export const SATOSHIS_KEY = 'satoshis';
export const MILLISATOSHIS_KEY = 'millisatoshis';
export const SIGNATURE_KEY = 'signature';
export const TIMESTAMP_KEY = 'timestamp';
export const TIMESTAMP_STRING_KEY = 'timestampString';
Expand All @@ -18,4 +19,9 @@ export const CODE_KEY = 'code';
export const ADDRESS_KEY = 'address';
export const ADDRESS_HASH_KEY = 'addressHash';
export const DESCRIPTION_KEY = 'description';
export const EXPIRY_HTLC = 'min_final_cltv_expiry';
export const EXPIRE_TIME = 'expire_time';
export const EXPIRY_HTLC = 'expiry_htlc';
export const MIN_FINAL_CLTV_EXPIRY = 'min_final_cltv_expiry';
export const TIME_EXPIRE_DATE_STRING = 'timeExpireDateString';
export const TIME_EXPIRE_DATE = 'timeExpireDate';
export const timeExpireDate = 'min_final_cltv_expiry';
32 changes: 25 additions & 7 deletions src/utils/keys.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Key Formatting Utilities
import {
COIN_TYPE_KEY,
COMPLETE_KEY,
PAYEE_NODE_KEY,
PAYMENT_REQUEST_KEY,
PREFIX_KEY,
TIMESTAMP_STRING_KEY,
TIMESTAMP_KEY,
SATOSHIS_KEY,
SIGNATURE_KEY,
RECOVERY_FLAG_KEY,
Expand All @@ -14,31 +14,41 @@ import {
FALLBACK_ADDRESS_KEY,
ADDRESS_HASH_KEY,
ADDRESS_KEY,
MILLISATOSHIS_KEY,
CODE_KEY,
DESCRIPTION_KEY,
EXPIRY_HTLC,
TIME_EXPIRE_DATE,
WORDS_TEMP_KEY,
EXPIRE_TIME,
TIME_EXPIRE_DATE_STRING,
MIN_FINAL_CLTV_EXPIRY,
} from '../constants/keys';

export const formatDetailsKey = (key: string) => {
switch (key) {
case COIN_TYPE_KEY:
return 'Chain';
case COMPLETE_KEY:
return 'Tx Complete?';
case PAYEE_NODE_KEY:
return 'Payee Pub Key';
case EXPIRE_TIME:
return 'Expire Time';
case PAYMENT_REQUEST_KEY:
return 'Payment Request';
return 'Invoice';
case PREFIX_KEY:
return 'Prefix';
case RECOVERY_FLAG_KEY:
return 'Recovery Flag';
case SATOSHIS_KEY:
return 'Payment Amount';
return 'Amount (Satoshis)';
case MILLISATOSHIS_KEY:
return 'Amount (Millisatoshis)';
case SIGNATURE_KEY:
return 'Tx Signature';
return 'Transaction Signature';
case TIMESTAMP_STRING_KEY:
return 'Timestamp';
return 'Timestamp String';
case WORDS_TEMP_KEY:
return 'Words Temp';
case COMMIT_HASH_KEY:
return 'Commit Hash';
case PAYMENT_HASH_KEY:
Expand All @@ -55,6 +65,14 @@ export const formatDetailsKey = (key: string) => {
return 'Description';
case EXPIRY_HTLC:
return 'Expiry CLTV';
case TIME_EXPIRE_DATE_STRING:
return 'Time Expire Date String';
case TIME_EXPIRE_DATE:
return 'Time Expire Date';
case TIMESTAMP_KEY:
return 'Timestamp';
case MIN_FINAL_CLTV_EXPIRY:
return 'Minimum Final CLTV Expiry';
default:
break;
}
Expand Down

0 comments on commit 6c3bde5

Please sign in to comment.