Skip to content
This repository was archived by the owner on Mar 3, 2019. It is now read-only.

Commit 90db544

Browse files
committed
Merge branch 'feature/new_stakeholder' into develop
2 parents 3218efa + 990dc33 commit 90db544

File tree

54 files changed

+1132
-440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1132
-440
lines changed

config-overrides.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
1-
const { injectBabelPlugin } = require('react-app-rewired'); // eslint-disable line import/no-extraneous-dependencies
1+
const path = require('path');
2+
const { injectBabelPlugin, compose } = require('react-app-rewired'); // eslint-disable line import/no-extraneous-dependencies
23

34
/**
45
* Override webpack configurations for the application
56
*
67
* @param {Object} config
78
* @param {Object} env
89
*/
9-
module.exports = function override(config, env) {
10-
const newConfig = injectBabelPlugin(['import',
11-
{ libraryName: 'antd', libraryDirectory: 'es', style: 'css' },
12-
], config);
10+
module.exports = {
11+
webpack: function (config, env) {
12+
const newConfig = injectBabelPlugin(['import',
13+
{ libraryName: 'antd', libraryDirectory: 'es', style: 'css' },
14+
], config);
1315

14-
return newConfig;
16+
const rewires = compose(
17+
// Add CSS modules
18+
require('react-app-rewire-css-modules-extensionless')({
19+
include: /.*\.module\.css$/ // add css modules only to css files with keword module
20+
})
21+
);
22+
23+
// Add src shared components to the webpack modules to make
24+
// import from these folder possible without writing relative path
25+
const modules = [
26+
__dirname,
27+
path.resolve(__dirname, 'src', 'common'),
28+
path.resolve(__dirname, 'src', 'common', 'components'),
29+
...newConfig.resolve.modules
30+
];
31+
newConfig.resolve.modules = modules;
32+
33+
34+
return rewires(newConfig, env);
35+
}
1536
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"eslint-plugin-import": "^2.13.0",
2929
"eslint-plugin-jsx-a11y": "^6.1.1",
3030
"eslint-plugin-react": "^7.10.0",
31+
"react-app-rewire-css-modules-extensionless": "^1.2.0",
3132
"react-app-rewired": "^1.5.2",
3233
"redux-devtools-extension": "^2.13.5"
3334
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
{
3+
"data": [
4+
{ "name": "Dar es Salaam Region Authority", "phone": "+233 54534545", "email": "[email protected]" },
5+
{ "name": "Tanzania Fire and Rescue Force", "phone": "+233 54534545", "email": "[email protected]" }
6+
7+
]
8+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
{
3+
"data": [
4+
{ "name": "Tanzania Red Cross Society", "phone": "+233 54534545", "email": "[email protected]" },
5+
{ "name": "Dar es Salaam Region Authority", "phone": "+233 54534545", "email": "[email protected]" },
6+
{ "name": "Tanzania Police Force", "phone": "+233 54534545", "email": "[email protected]" },
7+
{ "name": "Ambulance Services", "phone": "+233 54534545", "email": "[email protected]" },
8+
{ "name": "Supportive Personnel", "phone": "+233 54534545", "email": "[email protected]" },
9+
{ "name": "Prime Minister’s Office –Disaster Management Department", "phone": "+233 54534545", "email": "[email protected]" },
10+
{ "name": "Hospitals", "phone": "+233 54534545", "email": "[email protected]" },
11+
{ "name": "Tanzania Fire and Rescue Force", "phone": "+233 54534545", "email": "[email protected]" }
12+
13+
]
14+
}

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { Provider } from 'react-redux';
33
import { BrowserRouter } from 'react-router-dom';
4-
import configureStore from './configureStore';
4+
import configureStore from 'redux/configureStore';
55
import Dashboard from './dashboard';
66
/* import global styles */
77
import './utils.css';
File renamed without changes.

src/common/API/index.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const API_END_POINT = 'https://emis-asat.herokuapp.com/v1';
2+
const API = {
3+
findStakeholders: () => {
4+
return fetch(`${API_END_POINT}/parties`).then(res => res.json());
5+
},
6+
searchStakeholder: searchText => {
7+
return fetch(`${API_END_POINT}/parties?q=${searchText}`)
8+
.then(res => res.json())
9+
},
10+
createStakeholder: data => {
11+
const url = `${API_END_POINT}/parties`;
12+
const config = {
13+
method: 'POST',
14+
body: JSON.stringify(data),
15+
headers: {
16+
'content-type': 'application/json'
17+
}
18+
};
19+
return fetch(url, config).then(res => res.json());
20+
},
21+
updateStakeholder: (stakeholderId, updates) => {
22+
const url = `${API_END_POINT}/parties/${stakeholderId}`;
23+
const config = {
24+
method: 'PATCH',
25+
body: JSON.stringify(updates),
26+
headers: {
27+
'content-type': 'application/json'
28+
}
29+
};
30+
return fetch(url, config).then(res => res.json());
31+
}
32+
};
33+
34+
export default API;

src/dashboard/contacts/components/Header/index.js renamed to src/common/components/ColHeader/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import classnames from 'classnames';
1+
import classNames from 'classnames/bind';
22
import PropTypes from 'prop-types';
33
import React from 'react';
44
/* import styles */
5-
import styles from './index.css';
5+
import styles from './index.module.css';
66

77

88
/* local constants */
9-
const cx = classnames.bind(styles);
9+
const cx = classNames.bind(styles);
1010

1111

1212
/**
@@ -22,7 +22,7 @@ const cx = classnames.bind(styles);
2222
*/
2323
export default function Header({ children }) {
2424
return (
25-
<div className={cx('header b-b')}>
25+
<div className={cx('container')}>
2626
{React.isValidElement(children)
2727
? (
2828
<div className={cx('component')}>

src/dashboard/contacts/components/Header/index.css renamed to src/common/components/ColHeader/index.module.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
/* contacts header styles */
22

3+
.container {
4+
flex: 0 0 50px;
5+
border-bottom: 1px solid #E0E0E0;
6+
padding-left: 15px;
7+
}
8+
39
.title {
410
font-size: 14px;
511
padding-top: 15px;
@@ -10,4 +16,4 @@
1016
width: 95%;
1117
margin: 0 auto;
1218
padding-top: 10px;
13-
}
19+
}

src/common/components/Header/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import classNames from 'classnames/bind';
3+
import styles from './index.module.css';
4+
5+
6+
/* local constants */
7+
const cx = classNames.bind(styles);
8+
9+
export default ({ title }) => (
10+
<div className={cx('container')}>
11+
<span className={cx('title')}>{title}</span>
12+
</div>
13+
);

0 commit comments

Comments
 (0)