aboutsummaryrefslogtreecommitdiff
path: root/src/MainPage.js
blob: f00db6a1fd50379ae7420370212641dc6184adf1 (plain) (blame)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import React from "react";
import Card from "./Card";
import GoatCounter from "./GoatCounter";

const MainPage = (props) => {
    const data = props.data;
    const latest = data[data.length - 1];
    const prior = data[data.length - (1 + props.timeDifference)];

    return (
        <>
            <h4 className="text-2xl">
                Alert Level: {latest.alert_level.charAt(0).toUpperCase() + latest.alert_level.slice(1)}
            </h4>
            <h5 className="text-gray-600 text-sm">
                (Prior Alert Level: {prior.alert_level.charAt(0).toUpperCase() + prior.alert_level.slice(1)})
            </h5>
            <br />
            <div id="total">
                <h4 className="text-2xl">Total Positive Cases Since August 19 (First Day of Classes)</h4>
                <div className="Section">
                    <Card
                        name="Students"
                        latest={latest.total_students}
                        diff={latest.total_students - prior.total_students}
                        link="/totalstudents"
                    />
                    <Card
                        name="Staff"
                        latest={latest.total_staff}
                        diff={latest.total_staff - prior.total_staff}
                        link="/totalstaff"
                    />
                </div>
            </div>
            <br />
            <div id="new">
                <h4 className="text-2xl">New Positive Cases From Past 14 Days</h4>
                <div className="Section">
                    <Card
                        name="Students"
                        latest={latest.new_students}
                        diff={latest.new_students - prior.new_students}
                        link="/newstudents"
                    />
                    <Card
                        name="Staff"
                        latest={latest.new_staff}
                        diff={latest.new_staff - prior.new_staff}
                        link="/newstaff"
                    />
                </div>
            </div>
            <br />
            <div id="quarantine">
                <h4 className="text-2xl">Number of Students in Quarantine</h4>
                <h5 className="text-base">
                    Quarantine separates and restricts the movement of people who were exposed to a contagious disease
                    to see if they become sick.
                </h5>
                <div className="Section">
                    <Card
                        name="On Campus"
                        latest={latest.quarantine_on_campus}
                        diff={latest.quarantine_on_campus - prior.quarantine_on_campus}
                        link="/quarantineoncampus"
                    />
                    <Card
                        name="Off Campus"
                        latest={latest.quarantine_off_campus}
                        diff={latest.quarantine_off_campus - prior.quarantine_off_campus}
                        link="/quarantineoffcampus"
                    />
                </div>
            </div>
            <br />
            <div id="isolation">
                <h4 className="text-2xl">Number of Students in Isolation</h4>
                <h5 className="text-base">
                    Isolation separates sick people with a contagious disease from people who are not sick.
                </h5>
                <div className="Section">
                    <Card
                        name="On Campus"
                        latest={latest.isolation_on_campus}
                        diff={latest.isolation_on_campus - prior.isolation_on_campus}
                        link="isolationoncampus"
                    />
                    <Card
                        name="Off Campus"
                        latest={latest.isolation_off_campus}
                        diff={latest.isolation_off_campus - prior.isolation_off_campus}
                        link="isolationoffcampus"
                    />
                </div>
            </div>
            <br />
            <div id="tests">
                <h4 className="text-2xl">Number of Tests Administered by Student Health Center</h4>
                <div className="Section">
                    <Card
                        name="Tests to date"
                        latest={latest.tests_administered}
                        diff={latest.tests_administered - prior.tests_administered}
                        link="/tests"
                    />
                </div>
            </div>
            <br />
            <div id="beds">
                <h4 className="text-2xl">Quarantine/Isolation Bed Availability On-campus</h4>
                <div className="Section">
                    <Card
                        name="Beds Available"
                        latest={latest.beds_available + "%"}
                        diff={latest.beds_available - prior.beds_available + "%"}
                        suffix="%"
                        link="/beds"
                    />
                </div>
            </div>
            <GoatCounter />
        </>
    );
};

export default MainPage;