Skip to content

Commit 5295af2

Browse files
committed
final fixes for challenge #30056080 PREFLIGHT CHECKLIST
1 parent 067148d commit 5295af2

File tree

6 files changed

+42
-2
lines changed

6 files changed

+42
-2
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React, {PropTypes} from 'react';
2+
import CSSModules from 'react-css-modules';
3+
import styles from './BreadcrumbItem.scss';
4+
5+
export const BreadcrumbItem = ({title}) => (
6+
<span styleName="breadcrumb-item">
7+
{title}
8+
</span>
9+
);
10+
11+
BreadcrumbItem.propTypes = {
12+
title: PropTypes.string.isRequired,
13+
};
14+
15+
export default CSSModules(BreadcrumbItem, styles);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.breadcrumb-item {
2+
background-color: transparent;
3+
4+
:global {
5+
6+
}
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import BreadcrumbItem from './BreadcrumbItem';
2+
3+
export default BreadcrumbItem;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {connect} from 'react-redux';
2+
3+
// we use global BreadcrumbItem component to display breadcrumb item,
4+
// just pass a title property here
5+
import BreadcrumbItem from 'components/BreadcrumbItem';
6+
7+
const mapState = (state) => ({
8+
title: state.pilotChecklist.missionName,
9+
});
10+
11+
export default connect(mapState, {})(BreadcrumbItem);

src/routes/PilotChecklist/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import {injectReducer} from '../../store/reducers';
2+
import React from 'react';
3+
import BreadcrumbItem from './containers/BreadcrumbItemContainer';
24

35
export default (store) => ({
4-
name: 'Pilot Checklist',
6+
name: 'Flight Checklist',
57
path: 'pilot-checklist/:id',
68
getComponent(nextState, cb) {
79
require.ensure([], (require) => {
@@ -12,4 +14,5 @@ export default (store) => ({
1214
cb(null, PilotChecklist);
1315
}, 'PilotChecklist');
1416
},
17+
prettifyParam: () => React.createElement(BreadcrumbItem), // eslint-disable-line react/display-name
1518
});

src/routes/PilotChecklist/modules/PilotChecklist.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const load = (missionId) => async(dispatch) => {
1616
const response = await APIService.getPilotChecklist(missionId);
1717
const answers = response.pilotChecklist ? response.pilotChecklist.answers : [];
1818

19-
dispatch({type: LOADED, payload: {..._.pick(response, ['missionStatus', 'questions']), answers, missionId}});
19+
dispatch({type: LOADED, payload: {..._.pick(response, ['missionStatus', 'missionName', 'questions']), answers, missionId}});
2020
};
2121

2222
export const save = (values) => async (dispatch, getState) => {
@@ -69,6 +69,7 @@ export default handleActions({
6969
}, {
7070
missionId: '',
7171
missionStatus: '',
72+
missionName: '',
7273
questions: [],
7374
answers: [],
7475
});

0 commit comments

Comments
 (0)