mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-20 21:46:20 +00:00
Updated cities chart so that map shows locations from current page when result set is paginated
This commit is contained in:
@@ -10,22 +10,24 @@ export default class OpenMapModalBtn extends React.Component {
|
||||
static propTypes = {
|
||||
modalTitle: PropTypes.string.isRequired,
|
||||
locations: PropTypes.arrayOf(PropTypes.object),
|
||||
filterLocations: PropTypes.func,
|
||||
};
|
||||
|
||||
state = { mapIsOpened: false };
|
||||
|
||||
render() {
|
||||
const { modalTitle, locations = [] } = this.props;
|
||||
const { modalTitle, locations = [], filterLocations } = this.props;
|
||||
const toggleMap = () => this.setState(({ mapIsOpened }) => ({ mapIsOpened: !mapIsOpened }));
|
||||
const buttonRef = React.createRef();
|
||||
const filteredLocations = filterLocations ? filterLocations(locations) : locations;
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<button className="btn btn-link open-map-modal-btn__btn" ref={buttonRef} onClick={toggleMap}>
|
||||
<FontAwesomeIcon icon={mapIcon} />
|
||||
</button>
|
||||
<UncontrolledTooltip placement="bottom" target={() => buttonRef.current}>Show in map</UncontrolledTooltip>
|
||||
<MapModal toggle={toggleMap} isOpen={this.state.mapIsOpened} title={modalTitle} locations={locations} />
|
||||
<UncontrolledTooltip placement="left" target={() => buttonRef.current}>Show in map</UncontrolledTooltip>
|
||||
<MapModal toggle={toggleMap} isOpen={this.state.mapIsOpened} title={modalTitle} locations={filteredLocations} />
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user