Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
753807f
add main pages and styles
Stan0men Jul 17, 2018
2566917
trouble with hide panel -_-
Stan0men Jul 18, 2018
444eb68
add state with error
Stan0men Jul 18, 2018
df9a34b
add function toogglePanel
Stan0men Jul 19, 2018
7e3f701
some commit
Stan0men Jul 23, 2018
d01b691
pass json to tripListDetails
Stan0men Jul 23, 2018
b0d0b0f
add data to tripListDetails
Stan0men Jul 23, 2018
0515073
add clearInput
Stan0men Jul 24, 2018
fbfc865
changed structure of this page
Stan0men Jul 25, 2018
457a376
add updateFilter method
Stan0men Jul 25, 2018
4652826
fix troubles with state & many folders
Stan0men Jul 30, 2018
0f3359e
add clearInput and filter methods
Stan0men Jul 30, 2018
cd80a76
add some styles
Stan0men Jul 30, 2018
d66ea5d
update from dev
Stan0men Jul 30, 2018
5c0394a
commit for merge
Stan0men Jul 31, 2018
14ce247
commit for merge
Stan0men Jul 31, 2018
70e1645
add routes to profile (need fix)
Stan0men Jul 31, 2018
2aba372
add some styles to Info page
Stan0men Jul 31, 2018
c08870d
fix syles
Stan0men Jul 31, 2018
86c8326
change trip_desc for the third time
Stan0men Aug 2, 2018
b61afab
add routes for trip_desc
Stan0men Aug 3, 2018
d1341de
accidentally commit from info_page, fix it
Stan0men Aug 4, 2018
8c0d884
accidentally commit from info_page, fix it
Stan0men Aug 4, 2018
a4600a3
add route for trip_desc
Stan0men Aug 6, 2018
ade1d16
add route for trip_desc
Stan0men Aug 6, 2018
2c99fe6
add route for trip_desc
Stan0men Aug 6, 2018
70ad5dc
get data with axios
Stan0men Aug 8, 2018
5585b85
bug when your go to tripdesc/2
Stan0men Aug 13, 2018
4de284f
bug with routes
Stan0men Aug 14, 2018
7109d7b
bug with routes
Stan0men Aug 14, 2018
ca34eb5
add react-modal
Stan0men Aug 15, 2018
2be4549
add some styles
Stan0men Aug 16, 2018
3b077f5
add rating and feedback
Stan0men Aug 16, 2018
42629cb
commit for merge
Stan0men Aug 17, 2018
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
85 changes: 71 additions & 14 deletions client/components/HistoryWrap/HistoryCard/HistoryCard.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,76 @@
import React from 'react';
import PropTypes from 'prop-types';
import { getDateFromTimestamp } from '../../../helpers';

import Modal from 'react-modal';
import './HistoryCard.scss';

const HistoryCard = ({ routeName, routeDate, isActive, routeColor }) => (
<div className={`historyCard lighten-5 ${routeColor} ${isActive ? 'is-active' : ''}`}>
<p className="historyCard__p">
{routeName} &nbsp;
<span className="historyCard__p--date">{getDateFromTimestamp(routeDate)}
</span>
{isActive && <span className="historyCard__p--is-active">Active</span>}
</p>
<button type="button" href="#" className="historyCard__btn">VIEW</button>
</div>
);
const customStyles = {
content: {
top: '50%',
left: '50%',
right: 'auto',
bottom: 'auto',
marginRight: '-50%',
transform: 'translate(-50%, -50%)',
background: 'lightblue',
textAlign: 'center',
width: '20%'
}
};
class HistoryCard extends React.Component {
constructor() {
super();

this.state = {
modalIsOpen: false
};

this.openModal = this.openModal.bind(this);
this.closeModal = this.closeModal.bind(this);
}

componentDidMount() {
Modal.setAppElement(document.getElementById('app'));
}

openModal = () => {
this.setState({ modalIsOpen: true });
}

closeModal() {
this.setState({ modalIsOpen: false });
}

render() {
const { modalIsOpen } = this.state;
const { routeName, routeDate, isActive, rating, feedback } = this.props;
return (
<div className={`historyCard ${isActive ? 'is-active' : ''}`}>
<p className="historyCard__p">
{routeName} &nbsp;
<span className="historyCard__p--date">{routeDate}</span>
{isActive && <span className="historyCard__p--is-active">Active</span>}
</p>
<button type="submit" onClick={this.openModal} className="historyCard__btn">VIEW</button>
<Modal
isOpen={modalIsOpen}
onRequestClose={this.closeModal}
closeTimeoutMS={200}
ariaHideApp={false}
contentLabel="Trip details"
style={customStyles}
>
<h4>Trip details</h4>
<p>Route name: {routeName}</p>
<p>Route date: {routeDate}</p>
<p>Rating : {rating}</p>
<p>Feedback : {feedback}</p>
<button type="submit" onClick={this.closeModal} className="historyCard__btn trip_details">close!</button>
</Modal>
</div>
);
}
}


HistoryCard.defaultProps = {
isActive: false
Expand All @@ -24,7 +80,8 @@ HistoryCard.propTypes = {
routeName: PropTypes.string.isRequired,
routeDate: PropTypes.string.isRequired,
isActive: PropTypes.bool,
routeColor: PropTypes.string.isRequired
rating: PropTypes.number.isRequired,
feedback: PropTypes.string.isRequired
};

export default HistoryCard;
4 changes: 4 additions & 0 deletions client/components/HistoryWrap/HistoryCard/HistoryCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@
background-color: #252d3a;
}
}

