diff --git a/gatsby-config.js b/gatsby-config.js index 35700a3..414c689 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -6,5 +6,5 @@ module.exports = { /* Your site config here */ - plugins: ["fullstack-gatsby-theme-bch-wallet"] + plugins: ['fullstack-gatsby-theme-bch-wallet'] } diff --git a/src/explorer/details.js b/src/explorer/details.js index 9fbfb64..d8a1325 100644 --- a/src/explorer/details.js +++ b/src/explorer/details.js @@ -1,51 +1,51 @@ -import React from "react" -import PropTypes from "prop-types" -import { Row, Col, Box, Button } from "adminlte-2-react" -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" -import JSONPretty from "react-json-pretty" +import React from 'react' +import PropTypes from 'prop-types' +import { Row, Col, Box, Button } from 'adminlte-2-react' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import JSONPretty from 'react-json-pretty' -const HASH_EXPLORER = "https://p2wdb.fullstack.cash/entry/hash/" // PSF p2wdb hash explorer -const TX_EXPLORER = "https://simpleledger.info/tx/" // BCH Transaction Explorer +const HASH_EXPLORER = 'https://p2wdb.fullstack.cash/entry/hash/' // PSF p2wdb hash explorer +const TX_EXPLORER = 'https://simpleledger.info/tx/' // BCH Transaction Explorer let _this class Details extends React.Component { - constructor(props) { + constructor (props) { super(props) _this = this this.state = { entry: {}, - entryData: {}, + entryData: {} } } - render() { + render () { const { entry, entryData } = _this.state return ( <> - - + + -

+

Details

{entry._id && ( - +

IS VALID: {entry.isValid}

APP ID: - {entry.appId || "none"} + {entry.appId || 'none'}

CREATE AT: @@ -59,8 +59,8 @@ class Details extends React.Component { HASH: {entry.hash} @@ -69,8 +69,8 @@ class Details extends React.Component { TRANSACTION ID : {entry.key} @@ -95,7 +95,7 @@ class Details extends React.Component { <> - Data : @@ -107,11 +107,11 @@ class Details extends React.Component { )} -

+
@@ -124,34 +124,34 @@ class Details extends React.Component { ) } - componentDidMount() { + componentDidMount () { _this.handleData() } - componentDidUpdate() { + componentDidUpdate () { if (_this.props.entry._id !== _this.state.entry._id) { _this.handleData() } } - handleData() { + handleData () { try { const { entry } = _this.props _this.setState({ entry, - entryData: entry.value, + entryData: entry.value }) } catch (err) { - console.warn("Error in handleData()", err) + console.warn('Error in handleData()', err) } } - handleClose() { + handleClose () { _this.props.onClose() } // Detects if the input is a string and converts to json object - isJson(data) { + isJson (data) { try { JSON.parse(data) return true @@ -162,6 +162,6 @@ class Details extends React.Component { } Details.propTypes = { entry: PropTypes.object, - onClose: PropTypes.func, + onClose: PropTypes.func } export default Details diff --git a/src/explorer/index.js b/src/explorer/index.js index f0b81fd..1da6508 100644 --- a/src/explorer/index.js +++ b/src/explorer/index.js @@ -1,7 +1,9 @@ import React from 'react' -import { Row, Col, Content, Box, DataTable } from 'adminlte-2-react' +import { Row, Col, Content, Box, DataTable, Inputs, Button } from 'adminlte-2-react' import Details from './details' import './explorer.css' +const { Text } = Inputs + const axios = require('axios').default const SERVER = 'https://p2wdb.fullstack.cash/' @@ -16,7 +18,8 @@ class Explorer extends React.Component { showEntry: false, data: [], entries: [], - entryData: null + entryData: null, + addId: '' } this.firstColumns = [ @@ -52,6 +55,25 @@ class Explorer extends React.Component { browserTitle='P2WDB Explorer' > + {!entryData && ( + + +