@tmf_ciclica/ciclicastorybook 1.0.12 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/package.json +32 -54
  2. package/.storybook/main.js +0 -21
  3. package/.storybook/preview.jsx +0 -31
  4. package/eslint.config.js +0 -38
  5. package/index.html +0 -13
  6. package/public/vite.svg +0 -1
  7. package/src/App.css +0 -0
  8. package/src/App.jsx +0 -36
  9. package/src/_variables.scss +0 -56
  10. package/src/assets/img/arrowDown.svg +0 -3
  11. package/src/assets/img/closeIcon.svg +0 -4
  12. package/src/assets/img/copyIcon.svg +0 -17
  13. package/src/assets/img/deleteIcon.svg +0 -6
  14. package/src/assets/img/eyeActiveIcon.svg +0 -6
  15. package/src/assets/img/eyeNotActiveIcon.svg +0 -8
  16. package/src/assets/img/filtersIcon.svg +0 -6
  17. package/src/assets/img/langarrow.png +0 -0
  18. package/src/assets/img/pause.svg +0 -5
  19. package/src/assets/img/play.svg +0 -4
  20. package/src/assets/img/processingIcon.svg +0 -20
  21. package/src/assets/img/sample-image.png +0 -0
  22. package/src/assets/img/sample2.png +0 -0
  23. package/src/assets/img/world.svg +0 -3
  24. package/src/assets/mapStyles/mapStyle.js +0 -781
  25. package/src/components/AmbitSelector/AmbitItem/AmbitItem.jsx +0 -74
  26. package/src/components/AmbitSelector/AmbitItem/AmbitItem.module.scss +0 -27
  27. package/src/components/AmbitSelector/AmbitSelector.jsx +0 -68
  28. package/src/components/AmbitSelector/AmbitSelector.module.scss +0 -29
  29. package/src/components/AmbitSelector/AmbitSelector.stories.jsx +0 -21
  30. package/src/components/ButtonsList/ButtonsList.jsx +0 -92
  31. package/src/components/ButtonsList/ButtonsList.module.scss +0 -37
  32. package/src/components/ButtonsList/ButtonsList.stories.jsx +0 -55
  33. package/src/components/DropdownList/DropdownList.jsx +0 -69
  34. package/src/components/DropdownList/DropdownList.module.scss +0 -20
  35. package/src/components/DropdownList/DropdownList.stories.jsx +0 -22
  36. package/src/components/DropdownList/DropdownListExample/DropDownListExample.jsx +0 -33
  37. package/src/components/DropdownList/DropdownListExample/DropdownListExample.stories.jsx +0 -11
  38. package/src/components/EditAmbit/EditAmbit.jsx +0 -7
  39. package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.jsx +0 -57
  40. package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.module.scss +0 -13
  41. package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.stories.jsx +0 -47
  42. package/src/components/FiltersAmbit/FiltersAmbit.jsx +0 -58
  43. package/src/components/FiltersAmbit/FiltersAmbit.module.scss +0 -28
  44. package/src/components/FiltersAmbit/FiltersAmbit.stories.jsx +0 -36
  45. package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.jsx +0 -33
  46. package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.module.scss +0 -13
  47. package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.stories.jsx +0 -47
  48. package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.jsx +0 -83
  49. package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.module.scss +0 -8
  50. package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.stories.jsx +0 -17
  51. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersCategory/TematicalFiltersCategory.jsx +0 -60
  52. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/AbsoluteSlider/AbsoluteSlider.jsx +0 -61
  53. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/AbsoluteSlider/AbsoluteSlider.module.scss +0 -45
  54. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/CategoryCheckbox/CategoryChackbox.module.scss +0 -18
  55. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/CategoryCheckbox/CategoryCheckbox.jsx +0 -47
  56. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/TematicalFiltersInput.jsx +0 -267
  57. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/TematicalFiltersInput.module.scss +0 -31
  58. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersSubcat/TematicalFiltersSubcat.jsx +0 -58
  59. package/src/components/FiltersAmbit/useAmbitStore.jsx +0 -10
  60. package/src/components/Graphic/BarChart/BarChart.jsx +0 -146
  61. package/src/components/Graphic/BarChart/BarChart.module.scss +0 -5
  62. package/src/components/Graphic/BarChart/BarChart.stories.jsx +0 -18
  63. package/src/components/Graphic/Graphic.jsx +0 -55
  64. package/src/components/Graphic/Graphic.module.scss +0 -12
  65. package/src/components/Graphic/Graphic.stories.jsx +0 -25
  66. package/src/components/IndicatorsList/Indicator/Indicator.jsx +0 -180
  67. package/src/components/IndicatorsList/Indicator/Indicator.module.scss +0 -46
  68. package/src/components/IndicatorsList/IndicatorSubCategory/IndicatorSubCategory.jsx +0 -76
  69. package/src/components/IndicatorsList/IndicatorSubCategory/IndicatorSubCategory.module.scss +0 -12
  70. package/src/components/IndicatorsList/IndicatorsCategory/IndicatorsCategory.jsx +0 -122
  71. package/src/components/IndicatorsList/IndicatorsCategory/IndicatorsCategory.module.scss +0 -20
  72. package/src/components/IndicatorsList/IndicatorsList.jsx +0 -173
  73. package/src/components/IndicatorsList/IndicatorsList.module.scss +0 -10
  74. package/src/components/IndicatorsList/IndicatorsList.stories.jsx +0 -263
  75. package/src/components/LangSelector/LangSelector.jsx +0 -70
  76. package/src/components/LangSelector/LangSelector.module.scss +0 -41
  77. package/src/components/LangSelector/LangSelector.stories.jsx +0 -27
  78. package/src/components/Legend/Legend.jsx +0 -132
  79. package/src/components/Legend/Legend.module.scss +0 -121
  80. package/src/components/Legend/Legend.stories.jsx +0 -53
  81. package/src/components/LogoApp/LogoApp.jsx +0 -33
  82. package/src/components/LogoApp/LogoApp.module.scss +0 -7
  83. package/src/components/LogoApp/LogoApp.stories.jsx +0 -27
  84. package/src/components/MapboxMap/MapboxMap.jsx +0 -160
  85. package/src/components/MapboxMap/MapboxMap.module.scss +0 -4
  86. package/src/components/MapboxMap/MapboxMap.stories.jsx +0 -57
  87. package/src/components/MaplibreMap/MaplibreMap.jsx +0 -166
  88. package/src/components/MaplibreMap/MaplibreMap.module.scss +0 -5
  89. package/src/components/MaplibreMap/MaplibreMap.stories.jsx +0 -55
  90. package/src/components/SectionBar/SectionBar.jsx +0 -41
  91. package/src/components/SectionBar/SectionBar.module.scss +0 -40
  92. package/src/components/SectionBar/SectionBar.stories.jsx +0 -35
  93. package/src/components/TimeSlider/TimeSlider.jsx +0 -147
  94. package/src/components/TimeSlider/TimeSlider.module.scss +0 -63
  95. package/src/components/TimeSlider/TimeSlider.stories.jsx +0 -9
  96. package/src/components/Tooltip/Tooltip.jsx +0 -40
  97. package/src/components/Tooltip/Tooltip.module.scss +0 -141
  98. package/src/components/Tooltip/Tooltip.stories.jsx +0 -51
  99. package/src/components/TopNavMenu/TopNavMenu.jsx +0 -62
  100. package/src/components/TopNavMenu/TopNavMenu.module.scss +0 -21
  101. package/src/components/TopNavMenu/TopNavMenu.stories.jsx +0 -20
  102. package/src/components/UserMenuTrigger/UserMenuTrigger.jsx +0 -47
  103. package/src/components/UserMenuTrigger/UserMenuTrigger.module.scss +0 -5
  104. package/src/components/UserMenuTrigger/UserMenuTrigger.stories.jsx +0 -33
  105. package/src/components/index.jsx +0 -17
  106. package/src/constants/indicators.js +0 -1371
  107. package/src/constants/mapTexts.js +0 -161
  108. package/src/constants/textLayers.js +0 -639
  109. package/src/constants/topNavMenuOptions.js +0 -14
  110. package/src/i18n.js +0 -19
  111. package/src/index.jsx +0 -2
  112. package/src/index.scss +0 -87
  113. package/src/locales/ca.json +0 -8
  114. package/src/locales/es.json +0 -15
  115. package/src/main.jsx +0 -10
  116. package/src/sections/HeaderSection/HeaderSection.jsx +0 -51
  117. package/src/sections/HeaderSection/HeaderSection.module.scss +0 -33
  118. package/src/sections/HeaderSection/HeaderSection.stories.jsx +0 -61
  119. package/src/sections/RightSidebar/RightSidebar.jsx +0 -35
  120. package/src/sections/RightSidebar/RightSidebar.module.scss +0 -39
  121. package/src/sections/RightSidebar/RightSidebar.stories.jsx +0 -21
  122. package/src/sections/index.jsx +0 -2
  123. package/src/store/index.js +0 -1
  124. package/src/store/mapSlice/index.js +0 -1
  125. package/src/store/mapSlice/mapSlice.js +0 -30
  126. package/src/store/rightBarSlice/index.js +0 -1
  127. package/src/store/rightBarSlice/rightBarSlice.js +0 -28
  128. package/src/store/routerSlice/index.js +0 -1
  129. package/src/store/routerSlice/routerSlice.js +0 -14
  130. package/src/store/store.js +0 -14
  131. package/src/store/userSlice/index.js +0 -1
  132. package/src/store/userSlice/userSlice.js +0 -22
  133. package/tmf_ciclica-ciclicastorybook-1.0.8.tgz +0 -0
  134. package/vite.config.js +0 -49
