mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-18 13:09:08 +02:00
Fix toggle profile and peer (#1824)
* Fix toggle reload for profile page and peer page * Update frontend build
This commit is contained in:
parent
98104faee7
commit
c53dadb006
8 changed files with 26 additions and 38 deletions
|
|
@ -30,15 +30,12 @@ export default function PeerPage() {
|
|||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
const { id } = useParams();
|
||||
const [peer, setPeer] = useState(null);
|
||||
const [peerResp, setPeerResp] = useState(null);
|
||||
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
||||
const [waitingForPeer, setWaitingForPeer] = useState(false);
|
||||
|
||||
const getSqueakPeer = (id) => {
|
||||
setWaitingForPeer(true);
|
||||
getPeerRequest(id, (peer => {
|
||||
setWaitingForPeer(false);
|
||||
setPeer(peer);
|
||||
getPeerRequest(id, (resp => {
|
||||
setPeerResp(resp);
|
||||
}));
|
||||
};
|
||||
const setAutoconnect = (id, autoconnect) => {
|
||||
|
|
@ -82,7 +79,7 @@ export default function PeerPage() {
|
|||
function PeerContent() {
|
||||
return (
|
||||
<>
|
||||
{peer
|
||||
{peerResp.getSqueakPeer()
|
||||
? PeerDisplay()
|
||||
: NoPeerDisplay()}
|
||||
</>
|
||||
|
|
@ -103,7 +100,7 @@ export default function PeerPage() {
|
|||
<p>
|
||||
Peer name:
|
||||
{' '}
|
||||
{peer.getPeerName()}
|
||||
{peerResp.getSqueakPeer().getPeerName()}
|
||||
</p>
|
||||
<p>
|
||||
{PeerAddressContent()}
|
||||
|
|
@ -120,11 +117,11 @@ export default function PeerPage() {
|
|||
<FormLabel component="legend">Peer settings</FormLabel>
|
||||
<FormGroup>
|
||||
<FormControlLabel
|
||||
control={<Switch checked={peer.getAutoconnect()} onChange={handleSettingsAutoconnectChange} />}
|
||||
control={<Switch checked={peerResp.getSqueakPeer().getAutoconnect()} onChange={handleSettingsAutoconnectChange} />}
|
||||
label="Autoconnect"
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Switch checked={peer.getShareForFree()} onChange={handleSettingsShareForFreeChange} />}
|
||||
control={<Switch checked={peerResp.getSqueakPeer().getShareForFree()} onChange={handleSettingsShareForFreeChange} />}
|
||||
label="Share For Free"
|
||||
/>
|
||||
</FormGroup>
|
||||
|
|
@ -157,13 +154,14 @@ export default function PeerPage() {
|
|||
<DeletePeerDialog
|
||||
open={deleteDialogOpen}
|
||||
handleClose={handleCloseDeleteDialog}
|
||||
peer={peer}
|
||||
peer={peerResp.getSqueakPeer()}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function PeerAddressContent() {
|
||||
const peer = peerResp.getSqueakPeer();
|
||||
console.log(peer.getPeerAddress());
|
||||
console.log(peer.getPeerAddress().getNetwork());
|
||||
const peerAddressStr = peerAddressToStr(peer.getPeerAddress());
|
||||
|
|
@ -196,14 +194,14 @@ export default function PeerPage() {
|
|||
|
||||
return (
|
||||
<>
|
||||
{!waitingForPeer
|
||||
{peerResp
|
||||
? (
|
||||
<>
|
||||
{PeerContent()}
|
||||
{DeletePeerDialogContent()}
|
||||
</>
|
||||
)
|
||||
: WaitingIndicator()}
|
||||
{DeletePeerDialogContent()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,18 +20,15 @@ import {
|
|||
export default function ProfilePage() {
|
||||
const classes = useStyles();
|
||||
const { id } = useParams();
|
||||
const [squeakProfile, setSqueakProfile] = useState(null);
|
||||
const [waitingForProfile, setWaitingForProfile] = useState(false);
|
||||
const [squeakProfileResp, setSqueakProfileResp] = useState(null);
|
||||
|
||||
const handleGetSqueakProfileErr = (err) => {
|
||||
setSqueakProfile(null);
|
||||
setSqueakProfileResp(null);
|
||||
};
|
||||
|
||||
const getSqueakProfile = useCallback(() => {
|
||||
setWaitingForProfile(true);
|
||||
getSqueakProfileRequest(id, (profile => {
|
||||
setWaitingForProfile(false);
|
||||
setSqueakProfile(profile);
|
||||
setSqueakProfileResp(profile);
|
||||
}), handleGetSqueakProfileErr);
|
||||
},
|
||||
[id]);
|
||||
|
|
@ -47,7 +44,7 @@ export default function ProfilePage() {
|
|||
function ProfileContent() {
|
||||
return (
|
||||
<>
|
||||
{squeakProfile
|
||||
{squeakProfileResp.getSqueakProfile()
|
||||
? SqueakProfileDisplay()
|
||||
: NoSqueakProfileDisplay()}
|
||||
</>
|
||||
|
|
@ -57,7 +54,7 @@ export default function ProfilePage() {
|
|||
function SqueakProfileDisplay() {
|
||||
return (
|
||||
<SqueakProfileDetailItem
|
||||
squeakProfile={squeakProfile}
|
||||
squeakProfile={squeakProfileResp.getSqueakProfile()}
|
||||
handleReloadProfile={handleReloadProfile}
|
||||
/>
|
||||
);
|
||||
|
|
@ -83,7 +80,7 @@ export default function ProfilePage() {
|
|||
|
||||
return (
|
||||
<>
|
||||
{!waitingForProfile
|
||||
{squeakProfileResp
|
||||
? ProfileContent()
|
||||
: WaitingIndicator()}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -391,9 +391,7 @@ export function getSqueakProfileRequest(id, handleResponse, handleErr) {
|
|||
'getsqueakprofile',
|
||||
request,
|
||||
GetSqueakProfileReply.deserializeBinary,
|
||||
(response) => {
|
||||
handleResponse(response.getSqueakProfile());
|
||||
},
|
||||
handleResponse,
|
||||
handleErr,
|
||||
);
|
||||
// client.getSqueakProfile(request, {}, (err, response) => {
|
||||
|
|
@ -513,13 +511,8 @@ export function getPeerRequest(id, handleResponse) {
|
|||
'getpeer',
|
||||
request,
|
||||
GetPeerReply.deserializeBinary,
|
||||
(response) => {
|
||||
handleResponse(response.getSqueakPeer());
|
||||
},
|
||||
handleResponse,
|
||||
);
|
||||
// client.getPeer(request, {}, (err, response) => {
|
||||
// handleResponse(response.getSqueakPeer());
|
||||
// });
|
||||
}
|
||||
|
||||
export function getPeerByAddressRequest(network, host, port, handleResponse) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"files": {
|
||||
"main.js": "/static/js/main.a7d10c80.chunk.js",
|
||||
"main.js.map": "/static/js/main.a7d10c80.chunk.js.map",
|
||||
"main.js": "/static/js/main.cc8b5dd9.chunk.js",
|
||||
"main.js.map": "/static/js/main.cc8b5dd9.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.48a1d1b9.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.48a1d1b9.js.map",
|
||||
"static/css/2.f68b60d4.chunk.css": "/static/css/2.f68b60d4.chunk.css",
|
||||
|
|
@ -18,6 +18,6 @@
|
|||
"static/js/runtime-main.48a1d1b9.js",
|
||||
"static/css/2.f68b60d4.chunk.css",
|
||||
"static/js/2.4b78e418.chunk.js",
|
||||
"static/js/main.a7d10c80.chunk.js"
|
||||
"static/js/main.cc8b5dd9.chunk.js"
|
||||
]
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Squeaknode</title><meta name="description" content="Squeaknode is a frontend for accessing a squeak node"><meta name="keywords" content="squeak, bitcoin, lightning"><meta name="author" content="Flatlogic LLC."><link href="/static/css/2.f68b60d4.chunk.css" rel="stylesheet"></head><body style="font-family:Roboto,sans-serif"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,f,l=r[0],a=r[1],i=r[2],c=0,s=[];c<l.length;c++)f=l[c],Object.prototype.hasOwnProperty.call(o,f)&&o[f]&&s.push(o[f][0]),o[f]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={1:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var l=this["webpackJsonpsqueak-node-frontend"]=this["webpackJsonpsqueak-node-frontend"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var p=a;t()}([])</script><script src="/static/js/2.4b78e418.chunk.js"></script><script src="/static/js/main.a7d10c80.chunk.js"></script></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Squeaknode</title><meta name="description" content="Squeaknode is a frontend for accessing a squeak node"><meta name="keywords" content="squeak, bitcoin, lightning"><meta name="author" content="Flatlogic LLC."><link href="/static/css/2.f68b60d4.chunk.css" rel="stylesheet"></head><body style="font-family:Roboto,sans-serif"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,f,l=r[0],a=r[1],i=r[2],c=0,s=[];c<l.length;c++)f=l[c],Object.prototype.hasOwnProperty.call(o,f)&&o[f]&&s.push(o[f][0]),o[f]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={1:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var l=this["webpackJsonpsqueak-node-frontend"]=this["webpackJsonpsqueak-node-frontend"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var p=a;t()}([])</script><script src="/static/js/2.4b78e418.chunk.js"></script><script src="/static/js/main.cc8b5dd9.chunk.js"></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue