better buttons on the map in community section

enable map button for domestic status
show like button when relevant
This commit is contained in:
Mateusz Konieczny 2023-02-07 10:26:45 +01:00
parent cee0c16edf
commit 5431f8528e

View File

@ -20,6 +20,10 @@ import { useDisplayPreferences } from '../../displayPreferences-context';
* Community view/edit section * Community view/edit section
*/ */
const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => { const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => {
const switchToIsDomesticMapStyle = (e) => {
e.preventDefault();
props.onMapColourScale('is_domestic')
}
const switchToLikesMapStyle = (e) => { const switchToLikesMapStyle = (e) => {
e.preventDefault(); e.preventDefault();
props.onMapColourScale('likes') props.onMapColourScale('likes')
@ -62,7 +66,11 @@ const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => {
verified_count={props.building.verified.is_domestic} verified_count={props.building.verified.is_domestic}
/> />
Work from home does not count as office and does not make building non-domestic. Work from home does not count as office and does not make building non-domestic.
<button className={`map-switcher-inline ${props.mapColourScale == "is_domestic" ? "enabled-state" : "disabled-state"} btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={switchToIsDomesticMapStyle}>
{(props.mapColourScale == "is_domestic")? 'Showing domestic status for specific buildings' : 'Click to see domestic status for specific buildings mapped'}
</button>
{(props.building.is_domestic === "no" || props.building.is_domestic === "mixed") ? {(props.building.is_domestic === "no" || props.building.is_domestic === "mixed") ?
<>
<UserOpinionEntry <UserOpinionEntry
slug='community_like' slug='community_like'
title={buildingUserFields.community_like.title} title={buildingUserFields.community_like.title}
@ -72,12 +80,12 @@ const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => {
onChange={props.onSaveChange} onChange={props.onSaveChange}
mode={props.mode} mode={props.mode}
copy={props.copy} copy={props.copy}
/> />
: <></>}
<button className={`map-switcher-inline ${props.mapColourScale == "likes" ? "enabled-state" : "disabled-state"} btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={switchToLikesMapStyle}> <button className={`map-switcher-inline ${props.mapColourScale == "likes" ? "enabled-state" : "disabled-state"} btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={switchToLikesMapStyle}>
{'Click here to switch map key to this info'} {(props.mapColourScale == "likes")? 'Showing likes for specific buildings' : 'Click to see likes for specific buildings mapped'}
</button> </button>
</>
: <></>}
<LogicalDataEntryYesOnly <LogicalDataEntryYesOnly
slug='community_type_worth_keeping' slug='community_type_worth_keeping'
title={buildingUserFields.community_type_worth_keeping.title} title={buildingUserFields.community_type_worth_keeping.title}