diff --git a/backend/utils/parse.js b/backend/utils/parse.js index 313f2dc..b7df49d 100644 --- a/backend/utils/parse.js +++ b/backend/utils/parse.js @@ -9,7 +9,7 @@ module.exports.parseRoute = route => route.filter(el => ( )); module.exports.parseStickers = stickers => stickers.filter(el => ( - Object.keys(el).length === 3 + Object.keys(el).length === 4 && el.latlng && Object.keys(el.latlng).length === 2 && el.latlng.lat @@ -19,6 +19,7 @@ module.exports.parseStickers = stickers => stickers.filter(el => ( && parseInt(el.latlng.lng, 10) > 0 && parseInt(el.latlng.lng, 10) < 1000 )); +// .map(el => ((el.text && String(el.text).substr(0, 100)) || '')); module.exports.parseString = (value, size) => (value && String(value).substr(0, size)) || ''; module.exports.parseNumber = (value, min, max) => (value && Number(value) && Math.min(max, Math.max(min, value))) || 0; diff --git a/src/components/StickerDesc.jsx b/src/components/StickerDesc.jsx new file mode 100644 index 0000000..38d361b --- /dev/null +++ b/src/components/StickerDesc.jsx @@ -0,0 +1,44 @@ +import React from 'react'; + +type State = { + text: String, +} + +export class StickerDesc extends React.PureComponent { + state = { + text: this.props.value, + }; + + setText = e => { + this.setState({ text: e.target.value }); + this.props.onChange(e.target.value); + }; + + blockMouse = e => e.stopPropagation(); // todo: pass here locker for moving markers from Sticker.js + + render() { + const { text } = this.state; + + return ( +
+
+ ') || ' ') + }} + /> +