Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Enhancement] Add Bug Report User Guides to demo app panel header (#787)
Shan He6b380ac6db94
diff --git a/examples/demo-app/src/app.js b/examples/demo-app/src/app.jsindex 4b00c5852..a2c47694c 100644--- a/examples/demo-app/src/app.js+++ b/examples/demo-app/src/app.js@@ -30,6 +30,7 @@ import Announcement from './components/announcement';import {replaceLoadDataModal} from './factories/load-data-modal';import {replaceSaveMap} from './factories/save-map';import {replaceMapControl} from './factories/map-control';+import {replacePanelHeader} from './factories/panel-header';import ExportUrlModal from './components/sharing/export-url-modal';import {AUTH_TOKENS} from './constants/default-settings';import {@@ -42,7 +43,8 @@ import {const KeplerGl = require('kepler.gl/components').injectComponents([replaceLoadDataModal(),replaceSaveMap(),- replaceMapControl()+ replaceMapControl(),+ replacePanelHeader()]);// Sample datadiff --git a/examples/demo-app/src/factories/panel-header.js b/examples/demo-app/src/factories/panel-header.jsnew file mode 100644index 000000000..ec61748a7--- /dev/null+++ b/examples/demo-app/src/factories/panel-header.js@@ -0,0 +1,60 @@+// Copyright (c) 2019 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import {PanelHeaderFactory, Icons} from 'kepler.gl/components';+import {GITHUB_BUG_REPORT, GITHUB_USER_GUIDE} from 'kepler.gl/constants';++export function CustomPanelHeaderFactory(SaveExportDropdown) {+ const PanelHeader = PanelHeaderFactory(SaveExportDropdown);++ PanelHeader.defaultProps = {+ ...PanelHeader.defaultProps,+ actionItems: [+ {+ id: 'bug',+ iconComponent: Icons.Bug,+ href: GITHUB_BUG_REPORT,+ blank: true,+ tooltip: 'Bug Report',+ onClick: () => {}+ },+ {+ id: 'docs',+ iconComponent: Icons.Docs,+ href: GITHUB_USER_GUIDE,+ blank: true,+ tooltip: 'User Guide',+ onClick: () => {}+ },+ {+ ...PanelHeader.defaultProps.actionItems.find(item => item.id === 'save'),+ label: null,+ tooltip: 'Share'+ }+ ]+ };+ return PanelHeader;+}++CustomPanelHeaderFactory.deps = PanelHeaderFactory.deps;++export function replacePanelHeader() {+ return [PanelHeaderFactory, CustomPanelHeaderFactory];+}diff --git a/src/components/common/icons/bug.js b/src/components/common/icons/bug.jsnew file mode 100644index 000000000..bf206cc31--- /dev/null+++ b/src/components/common/icons/bug.js@@ -0,0 +1,46 @@+// Copyright (c) 2019 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import React, {Component} from 'react';+import PropTypes from 'prop-types';+import Base from './base';++export default class Bug extends Component {+ static propTypes = {+ /** Set the height of the icon, ex. '16px' */+ height: PropTypes.string+ };++ static defaultProps = {+ height: '16px',+ predefinedClassName: 'data-ex-icons-bug'+ };++ render() {+ return (+ <Base {...this.props}>+ <g>+ <path d="M32 8.333C26.698 8.333 22.4 13 22.4 19h19.2c0-6-4.298-10.667-9.6-10.667z"/>+ <path d="M53.6 32H46v-6.506c0-.074.184-.142.18-.215l5.417-5.907c.937-1.042.987-2.73.05-3.772-.937-1.041-2.432-1.041-3.369 0l-5.304 5.664c-.066-.004-.115-.264-.181-.264H21.207c-.066 0-.128.26-.193.264l-5.317-5.785c-.937-1.042-2.457-.981-3.394.06-.937 1.042-.937 2.76 0 3.802l5.516 5.923c-.003.072.181.156.181.23V32h-7.6C9.075 32 8 33.027 8 34.5S9.075 37 10.4 37h7.2c0 3 .375 4.299 1.025 6.12-.105.084-.227.253-.322.359l-6.788 7.603c-.937 1.041-.937 2.76 0 3.802.937 1.04 2.457 1.056 3.394.015l6.443-6.93C23.494 50.693 26 52.619 30 53.246V27h4v26.246c4-.626 6.506-2.545 8.648-5.27l6.343 6.938a2.29 2.29 0 0 0 3.444 0c.937-1.041.962-2.73.025-3.771L45.684 43.6c-.094-.105-.21-.396-.316-.48C46.018 41.298 46.4 40 46.4 37h7.2c1.325 0 2.4-1.027 2.4-2.5S54.925 32 53.6 32z"/>+ </g>+ </Base>+ );+ }+}diff --git a/src/components/common/icons/index.js b/src/components/common/icons/index.jsindex a729d84c5..d3c23c0bb 100644--- a/src/components/common/icons/index.js+++ b/src/components/common/icons/index.js@@ -23,6 +23,7 @@ export {default as ArrowDown} from './arrow-down';export {default as ArrowLeft} from './arrow-left';export {default as ArrowRight} from './arrow-right';export {default as Base} from './base';+export {default as Bug} from './bug';export {default as Checkmark} from './checkmark';export {default as Clock} from './clock';export {default as Close} from './close';diff --git a/src/components/side-panel/panel-header.js b/src/components/side-panel/panel-header.jsindex ef901f494..332556ebb 100644--- a/src/components/side-panel/panel-header.js+++ b/src/components/side-panel/panel-header.js@@ -59,9 +59,12 @@ const StyledPanelAction = styled.div.attrs({height: 26px;justify-content: space-between;margin-left: 4px;- width: 70px;padding: 5px;font-weight: bold;+ p {+ display: inline-block;+ margin-right: 6px;+ }a {height: 20px;}diff --git a/src/constants/index.js b/src/constants/index.jsindex 5f293762d..bf1dec046 100644--- a/src/constants/index.js+++ b/src/constants/index.js@@ -54,5 +54,11 @@ export {DEFAULT_COLOR_RANGE,PANELS} from './default-settings';++export {+ GITHUB_BUG_REPORT,+ GITHUB_USER_GUIDE+} from './user-guides';+export {VizColorPalette, DataVizColors} from './custom-color-ranges';export {COLOR_RANGES, DefaultColorRange} from './color-ranges';diff --git a/src/constants/user-guides.js b/src/constants/user-guides.jsindex bc5230694..e4361a28b 100644--- a/src/constants/user-guides.js+++ b/src/constants/user-guides.js@@ -21,7 +21,9 @@export const GITHUB_EXPORT_HTML_MAP = 'https://github.com/keplergl/kepler.gl/blob/master/docs/user-guides/k-save-and-export.md#2save-and-export-current-map';export const GITHUB_ADD_DATA_TO_MAP = 'https://github.com/keplergl/kepler.gl/blob/master/docs/api-reference/actions/actions.md#adddatatomap';export const MAPBOX_ACCESS_TOKEN = 'https://docs.mapbox.com/help/how-mapbox-works/access-tokens/';-export const GITHUB_BUG_REPORT = 'https://github.com/keplergl/kepler.gl/issues/new?template=bug_report.md';+// TODO: create new readme sectionexport const GITHUB_EXPORT_HTML_MAP_MODES = 'https://github.com/keplergl/kepler.gl/blob/master/docs/user-guides/k-save-and-export.md#2save-and-export-current-map';export const GUIDES_FILE_FORMAT = 'https://github.com/keplergl/kepler.gl/blob/master/docs/user-guides/b-kepler-gl-workflow/a-add-data-to-the-map.md#supported-file-formats';+export const GITHUB_BUG_REPORT = 'https://github.com/keplergl/kepler.gl/issues/new?assignees=&labels=bug&template=bug_report.md&title=%5BBug%5D';+export const GITHUB_USER_GUIDE = 'https://github.com/keplergl/kepler.gl/blob/master/docs/user-guides/a-introduction.md';