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 { lndOpenChannelSyncRequest, } from "../../squeakclient/requests" export default function OpenChannelDialog({ open, pubkey, handleClose, ...props }) { var classes = useStyles(); const history = useHistory(); var [amount, setAmount] = useState(""); const resetFields = () => { setAmount(""); }; const handleChangeAmount = (event) => { setAmount(event.target.value); }; const handleResponse = (response) => { // TODO: go to channel page instead of showing alert. alert('Open channel pending.'); }; const handleErr = (err) => { alert('Error opening channel: ' + err.message); }; const openChannel = (pubkey, amount) => { lndOpenChannelSyncRequest(pubkey, amount, handleResponse, handleErr); }; // const goToProfilePage = (profileId) => { // history.push("/app/profile/" + profileId); // }; function handleSubmit(event) { event.preventDefault(); console.log( 'pubkey:', pubkey); console.log( 'amount:', amount); if (!amount) { alert('Amount cannot be empty.'); return; } openChannel(pubkey, amount); handleClose(); } function PubKeyInput() { return ( ) } function LocalFundingAmountInput() { return ( ) } function CancelButton() { return ( ) } function OpenChannelButton() { return ( ) } return ( Open Channel
{PubKeyInput()} {LocalFundingAmountInput()} {CancelButton()} {OpenChannelButton()}
) }