Skip to content
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

formatting #11

Merged
merged 1 commit into from
Jan 28, 2022
Merged
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
23 changes: 0 additions & 23 deletions .eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/constants/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const SERVER_URL = process.env.REACT_APP_AGENCY_SERVER_API;
const API_PATH = SERVER_URL + '/api/v1';
const API_PATH = `${SERVER_URL}/api/v1`;

module.exports = {
AID_CONNECT: API_PATH + '/aid-connect',
AID_CONNECT: `${API_PATH}/aid-connect`,
};
6 changes: 3 additions & 3 deletions src/contexts/registerBeneficiaryContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export const RegisterBeneficiaryContextProvider = ({ children }) => {
};

const setBeneficiaryPhone = phone => {
dispatch({ type: BENEFICIARY_ACTIONS.SET_PHONE, phone: phone });
dispatch({ type: BENEFICIARY_ACTIONS.SET_PHONE, phone });
};

const setBeneficiaryPhoto = photo => {
dispatch({ type: BENEFICIARY_ACTIONS.SET_PHOTO, photo: photo });
dispatch({ type: BENEFICIARY_ACTIONS.SET_PHOTO, photo });
};

const setBeneficiaryIdImage = idImage => {
dispatch({ type: BENEFICIARY_ACTIONS.SET_ID_IMAGE, idImage: idImage });
dispatch({ type: BENEFICIARY_ACTIONS.SET_ID_IMAGE, idImage });
};

const resetBeneficiary = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { BrowserRouter, Switch, Route } from 'react-router-dom';
import Home from '../modules/home';
import Errorpage from '../modules/global/Invalid';
import Home from './home';
import Errorpage from './global/Invalid';
import { AppContextProvider } from '../contexts/AppContext';
import { RegisterBeneficiaryContextProvider } from '../contexts/registerBeneficiaryContext';

Expand Down
3 changes: 1 addition & 2 deletions src/modules/beneficiary/beneficiaryDetails.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState, useEffect, useCallback, useContext } from 'react';
import { useHistory } from 'react-router-dom';
import Swal from 'sweetalert2';
import { RiDeleteBin6Line } from 'react-icons/ri';
import Avatar from '../../assets/images/Man.png';
import DataService from '../../services/db';
import AppHeader from '../layouts/AppHeader';
import { RiDeleteBin6Line } from 'react-icons/ri';
import { AppContext } from '../../contexts/AppContext';

const BeneficiaryDetail = props => {
Expand All @@ -22,7 +22,6 @@ const BeneficiaryDetail = props => {
}, [benId]);

