diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-07-19 18:32:55 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-07-19 18:32:55 +0200 |
commit | 67ad38d0a7cd319623e9f41c0c381ed5c5f6f973 (patch) | |
tree | 2d7498fd846109c0e2f5e72d74d6fa71d6895c2e /app/screens/graph | |
parent | bbb50922bf2d80e6b510eaca35477efb75704722 (diff) |
added theme fetching
Diffstat (limited to 'app/screens/graph')
-rw-r--r-- | app/screens/graph/graph-screen.tsx | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/app/screens/graph/graph-screen.tsx b/app/screens/graph/graph-screen.tsx index cee0bf7..a97fe68 100644 --- a/app/screens/graph/graph-screen.tsx +++ b/app/screens/graph/graph-screen.tsx @@ -17,6 +17,7 @@ import axios from "axios" import rando from "../../data/rando.json" + const ROOT: ViewStyle = { backgroundColor: color.palette.black, flex: 1, @@ -136,25 +137,45 @@ export const GraphScreen = observer(function GraphScreen() { return data; } - const getNodesById = (data) => { - let temp = [] - data.nodes.forEach((node, i) => { - temp.push(node.id) - node.index = i - }) - setNodeIds(temp) - return temp - } +const [theme, setTheme] = useState({ +base1: "#1c1f24", +base2: "#21272d", +base3: "#23272e", +base4: "#484854", +base5: "#62686E", +base6: "#757B80", +base7: "#9ca0a4", +base8: "#DFDFDF", +bg: "#242730", +"bg-alt": "#2a2e38", +blue: "#51afef", +cyan: "#5cEfFF", +"dark-blue": "#1f5582", +"dark-cyan": "#6A8FBF", +fg: "#bbc2cf", +"fg-alt": "#5D656B", +green: "#7bc275", +grey: "#484854", +magenta: "#C57BDB", +orange: "#e69055", +red: "#ff665c", +teal: "#4db5bd", +violet: "#a991f1", +yellow: "#FCCE7B", + }); useEffect(() => { getData().then((data) => setPhysics(data)) + axios.get("http://localhost:35901/theme") + .then((theme)=>{setTheme(theme.data); + console.log(theme.data)}) + .catch((e) => { + console.log("No theme found") + }) axios .get("http://localhost:35901/graph") .then((dataa) => { - let nods = getNodesById(dataa.data) - setNodeIds(nods) - console.log(nodeIds) let cleanData = sanitizeGraph(dataa.data) console.log(cleanData) setGraphData(cleanData) @@ -164,7 +185,7 @@ export const GraphScreen = observer(function GraphScreen() { console.log("Couldn't get data.") //setGraphData(rando); }) - }, []) + }, []); const [threeDim, setThreeDim] = useState(false); const [local, setLocal] = useState(false); |