2019-08-14 16:54:31 -04:00
|
|
|
import React, { Fragment } from 'react';
|
|
|
|
import { NavLink } from 'react-router-dom';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import Tooltip from '../../components/tooltip';
|
|
|
|
|
|
|
|
const LikeDataEntry: React.FunctionComponent<any> = (props) => { // TODO: remove any
|
|
|
|
const data_string = JSON.stringify({like: true});
|
|
|
|
return (
|
|
|
|
<Fragment>
|
2019-08-23 12:35:17 -04:00
|
|
|
<div className="data-title">
|
2019-08-14 17:46:35 -04:00
|
|
|
<Tooltip text="People who like the building and think it contributes to the city." />
|
2019-08-14 16:54:31 -04:00
|
|
|
<div className="icon-buttons">
|
|
|
|
<NavLink
|
2019-09-08 20:11:45 -04:00
|
|
|
to={`/multi-edit/like?data=${data_string}`}
|
2019-08-23 12:35:17 -04:00
|
|
|
className="icon-button like">
|
|
|
|
Like more
|
2019-08-14 16:54:31 -04:00
|
|
|
</NavLink>
|
|
|
|
</div>
|
2019-08-23 12:35:17 -04:00
|
|
|
<label>Number of likes</label>
|
|
|
|
</div>
|
|
|
|
<p>
|
2019-08-14 16:54:31 -04:00
|
|
|
{
|
|
|
|
(props.value != null)?
|
|
|
|
(props.value === 1)?
|
|
|
|
`${props.value} person likes this building`
|
|
|
|
: `${props.value} people like this building`
|
2019-08-23 12:35:17 -04:00
|
|
|
: "0 people like this building so far - you could be the first!"
|
2019-08-14 16:54:31 -04:00
|
|
|
}
|
2019-08-23 12:35:17 -04:00
|
|
|
</p>
|
2019-10-16 15:34:29 -04:00
|
|
|
<label className="form-check-label">
|
|
|
|
<input className="form-check-input" type="checkbox"
|
|
|
|
name="like"
|
|
|
|
checked={!!props.building_like}
|
|
|
|
disabled={props.mode === 'view'}
|
|
|
|
onChange={props.onLike}
|
|
|
|
/>
|
2019-08-23 12:35:17 -04:00
|
|
|
I like this building and think it contributes to the city!
|
|
|
|
</label>
|
2019-08-14 16:54:31 -04:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
LikeDataEntry.propTypes = {
|
|
|
|
value: PropTypes.any,
|
|
|
|
user_building_like: PropTypes.bool
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LikeDataEntry;
|