@opengeoweb/warnings 9.35.1-spike-oltanstack.0 → 9.36.0

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 (22) hide show
  1. package/index.esm.js +395 -689
  2. package/package.json +2 -3
  3. package/src/lib/components/FilterList/ExpandableFilterChip.d.ts +2 -2
  4. package/src/lib/components/FilterList/{FilterChipWithOptions.stories.d.ts → ExpandableFilterChip.stories.d.ts} +2 -2
  5. package/src/lib/components/FilterList/FilterList.d.ts +0 -2
  6. package/src/lib/components/FilterList/filter-hooks.d.ts +5 -1
  7. package/src/lib/components/FilterList/filter-utils.d.ts +4 -0
  8. package/src/lib/components/PublicWarningList/PublicWarningList.d.ts +1 -4
  9. package/src/lib/components/PublicWarningList/WarningListItem.d.ts +1 -0
  10. package/src/lib/components/PublicWarningList/WarningListItem.spec.d.ts +1 -0
  11. package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +4 -0
  12. package/src/lib/components/PublicWarningsForm/PublicWarningsForm.stories.d.ts +6 -8
  13. package/src/lib/store/publicWarningForm/types.d.ts +1 -0
  14. package/src/lib/store/publicWarnings/reducer.d.ts +1 -9
  15. package/src/lib/store/publicWarnings/selectors.d.ts +2 -19
  16. package/src/lib/store/publicWarnings/types.d.ts +0 -22
  17. package/src/lib/utils/fakeApi/index.d.ts +2 -1
  18. package/src/lib/components/FilterList/FilterChipWithOptions.d.ts +0 -7
  19. package/src/lib/components/FilterList/FilterChipWithOptionsConnect.d.ts +0 -7
  20. package/src/lib/store/publicWarnings/utils.d.ts +0 -24
  21. /package/src/lib/components/FilterList/{FilterChipWithOptions.spec.d.ts → ExpandableFilterChip.spec.d.ts} +0 -0
  22. /package/src/lib/{store/publicWarnings/utils.spec.d.ts → components/FilterList/filter-utils.spec.d.ts} +0 -0
package/index.esm.js CHANGED
@@ -1,18 +1,19 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useDispatch, useSelector } from 'react-redux';
3
- import { Polygons, Share, ExitDomain, Edit, Delete, DrawPolygon, Visibility, Add, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, breakpoints, Close, Options, ChevronDown, ChevronUp, Copy, Success, Expire, Remove, ArrowUpCompact, ArrowDownCompact } from '@opengeoweb/theme';
4
- import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, drawtoolActions, mapStoreActions, layerActions, useSetupDialog, selectorMemoizationOptions, useUpdateSharedData } from '@opengeoweb/store';
3
+ import { Polygons, Share, ExitDomain, Edit, Delete, DrawPolygon, Visibility, Add, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, breakpoints, Options, Close, ChevronDown, ChevronUp, Copy, Success, Expire, Remove, ArrowUpCompact, ArrowDownCompact } from '@opengeoweb/theme';
4
+ import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, drawtoolActions, mapStoreActions, layerActions, useSetupDialog, useUpdateSharedData } from '@opengeoweb/store';
5
5
  import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, MapView, MapViewLayer, getFeatureExtent } from '@opengeoweb/webmap-react';
6
- import { SHARED_NAMESPACE, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, getPosition, FilterChip, FilterListItem, FilterLabel, FilterOption, StatusTag, LastUpdateTime, ErrorBoundary, pollingIntervalTimeout, isAxiosError as isAxiosError$1 } from '@opengeoweb/shared';
6
+ import { SHARED_NAMESPACE, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, FilterChip, FilterOption, StatusTag, LastUpdateTime, ErrorBoundary, pollingIntervalTimeout, isAxiosError as isAxiosError$1 } from '@opengeoweb/shared';
7
7
  import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit';
8
8
  import 'i18next';
9
9
  import { useTranslation } from 'react-i18next';
10
10
  import '@opengeoweb/core';
11
11
  import { FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormSelect, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, useDraftFormHelpers, errorMessages, ReactHookFormDateTime, isXHoursBefore, isXHoursAfter, isEmpty } from '@opengeoweb/form-fields';
12
12
  import { LayerType, generateMapId, getWMJSMapById, getGeoCoordFromLatLong, WMBBOX } from '@opengeoweb/webmap';