.trip_details {
margin-top: 20px;
}
22 changes: 12 additions & 10 deletions client/components/HistoryWrap/HistoryWrap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,34 @@ import PropTypes from 'prop-types';
import './HistoryWrap.scss';
import HistoryCard from './HistoryCard';


class HistoryWrap extends Component {
render() {
const { allHistory } = this.props;
const { allHistory, feedbacksInfo } = this.props;

return (
<div className="all-history__wrap">
<p className="all-history__heading">
History
</p>
<div className="feedbacks__body">
{allHistory.map(({ name, date, active, color }, i) => (
<HistoryCard
key={i}
routeName={name}
routeColor={color}
routeDate={date}
isActive={active}
/>))}
{allHistory.map(({ name, date, isActive, id }, i) => (
<HistoryCard key={i} routeName={name} routeDate={date} isActive={isActive} id={id} />
))}
</div>
<div className="feedbacksInfo">
{feedbacksInfo.map(({ rating, feedback }, i) => (
<HistoryCard key={i} rating={rating} feedback={feedback} />
))}
</div>
</div>
);
}
}

HistoryWrap.propTypes = {
allHistory: PropTypes.arrayOf(PropTypes.object).isRequired
allHistory: PropTypes.arrayOf(PropTypes.object).isRequired,
feedbacksInfo: PropTypes.arrayOf(PropTypes.object).isRequired
};

export default HistoryWrap;
4 changes: 4 additions & 0 deletions client/components/HistoryWrap/HistoryWrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@
padding: 8px 10px 10px;
text-align: center;
}

.feedbacksInfo {
display: none;
}
Empty file.
1 change: 0 additions & 1 deletion client/pages/Info/Info.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ footer {
}
}
}

3 changes: 1 addition & 2 deletions client/pages/Profile/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ class Profile extends Component {
</div>
<div className="col-12 col-md-6">
<CarsCard carsInfo={carsInfo} updateCarData={this.updateCarData} />
<HistoryWrap allHistory={allHistory} />
<HistoryWrap allHistory={allHistory} feedbacksInfo={feedbacksInfo} />
</div>
</div>
</div>
</div>
);
}
}

export default Profile;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"react-addons-css-transition-group": "^15.6.2",
"react-dom": "^16.3.2",
"react-geosuggest": "^2.8.0",
"react-modal": "^3.5.1",
"react-router-dom": "^4.3.1",
"uuid-v4": "^0.1.0",
"react-loader-spinner": "^2.1.0"
Expand Down
3 changes: 3 additions & 0 deletions public/data/allHistory.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
[
{
"id":1,
"name": "Lviv - Paris",
"date": "07/08/2018",
"isActive": true
},
{
"id":2,
"name": "Lviv - Rivne",
"date": "07/09/2018",
"isActive": false
},
{
"id":3,
"name": "Rivne - Lviv",
"date": "07/10/2018",
"isActive": false
Expand Down
23 changes: 23 additions & 0 deletions public/data/feedbacksData.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
[
<<<<<<< HEAD
{ "id":1,
"name": "Lviv - Paris",
=======
{
"name": "from trip where trip id",
>>>>>>> 276a0a0c3e59aafdc031825c862ab6e1cd6fc623
"rating": 4.7,
"feedback": "The driver was drunk! I liked everything!\n\n Quisque varius imperdiet auctor. In et dui elit. Nam metus lorem, imperdiet iaculis imperdiet sit amet, ullamcorper quis ipsum. Sed sed nisi vitae magna vestibulum commodo.",
"userName": "from user where create_by",
"date": "from trip where trip id"
},
{
"id":2,
"name": "Lviv - Ternopil",
"rating": 4.1,
"feedback": "The driver was drunk! I liked everything!\n\n Quisque varius imperdiet auctor. In et dui elit. Nam metus lorem, imperdiet iaculis imperdiet sit amet, ullamcorper quis ipsum. Sed sed nisi vitae magna vestibulum commodo.",
"userName": "Petro",
"date": "07/08/2018"
},
{
"id":3,
"name": "Lviv - Kyiv",
"rating": 5,
"feedback": "The driver was drunk! I liked everything!\n\n Quisque varius imperdiet auctor. In et dui elit. Nam metus lorem, imperdiet iaculis imperdiet sit amet, ullamcorper quis ipsum. Sed sed nisi vitae magna vestibulum commodo.",
"userName": "Petro",
"date": "07/08/2018"
},
{
"id":4,
"name": "Kyiv -Lviv ",
"rating": 5,
"feedback": "The driver was drunk! I liked everything!\n\n Quisque varius imperdiet auctor. In et dui elit. Nam metus lorem, imperdiet iaculis imperdiet sit amet, ullamcorper quis ipsum. Sed sed nisi vitae magna vestibulum commodo.",
"userName": "Petro",
"date": "07/08/2018"
},
{
"id":5,
"name": "Rivne -Lviv ",
"rating": 5,
"feedback": "The driver was drunk! I liked everything!\n\n Quisque varius imperdiet auctor. In et dui elit. Nam metus lorem, imperdiet iaculis imperdiet sit amet, ullamcorper quis ipsum. Sed sed nisi vitae magna vestibulum commodo.",
"userName": "Petro",
"date": "07/08/2018"
}
]