Skip to content

Commit

Permalink
Prettier format
Browse files Browse the repository at this point in the history
This fixes all the formatting flags so that we can start bringing some
code standards and CI into this repo.
  • Loading branch information
jkilpatr committed Apr 14, 2022
1 parent 265be3c commit d7253e2
Show file tree
Hide file tree
Showing 75 changed files with 2,715 additions and 2,624 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is a web interface that can be used to manage the settings and configuratio

The app is implemented with React. To get started:

```
```bash
git clone https://github.com/althea-mesh/althea-dash
cd althea-dash
yarn
Expand All @@ -18,3 +18,10 @@ The app is implemented with React. To get started:
2.) run ssh -L localhost:4877:localhost:4877 [email protected] in terminal

3.) navigate to althea-dash repo and run yarn start

### Formatting

```bash
yarn
node_modules/.bin/prettier --write src/*.js src/**/*.js src/**/**/*.js
```
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"node-sass": "^6.0.1",
"npm": "^6.3.0",
"popper.js": "^1.14.4",
"prettier": "1.14.0",
"prettier": "^1.14.0",
"prop-types": "^15.6.2",
"qrcode.react": "^0.8.0",
"qrious": "^4.0.2",
Expand All @@ -105,4 +105,4 @@
"glob-all": "^3.1.0",
"purgecss-webpack-plugin": "^1.6.0"
}
}
}
31 changes: 15 additions & 16 deletions src/AdvancedSettings/AdvancedDebugging.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,24 @@ const AdvancedDebugging = () => {
</div>
))}
</div>
{!isGateway &&
(haveProblem && (
<div className="mt-4 col-12">
<h5>{t("suggestedAction")}</h5>
{hasNeighborRoute ? (
hasExitRoute ? (
selectedExit ? (
<p>{t("exitProblem")}</p>
) : (
<p>{t("noExit")}</p>
)
{!isGateway && haveProblem && (
<div className="mt-4 col-12">
<h5>{t("suggestedAction")}</h5>
{hasNeighborRoute ? (
hasExitRoute ? (
selectedExit ? (
<p>{t("exitProblem")}</p>
) : (
<p>{t("noNeighborExit")}</p>
<p>{t("noExit")}</p>
)
) : (
<p>{t("noNeighbor")}</p>
)}
</div>
))}
<p>{t("noNeighborExit")}</p>
)
) : (
<p>{t("noNeighbor")}</p>
)}
</div>
)}
</Card>
);
};
Expand Down
11 changes: 5 additions & 6 deletions src/AdvancedSettings/BandwidthLimit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import {
Alert,
Expand All @@ -11,12 +11,11 @@ import {
InputGroupAddon,
InputGroupText,
Label,
Progress,
Progress
} from "reactstrap";
import { get, post } from "store";
import { Card } from "ui";


const BandwidthLimit = () => {
const [t] = useTranslation();
const [limit, setLimit] = useState(null);
Expand Down Expand Up @@ -58,7 +57,7 @@ const BandwidthLimit = () => {
}
}

const submit = async (e) => {
const submit = async e => {
e.preventDefault();
setLoading(true);

Expand Down Expand Up @@ -96,7 +95,7 @@ const BandwidthLimit = () => {
name="bandwidth"
id="selfLimitSpeed"
placeholder={t("enterSpeed")}
onChange={(e) => {
onChange={e => {
setLimit(e.target.value);
setUnsavedChanges(true);
}}
Expand All @@ -109,7 +108,7 @@ const BandwidthLimit = () => {
style={{
background: "#F8F9FA",
fontSize: 14,
color: "#888",
color: "#888"
}}
>
Mbps
Expand Down
29 changes: 13 additions & 16 deletions src/AdvancedSettings/Blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,20 @@ const Blockchain = () => {
const [{ blockchain }, dispatch] = useStore();
const [newBlockchain, setBlockchain] = useState(blockchain);

useEffect(
() => {
const controller = new AbortController();
const signal = controller.signal;
(async () => {
try {
const blockchain = await get("/blockchain/get", true, 5000, signal);
if (!(blockchain instanceof Error)) {
dispatch({ type: "blockchain", blockchain });
}
} catch (e) {}
})();
useEffect(() => {
const controller = new AbortController();
const signal = controller.signal;
(async () => {
try {
const blockchain = await get("/blockchain/get", true, 5000, signal);
if (!(blockchain instanceof Error)) {
dispatch({ type: "blockchain", blockchain });
}
} catch (e) {}
})();

return () => controller.abort();
},
[dispatch]
);
return () => controller.abort();
}, [dispatch]);

if (!blockchain || !newBlockchain) return null;

Expand Down
15 changes: 6 additions & 9 deletions src/AdvancedSettings/DaoFee.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,12 @@ const DaoFee = ({ readonly = false }) => {
}
};

useEffect(
() => {
const controller = new AbortController();
const signal = controller.signal;
getDaoFee(signal);
return () => controller.abort();
},
[getDaoFee]
);
useEffect(() => {
const controller = new AbortController();
const signal = controller.signal;
getDaoFee(signal);
return () => controller.abort();
}, [getDaoFee]);

const submit = e => {
e.preventDefault();
Expand Down
6 changes: 5 additions & 1 deletion src/AdvancedSettings/NetworkOrganizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ const NetworkOrganizer = () => {
</div>
</div>
</div>
<Button color="secondary" style={{ color: "white", minWidth: 200 }} onClick={edit}>
<Button
color="secondary"
style={{ color: "white", minWidth: 200 }}
onClick={edit}
>
{t("edit")}
</Button>
</>
Expand Down
29 changes: 13 additions & 16 deletions src/AdvancedSettings/NodeInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,21 @@ const NodeInformation = () => {
const [copied, setCopied] = useState("");
const [{ address, meshIp, wgPublicKey }, dispatch] = useStore();

useEffect(
() => {
const init = async () => {
try {
const { meshIp } = await get("/mesh_ip");
dispatch({ type: "meshIp", meshIp });
useEffect(() => {
const init = async () => {
try {
const { meshIp } = await get("/mesh_ip");
dispatch({ type: "meshIp", meshIp });

const wgPublicKey = await get("/wg_public_key");
dispatch({ type: "wgPublicKey", wgPublicKey });
} catch (e) {
console.log(e);
}
};
const wgPublicKey = await get("/wg_public_key");
dispatch({ type: "wgPublicKey", wgPublicKey });
} catch (e) {
console.log(e);
}
};

init();
},
[dispatch]
);
init();
}, [dispatch]);

const toggleQR = v => {
if (qr === v) return setQR("");
Expand Down
16 changes: 8 additions & 8 deletions src/AdvancedSettings/RemoteLogging.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ const RemoteLogging = () => {
const [success, setSuccess] = useState(false);
const [nowWaiting, setNowWaiting] = useState(false);

useEffect(
useEffect(() => {
if (level && !newLevel) setNewLevel(level);
return;
}, [level, newLevel]);

useInterval(
() => {
if (level && !newLevel) setNewLevel(level);
return;
if (nowWaiting) dispatch({ type: "keepWaiting" });
},
[level, newLevel]
waiting ? 1000 : null
);

useInterval(() => {
if (nowWaiting) dispatch({ type: "keepWaiting" });
}, waiting ? 1000 : null);

useRemoteLogging();

const check = async e => {
Expand Down
1 change: 1 addition & 0 deletions src/AdvancedSettings/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-anonymous-default-export */
import React from "react";
import { useTranslation } from "react-i18next";

Expand Down
Loading

0 comments on commit d7253e2

Please sign in to comment.