Fix display, netspace calc, new sidebar (#313)

* fix cc spendable balance, cc units, cc spend

* Enter correct units in create offer

* Fix netspace calculation

* Disconnect from useless peers, and sidebar revamp

* Remove logging

* Green icon to black icon
This commit is contained in:
Mariano Sorgente
2020-07-16 13:05:43 -07:00
committed by Gene Hoffman
parent 29ce4798e2
commit 96fb27f4c7
18 changed files with 224 additions and 232 deletions
+16 -1
View File
@@ -27,5 +27,20 @@ html, body, #wrapper-id, #root, #app, #app>div, #provider-wrap {
margin: 0px;
padding: 0;
top: 0px;
overflow: hidden;
overflow: hidden;
}
@font-face {
font-family: Roboto;
src: url("../fonts/Roboto-Medium.ttf");
font-weight: 500;
}
@font-face {
font-family: Roboto;
src: url("../fonts/Roboto-Regular.ttf");
font-weight: 400;
}
@font-face {
font-family: Roboto;
src: url("../fonts/Roboto-Light.ttf");
font-weight: 300;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
<svg width="32" height="37" viewBox="0 0 32 37" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M19.2165 14.2887C20.866 12.6392 23.5876 12.4742 24.8247 12.3918C24.8247 13.7113 24.4948 16.3505 22.7629 18C21.1134 19.6495 18.3918 19.8144 17.0722 19.8969C17.2371 18.6598 17.567 15.9381 19.2165 14.2887ZM7.01031 31.5258C4.37113 28.9691 4.04124 24.7629 4.04124 23.1134C5.69072 23.1134 9.97938 23.2783 12.5361 25.8351C15.1753 28.3918 15.5052 32.5979 15.5052 34.2474C13.8557 34.3299 9.64949 34.0825 7.01031 31.5258ZM15.5052 20.0619C14.1856 19.9794 11.5464 19.732 9.89691 18C8.24742 16.3505 8.08247 13.6289 8 12.3918C9.31959 12.3918 11.9588 12.7217 13.6082 14.4536C15.0103 15.9381 15.4227 18.1649 15.4227 19.567V20.0619H15.5052ZM14.5155 5.87629C14.5155 4.22681 15.5876 2.74227 16.2474 2C16.9897 2.74227 18.0619 4.22681 18.0619 5.79382C18.0619 7.4433 16.9897 8.92784 16.2474 9.6701C15.6701 8.92784 14.5155 7.4433 14.5155 5.87629ZM17.1546 34.2474C17.1546 32.5979 17.4845 28.3918 20.1237 25.8351C22.7629 23.2783 26.9691 23.1134 28.6186 23.1134C28.6186 24.8454 28.2887 29.0515 25.6495 31.5258C23.0928 34.0825 18.8866 34.3299 17.1546 34.2474ZM0 36.8041H32V35.1546H22.6804C24.1649 34.6598 25.6495 33.9175 26.8866 32.7629C30.7629 29.0515 30.3505 22.6186 30.3505 22.2887C30.3505 21.8763 30.0206 21.5464 29.6082 21.5464C29.3608 21.5464 22.9278 20.9691 19.0515 24.6804C18.3093 25.4227 17.732 26.2474 17.2371 27.1546V21.5464C18.7216 21.5464 21.9381 21.299 24.0825 19.2371C26.8866 16.5155 26.6392 11.8144 26.6392 11.6495C26.6392 11.2371 26.3093 10.9072 25.8969 10.9072C25.732 10.9072 21.0309 10.4948 18.2268 13.2165C17.8969 13.5464 17.567 13.9588 17.3196 14.2887V11.2371C17.9794 10.5773 19.9588 8.43299 19.9588 5.79382C19.9588 2.6598 17.0722 0.268041 16.9897 0.185567C16.6598 -0.0618557 16.2474 -0.0618557 15.9175 0.185567C15.8351 0.268041 13.0309 2.74227 13.0309 5.87629C13.0309 8.35052 14.8454 10.4124 15.6701 11.1546V14.0412C15.5052 13.7938 15.2577 13.4639 15.0103 13.2165C12.2887 10.4124 7.58763 10.6598 7.42268 10.6598C7.01031 10.6598 6.68041 10.9897 6.68041 11.4021C6.68041 11.567 6.26804 16.268 8.98969 19.0722C11.0515 21.2165 14.268 21.5464 15.7526 21.6289V27.0722C15.2577 26.1649 14.6804 25.3402 13.9381 24.5979C10.0619 20.8866 3.62887 21.4639 3.38144 21.4639C2.96907 21.5464 2.63918 21.7938 2.63918 22.2062C2.63918 22.4536 2.2268 28.9691 6.10309 32.6804C7.34021 33.8351 8.82474 34.5773 10.3093 35.0722H0V36.8041Z" fill="#66666B"/>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

@@ -0,0 +1,3 @@
<svg width="32" height="33" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M32 16.0045C32 7.12929 24.798 0 15.9955 0C11.7033 0 7.62947 1.74595 4.64681 4.80136C4.64681 4.80136 4.64681 4.80136 4.57406 4.80136V4.87411C-1.53676 11.0577 -1.53676 21.0969 4.64681 27.2804V27.3532H4.71956C10.9031 33.5368 20.8696 33.6095 27.1259 27.4987H27.1986C27.1986 27.4987 27.1986 27.4987 27.1986 27.4259C30.2541 24.3705 32 20.2966 32 16.0045ZM26.6894 25.8255L21.5243 20.6604C23.7795 17.9687 23.8522 14.0403 21.5971 11.3487L26.7622 6.18357C31.8545 11.8579 31.7818 20.3694 26.6894 25.8255ZM11.9216 20.1512C9.73916 17.8232 9.81191 14.1131 12.1398 11.9306C14.395 9.82096 17.8869 9.82096 20.1421 11.9306C22.3245 14.2586 22.2518 17.9687 19.9239 20.1512C17.6687 22.2608 14.104 22.2608 11.9216 20.1512ZM25.6709 5.23784L20.5058 10.4029C17.8142 8.22051 13.8858 8.22051 11.1941 10.4757L6.10177 5.31059C11.6306 0.218244 20.1421 0.145496 25.6709 5.23784ZM5.15604 6.40181L10.3211 11.5669C8.21145 14.2586 8.2842 18.0415 10.3939 20.6604L5.22879 25.8255C0.20919 20.2966 0.209191 11.9306 5.15604 6.40181ZM6.24726 26.7712L11.4124 21.6061C14.0313 23.7158 17.8142 23.7885 20.5058 21.6789L25.6709 26.844C20.0694 31.8636 11.7034 31.7908 6.24726 26.7712Z" fill="#66666B"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,3 @@
<svg width="32" height="31" viewBox="0 0 32 31" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0.571739 15.7671C0.48874 15.6841 0.476861 15.528 0.54195 15.4353L0.571732 15.4055L0.571739 15.4055L15.0758 0.901373L15.0824 0.894828L15.0887 0.888045C15.5542 0.386712 16.3523 0.383294 16.8193 0.807326L16.8624 0.850481L16.8624 0.850491L31.4174 15.4055C31.5275 15.5156 31.5275 15.657 31.4174 15.7671C31.3344 15.8501 31.1783 15.862 31.0856 15.7969L31.0558 15.7671L29.3255 14.0368L28.4719 13.1832V14.3903V29.6069C28.4719 29.8906 28.2378 30.1248 27.9541 30.1248H3.52614C3.24247 30.1248 3.00831 29.8906 3.00831 29.6069V14.8993V13.6921L2.15475 14.5457L0.933356 15.7671C0.823269 15.8772 0.681826 15.8772 0.571739 15.7671ZM15.6183 1.11844L15.5457 1.15472L15.4884 1.2121L3.6815 13.019L3.53506 13.1654V13.3725V29.098V29.598H4.03506H11.1599H11.6599V29.098V18.9197C11.6599 18.636 11.894 18.4019 12.1777 18.4019H19.8115C20.0951 18.4019 20.3293 18.636 20.3293 18.9197V29.098V29.598H20.8293H27.4452H27.9452V29.098V12.8636V12.6565L27.7988 12.51L16.5517 1.26299C16.2637 0.97499 15.8657 0.994735 15.6183 1.11844ZM19.8025 19.4286V18.9286H19.3025H12.6866H12.1866V19.4286V29.098V29.598H12.6866H19.3025H19.8025V29.098V19.4286Z" fill="#66666B" stroke="#66666B"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,3 @@
<svg width="40" height="32" viewBox="0 0 40 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M39.84 21.04L34.16 1.36C33.88 0.56 33.12 0 32.28 0H7.72C6.84 0 6.08 0.56 5.8 1.4L0.12 21C0.04 21.32 0 21.64 0 21.96V28.8C0 30.56 1.44 32 3.2 32H36.8C38.56 32 40 30.56 40 28.8V21.96C40 21.64 39.96 21.32 39.84 21.04ZM7.36 1.88C7.4 1.72 7.56 1.6 7.72 1.6H32.28C32.44 1.6 32.56 1.68 32.64 1.84L37.72 19.36C37.4 19.24 37.12 19.2 36.8 19.2H3.2C2.88 19.2 2.6 19.24 2.28 19.36L7.36 1.88ZM38.4 28.8C38.4 29.68 37.68 30.4 36.8 30.4H3.2C2.32 30.4 1.6 29.68 1.6 28.8V22.4C1.6 21.52 2.32 20.8 3.2 20.8H36.8C37.68 20.8 38.4 21.52 38.4 22.4V28.8ZM8 25.6C8 26.48 7.28 27.2 6.4 27.2C5.52 27.2 4.8 26.48 4.8 25.6C4.8 24.72 5.52 24 6.4 24C7.28 24 8 24.72 8 25.6ZM12.8 25.6C12.8 26.48 12.08 27.2 11.2 27.2C10.32 27.2 9.6 26.48 9.6 25.6C9.6 24.72 10.32 24 11.2 24C12.08 24 12.8 24.72 12.8 25.6ZM17.6 25.6C17.6 26.48 16.88 27.2 16 27.2C15.12 27.2 14.4 26.48 14.4 25.6C14.4 24.72 15.12 24 16 24C16.88 24 17.6 24.72 17.6 25.6ZM20.8 24H35.2V25.6H20.8V24Z" fill="#66666B"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,3 @@
<svg width="34" height="34" viewBox="0 0 34 34" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M22.7182 0.863589L22.7173 0.863515C19.3565 0.591019 16.0386 1.77164 13.6739 4.1814C11.9775 5.87811 10.8517 8.10021 10.468 10.4609C8.10909 10.843 5.92902 11.9263 4.18793 13.6674C2.27942 15.5759 1.09804 18.1202 0.87072 20.8014C0.598129 23.8466 1.55295 26.8011 3.50666 29.1183C5.46024 31.4353 8.23279 32.8904 11.2789 33.1178C14.6394 33.3901 17.9571 32.2095 20.3216 29.7999C22.018 28.1032 23.1444 25.9236 23.5279 23.5204C25.8867 23.1381 28.0666 22.0549 29.8076 20.3139C31.716 18.4055 32.8973 15.8614 33.1247 13.1805C33.7154 6.95136 29.0327 1.40873 22.7182 0.863589ZM10.3486 11.899C10.267 14.7277 11.1772 17.4613 13.0378 19.6762L13.038 19.6765C14.9915 21.9934 17.764 23.4484 20.8099 23.6759C21.2798 23.7151 21.7166 23.7205 22.1773 23.6923C21.793 25.6729 20.8038 27.4802 19.447 28.837C17.4237 30.8603 14.5654 32.0036 11.4866 31.7398C5.9444 31.256 1.85401 26.4182 2.2934 20.8761C2.51359 18.4122 3.56911 16.2579 5.19613 14.6309C6.59747 13.2295 8.36737 12.2795 10.3486 11.899ZM20.9277 22.2531L20.9272 22.2531C15.4803 21.8173 11.4144 17.107 11.7257 11.6721C12.2028 11.6399 12.6798 11.6436 13.1569 11.6834C18.6051 12.1631 22.6699 16.8745 22.3594 22.2645C21.8822 22.2967 21.405 22.2929 20.9277 22.2531ZM28.8906 19.3487L28.8889 19.3504C27.4878 20.7515 25.7182 21.7015 23.7374 22.0821C23.9359 16.0407 19.3833 10.7996 13.2758 10.3054C12.8054 10.2662 12.3681 10.2607 11.9069 10.289C12.2903 8.27033 13.2795 6.50273 14.638 5.14427C16.6613 3.12093 19.5197 1.97764 22.5985 2.2415C28.1422 2.72553 32.2753 7.56451 31.7917 13.1046C31.5715 15.5702 30.5152 17.768 28.8906 19.3487Z" fill="#66666B" stroke="#66666B" stroke-width="0.35"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1,3 @@
<svg width="32" height="39" viewBox="0 0 32 39" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M30.5735 13.9987H30.3807L29.6482 11.7625L25.9855 0.543235C25.9084 0.350464 25.7928 0.196248 25.6 0.0805849C25.4072 0.00347644 25.2145 -0.0350778 25.0217 0.0420307L5.16626 6.59625L1.69639 7.75287C1.31084 7.86854 1.07952 8.33119 1.19518 8.71673L2.93012 13.9987H1.42651C0.616867 13.9987 0 14.6541 0 15.4252V36.63C0 37.4396 0.655422 38.0565 1.42651 38.0565H30.5735C31.3831 38.0565 32 37.4011 32 36.63V15.4252C32 14.6541 31.3831 13.9987 30.5735 13.9987ZM30.4578 28.2252H22.9398V23.8685H30.4964L30.4578 28.2252ZM2.89157 8.83239L24.7518 1.66131L28.8771 13.9215L21.4747 13.9987C21.9373 12.7649 21.9759 11.4155 21.5518 10.1432C20.5494 7.09745 17.2337 5.40107 14.188 6.40348C12.7229 6.90468 11.4892 7.90709 10.7952 9.3336C10.1012 10.7601 9.98554 12.3023 10.4482 13.8059C10.4867 13.883 10.4867 13.9601 10.5253 14.0372H4.5494L2.89157 8.83239ZM19.0072 13.9987C19.2771 13.4975 19.3157 12.9191 19.1614 12.3408C18.9687 11.8011 18.6217 11.377 18.0819 11.1071C17.6578 10.9143 17.2337 10.8372 16.7711 10.9143C16.694 10.9143 16.6169 10.9143 16.5398 10.9529L16.4241 10.9914L16.0386 9.87336L16.1542 9.8348C16.5398 9.71914 16.7711 9.25649 16.6554 8.87095C16.5398 8.4854 16.0771 8.25408 15.6916 8.36974L15.5759 8.4083V8.25408C15.4988 8.02275 15.306 7.82998 15.0747 7.75287C16.0386 7.5601 17.041 7.67577 17.9277 8.09986C18.9687 8.60107 19.7012 9.48781 20.0867 10.6059C20.4723 11.724 20.3566 12.9577 19.7783 13.9987H19.0072ZM12.2217 13.9987C12.106 13.7673 11.9904 13.536 11.9133 13.3047C11.5663 12.2252 11.6434 11.03 12.1446 10.0276C12.6072 9.14083 13.3398 8.44685 14.2265 8.06131C14.0723 8.25408 14.0337 8.52396 14.1108 8.75528L14.1494 8.9095C13.6096 9.10227 13.1855 9.44926 12.9157 9.95047C12.6458 10.4517 12.6072 11.03 12.8 11.5697C12.9928 12.1095 13.3398 12.5336 13.8795 12.8035C14.188 12.9577 14.4964 13.0348 14.8434 13.0348C14.959 13.0348 15.0747 13.0348 15.2289 12.9962C15.306 12.9962 15.3446 12.9962 15.4217 12.9577L15.5373 12.9191L15.8843 13.9987H12.2217ZM14.3422 10.6444C14.4193 10.5288 14.5349 10.4131 14.6506 10.3746L14.9976 11.4926C14.8434 11.5312 14.6892 11.5312 14.5735 11.4541C14.4193 11.377 14.3422 11.2613 14.2651 11.1071C14.2651 10.9529 14.2651 10.7987 14.3422 10.6444ZM17.3494 13.5746L17.0024 12.4565C17.1566 12.4179 17.3108 12.4179 17.4265 12.495C17.5807 12.5722 17.6578 12.6878 17.7349 12.842C17.812 13.1505 17.6193 13.4589 17.3494 13.5746ZM1.54217 36.5529V15.5408H4.00964H11.759H20.2024C20.2024 15.5408 20.2024 15.5408 20.241 15.5408H26.4867H30.4964V22.3264H22.8241C22.0145 22.3264 21.3976 22.9818 21.3976 23.7529V28.3408C21.3976 29.1505 22.053 29.7673 22.8241 29.7673H30.4578V36.5529H1.54217Z" fill="#66666B"/>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

+1 -12
View File
@@ -1,20 +1,9 @@
export const presentFarmer = "FARMER";
export const presentPlotter = "PLOTTER";
export const presentHarvester = "HARVESTER";
export const changeFarmerMenu = item => ({ type: "FARMER_MENU", item: item });
const initial_state = {
view: presentFarmer
};
const initial_state = {};
export const farmerMenuReducer = (state = { ...initial_state }, action) => {
switch (action.type) {
case "LOG_OUT":
return { ...initial_state };
case "FARMER_MENU":
var item = action.item;
return { ...state, view: item };
default:
return state;
}
+1
View File
@@ -1,6 +1,7 @@
export const presentWallet = "WALLET";
export const presentNode = "NODE";
export const presentFarmer = "FARMER";
export const presentPlotter = "PLOTTER";
export const presentTrading = "TRADING";
export const changeMainMenu = item => ({ type: "MAIN_MENU", item: item });
+21 -40
View File
@@ -7,24 +7,24 @@ import AppBar from "@material-ui/core/AppBar";
import Toolbar from "@material-ui/core/Toolbar";
import Typography from "@material-ui/core/Typography";
import Divider from "@material-ui/core/Divider";
import IconButton from "@material-ui/core/IconButton";
import Container from "@material-ui/core/Container";
import ChevronLeftIcon from "@material-ui/icons/ChevronLeft";
import logo from "../assets/img/chia_logo.svg"; // Tell webpack this JS file uses this image
import Wallets from "./Wallets";
import MenuIcon from "@material-ui/icons/Menu";
import { SideBar } from "./sidebar";
import { useSelector } from "react-redux";
import Plotter from "./Plotter";
import {
presentWallet,
presentNode,
presentFarmer,
presentTrading
presentTrading,
presentPlotter
} from "../modules/mainMenu";
import FullNode from "./FullNode";
import Farmer from "./Farmer";
import { TradeManger } from "./trading/TradeManager";
const drawerWidth = 200;
const drawerWidth = 100;
const useStyles = makeStyles(theme => ({
root: {
@@ -73,17 +73,6 @@ const useStyles = makeStyles(theme => ({
duration: theme.transitions.duration.enteringScreen
})
},
drawerPaperClose: {
overflowX: "hidden",
transition: theme.transitions.create("width", {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen
}),
width: theme.spacing(7),
[theme.breakpoints.up("sm")]: {
width: theme.spacing(9)
}
},
appBarSpacer: theme.mixins.toolbar,
content: {
flexGrow: 1,
@@ -112,6 +101,13 @@ const useStyles = makeStyles(theme => ({
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen
})
},
logo: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
marginLeft: theme.spacing(2),
marginRight: theme.spacing(2),
width: "62px"
}
}));
@@ -124,6 +120,8 @@ const ComopnentSwitch = () => {
return <FullNode></FullNode>;
} else if (toPresent === presentFarmer) {
return <Farmer></Farmer>;
} else if (toPresent === presentPlotter) {
return <Plotter></Plotter>;
} else if (toPresent === presentTrading) {
return <TradeManger></TradeManger>;
}
@@ -132,14 +130,8 @@ const ComopnentSwitch = () => {
export default function Dashboard() {
const classes = useStyles();
const [open, setOpen] = React.useState(true);
const [open] = React.useState(true);
const toPresent = useSelector(state => state.main_menu.view);
const handleDrawerOpen = () => {
setOpen(true);
};
const handleDrawerClose = () => {
setOpen(false);
};
let title;
if (toPresent === presentWallet) {
title = "Wallets";
@@ -147,6 +139,10 @@ export default function Dashboard() {
title = "Full Node";
} else if (toPresent === presentFarmer) {
title = "Farming";
} else if (toPresent === presentPlotter) {
title = "Plotting";
} else if (toPresent === presentTrading) {
title = "Trading";
}
return (
@@ -157,18 +153,6 @@ export default function Dashboard() {
className={clsx(classes.appBar, open && classes.appBarShift)}
>
<Toolbar className={classes.toolbar}>
<IconButton
edge="start"
color="inherit"
aria-label="open drawer"
onClick={handleDrawerOpen}
className={clsx(
classes.menuButton,
open && classes.menuButtonHidden
)}
>
<MenuIcon />
</IconButton>
<Typography
component="h1"
variant="h6"
@@ -183,14 +167,11 @@ export default function Dashboard() {
<Drawer
variant="permanent"
classes={{
paper: clsx(classes.drawerPaper, !open && classes.drawerPaperClose)
paper: clsx(classes.drawerPaper)
}}
open={open}
>
<div className={classes.toolbarIcon}>
<IconButton onClick={handleDrawerClose}>
<ChevronLeftIcon />
</IconButton>
<img className={classes.logo} src={logo} alt="Logo" />
</div>
<Divider />
<SideBar></SideBar>
+25 -81
View File
@@ -1,5 +1,4 @@
import React, { Component } from "react";
import CssBaseline from "@material-ui/core/CssBaseline";
import Grid from "@material-ui/core/Grid";
import { makeStyles, withStyles } from "@material-ui/core/styles";
import Container from "@material-ui/core/Container";
@@ -9,8 +8,6 @@ import Box from "@material-ui/core/Box";
import {
Paper,
TableRow,
Drawer,
Divider,
List,
ListItem,
ListItemText,
@@ -37,9 +34,6 @@ import TablePagination from "@material-ui/core/TablePagination";
import RefreshIcon from "@material-ui/icons/Refresh";
import Connections from "./Connections";
import Plotter from "./Plotter";
import { presentFarmer } from "../modules/farmer_menu";
import { presentPlotter, changeFarmerMenu } from "../modules/farmer_menu";
import { big_int_to_array, arr_to_hex, sha256 } from "../util/utils";
import { mojo_to_chia_string } from "../util/chia";
import HelpIcon from "@material-ui/icons/Help";
@@ -535,74 +529,35 @@ const FarmerContent = props => {
const closeConnectionCallback = node_id => {
dispatch(closeConnection(node_id));
};
const to_present = useSelector(state => state.farmer_menu.view);
if (to_present === presentFarmer) {
return (
<Container maxWidth="lg" className={classes.container}>
<Grid container spacing={3}>
{/* Chart */}
<Grid item xs={12}>
<FarmerStatus
totalChiaFarmed={props.totalChiaFarmed}
biggestHeight={props.biggestHeight}
></FarmerStatus>
</Grid>
<Grid item xs={12}>
<Challenges></Challenges>
</Grid>
<Grid item xs={12}>
<Plots></Plots>
</Grid>
<Grid item xs={12}>
<Connections
connections={connections}
connectionError={connectionError}
openConnection={openConnectionCallback}
closeConnection={closeConnectionCallback}
></Connections>
</Grid>
return (
<Container maxWidth="lg" className={classes.container}>
<Grid container spacing={3}>
{/* Chart */}
<Grid item xs={12}>
<FarmerStatus
totalChiaFarmed={props.totalChiaFarmed}
biggestHeight={props.biggestHeight}
></FarmerStatus>
</Grid>
</Container>
);
} else {
return <Plotter></Plotter>;
}
};
const FarmerListItem = props => {
const dispatch = useDispatch();
const label = props.label;
const type = props.type;
function present() {
if (type === presentFarmer) {
dispatch(changeFarmerMenu(presentFarmer));
} else if (type === presentPlotter) {
dispatch(changeFarmerMenu(presentPlotter));
}
}
return (
<ListItem button onClick={present}>
<ListItemText primary={label} />
</ListItem>
<Grid item xs={12}>
<Challenges></Challenges>
</Grid>
<Grid item xs={12}>
<Plots></Plots>
</Grid>
<Grid item xs={12}>
<Connections
connections={connections}
connectionError={connectionError}
openConnection={openConnectionCallback}
closeConnection={closeConnectionCallback}
></Connections>
</Grid>
</Grid>
</Container>
);
};
const FarmerMenuList = () => {
return (
<List>
<FarmerListItem
label="Farmer & Harvester"
type={presentFarmer}
></FarmerListItem>
<Divider />
<FarmerListItem label="Plotter" type={presentPlotter}></FarmerListItem>
<Divider />
</List>
);
};
class Farmer extends Component {
constructor(props) {
super(props);
@@ -671,19 +626,8 @@ class Farmer extends Component {
render() {
const classes = this.props.classes;
var open = true;
return (
<div className={classes.root}>
<CssBaseline />
<Drawer
variant="permanent"
classes={{
paper: classes.drawerPaper
}}
open={open}
>
<FarmerMenuList></FarmerMenuList>
</Drawer>
<main className={classes.content}>
<Container maxWidth="lg" className={classes.noPadding}>
<FarmerContent
+63
View File
@@ -16,6 +16,12 @@ import { log_in, delete_key, get_private_key } from "../modules/message";
import Link from "@material-ui/core/Link";
import Button from "@material-ui/core/Button";
import VisibilityIcon from "@material-ui/icons/Visibility";
import { delete_all_keys } from "../modules/message";
import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogContentText from "@material-ui/core/DialogContentText";
import DialogTitle from "@material-ui/core/DialogTitle";
import {
changeEntranceMenu,
presentOldWallet,
@@ -53,6 +59,13 @@ const useStyles = makeStyles(theme => ({
marginTop: theme.spacing(2),
marginBottom: theme.spacing(1)
},
bottomButtonRed: {
width: 400,
height: 45,
marginTop: theme.spacing(2),
marginBottom: theme.spacing(1),
color: "red"
},
logo: {
marginTop: theme.spacing(8),
marginBottom: theme.spacing(3)
@@ -82,6 +95,8 @@ const SelectKey = () => {
state => state.wallet_state.public_key_fingerprints
);
const [open, setOpen] = React.useState(false);
const handleClick = fingerprint => {
return () => dispatch(log_in(fingerprint));
};
@@ -94,6 +109,20 @@ const SelectKey = () => {
dispatch(delete_key(fingerprint));
};
};
const handleClickOpen = () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};
const handleCloseDelete = () => {
handleClose();
dispatch(delete_all_keys());
};
const goToMnemonics = () => {
dispatch(changeEntranceMenu(presentOldWallet));
};
@@ -187,8 +216,42 @@ const SelectKey = () => {
Create a new private key
</Button>
</Link>
<Link onClick={handleClickOpen}>
<Button
type="submit"
fullWidth
variant="contained"
color="primary"
className={classes.bottomButtonRed}
>
Delete all keys
</Button>
</Link>
</div>
</Container>
<Dialog
open={open}
onClose={handleClose}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">{"Delete all keys"}</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
Deleting all keys will permanatly remove the keys from your
computer, make sure you have backups. Are you sure you want to
continue?
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleClose} color="secondary">
Back
</Button>
<Button onClick={handleCloseDelete} color="secondary" autoFocus>
Delete
</Button>
</DialogActions>
</Dialog>
</div>
);
};
+69 -95
View File
@@ -1,137 +1,111 @@
import React from "react";
import ListItem from "@material-ui/core/ListItem";
import ListItemIcon from "@material-ui/core/ListItemIcon";
import ListItemText from "@material-ui/core/ListItemText";
import {
presentWallet,
presentNode,
presentFarmer,
changeMainMenu,
presentTrading
presentTrading,
presentPlotter
} from "../modules/mainMenu";
import { delete_all_keys, logOut } from "../modules/message";
import { useSelector } from "react-redux";
import { logOut } from "../modules/message";
import { useDispatch } from "react-redux";
import List from "@material-ui/core/List";
import Divider from "@material-ui/core/Divider";
import AccountBalanceWalletIcon from "@material-ui/icons/AccountBalanceWallet";
import AccountTreeIcon from "@material-ui/icons/AccountTree";
import DonutLargeIcon from "@material-ui/icons/DonutLarge";
import LockIcon from "@material-ui/icons/Lock";
import DeleteForeverIcon from "@material-ui/icons/DeleteForever";
import Button from "@material-ui/core/Button";
import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogContentText from "@material-ui/core/DialogContentText";
import DialogTitle from "@material-ui/core/DialogTitle";
import { changeEntranceMenu, presentSelectKeys } from "../modules/entranceMenu";
import ImportExportIcon from "@material-ui/icons/ImportExport";
import walletSidebarLogo from "../assets/img/wallet_sidebar.svg"; // Tell webpack this JS file uses this image
import farmSidebarLogo from "../assets/img/farm_sidebar.svg";
import helpSidebarLogo from "../assets/img/help_sidebar.svg";
import homeSidebarLogo from "../assets/img/home_sidebar.svg";
import plotSidebarLogo from "../assets/img/plot_sidebar.svg";
import poolSidebarLogo from "../assets/img/pool_sidebar.svg";
import { makeStyles } from "@material-ui/core/styles";
const useStyles = makeStyles(theme => ({
div: {
textAlign: "center",
cursor: "pointer"
},
label: {
fontFamily: "Roboto",
fontWeight: "300",
fontSize: "16px",
fontStyle: "normal",
marginTop: "5px"
},
labelChosen: {
fontFamily: "Roboto",
fontWeight: "500",
fontSize: "16px",
fontStyle: "normal",
marginTop: "5px"
}
}));
const menuItems = [
{
label: "Wallet",
present: presentWallet,
icon: <AccountBalanceWalletIcon></AccountBalanceWalletIcon>
},
{
label: "Full Node",
present: presentNode,
icon: <AccountTreeIcon></AccountTreeIcon>
icon: <img src={homeSidebarLogo} alt="Logo" />
},
{
label: "Farming",
label: "Wallet",
present: presentWallet,
icon: <img src={walletSidebarLogo} alt="Logo" />
},
{
label: "Plot",
present: presentPlotter,
icon: <img src={plotSidebarLogo} alt="Logo" />
},
{
label: "Farm",
present: presentFarmer,
icon: <DonutLargeIcon></DonutLargeIcon>
icon: <img src={farmSidebarLogo} alt="Logo" />
},
{
label: "Trading",
label: "Trade",
present: presentTrading,
icon: <ImportExportIcon></ImportExportIcon>
icon: <img src={poolSidebarLogo} alt="Logo" />
},
{
label: "Keys",
changeKeys: true,
icon: <img src={helpSidebarLogo} alt="Logo" />
}
];
const MenuItem = menuItem => {
const MenuItem = (menuItem, currentView) => {
const classes = useStyles();
const dispatch = useDispatch();
const item = menuItem;
function presentMe() {
dispatch(changeMainMenu(item.present));
if (item.changeKeys) {
dispatch(logOut("log_out", {}));
dispatch(changeEntranceMenu(presentSelectKeys));
} else {
dispatch(changeMainMenu(item.present));
}
}
const labelClass =
currentView === item.present ? classes.labelChosen : classes.label;
return (
<ListItem button onClick={presentMe} key={item.label}>
<ListItemIcon>{item.icon}</ListItemIcon>
<ListItemText primary={item.label} />
</ListItem>
<div className={classes.div} onClick={presentMe} key={item.label}>
{item.icon}
<p className={labelClass}>{item.label}</p>
</div>
);
};
export const SideBar = () => {
const [open, setOpen] = React.useState(false);
const dispatch = useDispatch();
const handleClickOpen = () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};
const handleCloseDelete = () => {
handleClose();
dispatch(delete_all_keys());
};
function changeKey() {
// console.log("Changing key");
dispatch(logOut("log_out", {}));
dispatch(changeEntranceMenu(presentSelectKeys));
}
const currentView = useSelector(state => state.main_menu.view);
return (
<div>
<List>{menuItems.map(item => MenuItem(item))}</List>
<List>{menuItems.map(item => MenuItem(item, currentView))}</List>
<Divider />
<List>
<div>
<ListItem button onClick={handleClickOpen} key="0">
<ListItemIcon>
<DeleteForeverIcon />
</ListItemIcon>
<ListItemText primary="Delete All Keys" />
</ListItem>
<ListItem button onClick={changeKey} key="1">
<ListItemIcon>
<LockIcon />
</ListItemIcon>
<ListItemText primary="Change Key" />
</ListItem>
</div>
</List>
<Dialog
open={open}
onClose={handleClose}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">{"Delete all keys"}</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
Deleting all keys will permanatly remove the keys from your
computer, make sure you have backups. Are you sure you want to
continue?
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleClose} color="secondary">
Back
</Button>
<Button onClick={handleCloseDelete} color="secondary" autoFocus>
Delete
</Button>
</DialogActions>
</Dialog>
</div>
);
};
@@ -209,7 +209,7 @@ export const CreateOffer = () => {
return;
}
let mojo = chia_to_mojo(amount_input.value);
if (wallets[wallet_id.value].type == "COLOURED_COIN") {
if (wallets[wallet_id.value].type === "COLOURED_COIN") {
mojo = colouredcoin_to_mojo(amount_input.value);
}
var trade = null;
+9 -2
View File
@@ -5,6 +5,7 @@ from typing import Dict, Optional, Tuple, List, AsyncGenerator, Callable
import concurrent
from pathlib import Path
import random
import socket
import logging
import traceback
from blspy import PrivateKey
@@ -271,12 +272,18 @@ class WalletNode:
c.get_peer_info()
for c in self.global_connections.get_full_node_connections()
]
if full_node_peer in peers:
full_node_resolved = PeerInfo(
socket.gethostbyname(full_node_peer.host), full_node_peer.port
)
if full_node_peer in peers or full_node_resolved in peers:
self.log.info(
f"Will not attempt to connect to other nodes, already connected to {full_node_peer}"
)
for connection in self.global_connections.get_full_node_connections():
if connection.get_peer_info() != full_node_peer:
if (
connection.get_peer_info() != full_node_peer
and connection.get_peer_info() != full_node_resolved
):
self.log.info(
f"Closing unnecessary connection to {connection.get_peer_info()}."
)