From f9e2a6b792e906e3f1f736a365777356b57821e6 Mon Sep 17 00:00:00 2001 From: Fabioomega Date: Fri, 15 Mar 2024 11:48:25 -0300 Subject: [PATCH] =?UTF-8?q?Bot=C3=A3o=20IA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/app/js/MapView.jsx | 28 +++++++++++++++++++++----- app/static/app/js/classes/TempLayer.js | 2 +- app/static/app/js/components/Map.jsx | 6 ++++++ app/static/app/js/css/MapView.scss | 8 ++++++++ 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/app/static/app/js/MapView.jsx b/app/static/app/js/MapView.jsx index d1e4cab7..ae3ace28 100644 --- a/app/static/app/js/MapView.jsx +++ b/app/static/app/js/MapView.jsx @@ -4,6 +4,7 @@ import Map from './components/Map'; import $ from 'jquery'; import PropTypes from 'prop-types'; import { _, interpolate } from './classes/gettext'; +import update from 'immutability-helper'; class MapView extends React.Component { static defaultProps = { @@ -48,11 +49,13 @@ class MapView extends React.Component { this.state = { selectedMapType, - tiles: this.getTilesByMapType(selectedMapType) + tiles: this.getTilesByMapType(selectedMapType), + AIEnabled: false }; this.getTilesByMapType = this.getTilesByMapType.bind(this); this.handleMapTypeButton = this.handleMapTypeButton.bind(this); + this.handleAIBtnClick = this.handleAIBtnClick.bind(this); } getTilesByMapType(type){ @@ -75,13 +78,23 @@ class MapView extends React.Component { handleMapTypeButton(type){ return () => { - this.setState({ - selectedMapType: type, - tiles: this.getTilesByMapType(type) - }); + this.setState(update(this.state, { + $merge: { + selectedMapType: type, + tiles: this.getTilesByMapType(type) + } + })); }; } + handleAIBtnClick() { + this.setState(update(this.state, { + AIEnabled: {$set: !this.state.AIEnabled} + })); + + + } + render(){ let mapTypeButtons = [ { @@ -118,6 +131,11 @@ class MapView extends React.Component { onClick={this.handleMapTypeButton(mapType.type)} className={"btn rounded-corners " + (mapType.type === this.state.selectedMapType ? "selected-button" : "default-button")}> {mapType.label} )} + {this.props.title ? diff --git a/app/static/app/js/classes/TempLayer.js b/app/static/app/js/classes/TempLayer.js index b64d756e..b7cb8228 100644 --- a/app/static/app/js/classes/TempLayer.js +++ b/app/static/app/js/classes/TempLayer.js @@ -55,7 +55,7 @@ export function addTempLayer(file, cb) { return { opacity: 1, fillOpacity: 0.7, - color: getColor() + color: '#99ff99' } }, //for point layers diff --git a/app/static/app/js/components/Map.jsx b/app/static/app/js/components/Map.jsx index e7a080ff..4c7e5ef5 100644 --- a/app/static/app/js/components/Map.jsx +++ b/app/static/app/js/components/Map.jsx @@ -133,6 +133,12 @@ class Map extends React.Component { async.each(tiles, (tile, done) => { const { url, meta, type } = tile; + + window.this_map_info = { + id: meta.task.id, + project: meta.task.project + } + let metaUrl = url + "metadata"; diff --git a/app/static/app/js/css/MapView.scss b/app/static/app/js/css/MapView.scss index be10cf06..8815c8a9 100644 --- a/app/static/app/js/css/MapView.scss +++ b/app/static/app/js/css/MapView.scss @@ -112,6 +112,14 @@ margin-top: 0px; margin-bottom: 0px; } + + &.AI-btn { + font-size: 13px; + + i { + padding-right: 1px; + } + } } }