@@ -1,53 +0,0 @@
1
- import { Provider } from "react-redux"
2
- import { configureStore } from "@reduxjs/toolkit"
3
- import { Legend } from "./Legend"
4
-
5
- export default {
6
- title: "Components/Legend",
7
- component: Legend,
8
- args: {
9
- title: "Legend Title",
10
- containerStyles: {},
11
- },
12
- }
13
-
14
- export const DefaultLegend = {
15
- args: {
16
- title: "Sant Esteve de Palautordera",
17
- infoList: [
18
- { title: "Number of residential properties", value: 1.156 },
19
- { title: "Number of single-family dwellings", value: 1.156 },
20
- { title: "Number of multi-family dwellings", value: 246 },
21
- ],
22
- legendList: [
23
- { title: "Residential", color: "#FFB741" },
24
- { title: "Offices", color: "#E9622C" },
25
- { title: "Administration", color: "#043666" },
26
- { title: "Transport", color: "#822C58" },
27
- ],
28
- legendListTitle: "Main Use",
29
- buttonTitle: "More Info",
30
- onClickMoreInfo: () => alert("More Info Clicked"),
31
- onClickClose: () => alert("Close clicked"),
32
- },
33
- }
34
- export const AbsoluteValue = {
35
- args: {
36
- title: "Sant Esteve de Palautordera",
37
- infoList: [
38
- { title: "Number of residential properties", value: 1.156 },
39
- { title: "Number of single-family dwellings", value: 1.156 },
40
- { title: "Number of multi-family dwellings", value: 246 },
41
- ],
42
- absoluteValue: {
43
- "maxColor": "#043666",
44
- "minColor": "red",
45
- "minValue": "0 Viviendas",
46
- "maxValue": "100 Viviendas"
47
- },
48
- legendListTitle: "Main Use",
49
- buttonTitle: "More Info",
50
- onClickMoreInfo: () => alert("More Info Clicked"),
51
- onClickClose: () => alert("Close clicked"),
52
- },
53
- }
@@ -1,33 +0,0 @@
1
- /*
2
- Componente para el logo de la aplicación. Recibe:
3
- - Src de la imagen
4
- - Texto alt (obligatorio)
5
- - href en el caso de que funcione como link
6
- */
7
- import { useTranslation } from "react-i18next"
8
- import PropTypes from "prop-types";
9
-
10
- //styles
11
- import styles from "./LogoApp.module.scss"
12
-
13
- export const LogoApp = ({ src, alt, href }) => {
14
- const { t } = useTranslation()
15
- const imgElement = <img src={src} alt={t(alt)} />;
16
-
17
- return href ? (
18
- <div className={styles.logo}>
19
- <a href={href}>
20
- {imgElement}
21
- </a>
22
- </div>
23
- ) : (
24
- <div className={styles.logo}>{imgElement}</div>
25
- );
26
- };
27
-
28
- LogoApp.propTypes = {
29
- src: PropTypes.string.isRequired,
30
- alt: PropTypes.string.isRequired,
31
- href: PropTypes.string,
32
- className: PropTypes.string,
33
- };
@@ -1,7 +0,0 @@
1
- .logo {
2
- padding: 10px;
3
- height: 100%;
4
- img {
5
- height: 100%;
6
- }
7
- }
@@ -1,27 +0,0 @@
1
- import { LogoApp } from "./LogoApp";
2
- import sampleImage from "../../assets/img/sample-image.png";
3
-
4
- export default {
5
- title: "Components/LogoApp",
6
- component: LogoApp,
7
- };
8
-
9
- const Template = (args) => <LogoApp {...args} />;
10
-
11
- export const Default = Template.bind({});
12
- Default.args = {
13
- alt: "Sample Image",
14
- };
15
-
16
- export const WithCustomImage = Template.bind({});
17
- WithCustomImage.args = {
18
- src: sampleImage,
19
- alt: "Custom Image",
20
- };
21
-
22
- export const WithLink = Template.bind({});
23
- WithLink.args = {
24
- src: sampleImage,
25
- alt: "Linked Image",
26
- href: "https://example.com",
27
- };
@@ -1,160 +0,0 @@
1
- /*
2
- Mapa de mapbox-gl utilizando react-map-gl
3
- yarn add react-map-gl mapbox-gl @types/mapbox-gl
4
- Necesita un token de mapbox que tendremos en guardado en el .env
5
- Recibe:
6
- ·initialView-> {latitud, longitud, zoom} vista inicial del mapa
7
- ·maxZoom
8
- ·minZoom
9
- ·mapStyle->estilo del mapa. IMPORTANTE que las capas tipo symbol sean las últimas en el array de layers y tener identificada la primera de ellas
10
- ·firstSymbolLayer->id de la primera capa tipo symbol del mapa
11
- ·className
12
- ·layers->array de layers (ver PropTypes al final del componente)
13
- ·sources-> array de sources (ver PropTypes al final del componente)
14
- ·interactiveLayers->ids de las layers que deben responder al click
15
- ·onClick-> función onclick en el mapa (dependerá de la propiedad "interactiveLayers")
16
- ·popUp->si ha de haber un popup de los features, aquí pasamos todo lo necesario (propTypes)
17
- */
18
-
19
- import { useEffect, useRef, useState } from 'react';
20
- import mapboxgl from 'mapbox-gl';
21
- import 'mapbox-gl/dist/mapbox-gl.css';
22
- import { useSelector } from 'react-redux';
23
- import PropTypes from 'prop-types';
24
- import
25
- Map, {
26
- Layer,
27
- NavigationControl,
28
- Popup,
29
- Source
30
- }
31
- from 'react-map-gl/mapbox'
32
-
33
- //styles
34
- import styles from './MapboxMap.module.scss'
35
-
36
- // Token de Mapbox
37
- //mapboxgl.accessToken = process.env.REACT_APP_MAPBOX_TOKEN || 'pk.eyJ1IjoiY2ljbGljYSIsImEiOiJja3llODhxZ2UwYzF1Mm5xcHVhMzI3anhqIn0.-r56FLAzEH57eVsB2ZeVcA'
38
- mapboxgl.accessToken = 'pk.eyJ1IjoiY2ljbGljYSIsImEiOiJja3llODhxZ2UwYzF1Mm5xcHVhMzI3anhqIn0.-r56FLAzEH57eVsB2ZeVcA'
39
- export const MapboxMap = ({
40
- initialView = { latitude: 39.4699, longitude: -0.3763, zoom: 12 },
41
- maxZoom = 17,
42
- minZoom = 8,
43
- mapStyle,
44
- firstSymbolLayer,
45
- cssProps = '',
46
- onClick = '',
47
- interactiveLayers = [],
48
- popUp = false,
49
- sources = [],
50
- layers = []
51
- }) => {
52
- const mapRef = useRef()
53
- const [showPopup, setShowPopup] = useState(null)
54
- const showTexts = useSelector((state) => state.mapState.showTexts)
55
- useEffect(() => {
56
- if (mapRef.current) {
57
- const map = mapRef.current.getMap()
58
- const layers = map.getStyle().layers
59
- layers.map((layer) => {
60
- if (layer.type == "symbol" && layer.id != "professionals") {
61
- if (showTexts) {
62
- map.setLayoutProperty(layer.id, "visibility", "visible")
63
- } else {
64
- map.setLayoutProperty(layer.id, "visibility", "none")
65
- }
66
- }
67
- })
68
- }
69
- }, [showTexts])
70
- return (
71
- <div className={`${styles.mapContainer}`} style={cssProps}>
72
- <Map
73
- initialViewState={initialView}
74
- ref={mapRef}
75
- hash={false}
76
- maxZoom={maxZoom}
77
- minZoom={minZoom}
78
- mapStyle={mapStyle}
79
- onClick= {onClick}
80
- interactiveLayerIds={interactiveLayers}
81
- >
82
- {/* Mapeamos las sources y layers para añadirlas al mapa */}
83
- {sources.length && sources.map((source, i) => {
84
- return (
85
- <Source
86
- key={i}
87
- {...source}
88
- >
89
- {layers.length && layers.map((layer, i)=> {
90
- if(layer.sourceId == source.id) return (
91
- <Layer
92
- key={i}
93
- {...layer.layer}
94
- beforeId={firstSymbolLayer}
95
- />
96
- )
97
- })}
98
- </Source>
99
- )
100
- })}
101
- <NavigationControl position="bottom-right" visualizePitch />
102
- {
103
- (popUp && showPopup) &&
104
- <Popup
105
- longitude={popUp.longitude}
106
- latitude={popUp.latitude}
107
- anchor={popUp.anchor}
108
- onClose={() => setShowPopup(null)}
109
- >
110
- {popUp.content}
111
- </Popup>
112
- }
113
- </Map>
114
- </div>
115
- );
116
- };
117
-
118
- MapboxMap.propTypes = {
119
- initialView: PropTypes.shape({
120
- latitude: PropTypes.number.isRequired,
121
- longitude: PropTypes.number.isRequired,
122
- zoom: PropTypes.number.isRequired,
123
- }),
124
- mapStyle: PropTypes.object,
125
- firstSymbolLayer: PropTypes.string,
126
- cssProps: PropTypes.object,
127
- style: PropTypes.object,
128
- maxZoom: PropTypes.number,
129
- minZoom: PropTypes.number,
130
- onClick: PropTypes.func,
131
- interactiveLayers: PropTypes.array,
132
- popUp: PropTypes.shape({
133
- latitude: PropTypes.number,
134
- longitude: PropTypes.number,
135
- anchor: PropTypes.string,
136
- content: PropTypes.element
137
- }),
138
- textsUrl: PropTypes.string,
139
- sources: PropTypes.arrayOf(
140
- PropTypes.shape({
141
- id: PropTypes.string,
142
- type: PropTypes.string,
143
- url: PropTypes.string, //si es type: vector
144
- data: PropTypes.object //si es type: geojson
145
- })
146
- ),
147
- layers: PropTypes.arrayOf(
148
- PropTypes.shape({
149
- sourceId: PropTypes.string,
150
- layer: PropTypes.shape({
151
- id: PropTypes.string,
152
- type: PropTypes.string,
153
- sourceLayer: PropTypes.string,
154
- minZoom: PropTypes.number,
155
- maxZoom: PropTypes.number,
156
- paint: PropTypes.object
157
- })
158
- })
159
- )
160
- };
@@ -1,4 +0,0 @@
1
- .mapContainer {
2
- width: 100vw;
3
- height: 100vh;
4
- }
@@ -1,57 +0,0 @@
1
- //components
2
-
3
- import { MapboxMap } from "./MapboxMap";
4
-
5
- import lightStyle from "../../assets/mapStyles/mapStyle.js"
6
- import { textLayers } from '../../constants/mapTexts';
7
-
8
- export default {
9
- title: 'Components/MapboxMap',
10
- component: MapboxMap
11
- }
12
-
13
-
14
- export const Default = {
15
- args: {
16
- initialView: {
17
- latitude: parseFloat('39.4699'),
18
- longitude: parseFloat('-0.3763'),
19
- zoom: 10
20
- },
21
- mapStyle: lightStyle,
22
- textLayers: textLayers
23
- }
24
- }
25
- export const MunisLayer = {
26
- args: {
27
- initialView: {
28
- latitude: parseFloat('43.2630'),
29
- longitude: parseFloat('-2.9350'),
30
- zoom: 10
31
- },
32
- mapStyle: lightStyle,
33
- sources: [
34
- {
35
- id: 'municipis',
36
- type: 'vector',
37
- url: 'https://tiles.urbanzeb.com/VT_HDR/data/municipios.json'
38
- }
39
- ],
40
- layers: [
41
- {
42
- sourceId: 'municipis',
43
- layer: {
44
- id:'municipis-pv',
45
- type: 'fill',
46
- 'source-layer': 'PB_Munis_4326',
47
- minZoom: 0,
48
- maxZoom: 22,
49
- paint: {
50
- 'fill-color': '#000000',
51
- 'fill-opacity': 0.5
52
- }
53
- }
54
- }
55
- ]
56
- }
57
- }
@@ -1,166 +0,0 @@
1
- /*
2
- Mapa de mapbox-gl utilizando react-map-gl
3
- yarn add react-map-gl mapbox-gl @types/mapbox-gl
4
- Necesita un token de mapbox que tendremos en guardado en el .env
5
- Recibe:
6
- ·initialView-> {latitud, longitud, zoom} vista inicial del mapa
7
- ·maxZoom
8
- ·minZoom
9
- ·mapStyle->estilo del mapa. IMPORTANTE que las capas tipo symbol sean las últimas en el array de layers y tener identificada la primera de ellas
10
- ·firstSymbolLayer->id de la primera capa tipo symbol del mapa
11
- ·className
12
- ·layers->array de layers (ver PropTypes al final del componente)
13
- ·sources-> array de sources (ver PropTypes al final del componente)
14
- ·interactiveLayers->ids de las layers que deben responder al click
15
- ·onClick-> función onclick en el mapa (dependerá de la propiedad "interactiveLayers")
16
- ·popUp->si ha de haber un popup de los features, aquí pasamos todo lo necesario (propTypes)
17
- */
18
-
19
- import { useEffect, useRef, useState } from 'react';
20
- import MapLibreGL from "maplibre-gl"
21
- import { useSelector } from 'react-redux';
22
- import PropTypes from 'prop-types';
23
- import { Protocol } from "pmtiles"
24
- import
25
- Map, {
26
- Layer,
27
- NavigationControl,
28
- Popup,
29
- Source
30
- }
31
- from 'react-map-gl/maplibre'
32
-
33
- //styles
34
- import styles from './MaplibreMap.module.scss'
35
-
36
-
37
- export const MaplibreMap = ({
38
- initialView = { latitude: 39.4699, longitude: -0.3763, zoom: 12 },
39
- maxZoom = 17,
40
- minZoom = 8,
41
- mapStyle,
42
- firstSymbolLayer,
43
- cssProps = {},
44
- onClick = '',
45
- interactiveLayers = [],
46
- popUp = false,
47
- sources = [],
48
- layers = []
49
- }) => {
50
- const mapRef = useRef()
51
- const [showPopup, setShowPopup] = useState(null)
52
- const showTexts = useSelector((state) => state.mapState.showTexts)
53
- //mostramos/ocultamos las capas de texto
54
- useEffect(() => {
55
- if (mapRef.current) {
56
- const map = mapRef.current.getMap()
57
- const layers = map.getStyle().layers
58
- layers.map((layer) => {
59
- if (layer.type == "symbol" && layer.id != "professionals") {
60
- if (showTexts) {
61
- map.setLayoutProperty(layer.id, "visibility", "visible")
62
- } else {
63
- map.setLayoutProperty(layer.id, "visibility", "none")
64
- }
65
- }
66
- })
67
- }
68
- }, [showTexts])
69
- //preparamos el mapa para cargar capas de pmtiles
70
- useEffect(() => {
71
- let protocol = new Protocol()
72
- MapLibreGL.addProtocol("pmtiles", protocol.tile)
73
- return () => {
74
- MapLibreGL.removeProtocol("pmtiles")
75
- }
76
- }, [])
77
- return (
78
- <div className={`${styles.mapContainer}`} style={cssProps && cssProps}>
79
- <Map
80
- initialViewState={initialView}
81
- ref={mapRef}
82
- hash={false}
83
- maxZoom={maxZoom}
84
- minZoom={minZoom}
85
- mapStyle={mapStyle}
86
- onClick= {onClick}
87
- interactiveLayerIds={interactiveLayers}
88
- >
89
- {/* Mapeamos las sources y layers para añadirlas al mapa */}
90
- {sources.length && sources.map((source, i) => {
91
- return (
92
- <Source
93
- key={i}
94
- {...source}
95
- >
96
- {layers.length && layers.map((layer, i)=> {
97
- if(layer.sourceId == source.id) return (
98
- <Layer
99
- key={i}
100
- {...layer.layer}
101
- beforeId={firstSymbolLayer}
102
- />
103
- )
104
- })}
105
- </Source>
106
- )
107
- })}
108
- <NavigationControl position="bottom-right" visualizePitch />
109
- {
110
- (popUp && showPopup) &&
111
- <Popup
112
- longitude={popUp.longitude}
113
- latitude={popUp.latitude}
114
- anchor={popUp.anchor}
115
- onClose={() => setShowPopup(null)}
116
- >
117
- {popUp.content}
118
- </Popup>
119
- }
120
- </Map>
121
- </div>
122
- );
123
- };
124
-
125
- MaplibreMap.propTypes = {
126
- initialView: PropTypes.shape({
127
- latitude: PropTypes.number.isRequired,
128
- longitude: PropTypes.number.isRequired,
129
- zoom: PropTypes.number.isRequired,
130
- }),
131
- mapStyle: PropTypes.string,
132
- firstSymbolLayer: PropTypes.string,
133
- cssProps: PropTypes.object,
134
- style: PropTypes.object,
135
- maxZoom: PropTypes.number,
136
- minZoom: PropTypes.number,
137
- onClick: PropTypes.func,
138
- interactiveLayers: PropTypes.array,
139
- popUp: PropTypes.shape({
140
- latitude: PropTypes.number,
141
- longitude: PropTypes.number,
142
- anchor: PropTypes.string,
143
- content: PropTypes.element
144
- }),
145
- sources: PropTypes.arrayOf(
146
- PropTypes.shape({
147
- id: PropTypes.string,
148
- type: PropTypes.string,
149
- url: PropTypes.string, //si es type: vector
150
- data: PropTypes.object //si es type: geojson
151
- })
152
- ),
153
- layers: PropTypes.arrayOf(
154
- PropTypes.shape({
155
- sourceId: PropTypes.string,
156
- layer: PropTypes.shape({
157
- id: PropTypes.string,
158
- type: PropTypes.string,
159
- sourceLayer: PropTypes.string,
160
- minZoom: PropTypes.number,
161
- maxZoom: PropTypes.number,
162
- paint: PropTypes.object
163
- })
164
- })
165
- )
166
- };
@@ -1,5 +0,0 @@
1
- @import url("https://unpkg.com/maplibre-gl@^5.3.0/dist/maplibre-gl.css");
2
- .mapContainer {
3
- width: 100vw;
4
- height: calc(100vh - $headerHeight);
5
- }
@@ -1,55 +0,0 @@
1
- //components
2
-
3
- import { MaplibreMap } from "./MaplibreMap";
4
-
5
-
6
-
7
- export default {
8
- title: 'Components/MaplibreMap',
9
- component: MaplibreMap
10
- }
11
-
12
-
13
- export const Default = {
14
- args: {
15
- initialView: {
16
- latitude: parseFloat('39.4699'),
17
- longitude: parseFloat('-0.3763'),
18
- zoom: 10
19
- },
20
- mapStyle: "https://api.maptiler.com/maps/0196d855-d6c7-7d69-8a1a-333bda2c6b76/style.json?key=yYOspPMp7YyceIM85690",
21
- firstSymbolLayer: 'Ocean labels'
22
- }
23
- }
24
- export const MunisLayer = {
25
- args: {
26
- initialView: {
27
- latitude: parseFloat('43.2630'),
28
- longitude: parseFloat('-2.9350'),
29
- zoom: 10
30
- },
31
- sources: [
32
- {
33
- id: 'municipis',
34
- type: 'vector',
35
- url: 'https://tiles.urbanzeb.com/VT_HDR/data/municipios.json'
36
- }
37
- ],
38
- layers: [
39
- {
40
- sourceId: 'municipis',
41
- layer: {
42
- id:'municipis-pv',
43
- type: 'fill',
44
- 'source-layer': 'PB_Munis_4326',
45
- minZoom: 0,
46
- maxZoom: 22,
47
- paint: {
48
- 'fill-color': '#000000',
49
- 'fill-opacity': 0.5
50
- }
51
- }
52
- }
53
- ]
54
- }
55
- }
@@ -1,41 +0,0 @@
1
- /*
2
- Barra de sección que muestra el icono y el título de la sección en la parte izquierda y en su derecha recibe los botones o elementos que sean necesarios
3
- Recibe:
4
- lefticon-> icono de la sección
5
- title-> título de la sección o funcionalidad
6
- subtitle-> subtítulo (opcional) a continuación del título (por ej: Escenario personalizado: El nombre custom del escenario)
7
- rightContent -> contenido a la derecha de la barra
8
- mainColor -> color del título (si no se manda, el título se pinta en negro)
9
- */
10
- import PropTypes from 'prop-types';
11
- import styles from "./SectionBar.module.scss";
12
- import { useTranslation } from 'react-i18next';
13
-
14
- export const SectionBar= ({ leftIcon, title, subtitle, rightContent, mainColor }) => {
15
- const { t } = useTranslation()
16
- return (
17
- <div className={styles.sectionBar}>
18
- <div className={styles.leftContent}>
19
- {leftIcon && (
20
- <img src={leftIcon} alt="Icono" className={styles.icon} />
21
- )}
22
- <div className={styles.textContainer}>
23
- <div className={styles.title} style={mainColor ?{color: mainColor}:{}}>{t(title)}</div>
24
- {subtitle && <div className={styles.subtitle}>{subtitle}</div>}
25
- </div>
26
- </div>
27
- <div className={styles.rightContent}>
28
- {rightContent}
29
- </div>
30
- </div>
31
- );
32
- }
33
-
34
- export default SectionBar;
35
- SectionBar.propTypes = {
36
- leftIcon: PropTypes.node.isRequired,
37
- title: PropTypes.string.isRequired,
38
- subtitle: PropTypes.string,
39
- rightContent: PropTypes.node.isRequired,
40
- mainColor: PropTypes.string
41
- };
@@ -1,40 +0,0 @@
1
- .sectionBar {
2
- height: 60px;
3
- width: 100%;
4
- background-color: #fff;
5
- display: flex;
6
- align-items: center;
7
- justify-content: space-between;
8
- padding: 0 16px;
9
- border-bottom: 1px solid black;
10
- }
11
-
12
- .leftContent {
13
- display: flex;
14
- align-items: center;
15
- gap: 12px;
16
- }
17
-
18
- .textContainer {
19
- display: flex;
20
- flex-direction: row;
21
- align-items: center;
22
- gap: 8px;
23
- }
24
-
25
- .title {
26
- font-size: 16px;
27
- font-weight: 600;
28
- color: #000;
29
- }
30
-
31
- .subtitle {
32
- font-size: 16px;
33
- color: #000;
34
- }
35
-
36
- .rightContent {
37
- display: flex;
38
- align-items: center;
39
- gap: 8px;
40
- }
@@ -1,35 +0,0 @@
1
- import SectionBar from "./SectionBar";
2
- import Icon from "../../assets/img/pause.svg"
3
-
4
- export default {
5
- title: "Components/SectionBar",
6
- component: SectionBar,
7
- };
8
-
9
- export const Default = () => (
10
- <SectionBar
11
- leftIcon={Icon}
12
- title="login"
13
- subtitle="Actualizado recientemente"
14
- mainColor='#004152'
15
- rightContent={
16
- <>
17
- <button style={{ marginRight: 8 }}>Editar</button>
18
- <button>Eliminar</button>
19
- </>
20
- }
21
- />
22
- );
23
- export const WithoutMainColor = () => (
24
- <SectionBar
25
- leftIcon={Icon}
26
- title="indicators"
27
- subtitle="Mi Escenario"
28
- rightContent={
29
- <>
30
- <button style={{ marginRight: 8 }}>Editar</button>
31
- <button>Eliminar</button>
32
- </>
33
- }
34
- />
35
- );