const handleDelete = async () => {
console.log('deleting');
await DataService.deleteBeneficiary(benId);
Swal.fire({
title: 'Are you sure?',
Expand Down
4 changes: 2 additions & 2 deletions src/modules/beneficiary/beneficiaryLists.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useCallback, useContext } from 'react';
import { Link } from 'react-router-dom';
import AppHeader from '../layouts/AppHeader';
import { IoHomeOutline } from 'react-icons/io5';
import AppHeader from '../layouts/AppHeader';
import DataService from '../../services/db';
import Avatar from '../../assets/images/Man.png';
import { AppContext } from '../../contexts/AppContext';
Expand All @@ -10,7 +10,7 @@ const BeneficiaryList = () => {
const [ben, setBen] = useState([]);
const { aidConnectId } = useContext(AppContext);
const getBeneficiaries = useCallback(async () => {
let bens = await DataService.listBeneficiaries();
const bens = await DataService.listBeneficiaries();
if (!bens) return;
setBen(bens);
}, []);
Expand Down
13 changes: 8 additions & 5 deletions src/modules/beneficiary/idCard.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React, { useState, useEffect, useContext } from 'react';
import { useHistory } from 'react-router-dom';
import { IoChevronForwardOutline, IoRadioButtonOff } from 'react-icons/io5';
import { useHistory, Link } from 'react-router-dom';
import {
IoChevronForwardOutline,
IoRadioButtonOff,
IoChevronBackOutline,
IoHomeOutline,
} from 'react-icons/io5';

import { BiReset } from 'react-icons/bi';
import Webcam from 'react-webcam';
import AppHeader from '../layouts/AppHeader';
import { Link } from 'react-router-dom';
import { IoChevronBackOutline, IoHomeOutline } from 'react-icons/io5';
import { RegisterBeneficiaryContext } from '../../contexts/registerBeneficiaryContext';
import { AppContext } from '../../contexts/AppContext';

Expand Down Expand Up @@ -138,7 +141,7 @@ export default function Main() {
</div>
) : (
<div className="d-flex justify-content-between align-items-center mt-5 mb-3">
<div style={{ width: '40px', height: '40px' }}></div>
<div style={{ width: '40px', height: '40px' }} />

<div className="btn-shutter" onClick={capture}>
<IoRadioButtonOff className="btn-shutter-icon" />
Expand Down
12 changes: 8 additions & 4 deletions src/modules/beneficiary/photo.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import React, { useState, useEffect, useContext } from 'react';
import { useHistory } from 'react-router-dom';
import { IoChevronForwardOutline, IoSyncOutline, IoRadioButtonOff } from 'react-icons/io5';
import { useHistory, Link } from 'react-router-dom';
import {
IoChevronForwardOutline,
IoSyncOutline,
IoRadioButtonOff,
IoChevronBackOutline,
IoHomeOutline,
} from 'react-icons/io5';
import { BiReset } from 'react-icons/bi';
import Webcam from 'react-webcam';
import AppHeader from '../layouts/AppHeader';
import { Link } from 'react-router-dom';
import { IoChevronBackOutline, IoHomeOutline } from 'react-icons/io5';
import { AppContext } from '../../contexts/AppContext';
import { RegisterBeneficiaryContext } from '../../contexts/registerBeneficiaryContext';

Expand Down
13 changes: 6 additions & 7 deletions src/modules/beneficiary/preview.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useContext } from 'react';
import { Link } from 'react-router-dom';
import AppHeader from '../layouts/AppHeader';
import { useHistory } from 'react-router-dom';
import { Link, useHistory } from 'react-router-dom';
import { IoChevronBackOutline, IoHomeOutline } from 'react-icons/io5';
import { RegisterBeneficiaryContext } from '../../contexts/registerBeneficiaryContext';
import DataService from '../../services/db';
import { ImageGroup, Image } from 'react-fullscreen-image';
// import image from '../../../public/assets/img/brand/icon-192.png';
import { Row, Col } from 'react-bootstrap';
import DataService from '../../services/db';
import AppHeader from '../layouts/AppHeader';
import { RegisterBeneficiaryContext } from '../../contexts/registerBeneficiaryContext';
import { AppContext } from '../../contexts/AppContext';

export default function Preview() {
Expand Down Expand Up @@ -82,7 +81,7 @@ export default function Preview() {
<Row className="mt-2 mb-4 previewImage">
<Col xs={6} className="previewImg mb-2">
<Image
src={photo ? photo : '/assets/img/brand/icon-192.png'}
src={photo || '/assets/img/brand/icon-192.png'}
alt="profile_photo"
style={{
height: '200px',
Expand All @@ -92,7 +91,7 @@ export default function Preview() {
</Col>
<Col xs={6} className="previewImg">
<Image
src={govt_id_image ? govt_id_image : '/assets/img/brand/icon-192.png'}
src={govt_id_image || '/assets/img/brand/icon-192.png'}
alt="id_card"
style={{
height: '200px',
Expand Down
31 changes: 15 additions & 16 deletions src/modules/beneficiary/register.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useContext } from 'react';
import { Form, Button, Accordion, Card } from 'react-bootstrap';
import { IoCloseCircle, IoHomeOutline, IoChevronDownOutline } from 'react-icons/io5';
import { useHistory, Link } from 'react-router-dom';
import { RegisterBeneficiaryContext } from '../../contexts/registerBeneficiaryContext';
import { useHistory } from 'react-router-dom';
import AppHeader from '../layouts/AppHeader';
import { Link } from 'react-router-dom';
import { AppContext } from '../../contexts/AppContext';

const AddBeneficiary = () => {
Expand All @@ -27,8 +26,8 @@ const AddBeneficiary = () => {
} = useContext(RegisterBeneficiaryContext);

const updateBeneficiaryData = e => {
let formData = new FormData(e.target.form);
let data = {};
const formData = new FormData(e.target.form);
const data = {};
formData.forEach((value, key) => {
data[key] = value;
if (data[key] === '') data[key] = null;
Expand Down Expand Up @@ -72,7 +71,7 @@ const AddBeneficiary = () => {
name="name"
className="form-control"
placeholder="Enter your full name"
value={name ? name : ''}
value={name || ''}
onChange={updateBeneficiaryData}
required
/>
Expand All @@ -89,7 +88,7 @@ const AddBeneficiary = () => {
className="form-control"
name="phone"
placeholder="Enter mobile number"
value={phone ? phone : ''}
value={phone || ''}
onChange={updateBeneficiaryData}
onKeyDown={e => {
if (['-', '+', 'e'].includes(e.key)) {
Expand All @@ -111,7 +110,7 @@ const AddBeneficiary = () => {
className="form-control"
name="address"
placeholder="Enter permanent address"
value={address ? address : ''}
value={address || ''}
onChange={updateBeneficiaryData}
required
/>
Expand Down Expand Up @@ -141,7 +140,7 @@ const AddBeneficiary = () => {
className="form-control"
name="address_temporary"
placeholder="Enter temporary address"
value={address_temporary ? address_temporary : ''}
value={address_temporary || ''}
onChange={updateBeneficiaryData}
/>
<i className="clear-input">
Expand All @@ -157,7 +156,7 @@ const AddBeneficiary = () => {
className="form-control"
name="age"
placeholder="Enter age"
value={age ? age : ''}
value={age || ''}
onChange={updateBeneficiaryData}
/>
<i className="clear-input">
Expand Down Expand Up @@ -190,7 +189,7 @@ const AddBeneficiary = () => {
className="form-control"
name="email"
placeholder="Enter email"
value={email ? email : ''}
value={email || ''}
onChange={updateBeneficiaryData}
/>
<i className="clear-input">
Expand All @@ -206,7 +205,7 @@ const AddBeneficiary = () => {
className="form-control"
name="govt_id"
placeholder="Enter address"
value={govt_id ? govt_id : ''}
value={govt_id || ''}
onChange={updateBeneficiaryData}
/>
<i className="clear-input">
Expand All @@ -222,7 +221,7 @@ const AddBeneficiary = () => {
name="education"
className="form-control"
placeholder="Enter education"
value={education ? education : ''}
value={education || ''}
onChange={updateBeneficiaryData}
/>
<i className="clear-input">
Expand All @@ -238,7 +237,7 @@ const AddBeneficiary = () => {
name="profession"
className="form-control"
placeholder="Enter profession"
value={profession ? profession : ''}
value={profession || ''}
onChange={updateBeneficiaryData}
/>
<i className="clear-input">
Expand All @@ -254,7 +253,7 @@ const AddBeneficiary = () => {
className="form-control"
name="family_members"
placeholder="Enter number of family members"
value={family_members ? family_members : ''}
value={family_members || ''}
onChange={updateBeneficiaryData}
/>
<i className="clear-input">
Expand All @@ -270,7 +269,7 @@ const AddBeneficiary = () => {
className="form-control"
name="adult"
placeholder="Enter number of adults"
value={adult ? adult : ''}
value={adult || ''}
onChange={updateBeneficiaryData}
/>
<i className="clear-input">
Expand All @@ -286,7 +285,7 @@ const AddBeneficiary = () => {
className="form-control"
name="child"
placeholder="Enter number of children"
value={child ? child : ''}
value={child || ''}
onChange={updateBeneficiaryData}
/>
<i className="clear-input">
Expand Down
19 changes: 13 additions & 6 deletions src/modules/beneficiary/share.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useState, useEffect, useCallback, useContext } from 'react';
import { Link } from 'react-router-dom';
import { Link, useHistory } from 'react-router-dom';
import Swal from 'sweetalert2';
import AppHeader from '../layouts/AppHeader';
import { IoHomeOutline, IoEye } from 'react-icons/io5';
import { Button } from 'react-bootstrap';
import { useHistory } from 'react-router-dom';
import AppHeader from '../layouts/AppHeader';
import DataService from '../../services/db';
import { AppContext } from '../../contexts/AppContext';
import Info from '../global/Info';
Expand Down Expand Up @@ -55,7 +54,15 @@ const BeneficiaryList = () => {
selectedBeneficiary.map(async el => {
const { name, phone, address, email, gender, govt_id, shared } =
await DataService.getBeneficiary(el);
return { name, phone, address, email, gender, govt_id, shared };
return {
name,
phone,
address,
email,
gender,
govt_id,
shared,
};
}),
);
const filteredBen = filterSharedBeneficiary(beneficiaries);
Expand Down Expand Up @@ -99,8 +106,8 @@ const BeneficiaryList = () => {
<div className="card mt-3">
<div className="ml-3 mt-1 mb-1">
{selectedBeneficiary
? 'Beneficiary selected:' + selectedBeneficiary.length
: 'Beneficiary selected:' + 0}
? `Beneficiary selected:${selectedBeneficiary.length}`
: `Beneficiary selected:${0}`}
</div>
<div className="wide-block p-0">
<div className="table-responsive p-1">
Expand Down
2 changes: 1 addition & 1 deletion src/modules/global/Loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Loading({ showModal, message }) {
<Modal backdrop="static" style={{ marginTop: 100 }} show={showModal || false}>
<Modal.Body>
<div className="text-center">
<div className="spinner-border text-success mt-5 in-progress" role="status"></div>
<div className="spinner-border text-success mt-5 in-progress" role="status" />
<div>{message || 'Please wait...'}</div>
</div>
</Modal.Body>
Expand Down
5 changes: 2 additions & 3 deletions src/modules/home/PrivateRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ function PrivateRoute({ component: Component, ...rest }) {
{...rest}
render={props => {
if (aidConnectId) return <Component {...props} {...rest} />;
else {
return <Invalid message="Invalid Aid-Connect Link" />;
}

return <Invalid message="Invalid Aid-Connect Link" />;
}}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/layouts/Footer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useContext } from 'react';
import { useHistory } from 'react-router-dom';
import UnlockedFooter from './UnlockedFooter';
import { AppContext } from '../../contexts/AppContext';
import { useHistory } from 'react-router-dom';

export default function Footer() {
const history = useHistory();
Expand Down
Loading