13
+ import { SigmetForm, isInstanceOfCancelSigmet, AirmetForm, isInstanceOfCancelAirmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
13
14
  import { snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
14
15
  import * as React from 'react';
15
- import React__default, { useState, useEffect, useRef, useCallback } from 'react';
16
+ import React__default, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
16
17
  import { styled, Box, Typography, ListItem, Grid2, Paper, ListItemButton, Stack, LinearProgress, Button, FormHelperText, MenuItem, Tabs, Tab, Card, CardContent, CircularProgress, Menu, DialogTitle, DialogContent, Switch, ListItemText } from '@mui/material';
17
18
  import { VariableSizeList } from 'react-window';
18
19
  import AutoSizer from 'react-virtualized-auto-sizer';
@@ -20,8 +21,6 @@ import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInsta
20
21
  import { useFormContext } from 'react-hook-form';
21
22
  import { isEqual, cloneDeep, clamp, groupBy, pick } from 'lodash';
22
23
  import { getConfig, useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
23
- import { SigmetForm, isInstanceOfCancelSigmet, AirmetForm, isInstanceOfCancelAirmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
24
- import { produce } from 'immer';
25
24
  import { useQueryClient } from '@tanstack/react-query';
26
25
  import { isAxiosError } from 'axios';
27
26
 
@@ -2084,137 +2083,6 @@ var ConfirmDeleteDialog = function ConfirmDeleteDialog(_ref) {
2084
2083
  * */
2085
2084
  var publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
2086
2085
 
2087
- /* *
2088
- * Licensed under the Apache License, Version 2.0 (the "License");
2089
- * you may not use this file except in compliance with the License.
2090
- * You may obtain a copy of the License at
2091
- *
2092
- * http://www.apache.org/licenses/LICENSE-2.0
2093
- *
2094
- * Unless required by applicable law or agreed to in writing, software
2095
- * distributed under the License is distributed on an "AS IS" BASIS,
2096
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2097
- * See the License for the specific language governing permissions and
2098
- * limitations under the License.
2099
- *
2100
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2101
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
2102
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
2103
- * */
2104
- var emptyFilter = {
2105
- id: 'unspecified',
2106
- name: '(not specified)',
2107
- checked: true
2108
- };
2109
- var defaultFilters = [{
2110
- key: 'incident',
2111
- translationKey: 'filter-incident'
2112
- }, {
2113
- key: 'warningProposalSource',
2114
- translationKey: 'filter-source'
2115
- }];
2116
- var getFiltersFromWarnings = function getFiltersFromWarnings(t, warnings) {
2117
- if (!warnings || !warnings.length) {
2118
- // return default list
2119
- return defaultFilters.map(function (_ref) {
2120
- var key = _ref.key,
2121
- translationKey = _ref.translationKey;
2122
- return {
2123
- id: key,
2124
- translationKey: translationKey,
2125
- filterList: []
2126
- };
2127
- });
2128
- }
2129
- var filledFilters = defaultFilters.map(function (_ref2) {
2130
- var key = _ref2.key,
2131
- translationKey = _ref2.translationKey,
2132
- translations = _ref2.translations;
2133
- var filterOptions = [];
2134
- warnings.forEach(function (warning) {
2135
- var id = warning.warningDetail[key];
2136
- if (id && filterOptions.findIndex(function (option) {
2137
- return option.filter.id === id;
2138
- }) === -1) {
2139
- var _translationKey = translations && translations[id];
2140
- var label = _translationKey ? t(_translationKey) : id;
2141
- var filter = {
2142
- id: id,
2143
- name: label,
2144
- checked: true
2145
- };
2146
- filterOptions.push({
2147
- filter: filter
2148
- });
2149
- }
2150
- });
2151
- // add option for empty
2152
- filterOptions.push({
2153
- filter: emptyFilter
2154
- });
2155
- // sort alphabetically
2156
- var filtersSorted = [].concat(filterOptions).sort(function (a, b) {
2157
- return a.filter.name.localeCompare(b.filter.name);
2158
- });
2159
- return {
2160
- id: key,
2161
- translationKey: translationKey,
2162
- filterList: filtersSorted
2163
- };
2164
- });
2165
- return filledFilters;
2166
- };
2167
- var isWarningMatchingFilter = function isWarningMatchingFilter(filters, filterId, warningDetailValue) {
2168
- return filters.some(function (filter) {
2169
- return filter.filterId === filterId && filter.optionId === warningDetailValue;
2170
- }) || !warningDetailValue && filters.some(function (filter) {
2171
- return filter.filterId === filterId && filter.optionId === emptyFilter.id;
2172
- });
2173
- };
2174
- var getUpdatedFilters = function getUpdatedFilters(filters, newFilters) {
2175
- return filters.ids.reduce(function (list, id) {
2176
- var _filters$entities$id;
2177
- var existingFilterList = (_filters$entities$id = filters.entities[id]) == null ? void 0 : _filters$entities$id.filterList;
2178
- var newFilter = newFilters.find(function (filter) {
2179
- return filter.id === id;
2180
- });
2181
- if (newFilter && existingFilterList) {
2182
- var updatedFilterList = getUpdatedFilterList(existingFilterList, newFilter.filterList);
2183
- list.push({
2184
- id: id,
2185
- changes: Object.assign({}, newFilter, {
2186
- filterList: updatedFilterList
2187
- })
2188
- });
2189
- }
2190
- return list;
2191
- }, []);
2192
- };
2193
- var getUpdatedFilterList = function getUpdatedFilterList(oldList, newList) {
2194
- var updatedList = [];
2195
- // if the item existed already, keep its state
2196
- oldList.forEach(function (oldListItem) {
2197
- if (newList.some(function (newListItem) {
2198
- return newListItem.filter.id === oldListItem.filter.id;
2199
- })) {
2200
- updatedList.push(oldListItem);
2201
- }
2202
- });
2203
- // if the item did not exist yet, add it
2204
- newList.forEach(function (newListItem) {
2205
- if (oldList.every(function (oldListItem) {
2206
- return oldListItem.filter.id !== newListItem.filter.id;
2207
- })) {
2208
- updatedList.push(newListItem);
2209
- }
2210
- });
2211
- // sort alphabetically
2212
- var sortedList = [].concat(updatedList).sort(function (a, b) {
2213
- return a.filter.name.localeCompare(b.filter.name);
2214
- });
2215
- return sortedList;
2216
- };
2217
-
2218
2086
  /* *
2219
2087
  * Licensed under the Apache License, Version 2.0 (the "License");
2220
2088
  * you may not use this file except in compliance with the License.
@@ -2237,12 +2105,10 @@ var publicWarningsAdapter = createEntityAdapter({
2237
2105
  return warning.id;
2238
2106
  }
2239
2107
  });
2240
- var warningListFilterAdapter = createEntityAdapter();
2241
2108
  var initialState$1 = {
2242
2109
  warnings: publicWarningsAdapter.getInitialState(),
2243
2110
  isLoading: true,
2244
- lastUpdatedTime: '',
2245
- filters: warningListFilterAdapter.getInitialState()
2111
+ lastUpdatedTime: ''
2246
2112
  };
2247
2113
  var slice$1 = createSlice({
2248
2114
  initialState: initialState$1,
@@ -2264,63 +2130,6 @@ var slice$1 = createSlice({
2264
2130
  var error = action.payload.error;
2265
2131
  draft.isLoading = false;
2266
2132
  draft.error = error;
2267
- },
2268
- setWarningListFilters: function setWarningListFilters(draft, action) {
2269
- var newFilters = action.payload.newFilters;
2270
- // Update existing filters
2271
- var updates = getUpdatedFilters(draft.filters, newFilters);
2272
- warningListFilterAdapter.updateMany(draft.filters, updates);
2273
- // Add any new filters that didn't exist before
2274
- var newFiltersToAdd = newFilters.filter(function (filter) {
2275
- return !draft.filters.ids.includes(filter.id);
2276
- });
2277
- warningListFilterAdapter.upsertMany(draft.filters, newFiltersToAdd);
2278
- },
2279
- toggleFilter: function toggleFilter(draft, action) {
2280
- var _action$payload2 = action.payload,
2281
- filterId = _action$payload2.filterId,
2282
- isChecked = _action$payload2.isChecked;
2283
- if (!draft.filters.entities[filterId]) {
2284
- return;
2285
- }
2286
- draft.filters.entities[filterId].filterList.forEach(function (_, index) {
2287
- draft.filters.entities[filterId].filterList[index].filter.checked = !isChecked;
2288
- });
2289
- },
2290
- toggleOption: function toggleOption(draft, action) {
2291
- var _action$payload3 = action.payload,
2292
- filterId = _action$payload3.filterId,
2293
- optionId = _action$payload3.optionId;
2294
- if (!draft.filters.entities[filterId]) {
2295
- return;
2296
- }
2297
- var index = draft.filters.entities[filterId].filterList.findIndex(function (option) {
2298
- return option.filter.id === optionId;
2299
- });
2300
- if (index === -1) {
2301
- return;
2302
- }
2303
- draft.filters.entities[filterId].filterList[index].filter.checked = !draft.filters.entities[filterId].filterList[index].filter.checked;
2304
- },
2305
- enableOnlyOneFilterOption: function enableOnlyOneFilterOption(draft, action) {
2306
- var _action$payload4 = action.payload,
2307
- filterId = _action$payload4.filterId,
2308
- optionId = _action$payload4.optionId;
2309
- if (!draft.filters.entities[filterId]) {
2310
- return;
2311
- }
2312
- draft.filters.entities[filterId].filterList.forEach(function (_, index) {
2313
- var newStatus = draft.filters.entities[filterId].filterList[index].filter.id === optionId;
2314
- draft.filters.entities[filterId].filterList[index].filter.checked = newStatus;
2315
- });
2316
- },
2317
- toggleAllFilters: function toggleAllFilters(draft, action) {
2318
- var isChecked = action.payload.isChecked;
2319
- draft.filters.ids.forEach(function (id) {
2320
- draft.filters.entities[id].filterList.forEach(function (_, index) {
2321
- draft.filters.entities[id].filterList[index].filter.checked = !isChecked;
2322
- });
2323
- });
2324
2133
  }
2325
2134
  }
2326
2135
  });
@@ -7340,6 +7149,9 @@ var airmetListJSON = [
7340
7149
  var drawingList = drawingListJSON;
7341
7150
  var drawingsListFullContent = drawingsListFullContentJSON;
7342
7151
  var warningList = warningListJSON;
7152
+ warningList.filter(function (warning) {
7153
+ return warning.status !== 'EXPIRED' && warning.status !== 'WITHDRAWN';
7154
+ }).length;
7343
7155
  var sigmetList = sigmetListJSON;
7344
7156
  var airmetList = airmetListJSON;
7345
7157
  var areaKeywordList = ['North Sea districts', 'Coastal Districts', 'KNMI Specific', 'Objects', 'Baltic areas', 'NL', 'FI', 'METNorway Specific', 'Provinces', 'FIR', 'Countries'];
@@ -8572,6 +8384,109 @@ var AreaField = function AreaField(_ref) {
8572
8384
  });
8573
8385
  };
8574
8386
 
8387
+ var _defaultLevelFilter, _defaultEmptyFilter, _defaultPhenomenonFil;
8388
+ /* *
8389
+ * Licensed under the Apache License, Version 2.0 (the "License");
8390
+ * you may not use this file except in compliance with the License.
8391
+ * You may obtain a copy of the License at
8392
+ *
8393
+ * http://www.apache.org/licenses/LICENSE-2.0
8394
+ *
8395
+ * Unless required by applicable law or agreed to in writing, software
8396
+ * distributed under the License is distributed on an "AS IS" BASIS,
8397
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8398
+ * See the License for the specific language governing permissions and
8399
+ * limitations under the License.
8400
+ *
8401
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8402
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
8403
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
8404
+ * */
8405
+ var Domain;
8406
+ (function (Domain) {
8407
+ Domain["aviation"] = "aviation";
8408
+ Domain["maritime"] = "maritime";
8409
+ Domain["public"] = "public";
8410
+ })(Domain || (Domain = {}));
8411
+ var Level;
8412
+ (function (Level) {
8413
+ Level["extreme"] = "extreme";
8414
+ Level["moderate"] = "moderate";
8415
+ Level["severe"] = "severe";
8416
+ Level["airmet"] = "AIR";
8417
+ Level["sigmet"] = "SIG";
8418
+ })(Level || (Level = {}));
8419
+ var Phenomenon$1;
8420
+ (function (Phenomenon) {
8421
+ Phenomenon["wind"] = "wind";
8422
+ Phenomenon["fog"] = "fog";
8423
+ Phenomenon["thunderstorm"] = "thunderstorm";
8424
+ Phenomenon["snowIce"] = "snowIce";
8425
+ Phenomenon["rain"] = "rain";
8426
+ Phenomenon["highTemp"] = "highTemp";
8427
+ Phenomenon["lowTemp"] = "lowTemp";
8428
+ Phenomenon["coastalEvent"] = "coastalEvent";
8429
+ })(Phenomenon$1 || (Phenomenon$1 = {}));
8430
+ var emptyFilterId = 'unspecified';
8431
+ var defaultDomainFilter = {
8432
+ aviation: false,
8433
+ maritime: false,
8434
+ "public": true
8435
+ };
8436
+ var domainLevels = {
8437
+ aviation: [Level.airmet, Level.sigmet],
8438
+ maritime: [],
8439
+ "public": [Level.extreme, Level.moderate, Level.severe]
8440
+ };
8441
+ var defaultLevelFilter = (_defaultLevelFilter = {}, _defaultLevelFilter[emptyFilterId] = true, _defaultLevelFilter.extreme = true, _defaultLevelFilter.moderate = true, _defaultLevelFilter.severe = true, _defaultLevelFilter.AIR = true, _defaultLevelFilter.SIG = true, _defaultLevelFilter);
8442
+ (_defaultEmptyFilter = {}, _defaultEmptyFilter[emptyFilterId] = true, _defaultEmptyFilter);
8443
+ var defaultPhenomenonFilter = (_defaultPhenomenonFil = {}, _defaultPhenomenonFil[emptyFilterId] = true, _defaultPhenomenonFil.coastalEvent = true, _defaultPhenomenonFil.fog = true, _defaultPhenomenonFil.highTemp = true, _defaultPhenomenonFil.lowTemp = true, _defaultPhenomenonFil.rain = true, _defaultPhenomenonFil.snowIce = true, _defaultPhenomenonFil.thunderstorm = true, _defaultPhenomenonFil.wind = true, _defaultPhenomenonFil);
8444
+ var useSelectedOptions = function useSelectedOptions(options) {
8445
+ var selectedOptions = Object.keys(options).filter(function (k) {
8446
+ return options[k];
8447
+ });
8448
+ var allSelected = selectedOptions.length === Object.keys(options).length;
8449
+ return {
8450
+ noSelectedOptions: selectedOptions.length,
8451
+ allSelected: allSelected
8452
+ };
8453
+ };
8454
+ var updateState = function updateState(state, optionKey, value, only) {
8455
+ var _Object$assign3;
8456
+ if (only) {
8457
+ return Object.keys(state).reduce(function (acc, k) {
8458
+ var _Object$assign;
8459
+ return Object.assign({}, acc, (_Object$assign = {}, _Object$assign[k] = k === optionKey, _Object$assign));
8460
+ }, {});
8461
+ }
8462
+ return optionKey === 'ALL' ? Object.keys(state).reduce(function (acc, k) {
8463
+ var _Object$assign2;
8464
+ return Object.assign({}, acc, (_Object$assign2 = {}, _Object$assign2[k] = value, _Object$assign2));
8465
+ }, {}) : Object.assign({}, state, (_Object$assign3 = {}, _Object$assign3[optionKey] = value, _Object$assign3));
8466
+ };
8467
+ /** Make sure our value is in the filter */
8468
+ var getValue = function getValue(values, value) {
8469
+ return Object.values(values).find(function (v) {
8470
+ return v === value;
8471
+ }) || emptyFilterId;
8472
+ };
8473
+ var getFiltersFromWarnings = function getFiltersFromWarnings(warnings, filterKey) {
8474
+ var filterOptions = [emptyFilterId];
8475
+ if (!warnings || !warnings.length) {
8476
+ // return default list
8477
+ return filterOptions;
8478
+ }
8479
+ warnings.forEach(function (warning) {
8480
+ var id = warning.warningDetail[filterKey];
8481
+ if (id && filterOptions.findIndex(function (option) {
8482
+ return option === id;
8483
+ }) === -1) {
8484
+ filterOptions.push(id);
8485
+ }
8486
+ });
8487
+ return filterOptions;
8488
+ };
8489
+
8575
8490
  var getWarningPhenomenaIcon = function getWarningPhenomenaIcon(key) {
8576
8491
  switch (key) {
8577
8492
  case 'wind':
@@ -8632,7 +8547,7 @@ var getAviationPhenomenaIcon = function getAviationPhenomenaIcon(key) {
8632
8547
  };
8633
8548
  var warningPhenomena = [{
8634
8549
  translationKey: 'warning-unspecified',
8635
- key: 'unspecified',
8550
+ key: emptyFilterId,
8636
8551
  isAviation: false
8637
8552
  }, {
8638
8553
  translationKey: 'warning-phenomenon-wind',
@@ -8807,7 +8722,7 @@ var allPhenomenaDict = warningPhenomena.reduce(function (list, item) {
8807
8722
  var getPhenomenaIcon = function getPhenomenaIcon(key) {
8808
8723
  return getWarningPhenomenaIcon(key) || getAviationPhenomenaIcon(key);
8809
8724
  };
8810
- var Phenomenon$1 = function Phenomenon(_ref) {
8725
+ var Phenomenon = function Phenomenon(_ref) {
8811
8726
  var isDisabled = _ref.isDisabled,
8812
8727
  isReadOnly = _ref.isReadOnly;
8813
8728
  var _useWarningsTranslati = useWarningsTranslation(),
@@ -8816,7 +8731,7 @@ var Phenomenon$1 = function Phenomenon(_ref) {
8816
8731
  isRequired = _useDraftFormHelpers.isRequired;
8817
8732
  // These phenomena are sent to Public Warning Form
8818
8733
  var warningFormPhenomena = warningPhenomena.filter(function (phenomenon) {
8819
- return !phenomenon.isAviation && phenomenon.key !== 'unspecified';
8734
+ return !phenomenon.isAviation && phenomenon.key !== emptyFilterId;
8820
8735
  });
8821
8736
  return jsx(ReactHookFormSelect, {
8822
8737
  name: "phenomenon",
@@ -9397,15 +9312,6 @@ var getEmptyPublicWarning = function getEmptyPublicWarning() {
9397
9312
  areas: []
9398
9313
  };
9399
9314
  };
9400
- var getDefaultFeatureProperties = function getDefaultFeatureProperties(level) {
9401
- return {
9402
- fill: LevelColors[level].color,
9403
- stroke: LevelColors[level].color,
9404
- 'fill-opacity': 0.2,
9405
- 'stroke-width': 2,
9406
- 'stroke-opacity': 1
9407
- };
9408
- };
9409
9315
  var getFormData = function getFormData(publicWarningsDetails, object) {
9410
9316
  var data = Object.assign({
9411
9317
  IS_DRAFT: '',
@@ -9513,21 +9419,57 @@ var getErrors = function getErrors(errors) {
9513
9419
  errors: []
9514
9420
  }) : null;
9515
9421
  };
9516
- var getWarningGeoJSONWithColor = function getWarningGeoJSONWithColor(level, geoJSON) {
9517
- if (!geoJSON) {
9518
- return undefined;
9422
+ function warningLevelFeatureColors(level, geoJSON,
9423
+ // Allow undefined
9424
+ isAviationWarning) {
9425
+ if (isAviationWarning === void 0) {
9426
+ isAviationWarning = false;
9519
9427
  }
9520
- return produce(geoJSON, function (draft) {
9521
- var draftFeature = draft == null ? void 0 : draft.features[0];
9522
- if (draftFeature) {
9523
- var defaultProps = getDefaultFeatureProperties(level);
9524
- if (!draftFeature.properties) {
9525
- draftFeature.properties = Object.assign({}, defaultProps);
9428
+ if (!geoJSON || !geoJSON.features) {
9429
+ // Return an empty FeatureCollection if geoJSON is invalid
9430
+ return {
9431
+ type: 'FeatureCollection',
9432
+ features: []
9433
+ };
9434
+ }
9435
+ return Object.assign({}, geoJSON, {
9436
+ features: geoJSON.features.map(function (feature) {
9437
+ var _feature$properties2, _feature$properties3;
9438
+ var colors;
9439
+ if (isAviationWarning) {
9440
+ var _feature$properties$i, _feature$properties;
9441
+ var isStartGeometry = (_feature$properties$i = (_feature$properties = feature.properties) == null ? void 0 : _feature$properties.isStartGeometry) != null ? _feature$properties$i : false;
9442
+ colors = {
9443
+ color: isStartGeometry ? '#E27000' : '#800080',
9444
+ // Orange for start, purple for end
9445
+ borderColor: isStartGeometry ? '#FEAE02' : '#4B0082'
9446
+ };
9447
+ } else if (level) {
9448
+ // Public warning: use LevelColors if level is defined
9449
+ colors = LevelColors[level];
9450
+ } else {
9451
+ // Default to blue if level is undefined (public warning)
9452
+ colors = {
9453
+ color: '#0000FF',
9454
+ borderColor: '#0000A0'
9455
+ };
9526
9456
  }
9527
- Object.assign(draftFeature.properties, Object.assign({}, defaultProps, draftFeature.properties));
9528
- }
9457
+ var defaultProperties = {
9458
+ fill: colors.color,
9459
+ stroke: colors.color,
9460
+ 'fill-opacity': 0.2,
9461
+ 'stroke-width': 2,
9462
+ 'stroke-opacity': 1
9463
+ };
9464
+ return Object.assign({}, feature, {
9465
+ properties: Object.assign({}, defaultProperties, feature.properties, {
9466
+ fill: colors.color || ((_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.fill),
9467
+ stroke: colors.color || ((_feature$properties3 = feature.properties) == null ? void 0 : _feature$properties3.stroke)
9468
+ })
9469
+ });
9470
+ })
9529
9471
  });
9530
- };
9472
+ }
9531
9473
  var Form = function Form(_ref5) {
9532
9474
  var _publicWarningDetails;
9533
9475
  var defaultMapPreset = _ref5.defaultMapPreset,
@@ -9671,8 +9613,8 @@ var Form = function Form(_ref5) {
9671
9613
  // eslint-disable-next-line react-hooks/exhaustive-deps
9672
9614
  }, [aviationId, warningType]);
9673
9615
  var errors = getErrors(error.message);
9674
- var level = WarningLevel[publicWarningDetails == null ? void 0 : publicWarningDetails.level] || WarningLevel[WarningLevel.moderate];
9675
- var geoJSONFeature = getWarningGeoJSONWithColor(level, warningGeoJSONFeature);
9616
+ var level = publicWarningDetails != null && publicWarningDetails.level ? WarningLevel[publicWarningDetails.level] : undefined;
9617
+ var geoJSONFeature = warningLevelFeatureColors(level, warningGeoJSONFeature);
9676
9618
  var ref = useScrollTopOnError(error);
9677
9619
  var _useProductConfig = useProductConfig(warningType),
9678
9620
  aviationConfig = _useProductConfig.data;
@@ -9703,6 +9645,7 @@ var Form = function Form(_ref5) {
9703
9645
  showMap: false,
9704
9646
  mode: mode,
9705
9647
  initialSigmet: selectedAviationProduct !== undefined && !isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
9648
+ isCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct),
9706
9649
  initialCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
9707
9650
  productConfig: aviationConfig,
9708
9651
  product: selectedAviationProduct,
@@ -9733,7 +9676,7 @@ var Form = function Form(_ref5) {
9733
9676
  size: {
9734
9677
  xs: 12
9735
9678
  },
9736
- children: jsx(Phenomenon$1, {
9679
+ children: jsx(Phenomenon, {
9737
9680
  isDisabled: areFieldsDisabled,
9738
9681
  isReadOnly: isReadOnly
9739
9682
  })
@@ -10736,6 +10679,21 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
10736
10679
  * */
10737
10680
  var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(apiAirmet) {
10738
10681
  var airmet = apiAirmet.airmet;
10682
+ var areas = [];
10683
+ if (airmet.startGeometry) {
10684
+ areas.push({
10685
+ geoJSON: Object.assign({}, airmet.startGeometry, {
10686
+ features: airmet.startGeometry.features.map(function (feature) {
10687
+ return Object.assign({}, feature, {
10688
+ properties: Object.assign({}, feature.properties, {
10689
+ isStartGeometry: true
10690
+ })
10691
+ });
10692
+ })
10693
+ }),
10694
+ objectName: airmet.locationIndicatorATSR
10695
+ });
10696
+ }
10739
10697
  return {
10740
10698
  id: apiAirmet.uuid,
10741
10699
  lastUpdatedTime: apiAirmet.lastUpdateDate,
@@ -10743,10 +10701,7 @@ var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(api
10743
10701
  warningDetail: {
10744
10702
  descriptionOriginal: '',
10745
10703
  descriptionTranslation: '',
10746
- areas: [{
10747
- geoJSON: airmet.startGeometry,
10748
- objectName: airmet.locationIndicatorATSR
10749
- }],
10704
+ areas: areas,
10750
10705
  phenomenon: airmet.phenomenon,
10751
10706
  validFrom: airmet.validDateStart,
10752
10707
  validUntil: airmet.validDateEnd,
@@ -10759,6 +10714,37 @@ var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(api
10759
10714
  };
10760
10715
  var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(apiSigmet) {
10761
10716
  var sigmet = apiSigmet.sigmet;
10717
+ var areas = [];
10718
+ if (sigmet.startGeometry) {
10719
+ areas.push({
10720
+ areaId: sigmet.uuid + "-start",
10721
+ geoJSON: Object.assign({}, sigmet.startGeometry, {
10722
+ features: sigmet.startGeometry.features.map(function (feature) {
10723
+ return Object.assign({}, feature, {
10724
+ properties: Object.assign({}, feature.properties, {
10725
+ isStartGeometry: true
10726
+ })
10727
+ });
10728
+ })
10729
+ }),
10730
+ objectName: sigmet.locationIndicatorATSR
10731
+ });
10732
+ }
10733
+ if (sigmet.endGeometry) {
10734
+ areas.push({
10735
+ areaId: sigmet.uuid + "-end",
10736
+ geoJSON: Object.assign({}, sigmet.endGeometry, {
10737
+ features: sigmet.endGeometry.features.map(function (feature) {
10738
+ return Object.assign({}, feature, {
10739
+ properties: Object.assign({}, feature.properties, {
10740
+ isStartGeometry: false
10741
+ })
10742
+ });
10743
+ })
10744
+ }),
10745
+ objectName: sigmet.locationIndicatorATSR
10746
+ });
10747
+ }
10762
10748
  return {
10763
10749
  id: apiSigmet.uuid,
10764
10750
  lastUpdatedTime: apiSigmet.lastUpdateDate,
@@ -10766,10 +10752,7 @@ var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(api
10766
10752
  warningDetail: {
10767
10753
  descriptionOriginal: '',
10768
10754
  descriptionTranslation: '',
10769
- areas: [{
10770
- geoJSON: sigmet.startGeometry,
10771
- objectName: sigmet.locationIndicatorATSR
10772
- }],
10755
+ areas: areas,
10773
10756
  phenomenon: sigmet.phenomenon,
10774
10757
  validFrom: sigmet.validDateStart,
10775
10758
  validUntil: sigmet.validDateEnd,
@@ -10888,10 +10871,10 @@ var transformAirmetToProductFormat = function transformAirmetToProductFormat(war
10888
10871
  cloudLevel: airmet.cloudLevel,
10889
10872
  cloudLowerLevel: airmet.cloudLowerLevel
10890
10873
  }, isInstanceOfCancelAirmet(airmet) && {
10891
- cancelsSigmetSequenceId: cancelAirmet.cancelsAirmetSequenceId
10892
- }, isInstanceOfCancelSigmet(airmet) && {
10874
+ cancelsAirmetSequenceId: cancelAirmet.cancelsAirmetSequenceId
10875
+ }, isInstanceOfCancelAirmet(airmet) && {
10893
10876
  validDateStartOfAirmetToCancel: cancelAirmet.validDateStartOfAirmetToCancel
10894
- }, isInstanceOfCancelSigmet(airmet) && {
10877
+ }, isInstanceOfCancelAirmet(airmet) && {
10895
10878
  validDateEndOfAirmetToCancel: cancelAirmet.validDateEndOfAirmetToCancel
10896
10879
  });
10897
10880
  };
@@ -11205,230 +11188,6 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
11205
11188
  });
11206
11189
  };
11207
11190
 
11208
- var actionButton = function actionButton(amount) {
11209
- return jsxs(Grid2, {
11210
- container: true,
11211
- alignItems: "center",
11212
- style: {
11213
- marginRight: '8px',
11214
- minWidth: '36px'
11215
- },
11216
- children: [jsx(Options, {}), jsx(Typography, {
11217
- variant: "body2",
11218
- sx: {
11219
- paddingLeft: 0.5
11220
- },
11221
- children: amount > 0 && amount
11222
- })]
11223
- });
11224
- };
11225
- var FilterChipWithOptions = function FilterChipWithOptions(_ref) {
11226
- var id = _ref.id,
11227
- translationKey = _ref.translationKey,
11228
- handleClick = _ref.handleClick,
11229
- _ref$filterList = _ref.filterList,
11230
- filterList = _ref$filterList === void 0 ? [] : _ref$filterList;
11231
- var _useWarningsTranslati = useWarningsTranslation(),
11232
- t = _useWarningsTranslati.t;
11233
- var _React$useState = React.useState(undefined),
11234
- anchorEl = _React$useState[0],
11235
- setAnchorEl = _React$useState[1];
11236
- var _React$useState2 = React.useState(false),
11237
- isOpen = _React$useState2[0],
11238
- setIsOpen = _React$useState2[1];
11239
- var _getPosition = getPosition('bottom'),
11240
- anchorOrigin = _getPosition.anchorOrigin,
11241
- transformOrigin = _getPosition.transformOrigin;
11242
- var initialResult = {
11243
- isAllSelected: true,
11244
- selectedFiltersAmount: 0,
11245
- isDisabled: false
11246
- };
11247
- var _filterList$reduce = filterList.reduce(function (accumulatedResult, filterItem) {
11248
- var result = Object.assign({}, accumulatedResult);
11249
- var isEmptyFilter = filterItem.filter.id === emptyFilter.id;
11250
- var isOnlyFilter = filterList.length === 1 && isEmptyFilter;
11251
- if (!filterItem.filter.checked) {
11252
- result.isAllSelected = false;
11253
- if (isOnlyFilter) {
11254
- result.isDisabled = true;
11255
- }
11256
- } else if (isOnlyFilter) {
11257
- result.isDisabled = true;
11258
- } else {
11259
- result.selectedFiltersAmount += 1;
11260
- }
11261
- return result;
11262
- }, initialResult),
11263
- isAllSelected = _filterList$reduce.isAllSelected,
11264
- selectedFiltersAmount = _filterList$reduce.selectedFiltersAmount,
11265
- isDisabled = _filterList$reduce.isDisabled;
11266
- var isAnyFilterSelected = selectedFiltersAmount > 0;
11267
- var showDisabled = filterList.length === 0 || isDisabled;
11268
- var label = t(translationKey);
11269
- var onClickOptions = function onClickOptions() {
11270
- setIsOpen(!isOpen);
11271
- };
11272
- var onSelectAll = function onSelectAll() {
11273
- handleClick && handleClick(id, isAllSelected);
11274
- };
11275
- var handleClose = function handleClose(event) {
11276
- event.stopPropagation();
11277
- setIsOpen(false);
11278
- };
11279
- React.useEffect(function () {
11280
- setAnchorEl(document.getElementById(id));
11281
- }, [id]);
11282
- return jsxs(Fragment, {
11283
- children: [jsx(CustomTooltip, {
11284
- title: showDisabled ? t('filter-no-results') : t('filter-options'),
11285
- placement: "bottom",
11286
- children: jsx("span", {
11287
- style: {
11288
- margin: 0
11289
- },
11290
- children: jsx(FilterChip, {
11291
- id: id,
11292
- label: label,
11293
- actionIcon: actionButton(selectedFiltersAmount),
11294
- isSelected: isAnyFilterSelected,
11295
- handleClick: onClickOptions,
11296
- isDisabled: showDisabled,
11297
- size: "medium"
11298
- })
11299
- })
11300
- }), jsxs(Menu, {
11301
- title: label,
11302
- anchorEl: anchorEl,
11303
- open: isOpen,
11304
- onClose: handleClose,
11305
- anchorOrigin: anchorOrigin,
11306
- transformOrigin: transformOrigin,
11307
- BackdropProps: {
11308
- style: {
11309
- opacity: 0,
11310
- transition: 'none'
11311
- }
11312
- },
11313
- sx: {
11314
- padding: 3
11315
- },
11316
- children: [jsxs(DialogTitle, {
11317
- id: "dialog-title",
11318
- sx: {
11319
- zIndex: 1,
11320
- padding: '8px 18px 16px 24px',
11321
- display: 'flex',
11322
- justifyContent: 'space-between',
11323
- alignItems: 'center'
11324
- },
11325
- children: [jsx(Typography, {
11326
- sx: {
11327
- fontSize: '20px',
11328
- fontWeight: 500,
11329
- paddingRight: 1
11330
- },
11331
- "data-testid": "customDialog-title",
11332
- component: "span",
11333
- children: label
11334
- }), jsx(CustomIconButton, {
11335
- "aria-label": t('close-dialog-confirm'),
11336
- onClick: handleClose,
11337
- sx: {
11338
- '&.MuiIconButton-root': {
11339
- color: 'geowebColors.greys.accessible'
11340
- }
11341
- },
11342
- children: jsx(Close, {})
11343
- })]
11344
- }), jsxs(DialogContent, {
11345
- sx: {
11346
- padding: '0px 24px 16px 24px'
11347
- },
11348
- children: [jsxs(Grid2, {
11349
- container: true,
11350
- justifyContent: "space-between",
11351
- alignItems: "center",
11352
- children: [t('filter-select-all'), jsx(Switch, {
11353
- inputProps: {
11354
- 'aria-label': t('filter-select-all')
11355
- },
11356
- checked: isAllSelected,
11357
- onChange: onSelectAll,
11358
- sx: {
11359
- marginRight: '-12px'
11360
- }
11361
- })]
11362
- }), jsx(Box, {
11363
- sx: {
11364
- marginLeft: '-12px'
11365
- },
11366
- children: filterList.map(function (filterItem) {
11367
- switch (id) {
11368
- case 'phenomenon':
11369
- {
11370
- var icon = getWarningPhenomenaIcon(filterItem.filter.id);
11371
- return jsxs(FilterListItem, Object.assign({}, filterItem, {
11372
- children: [icon && jsx(Box, {
11373
- "data-testid": "icon-" + filterItem.filter.id,
11374
- sx: {
11375
- marginRight: 1
11376
- },
11377
- children: icon
11378
- }), jsx(FilterLabel, {
11379
- name: filterItem.filter.name
11380
- })]
11381
- }), filterItem.filter.id);
11382
- }
11383
- default:
11384
- {
11385
- return jsx(FilterListItem, Object.assign({}, filterItem), filterItem.filter.id);
11386
- }
11387
- }
11388
- })
11389
- })]
11390
- })]
11391
- })]
11392
- });
11393
- };
11394
-
11395
- var FilterChipWithOptionsConnect = function FilterChipWithOptionsConnect(_ref) {
11396
- var filter = _ref.filter;
11397
- var dispatch = useDispatch();
11398
- var toggleFilter = React.useCallback(function (filterId, isChecked) {
11399
- dispatch(publicWarningActions.toggleFilter({
11400
- filterId: filterId,
11401
- isChecked: isChecked
11402
- }));
11403
- }, [dispatch]);
11404
- var toggleOption = React.useCallback(function (filterId, optionId) {
11405
- dispatch(publicWarningActions.toggleOption({
11406
- filterId: filterId,
11407
- optionId: optionId
11408
- }));
11409
- }, [dispatch]);
11410
- var enableOnlyOneFilterOption = React.useCallback(function (filterId, optionId) {
11411
- dispatch(publicWarningActions.enableOnlyOneFilterOption({
11412
- filterId: filterId,
11413
- optionId: optionId
11414
- }));
11415
- }, [dispatch]);
11416
- var filterListWithActions = filter.filterList.map(function (option) {
11417
- return Object.assign({}, option, {
11418
- toggleFilter: function toggleFilter() {
11419
- return toggleOption(filter.id, option.filter.id);
11420
- },
11421
- enableOnlyOneFilter: function enableOnlyOneFilter() {
11422
- return enableOnlyOneFilterOption(filter.id, option.filter.id);
11423
- }
11424
- });
11425
- });
11426
- return jsx(FilterChipWithOptions, Object.assign({}, filter, {
11427
- handleClick: toggleFilter,
11428
- filterList: filterListWithActions
11429
- }));
11430
- };
11431
-
11432
11191
  /* *
11433
11192
  * Licensed under the Apache License, Version 2.0 (the "License");
11434
11193
  * you may not use this file except in compliance with the License.
@@ -11523,113 +11282,18 @@ function useOverflowCheck(text) {
11523
11282
  };
11524
11283
  }
11525
11284
  var getTranslationKey = function getTranslationKey(optionId, id) {
11285
+ if (id === 'source' || id === 'incident') {
11286
+ if (optionId === emptyFilterId) {
11287
+ return "warning-unspecified";
11288
+ }
11289
+ return optionId;
11290
+ }
11526
11291
  var phenomena = warningPhenomena.find(function (phenomenon) {
11527
11292
  return phenomenon.key === optionId;
11528
11293
  });
11529
11294
  return phenomena ? phenomena.translationKey : "warning-" + id + "-" + optionId;
11530
11295
  };
11531
11296
 
11532
- /* *
11533
- * Licensed under the Apache License, Version 2.0 (the "License");
11534
- * you may not use this file except in compliance with the License.
11535
- * You may obtain a copy of the License at
11536
- *
11537
- * http://www.apache.org/licenses/LICENSE-2.0
11538
- *
11539
- * Unless required by applicable law or agreed to in writing, software
11540
- * distributed under the License is distributed on an "AS IS" BASIS,
11541
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11542
- * See the License for the specific language governing permissions and
11543
- * limitations under the License.
11544
- *
11545
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
11546
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
11547
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
11548
- * */
11549
- var Domain;
11550
- (function (Domain) {
11551
- Domain["aviation"] = "aviation";
11552
- Domain["maritime"] = "maritime";
11553
- Domain["public"] = "public";
11554
- })(Domain || (Domain = {}));
11555
- var Level;
11556
- (function (Level) {
11557
- Level["extreme"] = "extreme";
11558
- Level["moderate"] = "moderate";
11559
- Level["severe"] = "severe";
11560
- Level["airmet"] = "AIR";
11561
- Level["sigmet"] = "SIG";
11562
- })(Level || (Level = {}));
11563
- var Phenomenon;
11564
- (function (Phenomenon) {
11565
- Phenomenon["wind"] = "wind";
11566
- Phenomenon["fog"] = "fog";
11567
- Phenomenon["thunderstorm"] = "thunderstorm";
11568
- Phenomenon["snowIce"] = "snowIce";
11569
- Phenomenon["rain"] = "rain";
11570
- Phenomenon["highTemp"] = "highTemp";
11571
- Phenomenon["lowTemp"] = "lowTemp";
11572
- Phenomenon["coastalEvent"] = "coastalEvent";
11573
- })(Phenomenon || (Phenomenon = {}));
11574
- var defaultDomainFilter = {
11575
- aviation: false,
11576
- maritime: false,
11577
- "public": true
11578
- };
11579
- var domainLevels = {
11580
- aviation: [Level.airmet, Level.sigmet],
11581
- maritime: [],
11582
- "public": [Level.extreme, Level.moderate, Level.severe]
11583
- };
11584
- var defaultLevelFilter = {
11585
- unspecified: true,
11586
- extreme: true,
11587
- moderate: true,
11588
- severe: true,
11589
- AIR: true,
11590
- SIG: true
11591
- };
11592
- var defaultPhenomenonFilter = {
11593
- unspecified: true,
11594
- coastalEvent: true,
11595
- fog: true,
11596
- highTemp: true,
11597
- lowTemp: true,
11598
- rain: true,
11599
- snowIce: true,
11600
- thunderstorm: true,
11601
- wind: true
11602
- };
11603
- var useSelectedOptions = function useSelectedOptions(options) {
11604
- var selectedOptions = Object.keys(options).filter(function (k) {
11605
- return options[k];
11606
- });
11607
- var allSelected = selectedOptions.length === Object.keys(options).length;
11608
- return {
11609
- noSelectedOptions: selectedOptions.length,
11610
- allSelected: allSelected
11611
- };
11612
- };
11613
- var updateState = function updateState(state, optionKey, value, only) {
11614
- var _Object$assign3;
11615
- if (only) {
11616
- return Object.keys(state).reduce(function (acc, k) {
11617
- var _Object$assign;
11618
- return Object.assign({}, acc, (_Object$assign = {}, _Object$assign[k] = k === optionKey, _Object$assign));
11619
- }, {});
11620
- }
11621
- return optionKey === 'ALL' ? Object.keys(state).reduce(function (acc, k) {
11622
- var _Object$assign2;
11623
- return Object.assign({}, acc, (_Object$assign2 = {}, _Object$assign2[k] = value, _Object$assign2));
11624
- }, {}) : Object.assign({}, state, (_Object$assign3 = {}, _Object$assign3[optionKey] = value, _Object$assign3));
11625
- };
11626
- /** Make sure our value is in the filter */
11627
- var getValue = function getValue(values, value) {
11628
- return Object.values(values).find(function (v) {
11629
- return v === value;
11630
- }) || 'unspecified';
11631
- };
11632
-
11633
11297
  var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
11634
11298
  var id = _ref.id,
11635
11299
  options = _ref.options,
@@ -11642,9 +11306,10 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
11642
11306
  var _useSelectedOptions = useSelectedOptions(options),
11643
11307
  noSelectedOptions = _useSelectedOptions.noSelectedOptions,
11644
11308
  allSelected = _useSelectedOptions.allSelected;
11309
+ var isDisabled = Object.keys(options).length < 2;
11645
11310
  return jsxs(Fragment, {
11646
11311
  children: [jsx(CustomTooltip, {
11647
- title: t('filter-options'),
11312
+ title: isDisabled ? t('filter-no-results') : t('filter-options'),
11648
11313
  placement: "bottom",
11649
11314
  children: jsx("span", {
11650
11315
  style: {
@@ -11653,11 +11318,11 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
11653
11318
  children: jsx(FilterChip, {
11654
11319
  id: id,
11655
11320
  label: t("filter-" + id),
11656
- isSelected: noSelectedOptions > 0,
11321
+ isSelected: !isDisabled && noSelectedOptions > 0,
11657
11322
  onClick: function onClick(ref) {
11658
11323
  return setAnchorEl(ref);
11659
11324
  },
11660
- isDisabled: false,
11325
+ isDisabled: isDisabled,
11661
11326
  size: "medium",
11662
11327
  actionIcon: jsxs(Grid2, {
11663
11328
  container: true,
@@ -11671,7 +11336,7 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
11671
11336
  sx: {
11672
11337
  paddingLeft: 0.5
11673
11338
  },
11674
- children: noSelectedOptions > 0 && noSelectedOptions
11339
+ children: !isDisabled && noSelectedOptions > 0 && noSelectedOptions
11675
11340
  })]
11676
11341
  })
11677
11342
  })
@@ -11743,8 +11408,27 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
11743
11408
  marginTop: '-6px'
11744
11409
  }
11745
11410
  })]
11746
- }), jsx(Box, {
11747
- children: Object.keys(options).map(function (optionId) {
11411
+ }), jsxs(Box, {
11412
+ children: [options[emptyFilterId] !== undefined && jsx(FilterOption, {
11413
+ optionId: emptyFilterId,
11414
+ checked: options[emptyFilterId],
11415
+ onClick: function onClick(checked, only) {
11416
+ return updateFilter(id, emptyFilterId, checked, only);
11417
+ },
11418
+ labelStyle: {
11419
+ width: 'fit-content',
11420
+ fontSize: '16px',
11421
+ display: 'flex',
11422
+ alignItems: 'center',
11423
+ gap: 1
11424
+ },
11425
+ label: jsx(Fragment, {
11426
+ children: t(getTranslationKey(emptyFilterId, id))
11427
+ })
11428
+ }, id + "-" + emptyFilterId), Object.keys(options).map(function (optionId) {
11429
+ if (optionId === emptyFilterId) {
11430
+ return null;
11431
+ }
11748
11432
  var warningColor = warningColors[optionId];
11749
11433
  return jsx(FilterOption, {
11750
11434
  optionId: optionId,
@@ -11763,7 +11447,7 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
11763
11447
  children: [getWarningPhenomenaIcon(optionId), ' ', t(getTranslationKey(optionId, id))]
11764
11448
  })
11765
11449
  }, id + "-" + optionId);
11766
- })
11450
+ })]
11767
11451
  })]
11768
11452
  })]
11769
11453
  })]
@@ -11771,9 +11455,7 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
11771
11455
  };
11772
11456
 
11773
11457
  var FilterList = function FilterList(_ref) {
11774
- var _ref$filters = _ref.filters,
11775
- filters = _ref$filters === void 0 ? [] : _ref$filters,
11776
- _ref$onClickAll = _ref.onClickAll,
11458
+ var _ref$onClickAll = _ref.onClickAll,
11777
11459
  onClickAll = _ref$onClickAll === void 0 ? function () {} : _ref$onClickAll,
11778
11460
  _ref$isAllSelected = _ref.isAllSelected,
11779
11461
  isAllSelected = _ref$isAllSelected === void 0 ? true : _ref$isAllSelected,
@@ -11809,10 +11491,6 @@ var FilterList = function FilterList(_ref) {
11809
11491
  size: "medium"
11810
11492
  })
11811
11493
  })
11812
- }), filters.map(function (filter) {
11813
- return jsx(FilterChipWithOptionsConnect, {
11814
- filter: filter
11815
- }, filter.id);
11816
11494
  }), Object.keys(filterState).map(function (filterId) {
11817
11495
  return jsx(ExpandableFilterChip, {
11818
11496
  id: filterId,
@@ -11992,7 +11670,7 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
11992
11670
  }
11993
11671
  };
11994
11672
 
11995
- var _excluded$2 = ["warning", "activeWarningId", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning"];
11673
+ var _excluded$2 = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning"];
11996
11674
  var renderLevelText = function renderLevelText(levelString) {
11997
11675
  if (!levelString) {
11998
11676
  return null;
@@ -12066,6 +11744,7 @@ var WarningListItem = function WarningListItem(_ref) {
12066
11744
  var _warning$warningDetai, _sx, _sx2, _Object$assign;
12067
11745
  var warning = _ref.warning,
12068
11746
  activeWarningId = _ref.activeWarningId,
11747
+ highlightedItem = _ref.highlightedItem,
12069
11748
  _ref$onSelectWarning = _ref.onSelectWarning,
12070
11749
  onSelectWarning = _ref$onSelectWarning === void 0 ? function () {} : _ref$onSelectWarning,
12071
11750
  _ref$onEditWarning = _ref.onEditWarning,
@@ -12099,12 +11778,21 @@ var WarningListItem = function WarningListItem(_ref) {
12099
11778
  }
12100
11779
  return t(levelTranslation);
12101
11780
  }, [levelTranslation, t]);
11781
+ var backgroundColor = React__default.useMemo(function () {
11782
+ if (highlightedItem) {
11783
+ return 'geowebColors.cards.cardContainerMouseOver';
11784
+ }
11785
+ if (status === PublicWarningStatus.EXPIRED || status === PublicWarningStatus.WITHDRAWN) {
11786
+ return 'geowebColors.cards.cardContainerDisabled';
11787
+ }
11788
+ return 'geowebColors.cards.cardContainer';
11789
+ }, [highlightedItem, status]);
12102
11790
  return jsx(ListItem, Object.assign({
12103
11791
  sx: {
12104
11792
  marginBottom: 0.25,
12105
11793
  minHeight: '32px',
12106
11794
  padding: '0 0',
12107
- backgroundColor: status === PublicWarningStatus.EXPIRED || status === PublicWarningStatus.WITHDRAWN ? 'geowebColors.cards.cardContainerDisabled' : 'geowebColors.cards.cardContainer',
11795
+ backgroundColor: backgroundColor,
12108
11796
  borderColor: status === PublicWarningStatus.EXPIRED || status === PublicWarningStatus.WITHDRAWN ? 'geowebColors.cards.cardContainerDisabledBorder' : 'geowebColors.cards.cardContainerBorder',
12109
11797
  borderRadius: 1,
12110
11798
  borderWidth: activeWarningId === warning.id ? '1px' : '1px',
@@ -12500,7 +12188,6 @@ var PublicWarningList = function PublicWarningList(_ref) {
12500
12188
  var _sx, _sx2, _sx3;
12501
12189
  var _ref$warnings = _ref.warnings,
12502
12190
  warnings = _ref$warnings === void 0 ? [] : _ref$warnings,
12503
- filters = _ref.filters,
12504
12191
  filterHookState = _ref.filterHookState,
12505
12192
  _ref$isLoading = _ref.isLoading,
12506
12193
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
@@ -12524,10 +12211,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
12524
12211
  onExpireWarning = _ref$onExpireWarning === void 0 ? function () {} : _ref$onExpireWarning,
12525
12212
  _ref$onWithdrawWarnin = _ref.onWithdrawWarning,
12526
12213
  onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
12527
- _ref$onClickAllChip = _ref.onClickAllChip,
12528
- onClickAllChip = _ref$onClickAllChip === void 0 ? function () {} : _ref$onClickAllChip,
12529
- _ref$isAllChipSelecte = _ref.isAllChipSelected,
12530
- isAllChipSelected = _ref$isAllChipSelecte === void 0 ? true : _ref$isAllChipSelecte,
12214
+ hoveredFeatureId = _ref.hoveredFeatureId,
12531
12215
  expandedSections = _ref.expandedSections,
12532
12216
  setExpandedSections = _ref.setExpandedSections;
12533
12217
  var filterState = filterHookState.filterState,
@@ -12542,7 +12226,6 @@ var PublicWarningList = function PublicWarningList(_ref) {
12542
12226
  sortState = _React$useState[0],
12543
12227
  setSortState = _React$useState[1];
12544
12228
  var onClickAll = function onClickAll(isChecked) {
12545
- onClickAllChip(isChecked);
12546
12229
  updateFilter('ALL', 'ALL', !isChecked);
12547
12230
  };
12548
12231
  var sortedWarnings = React__default.useMemo(function () {
@@ -12561,19 +12244,21 @@ var PublicWarningList = function PublicWarningList(_ref) {
12561
12244
  setExpandedSections(Object.assign({}, expandedSections, (_Object$assign = {}, _Object$assign[status] = shouldToggle, _Object$assign)));
12562
12245
  resetListIndex();
12563
12246
  };
12564
- var items = [{
12565
- status: PublicWarningStatus.TODO,
12566
- totalWarnings: sortedWarnings.todo.length
12567
- }].concat(expandedSections.TODO ? sortedWarnings.todo : [], [{
12568
- status: PublicWarningStatus.DRAFT,
12569
- totalWarnings: sortedWarnings.draft.length
12570
- }], expandedSections.DRAFT ? sortedWarnings.draft : [], [{
12571
- status: PublicWarningStatus.PUBLISHED,
12572
- totalWarnings: sortedWarnings.published.length
12573
- }], expandedSections.PUBLISHED ? sortedWarnings.published : [], [{
12574
- status: PublicWarningStatus.EXPIRED,
12575
- totalWarnings: sortedWarnings.expired.length
12576
- }], expandedSections.EXPIRED ? sortedWarnings.expired : []);
12247
+ var items = React__default.useMemo(function () {
12248
+ return [{
12249
+ status: PublicWarningStatus.TODO,
12250
+ totalWarnings: sortedWarnings.todo.length
12251
+ }].concat(expandedSections.TODO ? sortedWarnings.todo : [], [{
12252
+ status: PublicWarningStatus.DRAFT,
12253
+ totalWarnings: sortedWarnings.draft.length
12254
+ }], expandedSections.DRAFT ? sortedWarnings.draft : [], [{
12255
+ status: PublicWarningStatus.PUBLISHED,
12256
+ totalWarnings: sortedWarnings.published.length
12257
+ }], expandedSections.PUBLISHED ? sortedWarnings.published : [], [{
12258
+ status: PublicWarningStatus.EXPIRED,
12259
+ totalWarnings: sortedWarnings.expired.length
12260
+ }], expandedSections.EXPIRED ? sortedWarnings.expired : []);
12261
+ }, [sortedWarnings, expandedSections]);
12577
12262
  var getItemSize = function getItemSize(index, width) {
12578
12263
  var item = items[index];
12579
12264
  if (item.totalWarnings !== undefined) {
@@ -12606,6 +12291,15 @@ var PublicWarningList = function PublicWarningList(_ref) {
12606
12291
  }
12607
12292
  }, [warnings]);
12608
12293
  var filterHeight = useGetFilterHeight(filterRef);
12294
+ React__default.useEffect(function () {
12295
+ if (hoveredFeatureId) {
12296
+ var _listRef$current;
12297
+ var index = items.findIndex(function (item) {
12298
+ return item.id === hoveredFeatureId;
12299
+ });
12300
+ (_listRef$current = listRef.current) == null || _listRef$current.scrollToItem(index, 'smart');
12301
+ }
12302
+ }, [hoveredFeatureId, items]);
12609
12303
  return jsxs(Fragment, {
12610
12304
  children: [isLoading && jsx(LinearProgress, {
12611
12305
  "data-testid": "loading-bar",
@@ -12652,8 +12346,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
12652
12346
  md: 8
12653
12347
  },
12654
12348
  children: jsx(FilterList, {
12655
- filters: filters,
12656
- isAllSelected: allSelected && isAllChipSelected,
12349
+ isAllSelected: allSelected,
12657
12350
  onClickAll: onClickAll,
12658
12351
  filterState: filterState,
12659
12352
  updateFilter: updateFilter
@@ -12796,9 +12489,11 @@ var PublicWarningList = function PublicWarningList(_ref) {
12796
12489
  }, key);
12797
12490
  }
12798
12491
  var publicWarning = warning;
12492
+ var highlightedItem = hoveredFeatureId === publicWarning.id;
12799
12493
  return jsx(WarningListItem, {
12800
12494
  style: style,
12801
12495
  warning: publicWarning,
12496
+ highlightedItem: highlightedItem,
12802
12497
  onSelectWarning: onSelectWarning,
12803
12498
  onEditWarning: onEditWarning,
12804
12499
  onDeleteWarning: onDeleteWarning,
@@ -12856,49 +12551,6 @@ var getPublicWarningsError = createSelector(getPublicWarningsStore, function (st
12856
12551
  var getPublicWarningsLastUpdatedTime = createSelector(getPublicWarningsStore, function (store) {
12857
12552
  return store == null ? void 0 : store.lastUpdatedTime;
12858
12553
  });
12859
- var _warningListFilterAda = warningListFilterAdapter.getSelectors(function (state) {
12860
- var _state$publicWarnings3, _state$publicWarnings4;
12861
- return (_state$publicWarnings3 = state == null || (_state$publicWarnings4 = state.publicWarnings) == null ? void 0 : _state$publicWarnings4.filters) != null ? _state$publicWarnings3 : {
12862
- entities: {},
12863
- ids: []
12864
- };
12865
- }),
12866
- selectAllFilters = _warningListFilterAda.selectAll,
12867
- selectAllFilterIds = _warningListFilterAda.selectIds;
12868
- var getIsAllSelected = createSelector(selectAllFilters, function (filters) {
12869
- var result = filters.findIndex(function (filter) {
12870
- return filter.filterList.findIndex(function (option) {
12871
- return option.filter.checked === false;
12872
- }) !== -1;
12873
- }) === -1;
12874
- return result;
12875
- });
12876
- var getSelectedFilterOptions = createSelector(selectAllFilters, function (filters) {
12877
- var selectedOptions = [];
12878
- filters.forEach(function (filter) {
12879
- filter.filterList.forEach(function (option) {
12880
- if (option.filter.checked === true) {
12881
- selectedOptions.push({
12882
- filterId: filter.id,
12883
- optionId: option.filter.id
12884
- });
12885
- }
12886
- });
12887
- });
12888
- return selectedOptions;
12889
- }, selectorMemoizationOptions);
12890
- var getFilteredWarnings = createSelector(selectAllPublicWarnings, getIsAllSelected, getSelectedFilterOptions, selectAllFilterIds, function (warnings, isAllSelected, filters, filterIds) {
12891
- if (isAllSelected) {
12892
- return warnings;
12893
- }
12894
- var result = warnings.filter(function (_ref) {
12895
- var warningDetail = _ref.warningDetail;
12896
- return filterIds.every(function (key) {
12897
- return isWarningMatchingFilter(filters, key, warningDetail[key]);
12898
- });
12899
- });
12900
- return result;
12901
- }, selectorMemoizationOptions);
12902
12554
 
12903
12555
  var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
12904
12556
  var _ref$onClose = _ref.onClose,
@@ -12999,7 +12651,7 @@ var useFilter = function useFilter(defaultFilter, pickedOptions) {
12999
12651
  var _useState = useState(defaultFilter),
13000
12652
  filter = _useState[0],
13001
12653
  setFilter = _useState[1];
13002
- var pickedFilterOptions = pick(filter, ['unspecified'].concat(pickedOptions));
12654
+ var pickedFilterOptions = pick(filter, [emptyFilterId].concat(pickedOptions));
13003
12655
  var _useSelectedOptions = useSelectedOptions(pickedFilterOptions),
13004
12656
  allSelected = _useSelectedOptions.allSelected;
13005
12657
  return [pickedFilterOptions, setFilter, allSelected];
@@ -13015,7 +12667,7 @@ var useWarningFilters = function useWarningFilters(warnings) {
13015
12667
  pickedLevelFilter = _useFilter[0],
13016
12668
  setLevelFilter = _useFilter[1],
13017
12669
  allLevelsSelected = _useFilter[2];
13018
- var existingPhenomenon = Object.values(Phenomenon).filter(function (p) {
12670
+ var existingPhenomenon = Object.values(Phenomenon$1).filter(function (p) {
13019
12671
  return warnings.find(function (w) {
13020
12672
  return w.warningDetail.phenomenon === p;
13021
12673
  });
@@ -13024,9 +12676,53 @@ var useWarningFilters = function useWarningFilters(warnings) {
13024
12676
  pickedPhenomenonFilter = _useFilter2[0],
13025
12677
  setPhenomenonFilter = _useFilter2[1],
13026
12678
  allPhenomenonSelected = _useFilter2[2];
12679
+ var relevantSources = useMemo(function () {
12680
+ return getFiltersFromWarnings(warnings, 'warningProposalSource');
12681
+ }, [warnings]);
12682
+ var defaultSourceFilter = useMemo(function () {
12683
+ return Object.fromEntries(relevantSources.map(function (key) {
12684
+ return [key, true];
12685
+ }));
12686
+ }, [relevantSources]);
12687
+ var _useFilter3 = useFilter(defaultSourceFilter, relevantSources),
12688
+ pickedSourceFilter = _useFilter3[0],
12689
+ setSourceFilter = _useFilter3[1],
12690
+ allSourcesSelected = _useFilter3[2];
12691
+ useEffect(function () {
12692
+ setSourceFilter(function (prevFilter) {
12693
+ var newSourceFilter = Object.assign({}, defaultSourceFilter, prevFilter);
12694
+ // Only update state if the new filter differs from the current one
12695
+ if (JSON.stringify(newSourceFilter) !== JSON.stringify(prevFilter)) {
12696
+ return newSourceFilter;
12697
+ }
12698
+ return prevFilter;
12699
+ });
12700
+ }, [defaultSourceFilter, setSourceFilter]);
12701
+ var relevantIncidents = useMemo(function () {
12702
+ return getFiltersFromWarnings(warnings, 'incident');
12703
+ }, [warnings]);
12704
+ var defaultIncidentFilter = useMemo(function () {
12705
+ return Object.fromEntries(relevantIncidents.map(function (key) {
12706
+ return [key, true];
12707
+ }));
12708
+ }, [relevantIncidents]);
12709
+ var _useFilter4 = useFilter(defaultIncidentFilter, relevantIncidents),
12710
+ pickedIncidentFilter = _useFilter4[0],
12711
+ setIncidentFilter = _useFilter4[1],
12712
+ allIncidentsSelected = _useFilter4[2];
12713
+ useEffect(function () {
12714
+ setIncidentFilter(function (prevFilter) {
12715
+ var newIncidentFilter = Object.assign({}, defaultIncidentFilter, prevFilter);
12716
+ // Only update state if the new filter differs from the current one
12717
+ if (JSON.stringify(newIncidentFilter) !== JSON.stringify(prevFilter)) {
12718
+ return newIncidentFilter;
12719
+ }
12720
+ return prevFilter;
12721
+ });
12722
+ }, [defaultIncidentFilter, setIncidentFilter]);
13027
12723
  var _useSelectedOptions2 = useSelectedOptions(domainFilter),
13028
12724
  allDomainSelected = _useSelectedOptions2.allSelected;
13029
- var allSelected = allDomainSelected && allLevelsSelected && allPhenomenonSelected;
12725
+ var allSelected = allDomainSelected && allLevelsSelected && allPhenomenonSelected && allIncidentsSelected && allSourcesSelected;
13030
12726
  /**
13031
12727
  * @param filterKey - Name of the filter | "ALL" filters
13032
12728
  * @param optionKey - Name of the option | "ALL" options
@@ -13044,6 +12740,12 @@ var useWarningFilters = function useWarningFilters(warnings) {
13044
12740
  setPhenomenonFilter(function (state) {
13045
12741
  return updateState(state, 'ALL', value);
13046
12742
  });
12743
+ setSourceFilter(function (state) {
12744
+ return updateState(state, 'ALL', value);
12745
+ });
12746
+ setIncidentFilter(function (state) {
12747
+ return updateState(state, 'ALL', value);
12748
+ });
13047
12749
  } else if (filterKey === 'domain') {
13048
12750
  setDomainFilter(function (state) {
13049
12751
  return updateState(state, optionKey, value, only);
@@ -13056,6 +12758,14 @@ var useWarningFilters = function useWarningFilters(warnings) {
13056
12758
  setPhenomenonFilter(function (state) {
13057
12759
  return updateState(state, optionKey, value, only);
13058
12760
  });
12761
+ } else if (filterKey === 'source') {
12762
+ setSourceFilter(function (state) {
12763
+ return updateState(state, optionKey, value, only);
12764
+ });
12765
+ } else if (filterKey === 'incident') {
12766
+ setIncidentFilter(function (state) {
12767
+ return updateState(state, optionKey, value, only);
12768
+ });
13059
12769
  }
13060
12770
  };
13061
12771
  var byFilterState = useCallback(function (warning) {
@@ -13069,14 +12779,28 @@ var useWarningFilters = function useWarningFilters(warnings) {
13069
12779
  if (!pickedLevelFilter[level]) {
13070
12780
  return false;
13071
12781
  }
13072
- var phenomenon = getValue(Phenomenon, warning.warningDetail.phenomenon);
12782
+ var phenomenon = getValue(Phenomenon$1, warning.warningDetail.phenomenon);
13073
12783
  if (!pickedPhenomenonFilter[phenomenon]) {
13074
12784
  return false;
13075
12785
  }
12786
+ var source = relevantSources.find(function (source) {
12787
+ return source === warning.warningDetail.warningProposalSource;
12788
+ }) || emptyFilterId;
12789
+ if (!pickedSourceFilter[source]) {
12790
+ return false;
12791
+ }
12792
+ var incident = relevantIncidents.find(function (incident) {
12793
+ return incident === warning.warningDetail.incident;
12794
+ }) || emptyFilterId;
12795
+ if (!pickedIncidentFilter[incident]) {
12796
+ return false;
12797
+ }
13076
12798
  return true;
13077
- }, [domainFilter, pickedLevelFilter, pickedPhenomenonFilter]);
12799
+ }, [domainFilter, pickedLevelFilter, pickedPhenomenonFilter, relevantSources, pickedSourceFilter, relevantIncidents, pickedIncidentFilter]);
13078
12800
  return {
13079
12801
  filterState: {
12802
+ incident: pickedIncidentFilter,
12803
+ source: pickedSourceFilter,
13080
12804
  domain: domainFilter,
13081
12805
  phenomenon: pickedPhenomenonFilter,
13082
12806
  level: pickedLevelFilter
@@ -13106,10 +12830,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
13106
12830
  var _React$useState = React__default.useState(undefined),
13107
12831
  confirmDialogOptions = _React$useState[0],
13108
12832
  setConfirmDialogOptions = _React$useState[1];
13109
- var filters = useSelector(selectAllFilters);
13110
- var isAllChipSelected = useSelector(getIsAllSelected);
13111
- var publicWarnings = useSelector(getFilteredWarnings);
13112
- var warnings = useSelector(selectAllPublicWarnings);
12833
+ var publicWarnings = useSelector(selectAllPublicWarnings);
13113
12834
  var selectedPublicWarningId = useSelector(getSelectedPublicWarningId);
13114
12835
  var isLoading = useSelector(isPublicWarningsLoading || isFetchingAirmet || isFetchingSigmet);
13115
12836
  var error = useSelector(getPublicWarningsError);
@@ -13168,26 +12889,24 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
13168
12889
  while (1) switch (_context2.prev = _context2.next) {
13169
12890
  case 0:
13170
12891
  if (!(publicWarning.id && auth != null && auth.username && !publicWarning.editor)) {
13171
- _context2.next = 7;
12892
+ _context2.next = 6;
13172
12893
  break;
13173
12894
  }
13174
- _context2.next = 3;
13175
- return dispatch(publicWarningFormActions.toggleEditorWarning({
12895
+ dispatch(publicWarningFormActions.toggleEditorWarning({
13176
12896
  warningId: publicWarning.id,
13177
12897
  isEditor: true,
13178
12898
  username: auth == null ? void 0 : auth.username
13179
12899
  }));
13180
- case 3:
13181
- _context2.next = 5;
12900
+ _context2.next = 4;
13182
12901
  return openPublicWarningDialog('', Object.assign({}, publicWarning, {
13183
12902
  editor: auth == null ? void 0 : auth.username
13184
12903
  }));
13185
- case 5:
13186
- _context2.next = 8;
12904
+ case 4:
12905
+ _context2.next = 7;
13187
12906
  break;
13188
- case 7:
12907
+ case 6:
13189
12908
  void openPublicWarningDialog('', publicWarning);
13190
- case 8:
12909
+ case 7:
13191
12910
  case "end":
13192
12911
  return _context2.stop();
13193
12912
  }
@@ -13312,23 +13031,10 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
13312
13031
  void refetchSigmetList();
13313
13032
  dispatch(publicWarningActions.fetchWarnings());
13314
13033
  }, [dispatch, refetchAirmetList, refetchSigmetList]);
13315
- var onClickAllChip = React__default.useCallback(function (isChecked) {
13316
- dispatch(publicWarningActions.toggleAllFilters({
13317
- isChecked: isChecked
13318
- }));
13319
- }, [dispatch]);
13320
13034
  React__default.useEffect(function () {
13321
13035
  // fetch warnings on mount
13322
13036
  fetchWarnings();
13323
13037
  }, [fetchWarnings]);
13324
- // update filters when warnings change
13325
- React__default.useEffect(function () {
13326
- // Generate new filters based on the provided warnings
13327
- var newFilters = getFiltersFromWarnings(t, warnings);
13328
- dispatch(publicWarningActions.setWarningListFilters({
13329
- newFilters: newFilters
13330
- }));
13331
- }, [dispatch, t, warnings]);
13332
13038
  var combinedWarnings = React__default.useMemo(function () {
13333
13039
  var transformedSigmets = (sigmetList == null ? void 0 : sigmetList.map(transformSigmetToWarningFormat)) || [];
13334
13040
  var transformedAirmets = (airmetList == null ? void 0 : airmetList.map(transformAirmetToWarningFormat)) || [];
@@ -13352,25 +13058,27 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
13352
13058
  });
13353
13059
  }, [filteredWarnings, expandedSections]);
13354
13060
  var allFeatures = React__default.useMemo(function () {
13355
- return filteredWarningsByExpandedSections.reduce(function (acc, warning) {
13061
+ return filteredWarningsByExpandedSections.flatMap(function (warning) {
13356
13062
  var _warning$warningDetai;
13357
- var features = warning == null || (_warning$warningDetai = warning.warningDetail.areas) == null ? void 0 : _warning$warningDetai.map(function (a) {
13063
+ return (warning == null ? void 0 : warning.id) && (warning == null || (_warning$warningDetai = warning.warningDetail) == null || (_warning$warningDetai = _warning$warningDetai.areas) == null ? void 0 : _warning$warningDetai.filter(function (area) {
13064
+ return area.geoJSON;
13065
+ }).map(function (area) {
13066
+ var isAviationWarning = warning.warningDetail.level === 'SIG' || warning.warningDetail.level === 'AIR';
13067
+ var styledGeoJSON = warningLevelFeatureColors(warning.warningDetail.level, area.geoJSON, isAviationWarning);
13358
13068
  return {
13359
- id: warning.id + a.objectName,
13360
- geoJSON: a.geoJSON
13069
+ id: warning.id + area.areaId,
13070
+ originalId: warning.id,
13071
+ geoJSON: styledGeoJSON
13361
13072
  };
13362
- }).filter(function (a) {
13363
- return a.geoJSON;
13364
- });
13365
- if ((features == null ? void 0 : features.length) > 0) {
13366
- return [].concat(acc, features);
13367
- }
13368
- return acc;
13369
- }, []);
13073
+ })) || [];
13074
+ }).filter(function (feature) {
13075
+ return feature.id;
13076
+ });
13370
13077
  }, [filteredWarningsByExpandedSections]);
13371
- useUpdateSharedData({
13372
- features: allFeatures
13373
- }, panelId);
13078
+ var _useUpdateSharedData = useUpdateSharedData({
13079
+ features: allFeatures
13080
+ }, panelId),
13081
+ hoveredFeatureId = _useUpdateSharedData.hoverId;
13374
13082
  return jsxs(Fragment, {
13375
13083
  children: [jsx(PublicWarningList, {
13376
13084
  warnings: filteredWarnings,
@@ -13388,10 +13096,8 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
13388
13096
  selectedPublicWarningId: selectedPublicWarningId,
13389
13097
  lastUpdatedTime: lastUpdatedTime,
13390
13098
  onRefetchWarnings: fetchWarnings,
13391
- filters: filters,
13392
13099
  filterHookState: filterHookState,
13393
- isAllChipSelected: isAllChipSelected,
13394
- onClickAllChip: onClickAllChip
13100
+ hoveredFeatureId: hoveredFeatureId
13395
13101
  }), confirmDialogOptions && jsx(ConfirmDeleteWarningDialog, {
13396
13102
  onClose: function onClose() {
13397
13103
  return setConfirmDialogOptions(undefined);