// Copyright (c) 2022 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 from 'react'; import {StyledExportSection, StyledType, CheckMark} from 'components/common/styled-components'; import {StyledExportMapSection, StyledWarning, ExportMapLink} from './components'; import {EXPORT_HTML_MAP_MODE_OPTIONS} from 'constants/default-settings'; import {EXPORT_HTML_MAP_DOC, EXPORT_HTML_MAP_MODES_DOC} from 'constants/user-guides'; import styled from 'styled-components'; import {injectIntl} from 'react-intl'; import {FormattedMessage} from 'localization'; import {IntlShape} from 'react-intl'; import {setUserMapboxAccessToken, setExportHTMLMapMode, ActionHandler} from 'actions'; const ExportMapStyledExportSection = styled(StyledExportSection)` .disclaimer { font-size: ${props => props.theme.inputFontSize}; color: ${props => props.theme.inputColor}; margin-top: 12px; } `; interface StyledInputProps { error?: boolean; } const StyledInput = styled.input` width: 100%; padding: ${props => props.theme.inputPadding}; color: ${props => (props.error ? 'red' : props.theme.titleColorLT)}; height: ${props => props.theme.inputBoxHeight}; outline: 0; font-size: ${props => props.theme.inputFontSize}; :active, :focus, &.focus, &.active { outline: 0; } `; const BigStyledTile = styled(StyledType)` height: unset; width: unset; img { width: 180px; height: 120px; } `; type ExportHtmlMapProps = { onChangeExportMapHTMLMode: ActionHandler; onEditUserMapboxAccessToken: ActionHandler; options: { userMapboxToken?: string; mode?: string; }; }; type IntlProps = { intl: IntlShape; }; function ExportHtmlMapFactory(): React.ComponentType { /** @type {typeof import('./export-html-map').ExportHtmlMap} */ const ExportHtmlMap: React.FC = ({ onChangeExportMapHTMLMode = mode => {}, onEditUserMapboxAccessToken = token => {}, options = {}, intl }) => (
onEditUserMapboxAccessToken(e.target.value)} type="text" placeholder={intl.formatMessage({id: 'modal.exportMap.html.tokenPlaceholder'})} value={options ? options.userMapboxToken : ''} />
{EXPORT_HTML_MAP_MODE_OPTIONS.map(mode => ( mode.available && onChangeExportMapHTMLMode(mode.id)} >

{options.mode === mode.id && }
))}
); ExportHtmlMap.displayName = 'ExportHtmlMap'; return injectIntl(ExportHtmlMap); } export default ExportHtmlMapFactory;