Skip to content

Favicon remove #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm run start
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Preview

You can check out [live preview](https://reduction-admin.github.io/react-reduction/).
You can check out [live preview of Hive](https://obscure-forest-81707.herokuapp.com/).

## Quick Start

Expand Down
25,951 changes: 25,951 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
"name": "react-reduction",
"version": "1.1.0",
"private": false,
"homepage": "https://reduction-admin.github.io/react-reduction",
"homepage": "http://hellboy95.github.io/react-reduction/login",
"dependencies": {
"axios": "^0.19.2",
"bootstrap": "4.3.1",
"chart.js": "2.7.2",
"classnames": "^2.2.6",
"d3-geo": "^1.11.3",
"faker": "^4.1.0",
"lodash": "^4.17.21",
"lodash.sortby": "^4.7.0",
"prop-types": "^15.7.2",
"react": "^16.8.4",
"react-chartjs-2": "^2.7.4",
Expand Down Expand Up @@ -39,16 +42,21 @@
},
"scripts": {
"start": "react-scripts start",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"build": "react-scripts build",
"serve": "serve -s build",
"deploy": "gh-pages -d build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"heroku-postbuild": "npm run build"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
],
"engines": {
"node": "10.x"
}
}
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<meta name="twitter:image" content="%PUBLIC_URL%/img/screenshots/reduction-admin.jpg">

<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<!-- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" /> -->
<link rel="apple-touch-icon" sizes="57x57" href="%PUBLIC_URL%/apple-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="60x60" href="%PUBLIC_URL%/apple-icon-60x60.png" />
<link rel="apple-touch-icon" sizes="72x72" href="%PUBLIC_URL%/apple-icon-72x72.png" />
Expand Down
Binary file added src/assets/img/logo/hive-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
216 changes: 208 additions & 8 deletions src/components/AuthForm.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,117 @@
import logo200Image from 'assets/img/logo/logo_200.png';
import logo200Image from 'assets/img/logo/hive-logo.png';
import PropTypes from 'prop-types';
import React from 'react';
import { Button, Form, FormGroup, Input, Label } from 'reactstrap';
import { Button, Form, FormGroup, Input, Label, UncontrolledAlert } from 'reactstrap';


class AuthForm extends React.Component {
constructor(props){
super(props);
this.state={
username:'',
password:'',
validateLoginStatus: '',
validateLoginResponse:{},
fullname:'',
doctorname:'',
doctorid: '',
patientid:'',
deviceid:''
}
}
get isLogin() {
return this.props.authState === STATE_LOGIN;
}

get isSignup() {
return this.props.authState === STATE_SIGNUP;
}



changeAuthState = authState => event => {
event.preventDefault();

// {console.log("uerma",this.state.username)}
this.props.onChangeAuthState(authState);


};

handleSubmit = event => {
event.preventDefault();


if(this.props.authState=='LOGIN'){

console.log("The username:", this.props.username);
console.log("Inside login function");
fetch('https://spc89vwj89.execute-api.us-west-1.amazonaws.com/Production', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
pathParameters:{
username: this.state.username,
password: this.state.password,
}
})
})
.then(response => response.json())
.then(response => {
this.setState({
validateLoginResponse: response
})
this.state.validateLoginStatus = this.state.validateLoginResponse.statusCode;

if(this.state.validateLoginStatus==200){
console.log("inside 200");
this.props.history.push('/');
}
else{
// alert(this.state.username + 'is not a valid username!');
}
})
.catch(err => { console.log(err);
});
}else if(this.props.authState=='SIGNUP'){

console.log("Inside Registration function");
fetch('https://j982ampfu3.execute-api.us-west-1.amazonaws.com/Production/insert', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
User_Id : `USERNAME#${this.state.username}`,
Device_Id: `DEVICE#${this.state.deviceid}`,
User_Password: this.state.password,
User_Fullname: this.state.fullname,
Doctor_Name: this.state.doctorname,
Doctor_Id: this.state.doctorid,
Patient_Id: this.state.patientid
})
})
.then(response => response.json())
.then(response => {
this.setState({
validateLoginResponse: response
})
this.state.validateLoginStatus = this.state.validateLoginResponse.statusCode;

if(this.state.validateLoginStatus==200){
console.log("inside 200");
this.props.history.push('/');
}
else{
// alert(this.state.username + 'is not a valid username!');
}
})
.catch(err => { console.log(err);
});
}
};

