-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
61 lines (53 loc) · 2.01 KB
/
App.js
File metadata and controls
61 lines (53 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// This is where we bring each component together into a single app
"use strict";
import Navbar from "./components/navbar/Navbar";
import Message from "./components/message/Message";
import DataSelection from "./components/visualization/DataSelection";
import GraphDisplay from "./components/visualization/GraphDisplay";
import Table from "./components/visualization/Table";
import "./App.css";
// createContext to provide csv data for various components
export const DataContext = React.createContext();
export default () => {
// Single source where context is defined which starts out as an empty JSON string
const [json, setJson] = React.useState(JSON.stringify({}));
// const value = { json, setJson };
// For User Info under settings
// (uid, login, name, gender).
const [login, setLogin] = React.useState({
uid: null,
login: null,
name: null,
gender: null,
});
// For managing View button (Line, Pie, Bar, Map?)
const [view, setView] = React.useState("");
const value = { json, setJson, login, setLogin, view, setView };
// Encapsulate the components with the DataContext to pass the context
return (
<DataContext.Provider value={value}>
<div className="container-fluid">
<div className="row">
<Navbar />
</div>
<div className="row">
<Message />
</div>
<div className="row justify-content-center">
<div className="col-md-8">
<DataSelection />
</div>
<div className="col-md-4">
<GraphDisplay />
</div>
</div>
<hr />
<div className="row justify-content-center">
<div className="col-md-12">
<Table />
</div>
</div>
</div>
</DataContext.Provider>
);
};