diff --git a/client/features/evaluate/Card.js b/client/features/evaluate/Card.js index dddcb1f..c03435f 100644 --- a/client/features/evaluate/Card.js +++ b/client/features/evaluate/Card.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components/native'; import Icon from 'react-native-vector-icons/FontAwesome'; @@ -26,7 +26,7 @@ const propTypes = { const { width: windowWidth } = Dimensions.get('window'); -class Card extends Component { +class Card extends PureComponent { render() { const { item, onOk, onDecline, onAddComment } = this.props; @@ -34,7 +34,7 @@ class Card extends Component {
@@ -101,6 +101,7 @@ const CardWrapper = styled.View` shadow-color: #000; shadow-offset: 0px 4px; padding-bottom: 16px; + elevation: 3; `; const CardImage = styled.Image` @@ -146,6 +147,7 @@ const Details = styled.View` padding-horizontal: 16px; flex-direction: row; align-items: center; + justify-content: center; `; const AddComment = styled.View` diff --git a/client/features/evaluate/evaluate.screen.js b/client/features/evaluate/evaluate.screen.js index ed916e3..49a92c4 100644 --- a/client/features/evaluate/evaluate.screen.js +++ b/client/features/evaluate/evaluate.screen.js @@ -33,9 +33,8 @@ class EvaluateScreen extends Component { constructor(props) { super(props); this.state = { - swipes: 0, commentedItem: null, - dataSource: props.marks, + dataSource: [...props.marks], }; } @@ -45,34 +44,26 @@ class EvaluateScreen extends Component { handleOk = item => { if (this.deckSwiper) { - this.incSwipes(); - this.props.addMarkType({ id: item.id, type: 'ok' }); this.deckSwiper._root.swipeRight(); + this.props.addMarkType({ id: item.id, type: 'ok' }); } } handleDecline = item => { if (this.deckSwiper) { - this.incSwipes(); - this.props.addMarkType({ id: item.id, type: 'repair' }); this.deckSwiper._root.swipeLeft(); + this.props.addMarkType({ id: item.id, type: 'repair' }); } } handleSwipeLeft = item => { - this.incSwipes(); this.props.addMarkType({ id: item.id, type: 'repair' }); } handleSwipeRight = item => { - this.incSwipes(); this.props.addMarkType({ id: item.id, type: 'ok' }); } - incSwipes = () => { - this.setState(prev => ({ swipes: prev.swipes + 1 })); - } - finishEvaluation = () => { this.props.navigation.navigate('Optimize'); } @@ -97,8 +88,12 @@ class EvaluateScreen extends Component { } render() { - const { marksByid } = this.props; - const { isModalVisible, commentedItem, swipes, dataSource } = this.state; + const { marksByid, marks } = this.props; + const { isModalVisible, commentedItem, dataSource } = this.state; + const swipes = marks.reduce((sum, mark) => { + if (mark.type === 'repair' || mark.type === 'ok') sum += 1; + return sum; + }, 0); return ( diff --git a/client/features/mark/mark.ducks.js b/client/features/mark/mark.ducks.js index 8ef8252..af0e70f 100644 --- a/client/features/mark/mark.ducks.js +++ b/client/features/mark/mark.ducks.js @@ -86,7 +86,6 @@ function* handleCapturePhoto({ payload }) { if (!demoCoords.length) return; const id = guid(); - // const geo = demoCoords.pop(); const geo = demoCoords[0]; // post image and geo location to server @@ -104,6 +103,9 @@ function* handleCapturePhoto({ payload }) { } function* handleMarkReceive({ payload }) { + // Consume coords + if (demoCoords.length) demoCoords.shift(); + const { id, timestamp, diff --git a/client/features/mark/mark.screen.js b/client/features/mark/mark.screen.js index 5125568..be688eb 100644 --- a/client/features/mark/mark.screen.js +++ b/client/features/mark/mark.screen.js @@ -19,7 +19,7 @@ const propTypes = { marks: PropTypes.array.isRequired, }; -const PHOTO_INTERVAL = 2000; +const PHOTO_INTERVAL = 1000; class MarkScreen extends Component { componentDidMount() { @@ -68,6 +68,7 @@ class MarkScreen extends Component { captureQuality={Camera.constants.CaptureQuality['480p']} orientation="portrait" keepAwake + fixOrientation >