Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mapfor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simcaq
Mapfor
Commits
bd743bcc
Commit
bd743bcc
authored
3 years ago
by
Miguel Angelo Salerno
Browse files
Options
Downloads
Patches
Plain Diff
add active filters to the map
parent
36ec390b
Branches
Branches containing commit
No related tags found
2 merge requests
!41
Homologa
,
!39
New fixes
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Map/MapComponent.js
+36
-0
36 additions, 0 deletions
src/components/Map/MapComponent.js
src/css/Map/MapComponent.scss
+17
-3
17 additions, 3 deletions
src/css/Map/MapComponent.scss
with
53 additions
and
3 deletions
src/components/Map/MapComponent.js
+
36
−
0
View file @
bd743bcc
...
...
@@ -63,6 +63,7 @@ function MapComponent(props) {
}
const
[
mapTitleData
,
setMapTitleData
]
=
useState
([])
const
[
selectedFilters
,
setSelectedFilters
]
=
useState
([])
useEffect
(()
=>
{
ConsultHandler
.
fetchVar
(
...
...
@@ -84,6 +85,35 @@ function MapComponent(props) {
// eslint-disable-next-line react-hooks/exhaustive-deps
},
[
filtersLocation
,
filtersEducation
,
indicador
,
indicador
.
route
,
indicador
.
routeDim
]);
useEffect
(()
=>
{
const
filters
=
Object
.
entries
(
filtersEducation
)
const
mappedFilters
=
filters
.
map
((
item
)
=>
{
if
(
item
[
1
].
value
.
length
!==
0
)
{
let
chosenFilters
=
[]
for
(
let
idx
in
item
[
1
].
value
)
{
const
filterFound
=
item
[
1
].
data
.
find
(
filterItem
=>
filterItem
.
id
===
item
[
1
].
value
[
idx
])
chosenFilters
=
[
...
chosenFilters
,
filterFound
.
name
]
}
return
chosenFilters
}
else
{
return
[]
}
})
let
formattedFilters
=
''
for
(
let
idx
in
mappedFilters
)
{
for
(
let
jdx
in
mappedFilters
[
idx
])
{
formattedFilters
=
formattedFilters
===
''
?
mappedFilters
[
idx
][
jdx
]
:
formattedFilters
+
'
,
'
+
mappedFilters
[
idx
][
jdx
]
}
}
setSelectedFilters
(
formattedFilters
)
},
[
filtersEducation
])
useEffect
(()
=>
{
if
(
!
mapLoading
&&
mapData
.
length
>
0
)
{
setFormationData
(
mapData
)
...
...
@@ -381,6 +411,12 @@ function MapComponent(props) {
color
=
"
deepskyblue
"
/>
<
/div
>
{
selectedFilters
===
''
?
null
:
<
div
className
=
"
active-filters
"
>
<
p
><
strong
>
Filtros
ativos
:
<
/strong>{selectedFilters}</
p
>
<
/div
>
}
<
Map
ref
=
{
mapRef
}
bounds
=
{
mapBounds
}
minZoom
=
{
7
}
zoomSnap
=
{
0.1
}
>
<
TileLayer
attribution
=
"
<p>&copy <a href='http://osm.c3sl.ufpr.br/'>OpenStreetMap</a> contributors</p>
"
...
...
This diff is collapsed.
Click to expand it.
src/css/Map/MapComponent.scss
+
17
−
3
View file @
bd743bcc
.map
{
z-index
:
0
;
height
:
650px
;
//
height: 650px;
width
:
100%
;
max-width
:
930px
;
.active-filters
{
border-radius
:
10px
;
box-shadow
:
0
0
8px
rgba
(
0
,
0
,
0
,
0
.2
);
padding
:
10px
20px
;
margin-bottom
:
10px
;
p
{
font-family
:
'Montserrat'
;
font-size
:
14px
;
margin
:
0
;
padding
:
0
;
}
}
.leaflet-container
{
border-radius
:
10px
;
box-shadow
:
0
0
8px
rgba
(
0
,
0
,
0
,
0
.2
);
border-radius
:
10px
;
height
:
650px
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment