Skip to content

Commit d3f6d51

Browse files
committed
rewrote the whole code to FC
1 parent 4aeaf12 commit d3f6d51

28 files changed

Lines changed: 1113 additions & 584 deletions

package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030
"react-bootstrap": "0.32.4",
3131
"react-bootstrap-carousel": "^4.0.6",
3232
"react-chartist": "0.13.3",
33+
"react-datepicker": "^3.1.3",
3334
"react-datetime": "^2.16.3",
3435
"react-dom": "16.8.6",
3536
"react-google-maps": "9.4.5",
37+
"react-hooks-helper": "^1.6.0",
3638
"react-image-gallery": "^1.0.7",
3739
"react-image-viewer-zoom": "^1.0.36",
3840
"react-image-zoom": "^1.3.1",

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import "./assets/css/demo.css";
1111
import "./assets/css/pe-icon-7-stroke.css";
1212

1313
import AdminLayout from "layouts/Admin.jsx";
14-
import Login from "./views/LoginContainer.jsx";
14+
//import Login from "./views/LoginContainer.jsx";
1515

1616
ReactDOM.render(
1717
<BrowserRouter>
1818
<Switch>
19-
<Route exact path="/login">
19+
{/* <Route exact path="/login">
2020
<Login />
21-
</Route>
21+
</Route> */}
2222
<Route path="/admin" render={props => <AdminLayout {...props} />} />
2323
<Redirect from="/" to="/admin/notifications" />
2424
</Switch>

src/routes.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import Help from "views/Help.jsx";
66
import PatientRef from "views/PatientRef.jsx";
77
import Notifications from "views/Notifications.jsx";
88
import PatientRecords from "views/PatientRecords";
9-
import Login from "./views/LoginContainer"
9+
//import Login from "./views/LoginContainer"
1010

1111
const dashboardRoutes = [
12-
{
13-
path: "/login",
14-
name: "login",
15-
component: Login,
16-
layout: "/user"
17-
},
12+
// {
13+
// path: "/login",
14+
// name: "login",
15+
// component: Login,
16+
// layout: "/user"
17+
// },
1818
{
1919
path: "/notifications",
2020
name: "Dashboard",

src/views/ImageDisplay.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import React from "react";
23
import { Row, Col, FormGroup, ControlLabel } from 'react-bootstrap';
34
import { Card } from "components/Card/Card.jsx";
@@ -6,6 +7,7 @@ import IM2783RE from "../assets/img/IM2783RE.JPG";
67

78
const ImageDisplay = (props) => {
89
const propss = { width: 600, height: 500, zoomWidth: 750, img: IM2783RE };
10+
911
return (
1012
<Row>
1113
<Col md={12}>

src/views/ItemPatientForm.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from "react";
2+
3+
const ItemPatientForm = ({ label, children, type = "text", ...otherProps}) =>(
4+
<div>
5+
{
6+
type === "text" ? (
7+
<>
8+
<label>{label}</label>
9+
<input type={type} {...otherProps} />
10+
</>
11+
) : (
12+
<>
13+
<label/>
14+
<input type={type} {...otherProps} />
15+
{label}
16+
</>
17+
)
18+
}
19+
</div>
20+
);
21+
22+
export default ItemPatientForm;

src/views/LoginContainer.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState } from "react";
22
import { Button, FormGroup, FormControl, ControlLabel } from "react-bootstrap";
33
import "../assets/css/Login.css";
44

5-
export default function Login() {
5+
const Login = () => {
66
const [email, setEmail] = useState("");
77
const [password, setPassword] = useState("");
88

@@ -40,4 +40,4 @@ export default function Login() {
4040
</form>
4141
</div>
4242
);
43-
}
43+
}

src/views/MultiStepForm.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import React from "react";
2+
import {useForm, useStep } from "react-hooks-helper";
3+
4+
import StepOne from "./stepOne";
5+
import StepTwo from "./stepTwo";
6+
import StepThree from "./stepThree";
7+
import ReviewNewPatientDetails from "./ReviewNewPatientDetails";
8+
import SubmitPatientForm from "./submitPatientForm";
9+
10+
11+
const steps = [
12+
{id: "stepOne"},
13+
{id: "stepTwo"},
14+
{id: "stepThree"},
15+
{id: "reviewNewPatientDetails"},
16+
{id: "submitPatientForm"}
17+
];
18+
19+
const defaultData = {
20+
firstnamePatient: "",
21+
lastnamePatient: "",
22+
ncdNumberPatient: "",
23+
dfidStudyNumberPatient: "",
24+
optionsGender: "",
25+
optionTypeDiabetes: "",
26+
dobPatient: "",
27+
};
28+
29+
const MultiStepForm = () => {
30+
31+
const [formData, setForm] = useForm(defaultData);
32+
const {step, navigation } = useStep({initialStep: 0, steps });
33+
const { id } = step;
34+
35+
const props = {formData, setForm, navigation};
36+
37+
switch (id) {
38+
case "stepOne":
39+
return <StepOne {...props}/>;
40+
case "stepTwo":
41+
return <StepTwo {...props}/>;
42+
case "stepThree":
43+
return <StepThree {...props}/>;
44+
case "reviewNewPatientDetails":
45+
return <ReviewNewPatientDetails {...props}/>;
46+
case "submitPatientForm":
47+
return <SubmitPatientForm {...props}/>;
48+
default:
49+
return null;
50+
}
51+
};
52+
53+
export default MultiStepForm;

src/views/NewPatientsList.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
32
import { Grid, Row, Col, Table } from "react-bootstrap";
43
import Card from "components/Card/Card.jsx";
54
import Button from "components/CustomButton/CustomButton.jsx";

src/views/Notifications.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
1+
//To be reviewed after other components have been reviewed.
22
import React, { Component } from "react";
33
import ChartistGraph from "react-chartist";
44
import { Grid, Row, Col } from "react-bootstrap";
5-
65
import { Card } from "components/Card/Card.jsx";
76
import { StatsCard } from "components/StatsCard/StatsCard.jsx";
8-
97
import {
108
dataPie,
119
legendPie,
@@ -26,6 +24,7 @@ class Notifications extends Component {
2624
}
2725
return legend;
2826
}
27+
2928
render() {
3029
return (
3130
<div className="content">

0 commit comments

Comments
 (0)