From 67ad38d0a7cd319623e9f41c0c381ed5c5f6f973 Mon Sep 17 00:00:00 2001
From: "Thomas F. K. Jorna" <thomasfkjorna@gmail.com>
Date: Mon, 19 Jul 2021 18:32:55 +0200
Subject: added theme fetching

---
 app/screens/graph/graph-screen.tsx | 47 +++++++++++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 13 deletions(-)

(limited to 'app/screens/graph/graph-screen.tsx')

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);
-- 
cgit v1.2.3

