-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4069 from Vizzuality/feature/gfw-overflow-menu-on…
…-u-areas Feature/gfw overflow menu on user areas
- Loading branch information
Showing
18 changed files
with
326 additions
and
117 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,12 +19,16 @@ import Paginate from 'components/paginate'; | |
import ConfirmSubscriptionModal from 'components/modals/confirm-subscription'; | ||
|
||
import editIcon from 'assets/icons/edit.svg?sprite'; | ||
import shareIcon from 'assets/icons/share.svg?sprite'; | ||
import dashboardIcon from 'assets/icons/dashboard.svg?sprite'; | ||
import logoutIcon from 'assets/icons/logout.svg?sprite'; | ||
import screenImg1x from 'assets/images/aois/aoi-dashboard.png'; | ||
import screenImg2x from 'assets/images/aois/[email protected]'; | ||
|
||
import './styles.scss'; | ||
|
||
const isServer = typeof window === 'undefined'; | ||
|
||
class MapMenuMyGFW extends PureComponent { | ||
static propTypes = { | ||
isDesktop: PropTypes.bool, | ||
|
@@ -39,6 +43,7 @@ class MapMenuMyGFW extends PureComponent { | |
loading: PropTypes.bool, | ||
userData: PropTypes.object, | ||
setMapPromptsSettings: PropTypes.func, | ||
setShareModal: PropTypes.func, | ||
}; | ||
|
||
state = { | ||
|
@@ -126,14 +131,80 @@ class MapMenuMyGFW extends PureComponent { | |
); | ||
} | ||
|
||
renderAoiActions() { | ||
const { setShareModal, activeArea, onEditClick } = this.props; | ||
|
||
const btnTheme = cx( | ||
'theme-button-clear theme-button-clear-underline theme-button-small' | ||
); | ||
|
||
return ( | ||
<Dropdown | ||
layout="overflow-menu" | ||
className="edit-button" | ||
onChange={this.handleAreaActions} | ||
theme={cx('theme-button-medium theme-dropdown-no-border small square')} | ||
options={[ | ||
{ | ||
value: 'open_dashboard', | ||
component: ( | ||
<Button | ||
theme={btnTheme} | ||
link={activeArea && `/dashboards/aoi/${activeArea.id}`} | ||
> | ||
<Icon icon={dashboardIcon} /> | ||
Open Dashboard | ||
</Button> | ||
), | ||
}, | ||
{ | ||
value: 'edit_area', | ||
component: ( | ||
<Button | ||
theme={btnTheme} | ||
onClick={(e) => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
onEditClick({ open: true }); | ||
}} | ||
> | ||
<Icon icon={editIcon} /> | ||
Edit area | ||
</Button> | ||
), | ||
}, | ||
{ | ||
value: 'share_area', | ||
component: ( | ||
<Button | ||
theme={btnTheme} | ||
onClick={() => | ||
setShareModal({ | ||
title: 'Share this view', | ||
shareUrl: | ||
!isServer && | ||
(window.location.href.includes('embed') | ||
? window.location.href.replace('/embed', '') | ||
: window.location.href), | ||
embedUrl: | ||
!isServer && | ||
(window.location.href.includes('embed') | ||
? window.location.href | ||
: window.location.href.replace('/map', '/embed/map')), | ||
})} | ||
> | ||
<Icon icon={shareIcon} /> | ||
Share area | ||
</Button> | ||
), | ||
}, | ||
]} | ||
/> | ||
); | ||
} | ||
|
||
renderAreas() { | ||
const { | ||
isDesktop, | ||
activeArea, | ||
viewArea, | ||
onEditClick, | ||
areas: allAreas, | ||
} = this.props; | ||
const { isDesktop, activeArea, viewArea, areas: allAreas } = this.props; | ||
const { | ||
activeTags, | ||
areas, | ||
|
@@ -165,6 +236,7 @@ class MapMenuMyGFW extends PureComponent { | |
))} | ||
{unselectedTags && !!unselectedTags.length && ( | ||
<Dropdown | ||
alignMenuRight | ||
className="aoi-tags-dropdown" | ||
theme="theme-dropdown-button theme-dropdown-button-small" | ||
placeholder={ | ||
|
@@ -214,19 +286,7 @@ class MapMenuMyGFW extends PureComponent { | |
key={area.id} | ||
> | ||
<AoICard index={i} {...area} simple /> | ||
{active && ( | ||
<Button | ||
className="edit-button" | ||
theme="square theme-button-clear" | ||
onClick={(e) => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
onEditClick({ open: true }); | ||
}} | ||
> | ||
<Icon icon={editIcon} className="info-icon" /> | ||
</Button> | ||
)} | ||
{active && this.renderAoiActions()} | ||
</div> | ||
); | ||
})} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.