Skip to content

Commit cd3133c

Browse files
committed
don't include sattelite maps when there's not mapbox token
1 parent 21e5952 commit cd3133c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/EditorControls.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class EditorControls extends Component {
5050
traceTypesConfig: this.props.traceTypesConfig,
5151
showFieldTooltips: this.props.showFieldTooltips,
5252
glByDefault: this.props.glByDefault,
53+
mapBoxAccess: this.props.mapBoxAccess,
5354
};
5455
}
5556

@@ -310,6 +311,7 @@ EditorControls.propTypes = {
310311
traceTypesConfig: PropTypes.object,
311312
makeDefaultTrace: PropTypes.func,
312313
glByDefault: PropTypes.bool,
314+
mapBoxAccess: PropTypes.bool,
313315
};
314316

315317
EditorControls.defaultProps = {
@@ -349,6 +351,7 @@ EditorControls.childContextTypes = {
349351
traceTypesConfig: PropTypes.object,
350352
showFieldTooltips: PropTypes.bool,
351353
glByDefault: PropTypes.bool,
354+
mapBoxAccess: PropTypes.bool,
352355
};
353356

354357
export default EditorControls;

src/PlotlyEditor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class PlotlyEditor extends Component {
2828
srcConverters={this.props.srcConverters}
2929
makeDefaultTrace={this.props.makeDefaultTrace}
3030
glByDefault={this.props.glByDefault}
31+
mapBoxAccess={Boolean(this.props.config.mapboxAccessToken)}
3132
>
3233
{this.props.children}
3334
</EditorControls>

src/components/widgets/TraceTypeSelector.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,19 @@ class TraceTypeSelector extends Component {
9797
const {fullValue} = this.props;
9898
const {
9999
traceTypesConfig: {traces, categories, complex},
100+
mapBoxAccess,
100101
localize: _,
101102
} = this.context;
102103

103104
return categories(_).map((category, i) => {
104-
const items = traces(_)
105+
let items = traces(_)
105106
.filter(({category: {value}}) => value === category.value)
106107
.filter(i => i.value !== 'scattergl' && i.value !== 'scatterpolargl');
107108

109+
if (!mapBoxAccess) {
110+
items = items.filter(i => i.value !== 'scattermapbox');
111+
}
112+
108113
const MAX_ITEMS = 4;
109114

110115
let columnClasses = 'trace-grid__column';
@@ -227,6 +232,7 @@ TraceTypeSelector.contextTypes = {
227232
traceTypesConfig: PropTypes.object,
228233
handleClose: PropTypes.func,
229234
localize: PropTypes.func,
235+
mapBoxAccess: PropTypes.bool,
230236
};
231237
TraceTypeSelectorButton.propTypes = {
232238
handleClick: PropTypes.func.isRequired,

0 commit comments

Comments
 (0)