mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Refactor navigation functions (#776)
* Refactor navigation functions out of offer detail component * Remove old commentes * Fix go to lightning node from offer detail * Refactor more navigation functions * Refactor goto function out of create contact profile * Refactor goto out of create peer dialog * Refactor goto out of create signing dialog * Refactor goto out of delete squeak dialog * Refactor goto out of import signing profile dialog * Refactor goto out of lightning peer list dialog * Refactor goto out of make squeak dialog * Refactor goto out of open channel dialog * Refactor goto out of pending open channel component * Refactor goto out of pending received payment component * Refactor goto out of send bitcoin dialog * Refactor goto out of sent offer component * Refactor goto out of sent payment component * Refactor goto out of squeak detail component * Refactor goto out of profile detail component * Refactor goto out of squeak thread item component * Refactor goto out of payments page * Refactor goto out of peers page * Refactor goto out of profile page * Refactor goto out of squeak page * Refactor goto out of squeak address page * Refactor goto out of timeline page * Refactor reload out of buy dialog * Refactor reload out of delete peer dialog * Refactor reload out of delete profile dialog * Refactor reload out of delete squeak dialog * Refactor reload out of header * Refactor reload out of squeak detail component * Refactor goto out of timeline avatar component * Refactor reload out of upload image dialog * Refactor reload out of channel page * Refactor reload out of lightning node page * Refactor goto out of profiles page
This commit is contained in:
parent
7a6a9477ee
commit
0022860e7f
37 changed files with 215 additions and 442 deletions
|
|
@ -16,9 +16,6 @@ import classnames from "classnames";
|
|||
|
||||
import LockIcon from '@material-ui/icons/Lock';
|
||||
|
||||
// components
|
||||
import BuyOfferDialog from "../../components/BuyOfferDialog";
|
||||
|
||||
// styles
|
||||
import useStyles from "./styles";
|
||||
|
||||
|
|
@ -26,26 +23,21 @@ import Widget from "../../components/Widget";
|
|||
|
||||
import moment from 'moment';
|
||||
|
||||
import {
|
||||
goToPeerPage,
|
||||
goToLightningNodePage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
export default function BuyOfferDetailItem({
|
||||
offer,
|
||||
handleOfferClick,
|
||||
...props
|
||||
}) {
|
||||
var classes = useStyles();
|
||||
const history = useHistory();
|
||||
const [payOfferDialogOpen, setPayOfferDialogOpen] = useState(false);
|
||||
|
||||
|
||||
const preventDefault = (event) => event.preventDefault();
|
||||
|
||||
const onOfferClick = (event) => {
|
||||
event.preventDefault();
|
||||
console.log("Handling offer click...");
|
||||
if (handleOfferClick) {
|
||||
handleOfferClick();
|
||||
}
|
||||
}
|
||||
|
||||
const onPeerClick = (event) => {
|
||||
event.preventDefault();
|
||||
const peerId = getPeerId();
|
||||
|
|
@ -53,7 +45,17 @@ export default function BuyOfferDetailItem({
|
|||
return;
|
||||
}
|
||||
console.log("Handling peer click for peerId: " + peerId);
|
||||
goToPeerPage(peerId);
|
||||
goToPeerPage(history, peerId);
|
||||
}
|
||||
|
||||
const onLightningNodeClick = (event) => {
|
||||
event.preventDefault();
|
||||
goToLightningNodePage(
|
||||
history,
|
||||
offer.getNodePubkey(),
|
||||
offer.getNodeHost(),
|
||||
offer.getNodePort(),
|
||||
)
|
||||
}
|
||||
|
||||
const getPeerId = () => {
|
||||
|
|
@ -64,20 +66,7 @@ export default function BuyOfferDetailItem({
|
|||
return peer.getPeerId();
|
||||
}
|
||||
|
||||
const goToPeerPage = (peerId) => {
|
||||
history.push("/app/peer/" + peerId);
|
||||
};
|
||||
|
||||
const goToLightningNodePage = (pubkey, host, port) => {
|
||||
console.log("Go to lightning node for pubkey: " + pubkey);
|
||||
if (pubkey && host && port) {
|
||||
history.push("/app/lightningnode/" + pubkey + "/" + host + "/" + port);
|
||||
} else if (pubkey && host) {
|
||||
history.push("/app/lightningnode/" + pubkey + "/" + host);
|
||||
} else {
|
||||
history.push("/app/lightningnode/" + pubkey);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClickPayOffer = () => {
|
||||
console.log("Handle click pay offer.");
|
||||
|
|
@ -160,13 +149,7 @@ export default function BuyOfferDetailItem({
|
|||
<Box>
|
||||
<Typography
|
||||
size="md"
|
||||
>Lightning Node: <Link href="#" onClick={() => {
|
||||
goToLightningNodePage(
|
||||
offer.getNodePubkey(),
|
||||
offer.getNodeHost(),
|
||||
offer.getNodePort(),
|
||||
)
|
||||
}}>
|
||||
>Lightning Node: <Link href="#" onClick={onLightningNodeClick}>
|
||||
{lightningPubkey + "@" + lightningAddress}
|
||||
</Link>
|
||||
</Typography>
|
||||
|
|
@ -174,38 +157,12 @@ export default function BuyOfferDetailItem({
|
|||
)
|
||||
}
|
||||
|
||||
function PayOfferButton() {
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={() => {
|
||||
handleClickPayOffer();
|
||||
}}>Pay Offer
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function PayOfferDialogContent() {
|
||||
return (
|
||||
<>
|
||||
<BuyOfferDialog
|
||||
open={payOfferDialogOpen}
|
||||
offer={offer}
|
||||
handleClose={handleClosePayOfferDialog}
|
||||
></BuyOfferDialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
p={1}
|
||||
m={0}
|
||||
style={{backgroundColor: 'white'}}
|
||||
onClick={onOfferClick}
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
|
|
@ -248,7 +205,6 @@ export default function BuyOfferDetailItem({
|
|||
</Grid>
|
||||
</Grid>
|
||||
</Box>
|
||||
{PayOfferDialogContent()}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,109 +0,0 @@
|
|||
import React, {useState, useEffect} from 'react';
|
||||
import {
|
||||
Paper,
|
||||
IconButton,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Typography,
|
||||
Grid,
|
||||
Box,
|
||||
Link,
|
||||
Dialog,
|
||||
DialogTitle,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
TextField,
|
||||
DialogActions,
|
||||
Button,
|
||||
FormControl,
|
||||
InputLabel,
|
||||
Select,
|
||||
} from "@material-ui/core";
|
||||
import { MoreVert as MoreIcon } from "@material-ui/icons";
|
||||
import {useHistory} from "react-router-dom";
|
||||
import classnames from "classnames";
|
||||
|
||||
// styles
|
||||
import useStyles from "./styles";
|
||||
|
||||
import Widget from "../../components/Widget";
|
||||
import SqueakThreadItem from "../../components/SqueakThreadItem";
|
||||
|
||||
|
||||
import {
|
||||
payOfferRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
|
||||
|
||||
export default function BuyOfferDialog({
|
||||
open,
|
||||
offer,
|
||||
handleClose,
|
||||
...props
|
||||
}) {
|
||||
var classes = useStyles();
|
||||
const history = useHistory();
|
||||
|
||||
const handleResponse = (response) => {
|
||||
goToSqueakPage(offer.getSqueakHash());
|
||||
};
|
||||
|
||||
const handleErr = (err) => {
|
||||
alert('Payment failure: ' + err);
|
||||
};
|
||||
|
||||
const pay = (offerId) => {
|
||||
payOfferRequest(offerId, handleResponse, handleErr);
|
||||
};
|
||||
|
||||
const goToSqueakPage = (squeakHash) => {
|
||||
history.push("/app/squeak/" + squeakHash);
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'Offer ID:', offer.getOfferId());
|
||||
pay(offer.getOfferId());
|
||||
handleClose();
|
||||
}
|
||||
|
||||
function CancelButton() {
|
||||
return (
|
||||
<Button
|
||||
onClick={handleClose}
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
function PayOfferButton() {
|
||||
return (
|
||||
<Button
|
||||
type="submit"
|
||||
variant="contained"
|
||||
color="primary"
|
||||
className={classes.button}
|
||||
>
|
||||
Pay
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onClose={handleClose} aria-labelledby="form-dialog-title">
|
||||
<DialogTitle id="form-dialog-title">Buy Offer</DialogTitle>
|
||||
<form className={classes.root} onSubmit={handleSubmit} noValidate autoComplete="off">
|
||||
<DialogContent>
|
||||
Are you sure you want to pay {offer.getPriceMsat() / 1000} satoshis for this offer?
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
{CancelButton()}
|
||||
{PayOfferButton()}
|
||||
</DialogActions>
|
||||
</form>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"name": "BuyOfferDialog",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"main": "BuyOfferDialog.js"
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
import { makeStyles } from "@material-ui/styles";
|
||||
|
||||
export default makeStyles(theme => ({
|
||||
widgetWrapper: {
|
||||
display: "flex",
|
||||
minHeight: "100%",
|
||||
},
|
||||
widgetHeader: {
|
||||
padding: theme.spacing(3),
|
||||
paddingBottom: theme.spacing(1),
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
},
|
||||
widgetRoot: {
|
||||
boxShadow: theme.customShadows.widget,
|
||||
},
|
||||
widgetBody: {
|
||||
paddingBottom: theme.spacing(3),
|
||||
paddingRight: theme.spacing(3),
|
||||
paddingLeft: theme.spacing(3),
|
||||
},
|
||||
noPadding: {
|
||||
padding: 0,
|
||||
},
|
||||
paper: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
flexGrow: 1,
|
||||
overflow: "hidden",
|
||||
},
|
||||
moreButton: {
|
||||
margin: -theme.spacing(1),
|
||||
padding: 0,
|
||||
width: 40,
|
||||
height: 40,
|
||||
color: theme.palette.text.hint,
|
||||
"&:hover": {
|
||||
backgroundColor: theme.palette.primary.main,
|
||||
color: "rgba(255, 255, 255, 0.35)",
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
|
@ -43,6 +43,9 @@ import {
|
|||
import {
|
||||
payOfferRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
reloadRoute,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function BuySqueakDialog({
|
||||
|
|
@ -55,11 +58,11 @@ export default function BuySqueakDialog({
|
|||
var classes = useStyles();
|
||||
const history = useHistory();
|
||||
|
||||
var [selectedOfferId, setSelectedOfferId] = useState(-1);
|
||||
var [selectedOfferId, setSelectedOfferId] = useState("");
|
||||
const [offers, setOffers] = useState([]);
|
||||
|
||||
const resetFields = () => {
|
||||
setSelectedOfferId(-1);
|
||||
setSelectedOfferId("");
|
||||
};
|
||||
|
||||
const handleChange = (event) => {
|
||||
|
|
@ -84,8 +87,6 @@ export default function BuySqueakDialog({
|
|||
};
|
||||
|
||||
const handlePayResponse = (response) => {
|
||||
// goToSqueakPage(offer.getSqueakHash());
|
||||
// reloadRoute();
|
||||
handlePaymentComplete();
|
||||
};
|
||||
|
||||
|
|
@ -104,14 +105,10 @@ export default function BuySqueakDialog({
|
|||
syncSqueakRequest(hash, (response) => {
|
||||
console.log("response:");
|
||||
console.log(response);
|
||||
reloadRoute();
|
||||
reloadRoute(history);
|
||||
});
|
||||
}
|
||||
|
||||
const reloadRoute = () => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
const getSelectedOffer = () => {
|
||||
var offer;
|
||||
for (offer of offers) {
|
||||
|
|
@ -137,7 +134,7 @@ export default function BuySqueakDialog({
|
|||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'selectedOfferId:', selectedOfferId);
|
||||
if (selectedOfferId == -1) {
|
||||
if (selectedOfferId == "") {
|
||||
alert('Offer must be selected.');
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ import useStyles from "../../pages/wallet/styles";
|
|||
import moment from 'moment';
|
||||
import ChannelBalanceBar from "./ChannelBalanceBar";
|
||||
|
||||
import {
|
||||
goToChannelPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
export default function ChannelItem({
|
||||
channel,
|
||||
|
|
@ -43,16 +46,12 @@ export default function ChannelItem({
|
|||
return pieces[1];
|
||||
}
|
||||
|
||||
const goToChannelPage = (txId, outputIndex) => {
|
||||
history.push("/app/channel/" + txId + "/" + outputIndex);
|
||||
};
|
||||
|
||||
const onChannelClick = (event) => {
|
||||
event.preventDefault();
|
||||
console.log("Handling channel click...");
|
||||
var txId = getTxId(channel);
|
||||
var outputIndex = getOutputIndex(channel);
|
||||
goToChannelPage(txId, outputIndex);
|
||||
goToChannelPage(history, txId, outputIndex);
|
||||
}
|
||||
|
||||
function ChannelDetailItem(label, value) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ import useStyles from "./styles";
|
|||
import {
|
||||
createContactProfileRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToProfilePage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function CreateContactProfileDialog({
|
||||
|
|
@ -43,7 +46,7 @@ export default function CreateContactProfileDialog({
|
|||
};
|
||||
|
||||
const handleResponse = (response) => {
|
||||
goToProfilePage(response.getProfileId());
|
||||
goToProfilePage(history, response.getProfileId());
|
||||
};
|
||||
|
||||
const handleErr = (err) => {
|
||||
|
|
@ -54,10 +57,6 @@ export default function CreateContactProfileDialog({
|
|||
createContactProfileRequest(profileName, squeakAddress, handleResponse, handleErr);
|
||||
};
|
||||
|
||||
const goToProfilePage = (profileId) => {
|
||||
history.push("/app/profile/" + profileId);
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'profileName:', profileName);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ import {makeStyles} from '@material-ui/core/styles';
|
|||
import {
|
||||
createPeerRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToPeerPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
form: {
|
||||
|
|
@ -81,14 +85,10 @@ export default function CreatePeerDialog({
|
|||
|
||||
const createPeer = (peerName, host, port) => {
|
||||
createPeerRequest(peerName, host, port, (response) => {
|
||||
goToPeerPage(response.getPeerId());
|
||||
goToPeerPage(history, response.getPeerId());
|
||||
});
|
||||
};
|
||||
|
||||
const goToPeerPage = (peerId) => {
|
||||
history.push("/app/peer/" + peerId);
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'peerName:', peerName);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ import SqueakThreadItem from "../../components/SqueakThreadItem";
|
|||
import {
|
||||
createSigningProfileRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToProfilePage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function CreateSigningProfileDialog({
|
||||
|
|
@ -53,7 +56,7 @@ export default function CreateSigningProfileDialog({
|
|||
};
|
||||
|
||||
const handleResponse = (response) => {
|
||||
goToProfilePage(response.getProfileId());
|
||||
goToProfilePage(history, response.getProfileId());
|
||||
};
|
||||
|
||||
const handleErr = (err) => {
|
||||
|
|
@ -64,10 +67,6 @@ export default function CreateSigningProfileDialog({
|
|||
createSigningProfileRequest(profileName, handleResponse, handleErr);
|
||||
};
|
||||
|
||||
const goToProfilePage = (profileId) => {
|
||||
history.push("/app/profile/" + profileId);
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'profileName:', profileName);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ import Widget from "../../components/Widget";
|
|||
import {
|
||||
deletePeerRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
reloadRoute,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function DeletePeerDialog({
|
||||
|
|
@ -44,14 +47,10 @@ export default function DeletePeerDialog({
|
|||
|
||||
const deletePeer = (peerId) => {
|
||||
deletePeerRequest(peerId, (response) => {
|
||||
reloadRoute();
|
||||
reloadRoute(history);
|
||||
});
|
||||
};
|
||||
|
||||
const reloadRoute = () => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'peer:', peer);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ import Widget from "../../components/Widget";
|
|||
import {
|
||||
deleteProfileRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
reloadRoute,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function DeleteProfileDialog({
|
||||
|
|
@ -44,14 +47,10 @@ export default function DeleteProfileDialog({
|
|||
|
||||
const deleteProfile = (profileId) => {
|
||||
deleteProfileRequest(profileId, (response) => {
|
||||
reloadRoute();
|
||||
reloadRoute(history);
|
||||
});
|
||||
};
|
||||
|
||||
const reloadRoute = () => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'profile:', profile);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ import SqueakThreadItem from "../../components/SqueakThreadItem";
|
|||
import {
|
||||
deleteSqueakRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
reloadRoute,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function DeleteSqueakDialog({
|
||||
|
|
@ -45,18 +48,10 @@ export default function DeleteSqueakDialog({
|
|||
|
||||
const deleteSqueak = (squeakHash) => {
|
||||
deleteSqueakRequest(squeakHash, (response) => {
|
||||
reloadRoute();
|
||||
reloadRoute(history);
|
||||
});
|
||||
};
|
||||
|
||||
const goToSqueakPage = (squeakHash) => {
|
||||
history.push("/app/squeak/" + squeakHash);
|
||||
};
|
||||
|
||||
const reloadRoute = () => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'squeakToDelete:', squeakToDelete);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ import {
|
|||
logoutRequest,
|
||||
getUserRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
reloadRoute,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
const notifications = [];
|
||||
|
||||
|
|
@ -61,10 +64,6 @@ export default function Header(props) {
|
|||
var [isSearchOpen, setSearchOpen] = useState(false);
|
||||
var [username, setUsername] = useState("bob smith");
|
||||
|
||||
const reloadRoute = () => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
const getUser = () => {
|
||||
getUserRequest(setUsername);
|
||||
};
|
||||
|
|
@ -194,7 +193,7 @@ export default function Header(props) {
|
|||
color="primary"
|
||||
onClick={() => logoutRequest(
|
||||
() => {
|
||||
reloadRoute();
|
||||
reloadRoute(history);
|
||||
}
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ import SqueakThreadItem from "../../components/SqueakThreadItem";
|
|||
import {
|
||||
importSigningProfileRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToProfilePage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function ImportSigningProfileDialog({
|
||||
|
|
@ -58,17 +61,13 @@ export default function ImportSigningProfileDialog({
|
|||
};
|
||||
|
||||
const handleResponse = (response) => {
|
||||
goToProfilePage(response.getProfileId());
|
||||
goToProfilePage(history, response.getProfileId());
|
||||
};
|
||||
|
||||
const handleErr = (err) => {
|
||||
alert('Error creating contact profile: ' + err);
|
||||
};
|
||||
|
||||
const goToProfilePage = (profileId) => {
|
||||
history.push("/app/profile/" + profileId);
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'profileName:', profileName);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ import RecordVoiceOverIcon from '@material-ui/icons/RecordVoiceOver';
|
|||
|
||||
import useStyles from "../../pages/wallet/styles";
|
||||
|
||||
import {
|
||||
goToLightningNodePage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function LightningPeerListItem({
|
||||
peer,
|
||||
|
|
@ -24,15 +28,11 @@ export default function LightningPeerListItem({
|
|||
const onPeerClick = (event) => {
|
||||
event.preventDefault();
|
||||
console.log("Handling peer click...");
|
||||
goToLightningNodePage();
|
||||
}
|
||||
|
||||
const goToLightningNodePage = () => {
|
||||
const pubkey = peer.getPubKey();
|
||||
const host = getPeerHost();
|
||||
const port = getPeerPort();
|
||||
history.push("/app/lightningnode/" + pubkey + "/" + host + "/" + port);
|
||||
};
|
||||
goToLightningNodePage(history, pubkey, host, port);
|
||||
}
|
||||
|
||||
const getPeerHost = () => {
|
||||
const address = peer.getAddress();
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ import {
|
|||
makeSqueakRequest,
|
||||
getSigningProfilesRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToSqueakPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function MakeSqueakDialog({
|
||||
|
|
@ -63,7 +66,7 @@ export default function MakeSqueakDialog({
|
|||
};
|
||||
|
||||
const handleResponse = (response) => {
|
||||
goToSqueakPage(response.getSqueakHash());
|
||||
goToSqueakPage(history, response.getSqueakHash());
|
||||
};
|
||||
|
||||
const handleErr = (err) => {
|
||||
|
|
@ -81,10 +84,6 @@ export default function MakeSqueakDialog({
|
|||
loadSigningProfiles()
|
||||
}, []);
|
||||
|
||||
const goToSqueakPage = (squeakHash) => {
|
||||
history.push("/app/squeak/" + squeakHash);
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'profileId:', profileId);
|
||||
|
|
|
|||
|
|
@ -72,10 +72,6 @@ export default function OpenChannelDialog({
|
|||
lndOpenChannelSyncRequest(pubkey, amount, satperbyte, handleResponse, handleErr);
|
||||
};
|
||||
|
||||
// const goToProfilePage = (profileId) => {
|
||||
// history.push("/app/profile/" + profileId);
|
||||
// };
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'pubkey:', pubkey);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@ import moment from 'moment';
|
|||
import Card from "@material-ui/core/Card";
|
||||
import ChannelBalanceBar from "../ChannelItem/ChannelBalanceBar";
|
||||
|
||||
import {
|
||||
goToChannelPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function PendingOpenChannelItem({
|
||||
pendingOpenChannel,
|
||||
...props
|
||||
|
|
@ -48,10 +53,6 @@ export default function PendingOpenChannelItem({
|
|||
return pieces[1];
|
||||
}
|
||||
|
||||
const goToChannelPage = (txId, outputIndex) => {
|
||||
history.push("/app/channel/" + txId + "/" + outputIndex);
|
||||
};
|
||||
|
||||
const onChannelClick = (event) => {
|
||||
event.preventDefault();
|
||||
console.log("Handling channel click...");
|
||||
|
|
@ -103,4 +104,4 @@ export default function PendingOpenChannelItem({
|
|||
</Box>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ import Widget from "../../components/Widget";
|
|||
|
||||
import moment from 'moment';
|
||||
|
||||
import {
|
||||
goToSqueakPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function ReceivedPayment({
|
||||
receivedPayment,
|
||||
...props
|
||||
|
|
@ -28,17 +33,11 @@ export default function ReceivedPayment({
|
|||
|
||||
const history = useHistory();
|
||||
|
||||
const goToSqueakPage = (hash) => {
|
||||
history.push("/app/squeak/" + hash);
|
||||
};
|
||||
|
||||
const onSqueakClick = (event) => {
|
||||
event.preventDefault();
|
||||
var hash = receivedPayment.getSqueakHash();
|
||||
console.log("Handling squeak click for hash: " + hash);
|
||||
if (goToSqueakPage) {
|
||||
goToSqueakPage(hash);
|
||||
}
|
||||
goToSqueakPage(history, hash);
|
||||
}
|
||||
|
||||
console.log("receivedPayment:");
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ import SqueakThreadItem from "../../components/SqueakThreadItem";
|
|||
import {
|
||||
lndSendCoins,
|
||||
} from "../../squeakclient/requests"
|
||||
|
||||
import {
|
||||
reloadRoute,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function SendBitcoinDialog({
|
||||
|
|
@ -76,14 +78,11 @@ export default function SendBitcoinDialog({
|
|||
const sendBitcoin = (address, amount, satperbyte, sendall) => {
|
||||
lndSendCoins(address, amount, satperbyte, sendall, (response) => {
|
||||
// setAddress(response.getAddress());
|
||||
goToWalletPage();
|
||||
// goToWalletPage(history);
|
||||
reloadRoute();
|
||||
});
|
||||
};
|
||||
|
||||
const goToWalletPage = () => {
|
||||
history.push("/app/wallet/");
|
||||
};
|
||||
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
console.log( 'address:', address);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ import Widget from "../../components/Widget";
|
|||
|
||||
import moment from 'moment';
|
||||
|
||||
import {
|
||||
goToSqueakPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function SentOffer({
|
||||
receivedPayment,
|
||||
...props
|
||||
|
|
@ -30,17 +35,11 @@ export default function SentOffer({
|
|||
|
||||
const paymentTimeMs = receivedPayment.setPaymentTimeMs();
|
||||
|
||||
const goToSqueakPage = (hash) => {
|
||||
history.push("/app/squeak/" + hash);
|
||||
};
|
||||
|
||||
const onSqueakClick = (event) => {
|
||||
event.preventDefault();
|
||||
var hash = receivedPayment.getSqueakHash();
|
||||
console.log("Handling squeak click for hash: " + hash);
|
||||
if (goToSqueakPage) {
|
||||
goToSqueakPage(hash);
|
||||
}
|
||||
goToSqueakPage(history, hash);
|
||||
}
|
||||
|
||||
console.log("receivedPayment:");
|
||||
|
|
|
|||
|
|
@ -23,6 +23,13 @@ import Widget from "../../components/Widget";
|
|||
|
||||
import moment from 'moment';
|
||||
|
||||
import {
|
||||
goToSqueakPage,
|
||||
goToPeerPage,
|
||||
goToLightningNodePage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function SentPayment({
|
||||
sentPayment,
|
||||
...props
|
||||
|
|
@ -31,32 +38,11 @@ export default function SentPayment({
|
|||
|
||||
const history = useHistory();
|
||||
|
||||
const goToSqueakPage = (hash) => {
|
||||
history.push("/app/squeak/" + hash);
|
||||
};
|
||||
|
||||
const goToPeerPage = (id) => {
|
||||
history.push("/app/Peer/" + id);
|
||||
};
|
||||
|
||||
const goToLightningNodePage = (pubkey, host, port) => {
|
||||
console.log("Go to lightning node for pubkey: " + pubkey);
|
||||
if (pubkey && host && port) {
|
||||
history.push("/app/lightningnode/" + pubkey + "/" + host + "/" + port);
|
||||
} else if (pubkey && host) {
|
||||
history.push("/app/lightningnode/" + pubkey + "/" + host);
|
||||
} else {
|
||||
history.push("/app/lightningnode/" + pubkey);
|
||||
}
|
||||
};
|
||||
|
||||
const onSqueakClick = (event) => {
|
||||
event.preventDefault();
|
||||
var hash = sentPayment.getSqueakHash();
|
||||
console.log("Handling squeak click for hash: " + hash);
|
||||
if (goToSqueakPage) {
|
||||
goToSqueakPage(hash);
|
||||
}
|
||||
goToSqueakPage(history, hash);
|
||||
}
|
||||
|
||||
const onPeerClick = (event) => {
|
||||
|
|
@ -66,16 +52,14 @@ export default function SentPayment({
|
|||
return;
|
||||
}
|
||||
console.log("Handling peer click for peerId: " + peerId);
|
||||
goToPeerPage(peerId);
|
||||
goToPeerPage(history, peerId);
|
||||
}
|
||||
|
||||
const onLightningNodeClick = (event) => {
|
||||
event.preventDefault();
|
||||
var nodePubkey = sentPayment.getNodePubkey();
|
||||
console.log("Handling lightning node click for nodePubkey: " + nodePubkey);
|
||||
if (goToLightningNodePage) {
|
||||
goToLightningNodePage(nodePubkey);
|
||||
}
|
||||
goToLightningNodePage(history, nodePubkey);
|
||||
}
|
||||
|
||||
const getPeerId = () => {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,12 @@ import {
|
|||
|
||||
import moment from 'moment';
|
||||
|
||||
import {
|
||||
goToSqueakAddressPage,
|
||||
reloadRoute,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function SqueakDetailItem({
|
||||
hash,
|
||||
squeak,
|
||||
|
|
@ -55,14 +61,6 @@ export default function SqueakDetailItem({
|
|||
|
||||
const history = useHistory();
|
||||
|
||||
const goToSqueakAddressPage = () => {
|
||||
history.push("/app/squeakaddress/" + squeak.getAuthorAddress());
|
||||
};
|
||||
|
||||
const reloadRoute = () => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
const blockDetailUrl = () => {
|
||||
// return "https://blockstream.info/testnet/block/" + squeak.getBlockHash();
|
||||
return getBlockDetailUrl(squeak.getBlockHash(), network);
|
||||
|
|
@ -75,7 +73,7 @@ export default function SqueakDetailItem({
|
|||
if (!squeak) {
|
||||
return;
|
||||
}
|
||||
goToSqueakAddressPage(squeak.getAuthorAddress());
|
||||
goToSqueakAddressPage(history, squeak.getAuthorAddress());
|
||||
}
|
||||
|
||||
const onReplyClick = (event) => {
|
||||
|
|
@ -121,7 +119,7 @@ export default function SqueakDetailItem({
|
|||
event.preventDefault();
|
||||
console.log("Handling download click...");
|
||||
syncSqueakRequest(hash, (response) => {
|
||||
reloadRoute();
|
||||
reloadRoute(history);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import {
|
|||
getProfileImageSrcString,
|
||||
} from "../../squeakimages/images"
|
||||
|
||||
|
||||
import moment from 'moment';
|
||||
|
||||
export default function SqueakProfileDetailItem({
|
||||
|
|
@ -70,17 +71,14 @@ export default function SqueakProfileDetailItem({
|
|||
|
||||
const history = useHistory();
|
||||
|
||||
const goToSqueakAddressPage = () => {
|
||||
history.push("/app/squeakaddress/" + squeakProfile.getAddress());
|
||||
};
|
||||
|
||||
const onViewSqueaksClick = () => {
|
||||
console.log("Handling view squeaks click...");
|
||||
handleClose();
|
||||
if (!squeakProfile) {
|
||||
return;
|
||||
}
|
||||
goToSqueakAddressPage();
|
||||
//goToSqueakAddressPage(history, squeakProfile.getAddress());
|
||||
handleViewSqueaksClick();
|
||||
}
|
||||
|
||||
const onConfigureClick = () => {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ import {
|
|||
|
||||
import moment from 'moment';
|
||||
|
||||
import {
|
||||
goToSqueakPage,
|
||||
goToSqueakAddressPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
export default function SqueakThreadItem({
|
||||
hash,
|
||||
squeak,
|
||||
|
|
@ -42,14 +47,6 @@ export default function SqueakThreadItem({
|
|||
return getBlockDetailUrl(squeak.getBlockHash(), network);
|
||||
};
|
||||
|
||||
const goToSqueakPage = (hash) => {
|
||||
history.push("/app/squeak/" + hash);
|
||||
};
|
||||
|
||||
const goToSqueakAddressPage = () => {
|
||||
history.push("/app/squeakaddress/" + squeak.getAuthorAddress());
|
||||
};
|
||||
|
||||
const onAddressClick = (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
@ -57,15 +54,13 @@ export default function SqueakThreadItem({
|
|||
if (!squeak) {
|
||||
return;
|
||||
}
|
||||
goToSqueakAddressPage(squeak.getAuthorAddress());
|
||||
goToSqueakAddressPage(history, squeak.getAuthorAddress());
|
||||
}
|
||||
|
||||
const onSqueakClick = (event) => {
|
||||
event.preventDefault();
|
||||
console.log("Handling squeak click for hash: " + hash);
|
||||
if (goToSqueakPage) {
|
||||
goToSqueakPage(hash);
|
||||
}
|
||||
goToSqueakPage(history, hash);
|
||||
}
|
||||
|
||||
function SqueakUnlockedContent() {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ import {useHistory} from "react-router-dom";
|
|||
import {
|
||||
getProfileImageSrcString,
|
||||
} from "../../squeakimages/images"
|
||||
import {
|
||||
goToSqueakAddressPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function SqueakUserAvatar({
|
||||
|
|
@ -19,13 +22,9 @@ export default function SqueakUserAvatar({
|
|||
}) {
|
||||
const history = useHistory();
|
||||
|
||||
const goToSqueakAddressPage = (squeakAddress) => {
|
||||
history.push("/app/squeakaddress/" + squeakAddress);
|
||||
};
|
||||
|
||||
const handleAvatarClick = () => {
|
||||
if (squeakProfile) {
|
||||
goToSqueakAddressPage(squeakProfile.getAddress());
|
||||
goToSqueakAddressPage(history, squeakProfile.getAddress());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ import SqueakThreadItem from "../../components/SqueakThreadItem";
|
|||
import {
|
||||
setSqueakProfileImageRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
reloadRoute,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function UpdateProfileImageDialog({
|
||||
|
|
@ -51,13 +54,9 @@ export default function UpdateProfileImageDialog({
|
|||
setImageBase64(null);
|
||||
};
|
||||
|
||||
const reloadRoute = () => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
const handleResponse = (response) => {
|
||||
// TODO: reload profile only.
|
||||
reloadRoute();
|
||||
reloadRoute(history);
|
||||
};
|
||||
|
||||
const handleErr = (err) => {
|
||||
|
|
|
|||
46
frontend/src/navigation/navigation.js
Normal file
46
frontend/src/navigation/navigation.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
export const reloadRoute = (history) => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
export const goToPeerPage = (history, peerId) => {
|
||||
history.push("/app/peer/" + peerId);
|
||||
};
|
||||
|
||||
export const goToLightningNodePage = (history, pubkey, host, port) => {
|
||||
console.log("Go to lightning node for pubkey: " + pubkey);
|
||||
if (pubkey && host && port) {
|
||||
history.push("/app/lightningnode/" + pubkey + "/" + host + "/" + port);
|
||||
} else if (pubkey && host) {
|
||||
history.push("/app/lightningnode/" + pubkey + "/" + host);
|
||||
} else {
|
||||
history.push("/app/lightningnode/" + pubkey);
|
||||
}
|
||||
};
|
||||
|
||||
export const goToSqueakPage = (history, squeakHash) => {
|
||||
history.push("/app/squeak/" + squeakHash);
|
||||
};
|
||||
|
||||
export const goToSqueakAddressPage = (history, squeakAddress) => {
|
||||
history.push("/app/squeakaddress/" + squeakAddress);
|
||||
};
|
||||
|
||||
export const goToChannelPage = (history, txId, outputIndex) => {
|
||||
history.push("/app/channel/" + txId + "/" + outputIndex);
|
||||
};
|
||||
|
||||
export const goToProfilePage = (history, profileId) => {
|
||||
history.push("/app/profile/" + profileId);
|
||||
};
|
||||
|
||||
export const goToWalletPage = (history) => {
|
||||
history.push("/app/wallet/");
|
||||
};
|
||||
|
||||
export const goToSentPaymentsPage = (history) => {
|
||||
history.push("/app/sentpayments/");
|
||||
};
|
||||
|
||||
export const goToReceivedPaymentsPage = (history) => {
|
||||
history.push("/app/receivedpayments/");
|
||||
};
|
||||
|
|
@ -97,11 +97,6 @@ export default function LightningNodePage() {
|
|||
setCloseChannelDialogOpen(true);
|
||||
};
|
||||
|
||||
|
||||
const reloadRoute = () => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
listPeers()
|
||||
},[]);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ import {
|
|||
lndConnectPeerRequest,
|
||||
lndDisconnectPeerRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
reloadRoute,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function LightningNodePage() {
|
||||
var classes = useStyles();
|
||||
|
|
@ -124,19 +128,15 @@ export default function LightningNodePage() {
|
|||
};
|
||||
const connectPeer = (pubkey, host) => {
|
||||
lndConnectPeerRequest(pubkey, host, () => {
|
||||
reloadRoute();
|
||||
reloadRoute(history);
|
||||
});
|
||||
};
|
||||
const disconnectPeer = (pubkey) => {
|
||||
lndDisconnectPeerRequest(pubkey, () => {
|
||||
reloadRoute();
|
||||
reloadRoute(history);
|
||||
});
|
||||
};
|
||||
|
||||
const reloadRoute = () => {
|
||||
history.go(0);
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
listPeers()
|
||||
},[]);
|
||||
|
|
@ -277,7 +277,7 @@ export default function LightningNodePage() {
|
|||
<Typography size="md">
|
||||
{HasChannelToPeer()}
|
||||
</Typography>
|
||||
{!hasChannelToPeer &&
|
||||
{!hasChannelToPeer() &&
|
||||
OpenChannelButton()
|
||||
}
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import Table from "../dashboard/components/Table/Table";
|
|||
import SentPayment from "../../components/SentPayment";
|
||||
import ReceivedPayment from "../../components/ReceivedPayment";
|
||||
|
||||
|
||||
// data
|
||||
import mock from "../dashboard/mock";
|
||||
|
||||
|
|
@ -32,6 +31,10 @@ import {
|
|||
getReceivedPaymentsRequest,
|
||||
getPaymentSummaryRequest
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToSentPaymentsPage,
|
||||
goToReceivedPaymentsPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
|
|
@ -53,14 +56,6 @@ export default function Payments() {
|
|||
});
|
||||
};
|
||||
|
||||
const goToSentPaymentsPage = () => {
|
||||
history.push("/app/sentpayments/");
|
||||
};
|
||||
|
||||
const goToReceivedPaymentsPage = () => {
|
||||
history.push("/app/receivedpayments/");
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadPaymentSummary();
|
||||
}, []);
|
||||
|
|
@ -138,7 +133,7 @@ export default function Payments() {
|
|||
<Button
|
||||
variant="contained"
|
||||
onClick={() => {
|
||||
goToSentPaymentsPage();
|
||||
goToSentPaymentsPage(history);
|
||||
}}>View Sent Payments
|
||||
</Button>
|
||||
</div>
|
||||
|
|
@ -155,7 +150,7 @@ export default function Payments() {
|
|||
<Button
|
||||
variant="contained"
|
||||
onClick={() => {
|
||||
goToReceivedPaymentsPage();
|
||||
goToReceivedPaymentsPage(history);
|
||||
}}>View Received Payments
|
||||
</Button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ import mock from "../dashboard/mock";
|
|||
import {
|
||||
getPeersRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToPeerPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
|
|
@ -54,10 +57,6 @@ export default function Peers() {
|
|||
getPeersRequest(setPeers);
|
||||
};
|
||||
|
||||
const goToPeerPage = (id) => {
|
||||
history.push("/app/Peer/" + id);
|
||||
};
|
||||
|
||||
const handleClickOpenCreatePeerDialog = () => {
|
||||
setCreatePeerDialogOpen(true);
|
||||
};
|
||||
|
|
@ -126,7 +125,7 @@ export default function Peers() {
|
|||
onRowClick: rowData => {
|
||||
var id = rowData[0];
|
||||
console.log("clicked on id" + id);
|
||||
goToPeerPage(id);
|
||||
goToPeerPage(history, id);
|
||||
},
|
||||
}}/>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ import {
|
|||
import {
|
||||
getProfileImageSrcString,
|
||||
} from "../../squeakimages/images"
|
||||
|
||||
import {
|
||||
goToSqueakAddressPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function ProfilePage() {
|
||||
|
|
@ -77,11 +79,6 @@ export default function ProfilePage() {
|
|||
getSqueakProfileRequest(id, setSqueakProfile);
|
||||
};
|
||||
|
||||
const goToSqueakAddressPage = (squeakAddress) => {
|
||||
history.push("/app/squeakaddress/" + squeakAddress);
|
||||
};
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
getSqueakProfile(id)
|
||||
},[id]);
|
||||
|
|
@ -123,7 +120,7 @@ export default function ProfilePage() {
|
|||
};
|
||||
|
||||
const handleViewSqueaks = () => {
|
||||
goToSqueakAddressPage(squeakProfile.getAddress());
|
||||
goToSqueakAddressPage(history, squeakProfile.getAddress());
|
||||
};
|
||||
|
||||
function ProfileContent() {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ import {
|
|||
getSigningProfilesRequest,
|
||||
getContactProfilesRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToProfilePage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
|
|
@ -68,10 +71,6 @@ export default function Profiles() {
|
|||
getContactProfilesRequest(setContactProfiles);
|
||||
};
|
||||
|
||||
const goToProfilePage = (profileId) => {
|
||||
history.push("/app/profile/" + profileId);
|
||||
};
|
||||
|
||||
const handleClickOpenCreateSigningProfileDialog = () => {
|
||||
setCreateSigningProfileDialogOpen(true);
|
||||
};
|
||||
|
|
@ -255,8 +254,7 @@ export default function Profiles() {
|
|||
onRowClick: rowData => {
|
||||
var id = rowData[0];
|
||||
var address = rowData[2];
|
||||
//goToSqueakAddressPage(address);
|
||||
goToProfilePage(id);
|
||||
goToProfilePage(history, id);
|
||||
}
|
||||
}}/>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ import {
|
|||
getReplySqueakDisplaysRequest,
|
||||
getNetworkRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToSqueakAddressPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
function Alert(props) {
|
||||
|
|
@ -77,10 +80,6 @@ export default function SqueakPage() {
|
|||
getNetworkRequest(setNetwork);
|
||||
};
|
||||
|
||||
const goToSqueakAddressPage = (squeakAddress) => {
|
||||
history.push("/app/squeakaddress/" + squeakAddress);
|
||||
};
|
||||
|
||||
const unknownAncestorHash = () => {
|
||||
if (!ancestorSqueaks) {
|
||||
return null;
|
||||
|
|
@ -163,7 +162,7 @@ export default function SqueakPage() {
|
|||
const handleAvatarClick = () => {
|
||||
console.log("Avatar clicked...");
|
||||
if (squeak) {
|
||||
goToSqueakAddressPage(squeak.getAuthorAddress());
|
||||
goToSqueakAddressPage(history, squeak.getAuthorAddress());
|
||||
}
|
||||
};
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ import {
|
|||
getAddressSqueakDisplaysRequest,
|
||||
getNetworkRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToSqueakAddressPage,
|
||||
goToProfilePage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function SqueakAddressPage() {
|
||||
|
|
@ -53,14 +57,6 @@ export default function SqueakAddressPage() {
|
|||
getNetworkRequest(setNetwork);
|
||||
};
|
||||
|
||||
const goToProfilePage = (profileId) => {
|
||||
history.push("/app/profile/" + profileId);
|
||||
};
|
||||
|
||||
const goToSqueakAddressPage = (squeakAddress) => {
|
||||
history.push("/app/squeakaddress/" + squeakAddress);
|
||||
};
|
||||
|
||||
const handleClickOpenCreateContactProfileDialog = () => {
|
||||
setCreateContactProfileDialogOpen(true);
|
||||
};
|
||||
|
|
@ -95,7 +91,7 @@ export default function SqueakAddressPage() {
|
|||
<div className={classes.root}>
|
||||
Profile:
|
||||
<Button variant="contained" onClick={() => {
|
||||
goToProfilePage(squeakProfile.getProfileId());
|
||||
goToProfilePage(history, squeakProfile.getProfileId());
|
||||
}}>{squeakProfile.getProfileName()}</Button>
|
||||
</div>
|
||||
)
|
||||
|
|
@ -112,7 +108,7 @@ export default function SqueakAddressPage() {
|
|||
function TimelineUserAvatar(squeak) {
|
||||
const handleAvatarClick = () => {
|
||||
console.log("Avatar clicked...");
|
||||
goToSqueakAddressPage(squeak.getAuthorAddress());
|
||||
goToSqueakAddressPage(history, squeak.getAuthorAddress());
|
||||
};
|
||||
return (
|
||||
<TimelineDot
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ import {
|
|||
getTimelineSqueakDisplaysRequest,
|
||||
getNetworkRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
import {
|
||||
goToSqueakAddressPage,
|
||||
} from "../../navigation/navigation"
|
||||
|
||||
|
||||
export default function TimelinePage() {
|
||||
|
|
@ -66,10 +69,6 @@ export default function TimelinePage() {
|
|||
getNetworkRequest(setNetwork);
|
||||
};
|
||||
|
||||
const goToSqueakAddressPage = (squeakAddress) => {
|
||||
history.push("/app/squeakaddress/" + squeakAddress);
|
||||
};
|
||||
|
||||
const handleClickOpen = () => {
|
||||
setOpen(true);
|
||||
};
|
||||
|
|
@ -107,7 +106,7 @@ export default function TimelinePage() {
|
|||
function TimelineUserAvatar(squeak) {
|
||||
const handleAvatarClick = () => {
|
||||
console.log("Avatar clicked...");
|
||||
goToSqueakAddressPage(squeak.getAuthorAddress());
|
||||
goToSqueakAddressPage(history, squeak.getAuthorAddress());
|
||||
};
|
||||
return (
|
||||
<TimelineDot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue