diff --git a/.eslintrc.json b/.eslintrc.json index 2214c83d..0fb00d7c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,7 +4,7 @@ "settings": { "react": { "version": "detect" - } + } }, "rules": { "prettier/prettier": "warn" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 159c780c..70a0c1ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,6 @@ on: pull_request: branches: [master] - jobs: build-althea-dash: runs-on: ubuntu-latest @@ -19,4 +18,4 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build - run: yarn && yarn test \ No newline at end of file + run: yarn && yarn test diff --git a/craco.config.js b/craco.config.js index 369ff0f5..11312b1b 100644 --- a/craco.config.js +++ b/craco.config.js @@ -3,7 +3,7 @@ const fs = require("fs"); const glob = require("glob-all"); const appDirectory = fs.realpathSync(process.cwd()); -const resolveApp = relativePath => path.resolve(appDirectory, relativePath); +const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath); const PurgecssPlugin = require("purgecss-webpack-plugin"); @@ -13,9 +13,9 @@ module.exports = { new PurgecssPlugin({ paths: [ resolveApp("public/index.html"), - ...glob.sync(`${resolveApp("src")}/**/**/*`, { nodir: true }) - ] - }) - ] - } + ...glob.sync(`${resolveApp("src")}/**/**/*`, { nodir: true }), + ], + }), + ], + }, }; diff --git a/public/_font.scss b/public/_font.scss index 6a6d8120..5b7597b7 100755 --- a/public/_font.scss +++ b/public/_font.scss @@ -1,59 +1,65 @@ @font-face { - font-family: "Akkurat"; - src: url("../fonts_subsetted/lineto-akkurat-bold.eot"); - src: url("../fonts_subsetted/lineto-akkurat-bold.eot?#iefix") format("embedded-opentype"), - url("../fonts_subsetted/lineto-akkurat-bold.woff2") format("woff2"), - url("../fonts_subsetted/lineto-akkurat-bold.woff") format("woff"); - font-weight: bold; - font-style: normal; + font-family: "Akkurat"; + src: url("../fonts_subsetted/lineto-akkurat-bold.eot"); + src: url("../fonts_subsetted/lineto-akkurat-bold.eot?#iefix") + format("embedded-opentype"), + url("../fonts_subsetted/lineto-akkurat-bold.woff2") format("woff2"), + url("../fonts_subsetted/lineto-akkurat-bold.woff") format("woff"); + font-weight: bold; + font-style: normal; } @font-face { - font-family: "Akkurat"; - src: url("../fonts_subsetted/lineto-akkurat-bolditalic.eot"); - src: url("../fonts_subsetted/lineto-akkurat-bolditalic.eot?#iefix") format("embedded-opentype"), - url("../fonts_subsetted/lineto-akkurat-bolditalic.woff2") format("woff2"), - url("../fonts_subsetted/lineto-akkurat-bolditalic.woff") format("woff"); - font-weight: bold; - font-style: italic; + font-family: "Akkurat"; + src: url("../fonts_subsetted/lineto-akkurat-bolditalic.eot"); + src: url("../fonts_subsetted/lineto-akkurat-bolditalic.eot?#iefix") + format("embedded-opentype"), + url("../fonts_subsetted/lineto-akkurat-bolditalic.woff2") format("woff2"), + url("../fonts_subsetted/lineto-akkurat-bolditalic.woff") format("woff"); + font-weight: bold; + font-style: italic; } @font-face { - font-family: "Akkurat"; - src: url("../fonts_subsetted/lineto-akkurat-italic.eot"); - src: url("../fonts_subsetted/lineto-akkurat-italic.eot?#iefix") format("embedded-opentype"), - url("../fonts_subsetted/lineto-akkurat-italic.woff2") format("woff2"), - url("../fonts_subsetted/lineto-akkurat-italic.woff") format("woff"); - font-weight: normal; - font-style: italic; + font-family: "Akkurat"; + src: url("../fonts_subsetted/lineto-akkurat-italic.eot"); + src: url("../fonts_subsetted/lineto-akkurat-italic.eot?#iefix") + format("embedded-opentype"), + url("../fonts_subsetted/lineto-akkurat-italic.woff2") format("woff2"), + url("../fonts_subsetted/lineto-akkurat-italic.woff") format("woff"); + font-weight: normal; + font-style: italic; } @font-face { - font-family: "Akkurat"; - src: url("../fonts_subsetted/lineto-akkurat-light.eot"); - src: url("../fonts_subsetted/lineto-akkurat-light.eot?#iefix") format("embedded-opentype"), - url("../fonts_subsetted/lineto-akkurat-light.woff2") format("woff2"), - url("../fonts_subsetted/lineto-akkurat-light.woff") format("woff"); - font-weight: 200; - font-style: normal; + font-family: "Akkurat"; + src: url("../fonts_subsetted/lineto-akkurat-light.eot"); + src: url("../fonts_subsetted/lineto-akkurat-light.eot?#iefix") + format("embedded-opentype"), + url("../fonts_subsetted/lineto-akkurat-light.woff2") format("woff2"), + url("../fonts_subsetted/lineto-akkurat-light.woff") format("woff"); + font-weight: 200; + font-style: normal; } @font-face { - font-family: "Akkurat"; - src: url("../fonts_subsetted/lineto-akkurat-lightitalic.eot"); - src: url("../fonts_subsetted/lineto-akkurat-lightitalic.eot?#iefix") format("embedded-opentype"), - url("../fonts_subsetted/lineto-akkurat-lightitalic.woff2") format("woff2"), - url("../fonts_subsetted/lineto-akkurat-lightitalic.woff") format("woff"); - font-weight: lighter; - font-style: italic; + font-family: "Akkurat"; + src: url("../fonts_subsetted/lineto-akkurat-lightitalic.eot"); + src: url("../fonts_subsetted/lineto-akkurat-lightitalic.eot?#iefix") + format("embedded-opentype"), + url("../fonts_subsetted/lineto-akkurat-lightitalic.woff2") format("woff2"), + url("../fonts_subsetted/lineto-akkurat-lightitalic.woff") format("woff"); + font-weight: lighter; + font-style: italic; } @font-face { - font-family: "Akkurat"; - src: url("../fonts_subsetted/lineto-akkurat-regular.eot"); - src: url("../fonts_subsetted/lineto-akkurat-regular.eot?#iefix") format("embedded-opentype"), - url("../fonts_subsetted/lineto-akkurat-regular.woff2") format("woff2"), - url("../fonts_subsetted/lineto-akkurat-regular.woff") format("woff"); - font-weight: normal; - font-style: normal; + font-family: "Akkurat"; + src: url("../fonts_subsetted/lineto-akkurat-regular.eot"); + src: url("../fonts_subsetted/lineto-akkurat-regular.eot?#iefix") + format("embedded-opentype"), + url("../fonts_subsetted/lineto-akkurat-regular.woff2") format("woff2"), + url("../fonts_subsetted/lineto-akkurat-regular.woff") format("woff"); + font-weight: normal; + font-style: normal; } diff --git a/public/index.html b/public/index.html index 4623c820..ca7767e0 100644 --- a/public/index.html +++ b/public/index.html @@ -1,22 +1,37 @@ - - - - - - - - - - + + + + + + + + + + Althea Router Dashboard - +
diff --git a/public/manifest.json b/public/manifest.json index 9044f4db..43bd1084 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,19 +1,19 @@ { - "name": "Althea Dashboard", - "short_name": "Althea Dashboard", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-256x256.png", - "sizes": "256x256", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" + "name": "Althea Dashboard", + "short_name": "Althea Dashboard", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-256x256.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" } diff --git a/src/AdvancedSettings/AdvancedDebugging.js b/src/AdvancedSettings/AdvancedDebugging.js index a4d9548a..50655f1f 100644 --- a/src/AdvancedSettings/AdvancedDebugging.js +++ b/src/AdvancedSettings/AdvancedDebugging.js @@ -21,7 +21,7 @@ const AdvancedDebugging = () => { const [{ isGateway, neighbors, selectedExit }, dispatch] = useStore(); const getNeighbors = useCallback( - async signal => { + async (signal) => { try { let neighbors = await get("/neighbors", true, 10000, signal); if (neighbors instanceof Error) return; @@ -38,25 +38,25 @@ const AdvancedDebugging = () => { } let hasNeighborRoute = - neighbors.filter(n => n.routeMetric < 65000).length > 0; + neighbors.filter((n) => n.routeMetric < 65000).length > 0; let hasExitRoute = - neighbors.filter(n => n.routeMetricToExit < 65000).length > 0; + neighbors.filter((n) => n.routeMetricToExit < 65000).length > 0; let indicators = { haveRoute, isReachable, - isTunnelWorking + isTunnelWorking, }; if (!isGateway) indicators = { hasNeighborRoute, hasExitRoute, - ...indicators + ...indicators, }; - const haveProblem = Object.values(indicators).findIndex(v => !v) >= 0; + const haveProblem = Object.values(indicators).findIndex((v) => !v) >= 0; useInterval(getNeighbors, 10000); @@ -66,7 +66,7 @@ const AdvancedDebugging = () => {

{t("advancedDebugging")}

- {Object.keys(indicators).map(indicator => ( + {Object.keys(indicators).map((indicator) => (
{t(indicator)} diff --git a/src/AdvancedSettings/BandwidthLimit.js b/src/AdvancedSettings/BandwidthLimit.js index 625dfc44..dd9eae44 100644 --- a/src/AdvancedSettings/BandwidthLimit.js +++ b/src/AdvancedSettings/BandwidthLimit.js @@ -11,7 +11,7 @@ import { InputGroupAddon, InputGroupText, Label, - Progress + Progress, } from "reactstrap"; import { get, post } from "store"; import { Card } from "ui"; @@ -57,7 +57,7 @@ const BandwidthLimit = () => { } } - const submit = async e => { + const submit = async (e) => { e.preventDefault(); setLoading(true); @@ -95,7 +95,7 @@ const BandwidthLimit = () => { name="bandwidth" id="selfLimitSpeed" placeholder={t("enterSpeed")} - onChange={e => { + onChange={(e) => { setLimit(e.target.value); setUnsavedChanges(true); }} @@ -108,7 +108,7 @@ const BandwidthLimit = () => { style={{ background: "#F8F9FA", fontSize: 14, - color: "#888" + color: "#888", }} > Mbps diff --git a/src/AdvancedSettings/BandwidthSelling.js b/src/AdvancedSettings/BandwidthSelling.js index 6178e1f4..80722192 100644 --- a/src/AdvancedSettings/BandwidthSelling.js +++ b/src/AdvancedSettings/BandwidthSelling.js @@ -7,7 +7,7 @@ const BandwidthSelling = () => { const [t] = useTranslation(); const [{ sellingBandwidth }, dispatch] = useStore(); - const check = e => { + const check = (e) => { dispatch({ type: "sellingBandwidth", sellingBandwidth: !sellingBandwidth }); }; @@ -28,7 +28,7 @@ const BandwidthSelling = () => {

diff --git a/src/AdvancedSettings/Blockchain.js b/src/AdvancedSettings/Blockchain.js index 2588c0de..0a874c56 100644 --- a/src/AdvancedSettings/Blockchain.js +++ b/src/AdvancedSettings/Blockchain.js @@ -7,7 +7,7 @@ import { CardBody, Form, FormGroup, - Input + Input, } from "reactstrap"; import { get, post, useStore } from "store"; @@ -35,7 +35,7 @@ const Blockchain = () => { if (!blockchain || !newBlockchain) return null; - let submit = async e => { + let submit = async (e) => { e.preventDefault(); try { await post(`/blockchain/set/${newBlockchain}`); @@ -64,7 +64,7 @@ const Blockchain = () => { label={t("blockchain")} name="blockchain" placeholder={t("enterBlockchain")} - onChange={e => setBlockchain(e.target.value)} + onChange={(e) => setBlockchain(e.target.value)} value={newBlockchain} type="select" className="mr-2 mb-2" diff --git a/src/AdvancedSettings/DaoFee.js b/src/AdvancedSettings/DaoFee.js index b01f598c..d4e5d87d 100644 --- a/src/AdvancedSettings/DaoFee.js +++ b/src/AdvancedSettings/DaoFee.js @@ -12,7 +12,7 @@ import { InputGroupAddon, InputGroupText, Label, - Progress + Progress, } from "reactstrap"; import { get, post, useStore } from "store"; import { toEth, toWei, sleep } from "utils"; @@ -30,7 +30,7 @@ const DaoFee = ({ readonly = false }) => { const [{ symbol }] = useStore(); const [error, setError] = useState(false); - const getDaoFee = useCallback(async signal => { + const getDaoFee = useCallback(async (signal) => { setLoading(true); try { let res = await get("/dao_fee", true, 5000, signal); @@ -44,10 +44,8 @@ const DaoFee = ({ readonly = false }) => { setLoading(false); }, []); - const postDaoFee = async daoFee => { - let daoFeeWei = BigNumber(toWei(daoFee)) - .div(secondsPerMonth) - .toFixed(0); + const postDaoFee = async (daoFee) => { + let daoFeeWei = BigNumber(toWei(daoFee)).div(secondsPerMonth).toFixed(0); try { await post("/dao_fee/" + daoFeeWei.toString(10)); setSuccess(true); @@ -63,7 +61,7 @@ const DaoFee = ({ readonly = false }) => { return () => controller.abort(); }, [getDaoFee]); - const submit = e => { + const submit = (e) => { e.preventDefault(); postDaoFee(daoFee); }; @@ -98,7 +96,7 @@ const DaoFee = ({ readonly = false }) => { setDaoFee(e.target.value)} + onChange={(e) => setDaoFee(e.target.value)} value={daoFee} style={{ borderRight: "none", minWidth: 80 }} readOnly={readonly} @@ -108,7 +106,7 @@ const DaoFee = ({ readonly = false }) => { style={{ background: "#F8F9FA", fontSize: 14, - color: "#888" + color: "#888", }} > {symbol} / {t("month")} diff --git a/src/AdvancedSettings/LightClientAP.js b/src/AdvancedSettings/LightClientAP.js index d8cc6c56..498966d4 100644 --- a/src/AdvancedSettings/LightClientAP.js +++ b/src/AdvancedSettings/LightClientAP.js @@ -11,7 +11,7 @@ const LightClient = () => { uselightClientAP(); - const check = e => { + const check = (e) => { post(`/interfaces/lightclient/${!lightClientAP}`); dispatch({ type: "lightClientAP", lightClientAP: !lightClientAP }); }; diff --git a/src/AdvancedSettings/MeshAP.js b/src/AdvancedSettings/MeshAP.js index a7954306..939b2822 100644 --- a/src/AdvancedSettings/MeshAP.js +++ b/src/AdvancedSettings/MeshAP.js @@ -11,7 +11,7 @@ const Mesh = () => { useMeshAP(); - const check = e => { + const check = (e) => { post(`/interfaces/mesh/${!meshAP}`); dispatch({ type: "meshAP", meshAP: !meshAP }); }; diff --git a/src/AdvancedSettings/NetworkOrganizer.js b/src/AdvancedSettings/NetworkOrganizer.js index 71577676..c571a4b7 100644 --- a/src/AdvancedSettings/NetworkOrganizer.js +++ b/src/AdvancedSettings/NetworkOrganizer.js @@ -9,7 +9,7 @@ import { FormGroup, Input, Label, - Progress + Progress, } from "reactstrap"; import { Address6 } from "ip-address"; import { Error, Success } from "utils"; @@ -50,22 +50,22 @@ const NetworkOrganizer = () => { setEditing(true); }; - const handleIp = e => setIpAddress(e.target.value); - const handleDao = e => setDaoAddress(e.target.value); + const handleIp = (e) => setIpAddress(e.target.value); + const handleDao = (e) => setDaoAddress(e.target.value); const ipValid = ip.isValid(); const daoValid = isAddress(paymentAddress); const daoInvalid = paymentAddress && !isAddress(paymentAddress); const valid = ipValid && !daoInvalid; - const submit = async e => { + const submit = async (e) => { e.preventDefault(); setSaving(true); try { const daos = await get("/dao_list"); await Promise.all( - daos.map(address => post(`/dao_list/remove/${address}`)) + daos.map((address) => post(`/dao_list/remove/${address}`)) ); if (paymentAddress) { diff --git a/src/AdvancedSettings/NodeInformation.js b/src/AdvancedSettings/NodeInformation.js index 21ca6823..4d227a6c 100644 --- a/src/AdvancedSettings/NodeInformation.js +++ b/src/AdvancedSettings/NodeInformation.js @@ -10,7 +10,7 @@ import { InputGroup, InputGroupAddon, InputGroupText, - Label + Label, } from "reactstrap"; import { CopyToClipboard } from "react-copy-to-clipboard"; import { get, useStore } from "store"; @@ -37,7 +37,7 @@ const NodeInformation = () => { init(); }, [dispatch]); - const toggleQR = v => { + const toggleQR = (v) => { if (qr === v) return setQR(""); setQR(v); }; @@ -52,7 +52,7 @@ const NodeInformation = () => { { useRemoteAccess(); - const check = e => { + const check = (e) => { post(`/remote_access/${!remoteAccess}`); dispatch({ type: "remoteAccess", remoteAccess: !remoteAccess }); }; diff --git a/src/AdvancedSettings/RemoteLogging.js b/src/AdvancedSettings/RemoteLogging.js index 7ab28f45..a5c9a843 100644 --- a/src/AdvancedSettings/RemoteLogging.js +++ b/src/AdvancedSettings/RemoteLogging.js @@ -30,7 +30,7 @@ const RemoteLogging = () => { useRemoteLogging(); - const check = async e => { + const check = async (e) => { dispatch({ type: "startWaiting", waiting: 30 }); dispatch({ type: "remoteLogging", remoteLogging: !remoteLogging }); try { @@ -38,7 +38,7 @@ const RemoteLogging = () => { } catch (e) {} }; - const changeLevel = async e => { + const changeLevel = async (e) => { setNewLevel(e.target.value); setError(null); setSuccess(null); diff --git a/src/Backup.js b/src/Backup.js index be89fcac..01acf7e8 100644 --- a/src/Backup.js +++ b/src/Backup.js @@ -6,7 +6,7 @@ import { Modal, ModalHeader, ModalBody, - Tooltip + Tooltip, } from "reactstrap"; import { get, post, useStore } from "store"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -79,7 +79,7 @@ const Backup = ({ open, setOpen }) => { border: "1px solid #ddd", borderRadius: 5, background: "#eee", - wordWrap: "break-word" + wordWrap: "break-word", }} >

diff --git a/src/Deposit.js b/src/Deposit.js index 04f5e536..4648b3fe 100644 --- a/src/Deposit.js +++ b/src/Deposit.js @@ -9,7 +9,7 @@ import { Input, FormGroup, Label, - InputGroup + InputGroup, } from "reactstrap"; import QR from "qrcode.react"; import { CopyToClipboard } from "react-copy-to-clipboard"; @@ -67,7 +67,7 @@ function user_info_forum( type="text" defaultValue={billingDetails.user_first_name} placeholder="First Name" - onChange={e => { + onChange={(e) => { let local = billingDetails; local.user_first_name = e.target.value; setBillingDetails(local); @@ -82,7 +82,7 @@ function user_info_forum( type="text" defaultValue={billingDetails.user_last_name} placeholder="Last Name" - onChange={e => { + onChange={(e) => { let local = billingDetails; local.user_last_name = e.target.value; setBillingDetails(local); @@ -100,7 +100,7 @@ function user_info_forum( type="text" defaultValue={email} placeholder="User Email" - onChange={e => setEmail(e.target.value)} + onChange={(e) => setEmail(e.target.value)} /> @@ -113,7 +113,7 @@ function user_info_forum( id="exitPhone" placeholder="User Phonenumber" value={phone} - onChange={p => setPhone(p)} + onChange={(p) => setPhone(p)} /> @@ -126,7 +126,7 @@ function user_info_forum( type="text" placeholder="Street" defaultValue={billingDetails.mailing_address.street} - onChange={e => { + onChange={(e) => { let local = billingDetails; local.mailing_address.street = e.target.value; setBillingDetails(local); @@ -142,7 +142,7 @@ function user_info_forum( type="text" defaultValue={billingDetails.mailing_address.postal_code} placeholder="Postal Code" - onChange={e => { + onChange={(e) => { let local = billingDetails; local.mailing_address.postal_code = e.target.value; setBillingDetails(local); @@ -157,7 +157,7 @@ function user_info_forum( type="text" defaultValue={billingDetails.mailing_address.city} placeholder="City" - onChange={e => { + onChange={(e) => { let local = billingDetails; local.mailing_address.city = e.target.value; setBillingDetails(local); @@ -172,7 +172,7 @@ function user_info_forum( type="text" defaultValue={billingDetails.mailing_address.state} placeholder="State" - onChange={e => { + onChange={(e) => { let local = billingDetails; local.mailing_address.state = e.target.value; setBillingDetails(local); @@ -187,7 +187,7 @@ function user_info_forum( type="select" defaultValue={billingDetails.mailing_address.country} placeholder="Country" - onChange={e => { + onChange={(e) => { let local = billingDetails; local.mailing_address.country = e.target.value; setBillingDetails(local); @@ -210,7 +210,7 @@ function user_info_forum(