Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Enhancement] add file format instruction to file upload (#770)
Shan Hece943f077ab7
diff --git a/src/components/common/file-uploader/file-upload.js b/src/components/common/file-uploader/file-upload.jsindex 04b7e945b..3a9de50ce 100644--- a/src/components/common/file-uploader/file-upload.js+++ b/src/components/common/file-uploader/file-upload.js@@ -26,6 +26,9 @@ import UploadButton from './upload-button';import {FileType, DragNDrop} from 'components/common/icons';import LoadingSpinner from 'components/common/loading-spinner';import {isChrome} from 'utils/utils';+import {GUIDES_FILE_FORMAT} from 'constants/user-guides';+import ReactMarkdown from 'react-markdown';+// Breakpointsimport {media} from 'styles/media-breakpoints';@@ -38,11 +41,6 @@ const FileDrop =// it requires multiple files to be present.const defaultValidFileExt = ['csv',- // 'tar.gz',- // 'tgz',- // 'zip',- // 'gpx',- // 'kml','json','geojson'];@@ -50,12 +48,19 @@ const defaultValidFileExt = [const MESSAGE = ' Drag & Drop Your File(s) Here';const CHROME_MSG ='*Chrome user: Limit file size to 250mb, if need to upload larger file, try Safari';-const DISCLAIMER = '*Kepler.gl is a client-side application with no server backend. Data lives only on your machine/browser. ' ++const DISCLAIMER = '*kepler.gl is a client-side application with no server backend. Data lives only on your machine/browser. ' +'No information or map data is sent to any server.';-const CONFIG_UPLOAD_MESSAGE = 'Upload data files or upload a saved map via previously exported single Json of both config and data';+const CONFIG_UPLOAD_MESSAGE = `Upload **CSV**, **GeoJson** or saved map **Json**. Read more about [**supported file formats**](${GUIDES_FILE_FORMAT}).`;const fileIconColor = '#D3D8E0';+const LinkRenderer = props => {+ return (+ <a href={props.href} target="_blank" rel="noopener noreferrer">+ {props.children}+ </a>+ );+};const StyledUploadMessage = styled.div`color: ${props => props.theme.textColorLT};font-size: 14px;@@ -254,7 +259,12 @@ export default class FileUpload extends Component {onDragLeave={() => this._toggleDragState(false)}onDrop={this._handleFileInput}>- <StyledUploadMessage className="file-upload__message">{CONFIG_UPLOAD_MESSAGE}</StyledUploadMessage>+ <StyledUploadMessage className="file-upload__message">+ <ReactMarkdown+ source={CONFIG_UPLOAD_MESSAGE}+ renderers={{link: LinkRenderer}}+ />+ </StyledUploadMessage><StyledFileDrop dragOver={dragOver}><div style={{opacity: dragOver ? 0.5 : 1}}><StyledDragNDropIcon>diff --git a/src/constants/user-guides.js b/src/constants/user-guides.jsindex 5bc73a816..bc5230694 100644--- a/src/constants/user-guides.js+++ b/src/constants/user-guides.js@@ -24,3 +24,4 @@ export const MAPBOX_ACCESS_TOKEN = 'https://docs.mapbox.com/help/how-mapbox-workexport 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';