-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dashboard.jsx
180 lines (160 loc) · 8.78 KB
/
Dashboard.jsx
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import React from "react";
import { useState, useEffect } from "react";
import Nav from 'react-bootstrap/Nav';
import GoogleForms from "../GoogleForms/GoogleForms";
import "./Dashboard.css"
import Notifications from "../Notifications/Notifications";
import LoginNavBar from '../../components/LoginNavBar/LoginNavBar'
import GeneralNotifications from "../GeneralNotifications/GeneralNotifications";
import Complaints from "../Complaints/Complaints";
import Documents from "../Documents/Documents";
import UserNotification from "../UserNotification/UserNotification";
import announcement from "../../assests/announcement.png";
import form from "../../assests/form.png";
import meeting1 from "../../assests/meeting1.png";
import dashboard from "../../assests/dashboard.png";
import complaint1 from "../../assests/complaint1.png";
import documents from "../../assests/documents.png";
import notifications from "../../assests/notifications.png";
import {useGlobalContext} from "../../context/StateContext";
function Dashboard() {
const [IsForms, setIsForms] = useState(false);
const [IsMeeting, setIsMeeting] = useState(false);
const [IsNotification, setIsNotification] = useState(false);
const [IsComplaints, setIsComplaints] = useState(false);
const [IsDocuments, setIsDocuments] = useState(false);
const [IsAnnoucements, setIsAnnoucements] = useState(true);
const {User} = useGlobalContext();
const changeMenu = (e, tab) => {
if (tab == "Forms") {
setIsForms(true);
setIsMeeting(false);
setIsNotification(false);
setIsComplaints(false);
setIsDocuments(false);
setIsAnnoucements(false);
}
if (tab == "Meetings") {
setIsMeeting(true);
setIsForms(false);
setIsNotification(false);
setIsComplaints(false);
setIsDocuments(false);
setIsAnnoucements(false);
}
if (tab == "Notifications") {
setIsNotification(true);
setIsForms(false);
setIsMeeting(false);
setIsComplaints(false);
setIsDocuments(false);
setIsAnnoucements(false);
}
if (tab == "Complaints") {
setIsComplaints(true);
setIsForms(false);
setIsMeeting(false);
setIsNotification(false);
setIsDocuments(false);
setIsAnnoucements(false);
}
if (tab == "Documents") {
setIsComplaints(false);
setIsForms(false);
setIsMeeting(false);
setIsNotification(false);
setIsDocuments(true);
setIsAnnoucements(false);
}
if (tab == "Announcements") {
setIsComplaints(false);
setIsForms(false);
setIsMeeting(false);
setIsNotification(false);
setIsDocuments(false);
setIsAnnoucements(true);
}
};
return (
<>
<LoginNavBar />
<div>
<div style={{ display: "flex", marginTop: "100px", justifyContent: "center", }}>
<img src={dashboard} style={{ height: "60px", width: "50px", marginBottom: "0px", }}></img>
<p id="userDashboardTitle">Hello, {JSON.parse(User).OwnerName}!</p>
</div>
<p style={{textAlign:"center", letterSpacing:"1px", fontSize:"20px"}}>All Notifications and Updates posted will appear here</p>
<div className="d-flex mb-3 FacilityNavBar">
<Nav variant="pills" defaultActiveKey="/home">
<Nav.Item>
<Nav.Link className="FacilityLink" eventKey="/home" onClick={(e) => changeMenu(e, "Announcements")}>
<div style={{ display: "flex", alignItems: "center",height:"100%" , flexDirection: "column", textAlign: "center" }}>
<img src={announcement} height="50px" width="50px"></img>
<pre style={{ fontFamily: "Montserrat" }}>Announcements</pre>
</div>
</Nav.Link>
</Nav.Item>
{/* <Nav.Item className="navbarLink">
<Nav.Link className="FacilityLink" eventKey="/announcements" onClick={(e) => changeMenu(e, "Annoucements")}>
<div style={{ display: "flex", alignItems: "center", flexDirection: "column", textAlign: "center" }}>
<img src="../../assests/announcement.png" height="50px" width="50px"></img>
<pre style={{ fontFamily: "Montserrat" }}>Annoucements</pre>
</div>
</Nav.Link>
</Nav.Item> */}
<Nav.Item className="navbarLink">
<Nav.Link className="FacilityLink" eventKey="/forms" onClick={(e) => changeMenu(e, "Forms")}>
<div style={{ display: "flex", alignItems: "center", flexDirection: "column", textAlign: "center" }}>
<img src={form} height="50px" width="50px"></img>
<pre style={{ fontFamily: "Montserrat" }}> Forms </pre>
</div>
</Nav.Link>
</Nav.Item>
<Nav.Item className="navbarLink">
<Nav.Link className="FacilityLink" eventKey="/meet" onClick={(e) => changeMenu(e, "Meetings")}>
<div style={{ display: "flex", alignItems: "center", flexDirection: "column", textAlign: "center" }}>
<img src={meeting1} height="50px" width="50px"></img>
<pre style={{ fontFamily: "Montserrat" }}> Meetings </pre>
</div>
</Nav.Link>
</Nav.Item>
<Nav.Item>
<Nav.Link className="FacilityLink" eventKey="/complaints" onClick={(e) => changeMenu(e, "Complaints")}>
<div style={{ display: "flex", alignItems: "center", flexDirection: "column", textAlign: "center" }}>
<img src={complaint1} height="50px" width="50px"></img>
<pre style={{ fontFamily: "Montserrat" }}> Complaints </pre>
</div>
</Nav.Link>
</Nav.Item>
<Nav.Item>
<Nav.Link className="FacilityLink" eventKey="/docs" onClick={(e) => changeMenu(e, "Documents")}>
<div style={{ display: "flex", alignItems: "center", flexDirection: "column", textAlign: "center" }}>
<img src={documents} height="50px" width="50px"></img>
<pre style={{ fontFamily: "Montserrat" }}> Documents </pre>
</div></Nav.Link>
</Nav.Item>
<Nav.Item className="NotificationLinkItem">
<Nav.Link className="FacilityLink" eventKey="/notify" onClick={(e) => changeMenu(e, "Notifications")}>
<div style={{ display: "flex", alignItems: "center", flexDirection: "column", textAlign: "center" }}>
<img src={notifications} height="50px" width="50px"></img>
<pre style={{ fontFamily: "Montserrat" }}> Notifications </pre>
</div></Nav.Link>
</Nav.Item>
</Nav>
</div>
{IsForms && <GoogleForms />}
{IsMeeting && <Notifications />}
{IsAnnoucements && <GeneralNotifications />}
{IsComplaints && <Complaints />}
{IsDocuments && <Documents />}
<div className="userNotificationDivItem1" style={{float:"center"}}>
{IsNotification && <UserNotification />}
</div>
<div className="userNotificationDivItem" style={{ float: "right" }}>
{<UserNotification />}
</div>
</div>
</>
);
}
export default Dashboard;