diff options
author | Julia McCauley <skurvyj@gmail.com> | 2021-04-18 10:53:24 -0400 |
---|---|---|
committer | Julia McCauley <skurvyj@gmail.com> | 2021-04-18 10:53:24 -0400 |
commit | 79ff716c29a80d7a53abce69cb406a23953320c8 (patch) | |
tree | d6b71e420f753470331c5052912f4917fba0237a /react-frontend/src | |
parent | 7c1fc6472bfbc10bdb4e5bfa41c778020bd1c8fd (diff) | |
parent | 4cfdb31be3697565e5c4ae95cdc4b60161bd4e84 (diff) |
Merge branch 'master' of github.com:cs0320-2021/term-project-cohwille-jmccaul3-mfoiani-rhunt2
# Conflicts:
# src/main/java/edu/brown/cs/student/term/hub/SuspicionRanker.java
Diffstat (limited to 'react-frontend/src')
-rw-r--r-- | react-frontend/src/App.js | 11 | ||||
-rw-r--r-- | react-frontend/src/components/HubList.js | 4 | ||||
-rw-r--r-- | react-frontend/src/components/Visualization.js | 15 |
3 files changed, 19 insertions, 11 deletions
diff --git a/react-frontend/src/App.js b/react-frontend/src/App.js index 34632eb..0a6e6c1 100644 --- a/react-frontend/src/App.js +++ b/react-frontend/src/App.js @@ -31,6 +31,10 @@ function App() { const toEpochMilli = date => Date.parse(date); const getGraphData = () => { + console.log({ + start: toEpochMilli(dates.start), + end: toEpochMilli(dates.end) + }); fetch("http://localhost:4567/data", { method: "POST", body: JSON.stringify({ @@ -44,7 +48,10 @@ function App() { }) .then(res => res.json()) .then(data => { - setData(data.holders); + //TODO: optimize this + const sliced = data.holders.slice(0, 500); + console.log(sliced); + setData(sliced); setHasLoaded(true); }) .catch(err => console.log(err)); @@ -54,7 +61,7 @@ function App() { // Hooks to update data on init and switching of data - useEffect(() => getGraphData(), []); + //useEffect(() => getGraphData(), []); useEffect(() => { setIsChanging(true); getGraphData(); diff --git a/react-frontend/src/components/HubList.js b/react-frontend/src/components/HubList.js index 5736e89..0df3020 100644 --- a/react-frontend/src/components/HubList.js +++ b/react-frontend/src/components/HubList.js @@ -22,8 +22,8 @@ function HubList(props) { const updateHubItems = () => { // sort and create the elemnts let hubs = []; - const sorted = props.data.sort((a, b) => b.suspicionScore - a.suspicionScore); - sorted.forEach(hub => hubs.push( + //const sorted = props.data.sort((a, b) => b.suspicionScore - a.suspicionScore); + props.data.forEach(hub => hubs.push( <Hub key={hub.id} id={hub.id} name={hub.name} value={hub.suspicionScore} setSelected={props.setSelected}></Hub> )); diff --git a/react-frontend/src/components/Visualization.js b/react-frontend/src/components/Visualization.js index 91082e9..1975e86 100644 --- a/react-frontend/src/components/Visualization.js +++ b/react-frontend/src/components/Visualization.js @@ -15,8 +15,7 @@ function Visualization(props) { const options = { edges: { color: "#ffffff" - }, - autoResize: true + } }; const events = { select: () => event => props.setSelected(event.nodes[0]) @@ -29,11 +28,13 @@ function Visualization(props) { const getNodes = () => { let nodes = []; props.data.forEach(hub => { - nodes.push({ - id: hub.id, - label: hub.name, - size: hub.suspicionScore * 10 - }); + if (hub.followers) { + nodes.push({ + id: hub.id, + label: hub.name, + size: hub.suspicionScore + }); + } }); return nodes; } |