renderButtonText() {
Expand All @@ -36,6 +128,9 @@ class AuthForm extends React.Component {
return buttonText;
}




render() {
const {
showLogo,
Expand All @@ -47,8 +142,24 @@ class AuthForm extends React.Component {
confirmPasswordInputProps,
children,
onLogoClick,
FullNameLabel,
FullNameInputProps,
DoctorNameLabel,
DoctorNameInputProps,
DoctorIdLabel,
DoctorIdInputProps,
PatientIdLabel,
PatienIdInputProps,
DeviceIdLabel,
DeviceIdInputProps
} = this.props;

console.log("The props:", this.props)

console.log("121The username:", this.props.username);



return (
<Form onSubmit={this.handleSubmit}>
{showLogo && (
Expand All @@ -64,31 +175,72 @@ class AuthForm extends React.Component {
)}
<FormGroup>
<Label for={usernameLabel}>{usernameLabel}</Label>
<Input {...usernameInputProps} />
<Input onChange={e => {
usernameInputProps.inputvalue = e.target.value
this.setState({ username: e.target.value })}} {...usernameInputProps} />
</FormGroup>
<FormGroup>
<Label for={passwordLabel}>{passwordLabel}</Label>
<Input {...passwordInputProps} />
<Input onChange={e =>{
passwordInputProps.inputvalue = e.target.value
this.setState({ password: e.target.value })}} {...passwordInputProps } />
</FormGroup>
{this.isSignup && (
<>
<FormGroup>
<Label for={confirmPasswordLabel}>{confirmPasswordLabel}</Label>
<Input {...confirmPasswordInputProps} />
</FormGroup>
<FormGroup>
<Label for={FullNameLabel}>{FullNameLabel}</Label>
<Input onChange={e => {
FullNameInputProps.inputvalue = e.target.value
this.setState({ fullname: e.target.value })}} {...FullNameInputProps} />
</FormGroup>
<FormGroup>
<Label for={DoctorNameLabel}>{DoctorNameLabel}</Label>
<Input onChange={e => {
DoctorNameInputProps.inputvalue = e.target.value
this.setState({ doctorname: e.target.value })}} {...DoctorNameInputProps} />
</FormGroup>
<FormGroup>
<Label for={DoctorIdLabel}>{DoctorIdLabel}</Label>
<Input onChange={e => {
DoctorIdInputProps.inputvalue = e.target.value
this.setState({ doctorid: e.target.value })}} {...DoctorIdInputProps} />
</FormGroup>
<FormGroup>
<Label for={PatientIdLabel}>{PatientIdLabel}</Label>
<Input onChange={e => {
PatienIdInputProps.inputvalue = e.target.value
this.setState({ patientid: e.target.value })}}
{...PatienIdInputProps} />
</FormGroup>
<FormGroup>
<Label for={DeviceIdLabel}>{DeviceIdLabel}</Label>
<Input onChange={e => {
DeviceIdInputProps.inputvalue = e.target.value
this.setState({ deviceid: e.target.value })}} {...DeviceIdInputProps} />
</FormGroup>
</>
)}
<FormGroup check>
<Label check>
<Input type="checkbox" />{' '}
{this.isSignup ? 'Agree the terms and policy' : 'Remember me'}
</Label>
</FormGroup>
{this.state.validateLoginStatus==500 ? (
<UncontrolledAlert color="secondary">Invalid Login! User is not registered! </UncontrolledAlert>
) : null }
<hr />
<Button
size="lg"
className="bg-gradient-theme-left border-0"
block
onClick={this.handleSubmit}>
{this.renderButtonText()}

</Button>

<div className="text-center pt-1">
Expand All @@ -107,14 +259,18 @@ class AuthForm extends React.Component {
</div>

{children}

</Form>
);
}
}


// export const validationStatus = this.props.validateLoginStatus;
export const STATE_LOGIN = 'LOGIN';
export const STATE_SIGNUP = 'SIGNUP';


AuthForm.propTypes = {
authState: PropTypes.oneOf([STATE_LOGIN, STATE_SIGNUP]).isRequired,
showLogo: PropTypes.bool,
Expand All @@ -125,26 +281,70 @@ AuthForm.propTypes = {
confirmPasswordLabel: PropTypes.string,
confirmPasswordInputProps: PropTypes.object,
onLogoClick: PropTypes.func,
FullNameLabel: PropTypes.string,
FullNameInputProps: PropTypes.object,
DoctorNameLabel: PropTypes.string,
DoctorNameInputProps: PropTypes.object,
DoctorIdLabel: PropTypes.string,
DoctorIdInputProps: PropTypes.object,
PatientIdLabel: PropTypes.string,
PatienIdInputProps: PropTypes.object,
DeviceIdLabel: PropTypes.string,
DeviceIdInputProps: PropTypes.object,
};

AuthForm.defaultProps = {
authState: 'LOGIN',
showLogo: true,
usernameLabel: 'Email',
usernameLabel: 'Username',
usernameInputProps: {
type: 'email',
placeholder: '[email protected]',
type: 'string',
placeholder: 'your username',
inputvalue: ''
},
passwordLabel: 'Password',
passwordInputProps: {
type: 'password',
placeholder: 'your password',
inputvalue: ''
},
confirmPasswordLabel: 'Confirm Password',
confirmPasswordInputProps: {
type: 'password',
placeholder: 'confirm your password',
inputvalue: ''
},
FullNameLabel: 'Patient Full Name',
FullNameInputProps: {
type: 'string',
placeholder: 'Your full name',
inputvalue: ''
},
DoctorNameLabel: 'Doctor Name',
DoctorNameInputProps: {
type: 'string',
placeholder: 'Doctors name',
inputvalue: ''
},
DoctorIdLabel: 'Doctor ID',
DoctorIdInputProps: {
type: 'string',
placeholder: 'Doctors ID',
inputvalue: ''
},
PatientIdLabel: 'Patient ID',
PatienIdInputProps: {
type: 'string',
placeholder: 'Patient ID',
inputvalue: ''
},
DeviceIdLabel: 'HIVE Device ID',
DeviceIdInputProps: {
type: 'string',
placeholder: 'HIVE device ID',
inputvalue: ''
},

onLogoClick: () => {},
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Footer = () => {
<Navbar>
<Nav navbar>
<NavItem>
2018 Reduction theme, source on <SourceLink>Github</SourceLink>
{/* 2018 Reduction theme, source on <SourceLink>Github</SourceLink> */}
</NavItem>
</Nav>
</Navbar>
Expand Down
Loading