@abcagency/hc-ui-components 1.4.22 → 1.5.1
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.
- package/dist/components/HireControlMap.js +20 -32
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/containers/accordions/filter-container.js +5 -13
- package/dist/components/containers/accordions/filter-container.js.map +1 -1
- package/dist/components/containers/accordions/filter-item-container.js +9 -9
- package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
- package/dist/components/containers/accordions/map-accordion-item-container.js +5 -10
- package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
- package/dist/components/containers/filter/commute-container.js +3 -3
- package/dist/components/containers/filter/commute-container.js.map +1 -1
- package/dist/components/containers/filter/filter-container.js +5 -6
- package/dist/components/containers/filter/filter-container.js.map +1 -1
- package/dist/components/containers/filter/filter-item-container.js +12 -12
- package/dist/components/containers/filter/filter-item-container.js.map +1 -1
- package/dist/components/containers/filter/location-container.js +5 -6
- package/dist/components/containers/filter/location-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-container.js +5 -5
- package/dist/components/containers/filter/points-of-interest-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-radio-item-container.js +2 -2
- package/dist/components/containers/filter/points-of-interest-radio-item-container.js.map +1 -1
- package/dist/components/containers/filter/search-container.js +2 -2
- package/dist/components/containers/filter/search-container.js.map +1 -1
- package/dist/components/containers/jobListing/listing-details-container.js +2 -2
- package/dist/components/containers/jobListing/listing-details-container.js.map +1 -1
- package/dist/components/containers/list/item-list-container.js +8 -8
- package/dist/components/containers/list/item-list-container.js.map +1 -1
- package/dist/components/containers/list/list-item/list-item-container.js +2 -2
- package/dist/components/containers/list/list-item/list-item-container.js.map +1 -1
- package/dist/components/containers/maps/info-window-content-container.js +2 -2
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +9 -8
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/containers/maps/map-list-container.js +5 -5
- package/dist/components/containers/maps/map-list-container.js.map +1 -1
- package/dist/components/containers/maps/map-marker-container.js +6 -6
- package/dist/components/containers/maps/map-marker-container.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js +5 -5
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/accordions/default.js +15 -15
- package/dist/components/modules/accordions/default.js.map +1 -1
- package/dist/components/modules/accordions/filterItem.js +4 -4
- package/dist/components/modules/accordions/filterItem.js.map +1 -1
- package/dist/components/modules/accordions/filters.js +6 -6
- package/dist/components/modules/accordions/filters.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js +19 -19
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/components/modules/buttons/default.js +9 -9
- package/dist/components/modules/buttons/default.js.map +1 -1
- package/dist/components/modules/buttons/items-pill.js +2 -2
- package/dist/components/modules/buttons/items-pill.js.map +1 -1
- package/dist/components/modules/buttons/pill-wrapper.js +2 -2
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
- package/dist/components/modules/buttons/show-all-button.js +3 -3
- package/dist/components/modules/buttons/show-all-button.js.map +1 -1
- package/dist/components/modules/cards/default.js +11 -11
- package/dist/components/modules/cards/default.js.map +1 -1
- package/dist/components/modules/cards/filter.js +5 -5
- package/dist/components/modules/cards/filter.js.map +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js +19 -19
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
- package/dist/components/modules/filter/commute.js +19 -18
- package/dist/components/modules/filter/commute.js.map +1 -1
- package/dist/components/modules/filter/index.js +10 -10
- package/dist/components/modules/filter/index.js.map +1 -1
- package/dist/components/modules/filter/item.js +6 -6
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/location.js +6 -6
- package/dist/components/modules/filter/location.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js +6 -6
- package/dist/components/modules/filter/radio-item.js.map +1 -1
- package/dist/components/modules/filter/search.js +10 -10
- package/dist/components/modules/filter/search.js.map +1 -1
- package/dist/components/modules/filter/sort.js +28 -28
- package/dist/components/modules/filter/sort.js.map +1 -1
- package/dist/components/modules/grid.js +4 -4
- package/dist/components/modules/grid.js.map +1 -1
- package/dist/components/modules/icon.js +4 -4
- package/dist/components/modules/icon.js.map +1 -1
- package/dist/components/modules/jobListing/listing-details.js +4 -4
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/list/field-mapper-desktop.js +8 -8
- package/dist/components/modules/list/field-mapper-desktop.js.map +1 -1
- package/dist/components/modules/list/field-mapper-mobile.js +18 -18
- package/dist/components/modules/list/field-mapper-mobile.js.map +1 -1
- package/dist/components/modules/list/header-item.js +7 -7
- package/dist/components/modules/list/header-item.js.map +1 -1
- package/dist/components/modules/list/header.js +5 -5
- package/dist/components/modules/list/header.js.map +1 -1
- package/dist/components/modules/list/item-expand-card/index.js +3 -3
- package/dist/components/modules/list/item-expand-card/index.js.map +1 -1
- package/dist/components/modules/list/item-list.js +15 -15
- package/dist/components/modules/list/item-list.js.map +1 -1
- package/dist/components/modules/list/list-item/list-item.js +13 -13
- package/dist/components/modules/list/list-item/list-item.js.map +1 -1
- package/dist/components/modules/maps/info-window-card.js +2 -2
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js +5 -5
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/components/modules/maps/map-list.js +5 -5
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/components/modules/maps/map-marker.js +3 -3
- package/dist/components/modules/maps/map-marker.js.map +1 -1
- package/dist/components/modules/maps/map.js +5 -5
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/components/modules/maps/place-marker.js +5 -5
- package/dist/components/modules/maps/place-marker.js.map +1 -1
- package/dist/components/modules/maps/tabs.js +21 -21
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/contexts/mapContext.js +2 -2
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +46 -39
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js +2 -2
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/contexts/themeContext.js +2 -2
- package/dist/contexts/themeContext.js.map +1 -1
- package/dist/contexts/trackEventContext.js +2 -2
- package/dist/contexts/trackEventContext.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/core/dist/floating-ui.core.js +34 -21
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +103 -30
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +12 -4
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +37 -15
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +9 -8
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/primitive/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/primitive/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-accordion/dist/index.js +8 -6
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-accordion/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-arrow/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-arrow/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-collapsible/dist/index.js +5 -4
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-collapsible/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-collection/dist/index.js +5 -3
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-collection/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-compose-refs/dist/index.js +24 -3
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-context/dist/index.js +9 -9
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-context/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-dialog/dist/index.js +6 -4
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-direction/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-direction/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-focus-guards/dist/index.js +4 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-focus-guards/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-focus-scope/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-id/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-id/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-popper/dist/index.js +6 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-popper/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-portal/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-presence/dist/index.js +17 -6
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-presence/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-primitive/dist/index.js +4 -2
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-roving-focus/dist/index.js +8 -5
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-roving-focus/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-select/dist/index.js +77 -31
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-select/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-slot/dist/index.js +46 -38
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-tabs/dist/index.js +2 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-tabs/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +39 -15
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +2 -2
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-previous/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-previous/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-size/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-size/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-visually-hidden/dist/index.js +16 -16
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-visually-hidden/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@react-google-maps/api/dist/esm.js +8086 -7852
- package/dist/packages/hc-ui-components/node_modules/@react-google-maps/api/dist/esm.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@remix-run/router/dist/router.js +2 -2
- package/dist/packages/hc-ui-components/node_modules/@remix-run/router/dist/router.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@tanstack/react-virtual/dist/esm/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@tanstack/react-virtual/dist/esm/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@tanstack/virtual-core/dist/esm/index.js +213 -152
- package/dist/packages/hc-ui-components/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@tanstack/virtual-core/dist/esm/utils.js +6 -2
- package/dist/packages/hc-ui-components/node_modules/@tanstack/virtual-core/dist/esm/utils.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/aria-hidden/dist/es2015/index.js +3 -2
- package/dist/packages/hc-ui-components/node_modules/aria-hidden/dist/es2015/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +2 -2
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/UI.js +2 -2
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +12 -8
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-router/dist/index.js +6 -6
- package/dist/packages/hc-ui-components/node_modules/react-router/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-router-dom/dist/index.js +7 -7
- package/dist/packages/hc-ui-components/node_modules/react-router-dom/dist/index.js.map +1 -1
- package/dist/services/listingAggregatorService.js +15 -19
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +2 -3
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js +16 -1
- package/dist/services/listingService.js.map +1 -1
- package/dist/styles/index.css +3 -1
- package/dist/types/services/listingAggregatorService.d.ts +2 -2
- package/dist/types/services/listingEntityService.d.ts +3 -2
- package/dist/types/types/GetListingParams.d.ts +1 -1
- package/dist/types/types/ListingEntity.d.ts +1 -2
- package/dist/types/types/ListingFields.d.ts +2 -4
- package/dist/types/types/Listings.d.ts +1 -0
- package/dist/types/util/mapUtil.d.ts +3 -3
- package/dist/util/filterUtil.js +6 -6
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/loading.js +3 -3
- package/dist/util/loading.js.map +1 -1
- package/dist/util/mapUtil.js +25 -37
- package/dist/util/mapUtil.js.map +1 -1
- package/package.json +17 -60
- package/src/components/HireControlMap.js +7 -18
- package/src/components/containers/accordions/filter-container.js +1 -6
- package/src/components/containers/accordions/filter-item-container.js +2 -2
- package/src/components/containers/accordions/map-accordion-item-container.js +2 -6
- package/src/components/containers/filter/filter-container.js +2 -3
- package/src/components/containers/filter/filter-item-container.js +10 -10
- package/src/components/containers/filter/location-container.js +3 -3
- package/src/components/containers/list/item-list-container.tsx +3 -3
- package/src/components/containers/maps/info-window-content-container.js +1 -1
- package/src/components/containers/maps/map-container.js +1 -2
- package/src/components/modules/buttons/button-group-apply.js +8 -8
- package/src/components/modules/dialogs/apply-dialog.js +2 -2
- package/src/components/modules/list/field-mapper-desktop.jsx +2 -2
- package/src/components/modules/list/field-mapper-mobile.jsx +8 -8
- package/src/components/modules/list/header-item.js +1 -1
- package/src/components/modules/maps/map-list.js +1 -1
- package/src/contexts/mapListContext.tsx +70 -64
- package/src/services/listingAggregatorService.ts +21 -29
- package/src/services/listingEntityService.ts +3 -3
- package/src/services/listingService.ts +11 -1
- package/src/types/GetListingParams.ts +1 -1
- package/src/types/ListingEntity.ts +1 -2
- package/src/types/ListingFields.ts +2 -4
- package/src/types/Listings.ts +1 -0
- package/src/util/filterUtil.js +6 -6
- package/src/util/mapUtil.js +41 -52
- package/src/styles/components.css +0 -30
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Root as Root2, List, Trigger, Content } from '../../../packages/hc-ui-components/node_modules/@radix-ui/react-tabs/dist/index.js';
|
|
3
3
|
import Button from '../buttons/default.js';
|
|
4
4
|
import { useMapList } from '../../../contexts/mapListContext.js';
|
|
5
5
|
|
|
@@ -14,69 +14,69 @@ var MapTabs = function MapTabs(_ref) {
|
|
|
14
14
|
mobileTab = _useMapList.mobileTab,
|
|
15
15
|
setMobileTab = _useMapList.setMobileTab,
|
|
16
16
|
containerStyle = _useMapList.containerStyle;
|
|
17
|
-
return /*#__PURE__*/
|
|
17
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
18
18
|
style: containerStyle,
|
|
19
19
|
className: "\n hc-relative hc-overflow-hidden\n ".concat(className !== null && className !== void 0 ? className : "", "\n ")
|
|
20
|
-
}, /*#__PURE__*/
|
|
20
|
+
}, /*#__PURE__*/React__default.createElement(Root2, {
|
|
21
21
|
className: "hc-flex hc-flex-col hc-h-full",
|
|
22
22
|
value: mobileTab
|
|
23
|
-
}, /*#__PURE__*/
|
|
23
|
+
}, /*#__PURE__*/React__default.createElement(List, {
|
|
24
24
|
className: "hc-w-full hc-shrink-0 hc-flex hc-divide-x hc-divide-primary hc-bg-white hc-z-10",
|
|
25
25
|
"aria-label": "Review positions"
|
|
26
|
-
}, /*#__PURE__*/
|
|
26
|
+
}, /*#__PURE__*/React__default.createElement(Trigger, {
|
|
27
27
|
value: "listTab",
|
|
28
28
|
asChild: true,
|
|
29
29
|
onClick: function onClick() {
|
|
30
30
|
return setMobileTab("listTab");
|
|
31
31
|
}
|
|
32
|
-
}, /*#__PURE__*/
|
|
32
|
+
}, /*#__PURE__*/React__default.createElement(Button.Btn, {
|
|
33
33
|
variant: "outline",
|
|
34
34
|
isBlock: true,
|
|
35
35
|
className: tabButtonClasses
|
|
36
|
-
}, /*#__PURE__*/
|
|
36
|
+
}, /*#__PURE__*/React__default.createElement(Button.Body, {
|
|
37
37
|
className: "hc-justify-center"
|
|
38
|
-
}, /*#__PURE__*/
|
|
38
|
+
}, /*#__PURE__*/React__default.createElement(Button.Icon, {
|
|
39
39
|
icon: "mdi:view-list",
|
|
40
40
|
size: "hc-size-5"
|
|
41
|
-
}), "List"))), showMap && /*#__PURE__*/
|
|
41
|
+
}), "List"))), showMap && /*#__PURE__*/React__default.createElement(Trigger, {
|
|
42
42
|
value: "mapTab",
|
|
43
43
|
asChild: true,
|
|
44
44
|
onClick: function onClick() {
|
|
45
45
|
return setMobileTab("mapTab");
|
|
46
46
|
}
|
|
47
|
-
}, /*#__PURE__*/
|
|
47
|
+
}, /*#__PURE__*/React__default.createElement(Button.Btn, {
|
|
48
48
|
variant: "outline",
|
|
49
49
|
isBlock: true,
|
|
50
50
|
className: tabButtonClasses
|
|
51
|
-
}, /*#__PURE__*/
|
|
51
|
+
}, /*#__PURE__*/React__default.createElement(Button.Body, {
|
|
52
52
|
className: "hc-justify-center"
|
|
53
|
-
}, /*#__PURE__*/
|
|
53
|
+
}, /*#__PURE__*/React__default.createElement(Button.Icon, {
|
|
54
54
|
icon: "mdi:map",
|
|
55
55
|
size: "hc-size-5"
|
|
56
|
-
}), "Map"))), /*#__PURE__*/
|
|
56
|
+
}), "Map"))), /*#__PURE__*/React__default.createElement(Trigger, {
|
|
57
57
|
value: "filterTab",
|
|
58
58
|
asChild: true,
|
|
59
59
|
onClick: function onClick() {
|
|
60
60
|
return setMobileTab("filterTab");
|
|
61
61
|
}
|
|
62
|
-
}, /*#__PURE__*/
|
|
62
|
+
}, /*#__PURE__*/React__default.createElement(Button.Btn, {
|
|
63
63
|
variant: "outline",
|
|
64
64
|
isBlock: true,
|
|
65
65
|
className: tabButtonClasses
|
|
66
|
-
}, /*#__PURE__*/
|
|
66
|
+
}, /*#__PURE__*/React__default.createElement(Button.Body, {
|
|
67
67
|
className: "hc-justify-center"
|
|
68
|
-
}, /*#__PURE__*/
|
|
68
|
+
}, /*#__PURE__*/React__default.createElement(Button.Icon, {
|
|
69
69
|
icon: "fluent:search-12-filled",
|
|
70
70
|
size: "hc-size-5"
|
|
71
|
-
}), "Filter")))), /*#__PURE__*/
|
|
71
|
+
}), "Filter")))), /*#__PURE__*/React__default.createElement("div", {
|
|
72
72
|
className: "hc-flex-grow hc-h-[calc(100%-48px)]"
|
|
73
|
-
}, /*#__PURE__*/
|
|
73
|
+
}, /*#__PURE__*/React__default.createElement(Content, {
|
|
74
74
|
className: "hc-h-full hc-overflow-auto hc-bg-white hc-outline-none",
|
|
75
75
|
value: "listTab"
|
|
76
|
-
}, list), showMap && /*#__PURE__*/
|
|
76
|
+
}, list), showMap && /*#__PURE__*/React__default.createElement(Content, {
|
|
77
77
|
className: "hc-h-full hc-overflow-auto hc-bg-white hc-outline-none",
|
|
78
78
|
value: "mapTab"
|
|
79
|
-
}, map), /*#__PURE__*/
|
|
79
|
+
}, map), /*#__PURE__*/React__default.createElement(Content, {
|
|
80
80
|
className: "hc-h-full hc-bg-white hc-outline-none",
|
|
81
81
|
value: "filterTab"
|
|
82
82
|
}, filter))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sources":["../../../../src/components/modules/maps/tabs.js"],"sourcesContent":["import React from 'react';\nimport * as Tabs from '@radix-ui/react-tabs';\nimport Button from '~/components/modules/buttons/default';\nimport { useMapList } from '~/contexts/mapListContext';\n\nconst MapTabs = ({\n\tmap,\n\tlist,\n\tfilter,\n\tclassName,\n\tshowMap\n}) => {\n\tconst tabButtonClasses =\n \"hc-flex hc-items-center hc-gap-2 hc-rounded-none hc-border-x-0 data-[state=active]:hc-bg-primary data-[state=active]:hc-text-white\";\n\tconst { mobileTab, setMobileTab, containerStyle } = useMapList();\n\n\treturn (\n\t\t<div\n\t\t\tstyle={containerStyle}\n\t\t\tclassName={`\n hc-relative hc-overflow-hidden\n ${className ?? \"\"}\n `}\n\t\t>\n\t\t\t<Tabs.Root\n\t\t\t\tclassName=\"hc-flex hc-flex-col hc-h-full\"\n\t\t\t\tvalue={mobileTab}\n\t\t\t>\n\t\t\t\t{/* Fixed tab header */}\n\t\t\t\t<Tabs.List\n\t\t\t\t\tclassName=\"hc-w-full hc-shrink-0 hc-flex hc-divide-x hc-divide-primary hc-bg-white hc-z-10\"\n\t\t\t\t\taria-label=\"Review positions\"\n\t\t\t\t>\n\t\t\t\t\t<Tabs.Trigger value=\"listTab\" asChild onClick={() => setMobileTab(\"listTab\")}>\n\t\t\t\t\t\t<Button.Btn variant=\"outline\" isBlock className={tabButtonClasses}>\n\t\t\t\t\t\t\t<Button.Body className=\"hc-justify-center\">\n\t\t\t\t\t\t\t\t<Button.Icon icon=\"mdi:view-list\" size=\"hc-size-5\" />\n List\n\t\t\t\t\t\t\t</Button.Body>\n\t\t\t\t\t\t</Button.Btn>\n\t\t\t\t\t</Tabs.Trigger>\n\t\t\t\t\t{showMap && (\n\t\t\t\t\t\t<Tabs.Trigger value=\"mapTab\" asChild onClick={() => setMobileTab(\"mapTab\")}>\n\t\t\t\t\t\t\t<Button.Btn\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\tclassName={tabButtonClasses}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Button.Body className=\"hc-justify-center\">\n\t\t\t\t\t\t\t\t\t<Button.Icon icon=\"mdi:map\" size=\"hc-size-5\" />\n Map\n\t\t\t\t\t\t\t\t</Button.Body>\n\t\t\t\t\t\t\t</Button.Btn>\n\t\t\t\t\t\t</Tabs.Trigger>\n\t\t\t\t\t)}\n\t\t\t\t\t<Tabs.Trigger value=\"filterTab\" asChild onClick={() => setMobileTab(\"filterTab\")}>\n\t\t\t\t\t\t<Button.Btn variant=\"outline\" isBlock className={tabButtonClasses}>\n\t\t\t\t\t\t\t<Button.Body className=\"hc-justify-center\">\n\t\t\t\t\t\t\t\t<Button.Icon icon=\"fluent:search-12-filled\" size=\"hc-size-5\" />\n Filter\n\t\t\t\t\t\t\t</Button.Body>\n\t\t\t\t\t\t</Button.Btn>\n\t\t\t\t\t</Tabs.Trigger>\n\t\t\t\t</Tabs.List>\n\n\t\t\t\t{/* Tab content */}\n\t\t\t\t<div className=\"hc-flex-grow hc-h-[calc(100%-48px)]\">\n\t\t\t\t\t{/* List Tab Content */}\n\t\t\t\t\t<Tabs.Content\n\t\t\t\t\t\tclassName=\"hc-h-full hc-overflow-auto hc-bg-white hc-outline-none\"\n\t\t\t\t\t\tvalue=\"listTab\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{list}\n\t\t\t\t\t</Tabs.Content>\n\n\t\t\t\t\t{/* Map Tab Content */}\n\t\t\t\t\t{showMap && (\n\t\t\t\t\t\t<Tabs.Content\n\t\t\t\t\t\t\tclassName=\"hc-h-full hc-overflow-auto hc-bg-white hc-outline-none\"\n\t\t\t\t\t\t\tvalue=\"mapTab\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{map}\n\t\t\t\t\t\t</Tabs.Content>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Filter Tab Content */}\n\t\t\t\t\t<Tabs.Content\n\t\t\t\t\t\tclassName=\"hc-h-full hc-bg-white hc-outline-none\"\n\t\t\t\t\t\tvalue=\"filterTab\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{filter}\n\t\t\t\t\t</Tabs.Content>\n\t\t\t\t</div>\n\t\t\t</Tabs.Root>\n\t\t</div>\n\t);\n};\n\nexport default MapTabs;"],"names":["MapTabs","_ref","map","list","filter","className","showMap","tabButtonClasses","_useMapList","useMapList","mobileTab","setMobileTab","containerStyle","React","createElement","style","concat","Tabs","
|
|
1
|
+
{"version":3,"file":"tabs.js","sources":["../../../../src/components/modules/maps/tabs.js"],"sourcesContent":["import React from 'react';\nimport * as Tabs from '@radix-ui/react-tabs';\nimport Button from '~/components/modules/buttons/default';\nimport { useMapList } from '~/contexts/mapListContext';\n\nconst MapTabs = ({\n\tmap,\n\tlist,\n\tfilter,\n\tclassName,\n\tshowMap\n}) => {\n\tconst tabButtonClasses =\n \"hc-flex hc-items-center hc-gap-2 hc-rounded-none hc-border-x-0 data-[state=active]:hc-bg-primary data-[state=active]:hc-text-white\";\n\tconst { mobileTab, setMobileTab, containerStyle } = useMapList();\n\n\treturn (\n\t\t<div\n\t\t\tstyle={containerStyle}\n\t\t\tclassName={`\n hc-relative hc-overflow-hidden\n ${className ?? \"\"}\n `}\n\t\t>\n\t\t\t<Tabs.Root\n\t\t\t\tclassName=\"hc-flex hc-flex-col hc-h-full\"\n\t\t\t\tvalue={mobileTab}\n\t\t\t>\n\t\t\t\t{/* Fixed tab header */}\n\t\t\t\t<Tabs.List\n\t\t\t\t\tclassName=\"hc-w-full hc-shrink-0 hc-flex hc-divide-x hc-divide-primary hc-bg-white hc-z-10\"\n\t\t\t\t\taria-label=\"Review positions\"\n\t\t\t\t>\n\t\t\t\t\t<Tabs.Trigger value=\"listTab\" asChild onClick={() => setMobileTab(\"listTab\")}>\n\t\t\t\t\t\t<Button.Btn variant=\"outline\" isBlock className={tabButtonClasses}>\n\t\t\t\t\t\t\t<Button.Body className=\"hc-justify-center\">\n\t\t\t\t\t\t\t\t<Button.Icon icon=\"mdi:view-list\" size=\"hc-size-5\" />\n List\n\t\t\t\t\t\t\t</Button.Body>\n\t\t\t\t\t\t</Button.Btn>\n\t\t\t\t\t</Tabs.Trigger>\n\t\t\t\t\t{showMap && (\n\t\t\t\t\t\t<Tabs.Trigger value=\"mapTab\" asChild onClick={() => setMobileTab(\"mapTab\")}>\n\t\t\t\t\t\t\t<Button.Btn\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\tclassName={tabButtonClasses}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Button.Body className=\"hc-justify-center\">\n\t\t\t\t\t\t\t\t\t<Button.Icon icon=\"mdi:map\" size=\"hc-size-5\" />\n Map\n\t\t\t\t\t\t\t\t</Button.Body>\n\t\t\t\t\t\t\t</Button.Btn>\n\t\t\t\t\t\t</Tabs.Trigger>\n\t\t\t\t\t)}\n\t\t\t\t\t<Tabs.Trigger value=\"filterTab\" asChild onClick={() => setMobileTab(\"filterTab\")}>\n\t\t\t\t\t\t<Button.Btn variant=\"outline\" isBlock className={tabButtonClasses}>\n\t\t\t\t\t\t\t<Button.Body className=\"hc-justify-center\">\n\t\t\t\t\t\t\t\t<Button.Icon icon=\"fluent:search-12-filled\" size=\"hc-size-5\" />\n Filter\n\t\t\t\t\t\t\t</Button.Body>\n\t\t\t\t\t\t</Button.Btn>\n\t\t\t\t\t</Tabs.Trigger>\n\t\t\t\t</Tabs.List>\n\n\t\t\t\t{/* Tab content */}\n\t\t\t\t<div className=\"hc-flex-grow hc-h-[calc(100%-48px)]\">\n\t\t\t\t\t{/* List Tab Content */}\n\t\t\t\t\t<Tabs.Content\n\t\t\t\t\t\tclassName=\"hc-h-full hc-overflow-auto hc-bg-white hc-outline-none\"\n\t\t\t\t\t\tvalue=\"listTab\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{list}\n\t\t\t\t\t</Tabs.Content>\n\n\t\t\t\t\t{/* Map Tab Content */}\n\t\t\t\t\t{showMap && (\n\t\t\t\t\t\t<Tabs.Content\n\t\t\t\t\t\t\tclassName=\"hc-h-full hc-overflow-auto hc-bg-white hc-outline-none\"\n\t\t\t\t\t\t\tvalue=\"mapTab\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{map}\n\t\t\t\t\t\t</Tabs.Content>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Filter Tab Content */}\n\t\t\t\t\t<Tabs.Content\n\t\t\t\t\t\tclassName=\"hc-h-full hc-bg-white hc-outline-none\"\n\t\t\t\t\t\tvalue=\"filterTab\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{filter}\n\t\t\t\t\t</Tabs.Content>\n\t\t\t\t</div>\n\t\t\t</Tabs.Root>\n\t\t</div>\n\t);\n};\n\nexport default MapTabs;"],"names":["MapTabs","_ref","map","list","filter","className","showMap","tabButtonClasses","_useMapList","useMapList","mobileTab","setMobileTab","containerStyle","React","createElement","style","concat","Tabs","value","asChild","onClick","Button","Btn","variant","isBlock","Body","Icon","icon","size"],"mappings":";;;;;AAKA,IAAMA,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAMP;AAAA,EAAA,IALLC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IACHC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,OAAO,GAAAL,IAAA,CAAPK,OAAO,CAAA;EAEP,IAAMC,gBAAgB,GACnB,oIAAoI,CAAA;AACvI,EAAA,IAAAC,WAAA,GAAoDC,UAAU,EAAE;IAAxDC,SAAS,GAAAF,WAAA,CAATE,SAAS;IAAEC,YAAY,GAAAH,WAAA,CAAZG,YAAY;IAAEC,cAAc,GAAAJ,WAAA,CAAdI,cAAc,CAAA;EAE/C,oBACCC,cAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACCC,IAAAA,KAAK,EAAEH,cAAe;IACtBP,SAAS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AAwD;AAClEa,IAAAA,KAAK,EAAC,SAAA;GAELf,EAAAA,IACY,CAAC,EAGdG,OAAO,iBACPO,cAAA,CAAAC,aAAA,CAACG,OAAY,EAAA;AACZZ,IAAAA,SAAS,EAAC,wDAAwD;AAClEa,IAAAA,KAAK,EAAC,QAAA;GAELhB,EAAAA,GACY,CACd,eAGDW,cAAA,CAAAC,aAAA,CAACG,OAAY,EAAA;AACZZ,IAAAA,SAAS,EAAC,uCAAuC;AACjDa,IAAAA,KAAK,EAAC,WAAA;AAAW,GAAA,EAEhBd,MACY,CACV,CACK,CACP,CAAC,CAAA;AAER;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { createContext, useContext, useState, useRef, useEffect } from 'react';
|
|
2
2
|
import { getStorageObject, setStorageObject } from '../util/localStorageUtil.js';
|
|
3
3
|
|
|
4
4
|
const MapContext = createContext(undefined);
|
|
@@ -65,7 +65,7 @@ const MapProvider = ({ children, resetFilters, defaultZoomOverride }) => {
|
|
|
65
65
|
setTimeout(() => setLocation(location), 200);
|
|
66
66
|
setSelectedListItem(null);
|
|
67
67
|
};
|
|
68
|
-
return (
|
|
68
|
+
return (React__default.createElement(MapContext.Provider, { value: {
|
|
69
69
|
selectedListItem,
|
|
70
70
|
setSelectedListItem,
|
|
71
71
|
location,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapContext.js","sources":["../../src/contexts/mapContext.tsx"],"sourcesContent":["import React, { createContext, useState, useContext, useEffect, useRef, ReactNode } from 'react';\nimport { getStorageObject, setStorageObject } from '~/util/localStorageUtil';\nimport { Listing } from '~/types/Listings';\nimport { LatLng } from '~/types/LatLng';\ninterface IMapContext {\n selectedListItem: Listing | null;\n setSelectedListItem: (item: Listing | null) => void;\n location: any | null;\n setLocation: (location: LatLng | null) => void;\n center: LatLng;\n setCenter: (center: LatLng) => void;\n zoom: number;\n setZoom: (zoom: number) => void;\n selectedPlaces: string[];\n setSelectedPlaces: (places: string[]) => void;\n mapInteracted: boolean;\n setMapInteracted: (interacted: boolean) => void;\n userSetZoom: React.MutableRefObject<boolean>;\n firstLoadListItem: any;\n selectItem: (item: Listing, itemLocation: LatLng | null, zoom: number, center: LatLng) => void;\n filterReset: () => void;\n selectLocationEntity: (location: LatLng) => void;\n\tdefaultZoomOverride?: number | null;\n}\n\nconst MapContext = createContext<IMapContext | undefined>(undefined);\n\nexport const useMap = () => {\n\tconst context = useContext(MapContext);\n\tif (!context) {\n\t\tthrow new Error(\"useMap must be used within a MapProvider\");\n\t}\n\treturn context;\n};\n\ninterface MapProviderProps {\n children: ReactNode;\n resetFilters: boolean;\n\tdefaultZoomOverride?: number | null;\n}\n\nexport const MapProvider: React.FC<MapProviderProps> = ({ children, resetFilters, defaultZoomOverride }) => {\n\tconst [selectedListItem, setSelectedListItem] = useState<Listing | null>(getStorageObject('selectedListItem'));\n\tconst [location, setLocation] = useState<any>(getStorageObject('location'));\n\tconst [center, setCenter] = useState<LatLng>(getStorageObject(\"center\", { lat: 39.8283, lng: -98.5795 }) || { lat: 39.8283, lng: -98.5795 });\n\tconst [zoom, setZoom] = useState<number>(getStorageObject(\"zoom\", 9) || 9);\n\tconst [selectedPlaces, setSelectedPlaces] = useState<string[]>([]);\n\tconst [mapInteracted, setMapInteracted] = useState<boolean>(false);\n\tconst [firstLoadListItem] = useState<any>(getStorageObject('selectedListItem', { id: \"defaultId\" }));\n\tconst userSetZoom = useRef<boolean>(true);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(\"selectedListItem\", selectedListItem);\n\t}, [selectedListItem]);\n\n\tuseEffect(() => {\n\t\tlocalStorage.setItem(\"zoom\", zoom.toString());\n\t}, [zoom]);\n\n\tuseEffect(() => {\n\t\tif (location == null) {\n\t\t\tlocalStorage.removeItem(\"location\");\n\t\t} else {\n\t\t\tsetStorageObject(\"location\", location);\n\t\t}\n\t}, [location]);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(\"center\", center);\n\t}, [center]);\n\n\tconst selectItem = (item: Listing, itemLocation: LatLng | null, zoom: number, center: LatLng) => {\n\t\tsetSelectedListItem(item);\n\t\tif (mapInteracted === false && itemLocation != null) {\n\t\t\tsetLocation(itemLocation);\n\t\t}\n\t\tif (mapInteracted === false || itemLocation != null) {\n\t\t\tsetLocation(itemLocation);\n\t\t\tsetCenter(center);\n\t\t}\n\t\tif (mapInteracted === false) {\n\t\t\tsetZoom(zoom);\n\t\t}\n\t};\n\n\tconst filterReset = () => {\n\t\tsetSelectedPlaces([]);\n\t\tsetSelectedListItem(null);\n\t\tsetLocation(null);\n\t\tsetZoom(8);\n\t\tsetMapInteracted(false);\n\t};\n\n\tuseEffect(() => {\n\t\tif (resetFilters === true) {\n\t\t\tfilterReset();\n\t\t}\n\t}, [resetFilters]);\n\n\tconst selectLocationEntity = (location: LatLng) => {\n\t\tlocalStorage.removeItem(\"selectedListItem\");\n\t\tsetTimeout(() => setLocation(location), 200);\n\t\tsetSelectedListItem(null);\n\t};\n\n\treturn (\n\t\t<MapContext.Provider\n\t\t\tvalue={{\n\t\t\t\tselectedListItem,\n\t\t\t\tsetSelectedListItem,\n\t\t\t\tlocation,\n\t\t\t\tcenter,\n\t\t\t\tsetCenter,\n\t\t\t\tzoom,\n\t\t\t\tsetZoom,\n\t\t\t\tselectItem,\n\t\t\t\tsetSelectedPlaces,\n\t\t\t\tselectedPlaces,\n\t\t\t\tselectLocationEntity,\n\t\t\t\tsetLocation,\n\t\t\t\tsetMapInteracted,\n\t\t\t\tmapInteracted,\n\t\t\t\tuserSetZoom,\n\t\t\t\tfirstLoadListItem,\n\t\t\t\tfilterReset,\n\t\t\t\tdefaultZoomOverride\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</MapContext.Provider>\n\t);\n};\n"],"names":[],"mappings":";;;AAyBA,MAAM,UAAU,GAAG,aAAa,CAA0B,SAAS,CAAC,CAAC;AAE9D,MAAM,MAAM,GAAG,MAAK;AAC1B,IAAA,MAAM,OAAO,GAAG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AAC,CAAC;QAC1B,WAAW,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,CAAC,CAAC,CAAC,CAAC;QACX,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACzB,KAAC,CAAC;IAEF,SAAS,CAAC,MAAK;QACd,IAAI,YAAY,KAAK,IAAI,EAAE;AAC1B,YAAA,WAAW,EAAE,CAAC;AACd,SAAA;AACF,KAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AAEnB,IAAA,MAAM,oBAAoB,GAAG,CAAC,QAAgB,KAAI;AACjD,QAAA,YAAY,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;QAC5C,UAAU,CAAC,MAAM,WAAW,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;QAC7C,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAC3B,KAAC,CAAC;AAEF,IAAA,
|
|
1
|
+
{"version":3,"file":"mapContext.js","sources":["../../src/contexts/mapContext.tsx"],"sourcesContent":["import React, { createContext, useState, useContext, useEffect, useRef, ReactNode } from 'react';\nimport { getStorageObject, setStorageObject } from '~/util/localStorageUtil';\nimport { Listing } from '~/types/Listings';\nimport { LatLng } from '~/types/LatLng';\ninterface IMapContext {\n selectedListItem: Listing | null;\n setSelectedListItem: (item: Listing | null) => void;\n location: any | null;\n setLocation: (location: LatLng | null) => void;\n center: LatLng;\n setCenter: (center: LatLng) => void;\n zoom: number;\n setZoom: (zoom: number) => void;\n selectedPlaces: string[];\n setSelectedPlaces: (places: string[]) => void;\n mapInteracted: boolean;\n setMapInteracted: (interacted: boolean) => void;\n userSetZoom: React.MutableRefObject<boolean>;\n firstLoadListItem: any;\n selectItem: (item: Listing, itemLocation: LatLng | null, zoom: number, center: LatLng) => void;\n filterReset: () => void;\n selectLocationEntity: (location: LatLng) => void;\n\tdefaultZoomOverride?: number | null;\n}\n\nconst MapContext = createContext<IMapContext | undefined>(undefined);\n\nexport const useMap = () => {\n\tconst context = useContext(MapContext);\n\tif (!context) {\n\t\tthrow new Error(\"useMap must be used within a MapProvider\");\n\t}\n\treturn context;\n};\n\ninterface MapProviderProps {\n children: ReactNode;\n resetFilters: boolean;\n\tdefaultZoomOverride?: number | null;\n}\n\nexport const MapProvider: React.FC<MapProviderProps> = ({ children, resetFilters, defaultZoomOverride }) => {\n\tconst [selectedListItem, setSelectedListItem] = useState<Listing | null>(getStorageObject('selectedListItem'));\n\tconst [location, setLocation] = useState<any>(getStorageObject('location'));\n\tconst [center, setCenter] = useState<LatLng>(getStorageObject(\"center\", { lat: 39.8283, lng: -98.5795 }) || { lat: 39.8283, lng: -98.5795 });\n\tconst [zoom, setZoom] = useState<number>(getStorageObject(\"zoom\", 9) || 9);\n\tconst [selectedPlaces, setSelectedPlaces] = useState<string[]>([]);\n\tconst [mapInteracted, setMapInteracted] = useState<boolean>(false);\n\tconst [firstLoadListItem] = useState<any>(getStorageObject('selectedListItem', { id: \"defaultId\" }));\n\tconst userSetZoom = useRef<boolean>(true);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(\"selectedListItem\", selectedListItem);\n\t}, [selectedListItem]);\n\n\tuseEffect(() => {\n\t\tlocalStorage.setItem(\"zoom\", zoom.toString());\n\t}, [zoom]);\n\n\tuseEffect(() => {\n\t\tif (location == null) {\n\t\t\tlocalStorage.removeItem(\"location\");\n\t\t} else {\n\t\t\tsetStorageObject(\"location\", location);\n\t\t}\n\t}, [location]);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(\"center\", center);\n\t}, [center]);\n\n\tconst selectItem = (item: Listing, itemLocation: LatLng | null, zoom: number, center: LatLng) => {\n\t\tsetSelectedListItem(item);\n\t\tif (mapInteracted === false && itemLocation != null) {\n\t\t\tsetLocation(itemLocation);\n\t\t}\n\t\tif (mapInteracted === false || itemLocation != null) {\n\t\t\tsetLocation(itemLocation);\n\t\t\tsetCenter(center);\n\t\t}\n\t\tif (mapInteracted === false) {\n\t\t\tsetZoom(zoom);\n\t\t}\n\t};\n\n\tconst filterReset = () => {\n\t\tsetSelectedPlaces([]);\n\t\tsetSelectedListItem(null);\n\t\tsetLocation(null);\n\t\tsetZoom(8);\n\t\tsetMapInteracted(false);\n\t};\n\n\tuseEffect(() => {\n\t\tif (resetFilters === true) {\n\t\t\tfilterReset();\n\t\t}\n\t}, [resetFilters]);\n\n\tconst selectLocationEntity = (location: LatLng) => {\n\t\tlocalStorage.removeItem(\"selectedListItem\");\n\t\tsetTimeout(() => setLocation(location), 200);\n\t\tsetSelectedListItem(null);\n\t};\n\n\treturn (\n\t\t<MapContext.Provider\n\t\t\tvalue={{\n\t\t\t\tselectedListItem,\n\t\t\t\tsetSelectedListItem,\n\t\t\t\tlocation,\n\t\t\t\tcenter,\n\t\t\t\tsetCenter,\n\t\t\t\tzoom,\n\t\t\t\tsetZoom,\n\t\t\t\tselectItem,\n\t\t\t\tsetSelectedPlaces,\n\t\t\t\tselectedPlaces,\n\t\t\t\tselectLocationEntity,\n\t\t\t\tsetLocation,\n\t\t\t\tsetMapInteracted,\n\t\t\t\tmapInteracted,\n\t\t\t\tuserSetZoom,\n\t\t\t\tfirstLoadListItem,\n\t\t\t\tfilterReset,\n\t\t\t\tdefaultZoomOverride\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</MapContext.Provider>\n\t);\n};\n"],"names":["React"],"mappings":";;;AAyBA,MAAM,UAAU,GAAG,aAAa,CAA0B,SAAS,CAAC,CAAC;AAE9D,MAAM,MAAM,GAAG,MAAK;AAC1B,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC5D,KAAA;AACD,IAAA,OAAO,OAAO,CAAC;AAChB,EAAE;AAQK,MAAM,WAAW,GAA+B,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,mBAAmB,EAAE,KAAI;AAC1G,IAAA,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAA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,oBAAoB,GAAG,CAAC,QAAgB,KAAI;AACjD,QAAA,YAAY,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;QAC5C,UAAU,CAAC,MAAM,WAAW,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;QAC7C,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAC3B,KAAC,CAAC;AAEF,IAAA,QACCA,cAAC,CAAA,aAAA,CAAA,UAAU,CAAC,QAAQ,EAAA,EACnB,KAAK,EAAE;YACN,gBAAgB;YAChB,mBAAmB;YACnB,QAAQ;YACR,MAAM;YACN,SAAS;YACT,IAAI;YACJ,OAAO;YACP,UAAU;YACV,iBAAiB;YACjB,cAAc;YACd,oBAAoB;YACpB,WAAW;YACX,gBAAgB;YAChB,aAAa;YACb,WAAW;YACX,iBAAiB;YACjB,WAAW;YACX,mBAAmB;SACnB,EAEA,EAAA,QAAQ,CACY,EACrB;AACH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { createContext, useContext, useState, useEffect } from 'react';
|
|
2
2
|
import { applyFilters, generateFilterOptions, filterListingsByLocation } from '../util/filterUtil.js';
|
|
3
3
|
import { getStorageObject, setStorageObject } from '../util/localStorageUtil.js';
|
|
4
4
|
import { filtersFromURL, updateURLWithFilters } from '../util/urlFilterUtil.js';
|
|
@@ -13,24 +13,35 @@ const useMapList = () => {
|
|
|
13
13
|
}
|
|
14
14
|
return context;
|
|
15
15
|
};
|
|
16
|
-
const getQuery = () => {
|
|
16
|
+
const getQuery = (localStorageKey = '') => {
|
|
17
17
|
let query = null;
|
|
18
18
|
if (typeof window !== 'undefined') {
|
|
19
|
-
query = localStorage.getItem('query');
|
|
19
|
+
query = localStorage.getItem(localStorageKey + 'query');
|
|
20
20
|
}
|
|
21
21
|
return query;
|
|
22
22
|
};
|
|
23
|
-
const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails, navigateToEasyApply, Link, linkFormat, easyApplyUrl, easyApplyText, isIframe, trackEvent, listings = [], entities = [], setFiltersUrl, hiddenFilters, handleUrlUpdate, defaultFilters, containerStyle, ExpandListComponent, getListingEntitiesCallback, localStorageKey
|
|
23
|
+
const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails, navigateToEasyApply, Link, linkFormat, easyApplyUrl, easyApplyText, isIframe, trackEvent, listings = [], entities = [], setFiltersUrl, hiddenFilters, handleUrlUpdate, defaultFilters, containerStyle, ExpandListComponent, getListingEntitiesCallback, localStorageKey }) => {
|
|
24
24
|
const firstLoadFilters = () => {
|
|
25
25
|
let urlFilters = filtersFromURL(window.location)?.filters;
|
|
26
26
|
return (setFiltersUrl === true && urlFilters && Object.keys(urlFilters).length > 0) ? urlFilters : getStorageObject(localStorageKey + 'selectedFilters', {}) || {};
|
|
27
27
|
};
|
|
28
|
+
const firstLoadQuery = () => {
|
|
29
|
+
if (resetFilters)
|
|
30
|
+
return null;
|
|
31
|
+
// Check URL first
|
|
32
|
+
const urlData = filtersFromURL(window.location);
|
|
33
|
+
if (setFiltersUrl === true && urlData?.query) {
|
|
34
|
+
return urlData.query;
|
|
35
|
+
}
|
|
36
|
+
// Fall back to localStorage
|
|
37
|
+
return getQuery(localStorageKey);
|
|
38
|
+
};
|
|
28
39
|
const [allListings, setAllListings] = useState([]);
|
|
29
40
|
const [filteredListings, setFilteredListings] = useState([]);
|
|
30
41
|
const [loading, setLoading] = useState(false);
|
|
31
|
-
const [mapItems, setMapItems] = useState(getStorageObject('mapItems', []) || []);
|
|
32
|
-
const [query, setQuery] = useState(() =>
|
|
33
|
-
const [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });
|
|
42
|
+
const [mapItems, setMapItems] = useState(getStorageObject(localStorageKey + 'mapItems', []) || []);
|
|
43
|
+
const [query, setQuery] = useState(() => firstLoadQuery());
|
|
44
|
+
const [sortSetting, setSortSetting] = useState(getStorageObject(localStorageKey + 'sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });
|
|
34
45
|
const [listingEntities, setListingEntities] = useState({});
|
|
35
46
|
const [firstLoad, setFirstLoad] = useState(true);
|
|
36
47
|
const [commuteLocation, setCommuteLocation] = useState(getStorageObject('commuteLocation'));
|
|
@@ -47,40 +58,37 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
47
58
|
useEffect(() => {
|
|
48
59
|
if (!sortSetting)
|
|
49
60
|
return;
|
|
50
|
-
localStorage.setItem('sortSetting', JSON.stringify(sortSetting));
|
|
61
|
+
localStorage.setItem(localStorageKey + 'sortSetting', JSON.stringify(sortSetting));
|
|
51
62
|
setNewFilteredListings(filteredListings);
|
|
52
|
-
}, [sortSetting]);
|
|
63
|
+
}, [sortSetting, localStorageKey]);
|
|
53
64
|
useEffect(() => {
|
|
54
|
-
const loadedFavorites = JSON.parse(localStorage.getItem('favorites') || '[]');
|
|
65
|
+
const loadedFavorites = JSON.parse(localStorage.getItem(localStorageKey + 'favorites') || '[]');
|
|
55
66
|
setFavorites(loadedFavorites);
|
|
56
|
-
}, []);
|
|
67
|
+
}, [localStorageKey]);
|
|
57
68
|
useEffect(() => {
|
|
58
|
-
setStorageObject("commuteLocation", commuteLocation);
|
|
59
|
-
}, [commuteLocation]);
|
|
69
|
+
setStorageObject(localStorageKey + "commuteLocation", commuteLocation);
|
|
70
|
+
}, [commuteLocation, localStorageKey]);
|
|
60
71
|
useEffect(() => {
|
|
61
|
-
if (!commuteLocation
|
|
72
|
+
if (!commuteLocation)
|
|
62
73
|
return;
|
|
63
74
|
async function fetchEntities() {
|
|
75
|
+
const distinctEntityIds = [
|
|
76
|
+
...new Set(allListings.map(listing => listing.entityId ?? -1))
|
|
77
|
+
];
|
|
64
78
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
fetchedEntities = await getListingEntities(`${commuteLocation.lat}, ${commuteLocation.lng}`);
|
|
71
|
-
}
|
|
79
|
+
console.log(getListingEntitiesCallback);
|
|
80
|
+
console.log("fetching entities");
|
|
81
|
+
const fetchedEntities = getListingEntitiesCallback !== null && getListingEntitiesCallback !== undefined ? await getListingEntitiesCallback(distinctEntityIds, `${commuteLocation.lat}, ${commuteLocation.lng}`) : await getListingEntities(distinctEntityIds, `${commuteLocation.lat}, ${commuteLocation.lng}`);
|
|
72
82
|
setListingEntities(fetchedEntities);
|
|
73
|
-
|
|
74
|
-
const newFilteredListings = [...filteredListings];
|
|
83
|
+
const newFilteredListings = [...filteredListings] ?? [];
|
|
75
84
|
for (let i = 0; i < allListings.length; i++) {
|
|
76
85
|
const listing = newFilteredListings[i];
|
|
77
86
|
if (listing &&
|
|
78
87
|
listing.fields &&
|
|
79
|
-
listing.
|
|
80
|
-
listing.
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
const travelTime = (fetchedEntities[entityKey] || fetchedEntities[entityKey.toLowerCase()])?.travelTime;
|
|
88
|
+
listing.entityId !== undefined &&
|
|
89
|
+
listing.entityId !== -1) {
|
|
90
|
+
const entityId = listing.entityId;
|
|
91
|
+
const travelTime = fetchedEntities[entityId]?.travelTime;
|
|
84
92
|
if (travelTime !== undefined && listing.fields) {
|
|
85
93
|
listing.fields.travelTime = travelTime;
|
|
86
94
|
}
|
|
@@ -92,14 +100,14 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
92
100
|
}
|
|
93
101
|
}
|
|
94
102
|
fetchEntities();
|
|
95
|
-
}, [commuteLocation, allListings, siteConfig.companyId
|
|
103
|
+
}, [commuteLocation, allListings, siteConfig.companyId]);
|
|
96
104
|
useEffect(() => {
|
|
97
105
|
const handleFetchListings = async () => {
|
|
98
|
-
if (!
|
|
106
|
+
if (!getStorageObject(localStorageKey + 'listings') ?? [].length) {
|
|
99
107
|
setLoading(true);
|
|
100
108
|
}
|
|
101
109
|
try {
|
|
102
|
-
const { listingsResult,
|
|
110
|
+
const { listingsResult, fetchedEntities, distinctItems } = await fetchListings(commuteLocation, entities, listings, getListingEntitiesCallback);
|
|
103
111
|
if (defaultFilters) {
|
|
104
112
|
const filteredListings = listingsResult.filter(listing => {
|
|
105
113
|
if (!listing.fields)
|
|
@@ -115,7 +123,7 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
115
123
|
else {
|
|
116
124
|
setAllListings(listingsResult);
|
|
117
125
|
}
|
|
118
|
-
setListingEntities(
|
|
126
|
+
setListingEntities(fetchedEntities);
|
|
119
127
|
setMapItems(distinctItems);
|
|
120
128
|
}
|
|
121
129
|
catch (error) {
|
|
@@ -138,7 +146,7 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
138
146
|
setNewFilteredListings(filteredListings);
|
|
139
147
|
if (firstLoad && tempSelectedFilters) ;
|
|
140
148
|
else if (Object.keys(tempSelectedFilters).length === 0 && !firstLoad) {
|
|
141
|
-
localStorage.removeItem('selectedFilters');
|
|
149
|
+
localStorage.removeItem(localStorageKey + 'selectedFilters');
|
|
142
150
|
}
|
|
143
151
|
else if (!firstLoad) {
|
|
144
152
|
setStorageObject(localStorageKey + 'selectedFilters', tempSelectedFilters);
|
|
@@ -146,7 +154,7 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
146
154
|
if (setFiltersUrl === true) {
|
|
147
155
|
updateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);
|
|
148
156
|
}
|
|
149
|
-
tempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');
|
|
157
|
+
tempQuery != null ? localStorage.setItem(localStorageKey + 'query', tempQuery) : localStorage.removeItem(localStorageKey + 'query');
|
|
150
158
|
setMapItems(mapItems);
|
|
151
159
|
if (tempSelectedFilters) {
|
|
152
160
|
const keys = Object.keys(tempSelectedFilters);
|
|
@@ -172,14 +180,14 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
172
180
|
};
|
|
173
181
|
const handleSettingFavorites = (newFavorites) => {
|
|
174
182
|
if (newFavorites == null) {
|
|
175
|
-
localStorage.removeItem('favorites');
|
|
183
|
+
localStorage.removeItem(localStorageKey + 'favorites');
|
|
176
184
|
}
|
|
177
185
|
else {
|
|
178
186
|
setFavorites(newFavorites);
|
|
179
|
-
localStorage.setItem('favorites', JSON.stringify(newFavorites));
|
|
187
|
+
localStorage.setItem(localStorageKey + 'favorites', JSON.stringify(newFavorites));
|
|
180
188
|
}
|
|
181
189
|
};
|
|
182
|
-
return (
|
|
190
|
+
return (React__default.createElement(MapListContext.Provider, { value: {
|
|
183
191
|
loading,
|
|
184
192
|
allListings,
|
|
185
193
|
filteredListings,
|
|
@@ -218,8 +226,7 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
218
226
|
defaultFilters,
|
|
219
227
|
hiddenFilters,
|
|
220
228
|
containerStyle,
|
|
221
|
-
ExpandListComponent
|
|
222
|
-
noEntities
|
|
229
|
+
ExpandListComponent
|
|
223
230
|
} }, children));
|
|
224
231
|
};
|
|
225
232
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapListContext.js","sources":["../../src/contexts/mapListContext.tsx"],"sourcesContent":["import React, { createContext, useState, useEffect, useContext, ReactNode } from 'react';\n\nimport { generateFilterOptions, applyFilters, filterListingsByLocation } from '~/util/filterUtil';\nimport { getStorageObject, setStorageObject } from '~/util/localStorageUtil';\nimport { updateURLWithFilters, filtersFromURL } from '~/util/urlFilterUtil';\n\nimport { getListingEntities } from \"~/services/listingEntityService\";\nimport fetchListings from '~/services/listingAggregatorService';\n\nimport { Listing } from '~/types/Listings';\nimport { ListingEntity } from '~/types/ListingEntity';\nimport { Recruiter } from '~/types/Recruiter';\nimport { MapConfig, MapConfig as SiteConfig } from '~/types/config/MapConfig';\nimport { get } from 'http';\n\ninterface MapListContextProps {\n loading: boolean;\n allListings: Listing[];\n filteredListings: Listing[];\n mapItems: any;\n query: string | null;\n setNewFilteredListings: (filteredListings: Listing[]) => void;\n setQuery: (query: string | null) => void;\n listingEntities: Record<number, ListingEntity> | null;\n selectedFilters: Record<string, any>;\n setSelectedFilters: (filters: Record<string, any>) => void;\n filterOptions: any;\n recruiters: Record<number, Recruiter>;\n handleFilterListingsByLocation: (selectedLocation: any) => void;\n filterDialogIsOpen: boolean;\n setFilterDialogIsOpen: (isOpen: boolean) => void;\n setMobileTab: (tab: string) => void;\n mobileTab: string;\n siteConfig: SiteConfig;\n favorites: number[];\n resetEntityFilter: () => void;\n handleSettingFavorites: (favorites: number[] | null) => void;\n setFilterByFavorites: (filter: boolean) => void;\n filterByFavorites: boolean;\n commuteLocation: any | null;\n setCommuteLocation: (location: any | null) => void;\n navigateToDetails: (id: number) => void;\n navigateToEasyApply: (id: number) => void;\n Link: React.ComponentType<any>;\n linkFormat: string;\n easyApplyUrl: string;\n easyApplyText: string;\n\tisIframe: boolean;\n sortSetting: { field: string; type: string };\n setSortSetting: (setting: { field: string; type: string }) => void;\n trackEvent: (event: string) => void;\n defaultFilters?: Record<string, any>;\n hiddenFilters?: string[];\n containerStyle?: any;\n ExpandListComponent?: React.ComponentType<{ listing: any }> | ((listing: any) => JSX.Element) | null;\n noEntities?: boolean;\n}\n\nconst MapListContext = createContext<MapListContextProps | undefined>(undefined);\n\nexport const useMapList = () => {\n\tconst context = useContext(MapListContext);\n\tif (!context) {\n\t\tthrow new Error('useMapList must be used within a MapListProvider');\n\t}\n\treturn context;\n};\n\nconst getQuery = (): string | null => {\n\tlet query: string | null = null;\n\tif (typeof window !== 'undefined') {\n\t\tquery = localStorage.getItem('query');\n\t}\n\treturn query;\n};\n\ninterface MapListProviderProps {\n children: ReactNode;\n siteConfig: MapConfig;\n resetFilters: boolean;\n navigateToDetails: (id: number) => void;\n navigateToEasyApply: (id: number) => void;\n Link: React.ComponentType<any>;\n linkFormat: string;\n easyApplyUrl: string;\n easyApplyText: string;\n\tisIframe: boolean;\n trackEvent: (event: string) => void;\n listings?: Listing[];\n\tentities?: ListingEntity[];\n setFiltersUrl?:boolean;\n hiddenFilters?: string[];\n handleUrlUpdate: (searchParams: string) => void;\n defaultFilters?: Record<string, any>;\n containerStyle?: any;\n\tlocalStorageKey: string;\n\tgetListingEntitiesCallback?: (origin?: string) => Promise<any>;\n ExpandListComponent?: React.ComponentType<{ listing: Listing }> | ((listing: Listing) => JSX.Element) | null;\n hideMap?: boolean;\n hideFilters?: boolean;\n noEntities?: boolean;\n}\n\nexport const MapListProvider: React.FC<MapListProviderProps> = ({\n\tchildren,\n\tsiteConfig,\n\tresetFilters,\n\tnavigateToDetails,\n\tnavigateToEasyApply,\n\tLink,\n\tlinkFormat,\n\teasyApplyUrl,\n\teasyApplyText,\n\tisIframe,\n\ttrackEvent,\n\tlistings = [],\n\tentities = [],\n\tsetFiltersUrl,\n\thiddenFilters,\n\thandleUrlUpdate,\n\tdefaultFilters,\n\tcontainerStyle,\n\tExpandListComponent,\n\tgetListingEntitiesCallback,\n\tlocalStorageKey,\n\thideMap = false,\n\thideFilters = false,\n\tnoEntities = false\n}) => {\n\tconst firstLoadFilters = () =>{\n\t\tlet urlFilters = filtersFromURL(window.location)?.filters;\n\t\treturn (setFiltersUrl === true && urlFilters && Object.keys(urlFilters).length > 0) ? urlFilters : getStorageObject(localStorageKey + 'selectedFilters', {}) || {}\n\t}\n\tconst [allListings, setAllListings] = useState<Listing[]>([]);\n\tconst [filteredListings, setFilteredListings] = useState<Listing[]>([]);\n\tconst [loading, setLoading] = useState<boolean>(false);\n\tconst [mapItems, setMapItems] = useState<any>(getStorageObject('mapItems', []) || []);\n\tconst [query, setQuery] = useState<string | null>(() => resetFilters ? null : getQuery());\n\tconst [sortSetting, setSortSetting] = useState<{ field: string; type: string }>(getStorageObject('sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });\n\tconst [listingEntities, setListingEntities] = useState<Record<number, ListingEntity> | null>({});\n\tconst [firstLoad, setFirstLoad] = useState<boolean>(true);\n\tconst [commuteLocation, setCommuteLocation] = useState<any | null>(getStorageObject('commuteLocation'));\n\tconst [selectedFilters, setSelectedFilters] = useState<Record<string, any>>(() => resetFilters ? {} : firstLoadFilters());\n\tconst [filterOptions, setFilterOptions] = useState<any>();\n\tconst [recruiters, setRecruiters] = useState<Record<number, Recruiter>>({});\n\tconst [filterDialogIsOpen, setFilterDialogIsOpen] = useState<boolean>(false);\n\tconst [mobileTab, setMobileTab] = useState<string>(\"listTab\");\n\tconst [favorites, setFavorites] = useState<number[]>([]);\n\tconst [filterByFavorites, setFilterByFavorites] = useState<boolean>(false);\n\n\tconst setNewFilteredListings = (filteredListings: Listing[]) => {\n\t\tsetFilteredListings(filteredListings);\n\t};\n\n\tuseEffect(() => {\n\t\tif (!sortSetting) return;\n\t\tlocalStorage.setItem('sortSetting', JSON.stringify(sortSetting));\n\t\tsetNewFilteredListings(filteredListings);\n\t}, [sortSetting]);\n\n\tuseEffect(() => {\n\t\tconst loadedFavorites = JSON.parse(localStorage.getItem('favorites') || '[]');\n\t\tsetFavorites(loadedFavorites);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(\"commuteLocation\", commuteLocation);\n\t}, [commuteLocation]);\n\n\n\tuseEffect(() => {\n\t\tif (!commuteLocation || noEntities) return;\n\n\t\tasync function fetchEntities() {\n\t\t\ttry {\n\t\t\t\tlet fetchedEntities;\n\t\t\t\tif (getListingEntitiesCallback) {\n\t\t\t\t\tfetchedEntities = await getListingEntitiesCallback(`${commuteLocation.lat}, ${commuteLocation.lng}`);\n\t\t\t\t} else {\n\t\t\t\t\tfetchedEntities = await getListingEntities(`${commuteLocation.lat}, ${commuteLocation.lng}`);\n\t\t\t\t}\n\t\t\t\tsetListingEntities(fetchedEntities);\n\t\t\t\t// Update travelTime on listings\n\t\t\t\tconst newFilteredListings: Listing[] = [...filteredListings];\n\t\t\t\tfor (let i = 0; i < allListings.length; i++) {\n\t\t\t\t\tconst listing = newFilteredListings[i];\n\t\t\t\t\tif (\n\t\t\t\t\t\tlisting &&\n\t\t\t\t\t\tlisting.fields &&\n\t\t\t\t\t\tlisting.fields.entityKey &&\n\t\t\t\t\t\tlisting.fields.entityKey !== ''\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst entityKey = listing.fields.entityKey;\n\t\t\t\t\t\t// Try exact match first, then lowercase match for case-insensitive lookup\n\t\t\t\t\t\tconst travelTime = (fetchedEntities[entityKey] || fetchedEntities[entityKey.toLowerCase()])?.travelTime;\n\t\t\t\t\t\tif (travelTime !== undefined && listing.fields) {\n\t\t\t\t\t\t\tlisting.fields.travelTime = travelTime;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Failed to fetch listing entities:\", error);\n\t\t\t}\n\t\t}\n\n\t\tfetchEntities();\n\t}, [commuteLocation, allListings, siteConfig.companyId, getListingEntitiesCallback, noEntities]);\n\n\tuseEffect(() => {\n\t\tconst handleFetchListings = async () => {\n\t\tif (!(getStorageObject('listings', []) || []).length) {\n\t\t\tsetLoading(true);\n\t\t}\n\n\t\ttry {\n\t\t\tconst {\n\t\t\t\tlistingsResult,\n\t\t\t\tentitiesByKey,\n\t\t\t\tdistinctItems\n\t\t\t} = await fetchListings(commuteLocation, entities, listings, getListingEntitiesCallback, noEntities);\n\t\t\tif (defaultFilters) {\n\t\t\t\tconst filteredListings = listingsResult.filter(listing => {\n\t\t\t\tif (!listing.fields) return false;\n\n\t\t\t\treturn Object.keys(defaultFilters).every(filterKey => {\n\t\t\t\t\tconst filterValues = defaultFilters[filterKey as keyof typeof defaultFilters];\n\t\t\t\t\tconst listingValue = listing.fields ? listing.fields[filterKey as keyof typeof listing.fields] : null;\n\t\t\t\t\treturn filterValues.includes(listingValue);\n\t\t\t\t});\n\t\t\t});\n\t\t\tsetAllListings(filteredListings);\n\t\t} else {\n\t\t\tsetAllListings(listingsResult);\n\t\t}\n\t\t\tsetListingEntities(entitiesByKey);\n\t\t\t\tsetMapItems(distinctItems);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.log(error);\n\t\t\t}\n\t\t\tsetLoading(false);\n\t\t};\n\t\thandleFetchListings();\n\t}, [query, siteConfig, commuteLocation]);\n\n\tuseEffect(() => {\n\t\tconst processListings = () => {\n\t\t\tlet filteredListings: Listing[];\n\t\t\tlet tempSelectedFilters = selectedFilters;\n\t\t\tlet tempQuery = query;\n\n\t\t\tconst { mapItems, filteredListings: tempFilteredListings } = applyFilters(\n\t\t\t\tallListings,\n\t\t\t\ttempSelectedFilters,\n\t\t\t\ttempQuery,\n\t\t\t\tlistingEntities,\n\t\t\t\tfavorites,\n\t\t\t\tsiteConfig\n\t\t\t);\n\t\t\tfilteredListings = tempFilteredListings;\n\n\t\t\tif (filterByFavorites) {\n\t\t\t\tfilteredListings = filteredListings.filter((x: Listing) => favorites.includes(x.id));\n\t\t\t}\n\t\t\tsetNewFilteredListings(filteredListings);\n\t\t\tif (firstLoad && tempSelectedFilters) {\n\t\t\t\t// Update URL with filters if needed\n\t\t\t} else if (Object.keys(tempSelectedFilters).length === 0 && !firstLoad) {\n\t\t\t\tlocalStorage.removeItem('selectedFilters');\n\t\t\t} else if (!firstLoad) {\n\t\t\t\tsetStorageObject(localStorageKey + 'selectedFilters', tempSelectedFilters);\n\t\t\t}\n\t\t\tif(setFiltersUrl === true)\n\t\t\t{\n\t\t\t\tupdateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);\n\t\t\t}\n\t\t\ttempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');\n\t\t\tsetMapItems(mapItems);\n\n\t\t\tif (tempSelectedFilters) {\n\t\t\t\tconst keys = Object.keys(tempSelectedFilters);\n\t\t\t\tconst lastKey = keys[keys.length - 1];\n\t\t\t\tconst options = generateFilterOptions(\n\t\t\t\t\tfilteredListings,\n\t\t\t\t\tallListings,\n\t\t\t\t\tsiteConfig,\n\t\t\t\t\tfilterOptions,\n\t\t\t\t\tlastKey,\n\t\t\t\t\tfavorites,\n\t\t\t\t\ttempSelectedFilters\n\t\t\t\t);\n\t\t\t\tif (options) {\n\t\t\t\t\tsetFilterOptions(options);\n\t\t\t\t\tif (firstLoad) setFirstLoad(false);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tprocessListings();\n\t}, [selectedFilters, query, listingEntities, filterByFavorites, favorites]);\n\n\tconst handleFilterListingsByLocation = (selectedLocation: any) => {\n\t\tconst { filteredListings } = filterListingsByLocation(\n\t\t\tallListings,\n\t\t\tselectedLocation,\n\t\t\tlistingEntities\n\t\t);\n\t\tsetNewFilteredListings(filteredListings);\n\t};\n\n\tconst resetEntityFilter = () => {\n\t\tlet newFilters = {...selectedFilters};\n\t\tdelete newFilters.entityId;\n\t\tsetSelectedFilters(newFilters);\n\t}\n\n\tconst handleSettingFavorites = (newFavorites: number[] | null) => {\n\t\tif (newFavorites == null) {\n\t\t\tlocalStorage.removeItem('favorites');\n\t\t} else {\n\t\t\tsetFavorites(newFavorites);\n\t\t\tlocalStorage.setItem('favorites', JSON.stringify(newFavorites));\n\t\t}\n\t};\n\n\treturn (\n\t\t<MapListContext.Provider value={{\n\t\t\tloading,\n\t\t\tallListings,\n\t\t\tfilteredListings,\n\t\t\tmapItems,\n\t\t\tquery,\n\t\t\tsetNewFilteredListings,\n\t\t\tsetQuery,\n\t\t\tlistingEntities,\n\t\t\tselectedFilters,\n\t\t\tsetSelectedFilters,\n\t\t\tfilterOptions,\n\t\t\trecruiters,\n\t\t\thandleFilterListingsByLocation,\n\t\t\tfilterDialogIsOpen,\n\t\t\tsetFilterDialogIsOpen,\n\t\t\tsetMobileTab,\n\t\t\tmobileTab,\n\t\t\tsiteConfig,\n\t\t\tfavorites,\n\t\t\thandleSettingFavorites,\n\t\t\tresetEntityFilter,\n\t\t\tsetFilterByFavorites,\n\t\t\tfilterByFavorites,\n\t\t\tcommuteLocation,\n\t\t\tsetCommuteLocation,\n\t\t\tnavigateToDetails,\n\t\t\tnavigateToEasyApply,\n\t\t\tLink,\n\t\t\tlinkFormat,\n\t\t\teasyApplyUrl,\n\t\t\teasyApplyText,\n\t\t\tisIframe,\n\t\t\tsortSetting,\n\t\t\tsetSortSetting,\n\t\t\ttrackEvent,\n\t\t\tdefaultFilters,\n\t\t\thiddenFilters,\n\t\t\tcontainerStyle,\n\t\t\tExpandListComponent,\n\t\t\tnoEntities\n\t\t}}>\n\t\t\t{children}\n\t\t</MapListContext.Provider>\n\t);\n};\n"],"names":[],"mappings":";;;;;;;AA0DA,MAAM,cAAc,GAAG,aAAa,CAAkC,SAAS,CAAC,CAAC;AAE1E,MAAM,UAAU,GAAG,MAAK;AAC9B,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;AACpE,KAAA;AACD,IAAA,OAAO,OAAO,CAAC;AAChB,EAAE;AAEF,MAAM,QAAQ,GAAG,MAAoB;IACpC,IAAI,KAAK,GAAkB,IAAI,CAAC;AAChC,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAClC,QAAA,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACtC,KAAA;AACD,IAAA,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AA6BK,MAAM,eAAe,GAAmC,CAAC,EAC/D,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,UAAU,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,EAAE,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,OAAO,GAAG,KAAK,EACf,WAAW,GAAG,KAAK,EACnB,UAAU,GAAG,KAAK,EAClB,KAAI;IACJ,MA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,aAAa;YACb,cAAc;YACd,mBAAmB;YACnB,UAAU;SACV,EACC,EAAA,QAAQ,CACgB,EACzB;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"mapListContext.js","sources":["../../src/contexts/mapListContext.tsx"],"sourcesContent":["import React, { createContext, useState, useEffect, useContext, ReactNode } from 'react';\n\nimport { generateFilterOptions, applyFilters, filterListingsByLocation } from '~/util/filterUtil';\nimport { getStorageObject, setStorageObject } from '~/util/localStorageUtil';\nimport { updateURLWithFilters, filtersFromURL } from '~/util/urlFilterUtil';\n\nimport { getListingEntities } from \"~/services/listingEntityService\";\nimport fetchListings from '~/services/listingAggregatorService';\n\nimport { Listing } from '~/types/Listings';\nimport { ListingEntity } from '~/types/ListingEntity';\nimport { Recruiter } from '~/types/Recruiter';\nimport { MapConfig, MapConfig as SiteConfig } from '~/types/config/MapConfig';\nimport { get } from 'http';\n\ninterface MapListContextProps {\n loading: boolean;\n allListings: Listing[];\n filteredListings: Listing[];\n mapItems: any;\n query: string | null;\n setNewFilteredListings: (filteredListings: Listing[]) => void;\n setQuery: (query: string | null) => void;\n listingEntities: Record<number, ListingEntity> | null;\n selectedFilters: Record<string, any>;\n setSelectedFilters: (filters: Record<string, any>) => void;\n filterOptions: any;\n recruiters: Record<number, Recruiter>;\n handleFilterListingsByLocation: (selectedLocation: any) => void;\n filterDialogIsOpen: boolean;\n setFilterDialogIsOpen: (isOpen: boolean) => void;\n setMobileTab: (tab: string) => void;\n mobileTab: string;\n siteConfig: SiteConfig;\n favorites: number[];\n resetEntityFilter: () => void;\n handleSettingFavorites: (favorites: number[] | null) => void;\n setFilterByFavorites: (filter: boolean) => void;\n filterByFavorites: boolean;\n commuteLocation: any | null;\n setCommuteLocation: (location: any | null) => void;\n navigateToDetails: (id: number) => void;\n navigateToEasyApply: (id: number) => void;\n Link: React.ComponentType<any>;\n linkFormat: string;\n easyApplyUrl: string;\n easyApplyText: string;\n\tisIframe: boolean;\n sortSetting: { field: string; type: string };\n setSortSetting: (setting: { field: string; type: string }) => void;\n trackEvent: (event: string) => void;\n defaultFilters?: Record<string, any>;\n hiddenFilters?: string[];\n containerStyle?: any;\n ExpandListComponent?: React.ComponentType<{ listing: any }> | ((listing: any) => JSX.Element) | null;\n}\n\nconst MapListContext = createContext<MapListContextProps | undefined>(undefined);\n\nexport const useMapList = () => {\n\tconst context = useContext(MapListContext);\n\tif (!context) {\n\t\tthrow new Error('useMapList must be used within a MapListProvider');\n\t}\n\treturn context;\n};\n\nconst getQuery = (localStorageKey: string = ''): string | null => {\n\tlet query: string | null = null;\n\tif (typeof window !== 'undefined') {\n\t\tquery = localStorage.getItem(localStorageKey + 'query');\n\t}\n\treturn query;\n};\n\ninterface MapListProviderProps {\n children: ReactNode;\n siteConfig: MapConfig;\n resetFilters: boolean;\n navigateToDetails: (id: number) => void;\n navigateToEasyApply: (id: number) => void;\n Link: React.ComponentType<any>;\n linkFormat: string;\n easyApplyUrl: string;\n easyApplyText: string;\n\tisIframe: boolean;\n trackEvent: (event: string) => void;\n listings?: Listing[];\n\tentities?: ListingEntity[];\n setFiltersUrl?:boolean;\n hiddenFilters?: string[];\n handleUrlUpdate: (searchParams: string) => void;\n defaultFilters?: Record<string, any>;\n containerStyle?: any;\n\tlocalStorageKey: string;\n\tgetListingEntitiesCallback?: (entityIds: number[], origin?: string) => Promise<ListingEntity[]>;\n ExpandListComponent?: React.ComponentType<{ listing: Listing }> | ((listing: Listing) => JSX.Element) | null;\n}\n\nexport const MapListProvider: React.FC<MapListProviderProps> = ({\n\tchildren,\n\tsiteConfig,\n\tresetFilters,\n\tnavigateToDetails,\n\tnavigateToEasyApply,\n\tLink,\n\tlinkFormat,\n\teasyApplyUrl,\n\teasyApplyText,\n\tisIframe,\n\ttrackEvent,\n\tlistings = [],\n\tentities = [],\n\tsetFiltersUrl,\n\thiddenFilters,\n\thandleUrlUpdate,\n\tdefaultFilters,\n\tcontainerStyle,\n\tExpandListComponent,\n\tgetListingEntitiesCallback,\n\tlocalStorageKey\n}) => {\n\tconst firstLoadFilters = () =>{\n\t\tlet urlFilters = filtersFromURL(window.location)?.filters;\n\t\treturn (setFiltersUrl === true && urlFilters && Object.keys(urlFilters).length > 0) ? urlFilters : getStorageObject(localStorageKey + 'selectedFilters', {}) || {}\n\t}\n\t\n\tconst firstLoadQuery = (): string | null => {\n\t\tif (resetFilters) return null;\n\t\t// Check URL first\n\t\tconst urlData = filtersFromURL(window.location);\n\t\tif (setFiltersUrl === true && urlData?.query) {\n\t\t\treturn urlData.query;\n\t\t}\n\t\t// Fall back to localStorage\n\t\treturn getQuery(localStorageKey);\n\t}\n\t\n\tconst [allListings, setAllListings] = useState<Listing[]>([]);\n\tconst [filteredListings, setFilteredListings] = useState<Listing[]>([]);\n\tconst [loading, setLoading] = useState<boolean>(false);\n\tconst [mapItems, setMapItems] = useState<any>(getStorageObject(localStorageKey + 'mapItems', []) || []);\n\tconst [query, setQuery] = useState<string | null>(() => firstLoadQuery());\n\tconst [sortSetting, setSortSetting] = useState<{ field: string; type: string }>(getStorageObject(localStorageKey + 'sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });\n\tconst [listingEntities, setListingEntities] = useState<Record<number, ListingEntity> | null>({});\n\tconst [firstLoad, setFirstLoad] = useState<boolean>(true);\n\tconst [commuteLocation, setCommuteLocation] = useState<any | null>(getStorageObject('commuteLocation'));\n\tconst [selectedFilters, setSelectedFilters] = useState<Record<string, any>>(() => resetFilters ? {} : firstLoadFilters());\n\tconst [filterOptions, setFilterOptions] = useState<any>();\n\tconst [recruiters, setRecruiters] = useState<Record<number, Recruiter>>({});\n\tconst [filterDialogIsOpen, setFilterDialogIsOpen] = useState<boolean>(false);\n\tconst [mobileTab, setMobileTab] = useState<string>(\"listTab\");\n\tconst [favorites, setFavorites] = useState<number[]>([]);\n\tconst [filterByFavorites, setFilterByFavorites] = useState<boolean>(false);\n\n\tconst setNewFilteredListings = (filteredListings: Listing[]) => {\n\t\tsetFilteredListings(filteredListings);\n\t};\n\n\tuseEffect(() => {\n\t\tif (!sortSetting) return;\n\t\tlocalStorage.setItem(localStorageKey + 'sortSetting', JSON.stringify(sortSetting));\n\t\tsetNewFilteredListings(filteredListings);\n\t}, [sortSetting, localStorageKey]);\n\n\tuseEffect(() => {\n\t\tconst loadedFavorites = JSON.parse(localStorage.getItem(localStorageKey + 'favorites') || '[]');\n\t\tsetFavorites(loadedFavorites);\n\t}, [localStorageKey]);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(localStorageKey + \"commuteLocation\", commuteLocation);\n\t}, [commuteLocation, localStorageKey]);\n\n\tuseEffect(() => {\n\t\tif (!commuteLocation) return;\n\n\t\tasync function fetchEntities() {\n\t\t\tconst distinctEntityIds = [\n\t\t\t\t...new Set(allListings.map(listing => listing.entityId ?? -1))\n\t\t\t];\n\t\t\ttry {\n\t\t\t\tconsole.log(getListingEntitiesCallback);\n\t\t\t\tconsole.log(\"fetching entities\")\n\t\t\t\tconst fetchedEntities = getListingEntitiesCallback !== null && getListingEntitiesCallback !== undefined ? await getListingEntitiesCallback(distinctEntityIds,\n\t\t\t\t\t`${commuteLocation.lat}, ${commuteLocation.lng}`) : await getListingEntities(\n\t\t\t\t\tdistinctEntityIds,\n\t\t\t\t\t`${commuteLocation.lat}, ${commuteLocation.lng}`\n\t\t\t\t);\n\t\t\t\tsetListingEntities(fetchedEntities);\n\t\t\t\tconst newFilteredListings: Listing[] = [...filteredListings] ?? [];\n\t\t\t\tfor (let i = 0; i < allListings.length; i++) {\n\t\t\t\t\tconst listing = newFilteredListings[i];\n\t\t\t\t\tif (\n\t\t\t\t\t\tlisting &&\n\t\t\t\t\t\tlisting.fields &&\n\t\t\t\t\t\tlisting.entityId !== undefined &&\n\t\t\t\t\t\tlisting.entityId !== -1\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst entityId = listing.entityId;\n\t\t\t\t\t\tconst travelTime = fetchedEntities[entityId]?.travelTime;\n\n\t\t\t\t\t\tif (travelTime !== undefined && listing.fields) {\n\t\t\t\t\t\t\tlisting.fields.travelTime = travelTime;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Failed to fetch listing entities:\", error);\n\t\t\t}\n\t\t}\n\n\t\tfetchEntities();\n\t}, [commuteLocation, allListings, siteConfig.companyId]);\n\n\tuseEffect(() => {\n\t\tconst handleFetchListings = async () => {\n\t\t\tif (!getStorageObject(localStorageKey + 'listings') ?? [].length) {\n\t\t\t\tsetLoading(true);\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst {\n\t\t\t\t\tlistingsResult,\n\t\t\t\t\tfetchedEntities,\n\t\t\t\t\tdistinctItems\n\t\t\t\t} = await fetchListings(commuteLocation, entities, listings, getListingEntitiesCallback);\n\t\t\t\tif (defaultFilters) {\n\t\t\t\t\tconst filteredListings = listingsResult.filter(listing => {\n\t\t\t\t\tif (!listing.fields) return false;\n\n\t\t\t\t\treturn Object.keys(defaultFilters).every(filterKey => {\n\t\t\t\t\t\tconst filterValues = defaultFilters[filterKey as keyof typeof defaultFilters];\n\t\t\t\t\t\tconst listingValue = listing.fields ? listing.fields[filterKey as keyof typeof listing.fields] : null;\n\t\t\t\t\t\treturn filterValues.includes(listingValue);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tsetAllListings(filteredListings);\n\t\t\t} else {\n\t\t\t\tsetAllListings(listingsResult);\n\t\t\t}\n\t\t\t\tsetListingEntities(fetchedEntities);\n\t\t\t\tsetMapItems(distinctItems);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.log(error);\n\t\t\t}\n\t\t\tsetLoading(false);\n\t\t};\n\t\thandleFetchListings();\n\t}, [query, siteConfig, commuteLocation]);\n\n\tuseEffect(() => {\n\t\tconst processListings = () => {\n\t\t\tlet filteredListings: Listing[];\n\t\t\tlet tempSelectedFilters = selectedFilters;\n\t\t\tlet tempQuery = query;\n\n\t\t\tconst { mapItems, filteredListings: tempFilteredListings } = applyFilters(\n\t\t\t\tallListings,\n\t\t\t\ttempSelectedFilters,\n\t\t\t\ttempQuery,\n\t\t\t\tlistingEntities,\n\t\t\t\tfavorites,\n\t\t\t\tsiteConfig\n\t\t\t);\n\t\t\tfilteredListings = tempFilteredListings;\n\n\t\t\tif (filterByFavorites) {\n\t\t\t\tfilteredListings = filteredListings.filter((x: Listing) => favorites.includes(x.id));\n\t\t\t}\n\t\t\tsetNewFilteredListings(filteredListings);\n\t\t\tif (firstLoad && tempSelectedFilters) {\n\t\t\t\t// Update URL with filters if needed\n\t\t\t} else if (Object.keys(tempSelectedFilters).length === 0 && !firstLoad) {\n\t\t\t\tlocalStorage.removeItem(localStorageKey + 'selectedFilters');\n\t\t\t} else if (!firstLoad) {\n\t\t\t\tsetStorageObject(localStorageKey + 'selectedFilters', tempSelectedFilters);\n\t\t\t}\n\t\t\tif(setFiltersUrl === true)\n\t\t\t{\n\t\t\t\tupdateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);\n\t\t\t}\n\t\t\ttempQuery != null ? localStorage.setItem(localStorageKey + 'query', tempQuery) : localStorage.removeItem(localStorageKey + 'query');\n\t\t\tsetMapItems(mapItems);\n\n\t\t\tif (tempSelectedFilters) {\n\t\t\t\tconst keys = Object.keys(tempSelectedFilters);\n\t\t\t\tconst lastKey = keys[keys.length - 1];\n\t\t\t\tconst options = generateFilterOptions(\n\t\t\t\t\tfilteredListings,\n\t\t\t\t\tallListings,\n\t\t\t\t\tsiteConfig,\n\t\t\t\t\tfilterOptions,\n\t\t\t\t\tlastKey,\n\t\t\t\t\tfavorites,\n\t\t\t\t\ttempSelectedFilters\n\t\t\t\t);\n\t\t\t\tif (options) {\n\t\t\t\t\tsetFilterOptions(options);\n\t\t\t\t\tif (firstLoad) setFirstLoad(false);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tprocessListings();\n\t}, [selectedFilters, query, listingEntities, filterByFavorites, favorites]);\n\n\tconst handleFilterListingsByLocation = (selectedLocation: any) => {\n\t\tconst { filteredListings } = filterListingsByLocation(\n\t\t\tallListings,\n\t\t\tselectedLocation,\n\t\t\tlistingEntities\n\t\t);\n\t\tsetNewFilteredListings(filteredListings);\n\t};\n\n\tconst resetEntityFilter = () => {\n\t\tlet newFilters = {...selectedFilters};\n\t\tdelete newFilters.entityId;\n\t\tsetSelectedFilters(newFilters);\n\t}\n\n\tconst handleSettingFavorites = (newFavorites: number[] | null) => {\n\t\tif (newFavorites == null) {\n\t\t\tlocalStorage.removeItem(localStorageKey + 'favorites');\n\t\t} else {\n\t\t\tsetFavorites(newFavorites);\n\t\t\tlocalStorage.setItem(localStorageKey + 'favorites', JSON.stringify(newFavorites));\n\t\t}\n\t};\n\n\treturn (\n\t\t<MapListContext.Provider value={{\n\t\t\tloading,\n\t\t\tallListings,\n\t\t\tfilteredListings,\n\t\t\tmapItems,\n\t\t\tquery,\n\t\t\tsetNewFilteredListings,\n\t\t\tsetQuery,\n\t\t\tlistingEntities,\n\t\t\tselectedFilters,\n\t\t\tsetSelectedFilters,\n\t\t\tfilterOptions,\n\t\t\trecruiters,\n\t\t\thandleFilterListingsByLocation,\n\t\t\tfilterDialogIsOpen,\n\t\t\tsetFilterDialogIsOpen,\n\t\t\tsetMobileTab,\n\t\t\tmobileTab,\n\t\t\tsiteConfig,\n\t\t\tfavorites,\n\t\t\thandleSettingFavorites,\n\t\t\tresetEntityFilter,\n\t\t\tsetFilterByFavorites,\n\t\t\tfilterByFavorites,\n\t\t\tcommuteLocation,\n\t\t\tsetCommuteLocation,\n\t\t\tnavigateToDetails,\n\t\t\tnavigateToEasyApply,\n\t\t\tLink,\n\t\t\tlinkFormat,\n\t\t\teasyApplyUrl,\n\t\t\teasyApplyText,\n\t\t\tisIframe,\n\t\t\tsortSetting,\n\t\t\tsetSortSetting,\n\t\t\ttrackEvent,\n\t\t\tdefaultFilters,\n\t\t\thiddenFilters,\n\t\t\tcontainerStyle,\n\t\t\tExpandListComponent\n\t\t}}>\n\t\t\t{children}\n\t\t</MapList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V,8BAA8B;YAC9B,kBAAkB;YAClB,qBAAqB;YACrB,YAAY;YACZ,SAAS;YACT,UAAU;YACV,SAAS;YACT,sBAAsB;YACtB,iBAAiB;YACjB,oBAAoB;YACpB,iBAAiB;YACjB,eAAe;YACf,kBAAkB;YAClB,iBAAiB;YACjB,mBAAmB;YACnB,IAAI;YACJ,UAAU;YACV,YAAY;YACZ,aAAa;YACb,QAAQ;YACR,WAAW;YACX,cAAc;YACd,UAAU;YACV,cAAc;YACd,aAAa;YACb,cAAc;YACd,mBAAmB;SACnB,EACC,EAAA,QAAQ,CACgB,EACzB;AACH;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime, createForOfIteratorHelper as _createForOfIteratorHelper } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import React__default, { useState, useCallback, useEffect, createContext, useContext } from 'react';
|
|
3
3
|
import { markerIconProps } from '../util/mapIconUtil.js';
|
|
4
4
|
import { useMap } from './mapContext.js';
|
|
5
5
|
import { searchNearbyPlaces } from '../services/googlePlacesNearbyService.js';
|
|
@@ -135,7 +135,7 @@ var PlacesProvider = function PlacesProvider(_ref) {
|
|
|
135
135
|
}();
|
|
136
136
|
fetchPlaces();
|
|
137
137
|
}, [selectedPlaces, currentZoom, currentCenter, placeMappings, markerColors.placeMarkers, googleMapsApiKey, getRadiusForZoom, center]);
|
|
138
|
-
return /*#__PURE__*/
|
|
138
|
+
return /*#__PURE__*/React__default.createElement(PlacesContext.Provider, {
|
|
139
139
|
value: {
|
|
140
140
|
poiMarkers: poiMarkers,
|
|
141
141
|
setCurrentCenter: setCurrentCenter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placesContext.js","sources":["../../src/contexts/placesContext.js"],"sourcesContent":["import React, { createContext, useContext, useEffect, useState, useCallback } from 'react';\n\nimport { markerIconProps } from '~/util/mapIconUtil';\n\nimport { useMap } from '~/contexts/mapContext';\n\nimport { searchNearbyPlaces } from '~/services/googlePlacesNearbyService';\n\nconst PlacesContext = createContext();\n\nexport const usePlaces = () => useContext(PlacesContext);\n\nexport const PlacesProvider = ({ children, placeMappings, markerColors, additionalMapMarkers, googleMapsApiKey }) => {\n\tconst { selectedPlaces, zoom, center } = useMap();\n\tconst [poiMarkers, setPoiMarkers] = useState({ markers: [], icon: null });\n\tconst [currentCenter, setCurrentCenter] = useState(center);\n\tconst [currentZoom, setCurrentZoom] = useState(zoom);\n\tconst [placesWindow, setPlacesWindow] = useState(false);\n\tconst [selectedPlaceMarker, setSelectedPlaceMarker] = useState(null);\n\n\tconst getRadiusForZoom = useCallback(() => {\n\t\tif (currentZoom >= 18) return 1000;\n\t\tif (currentZoom <= 10) return 0;\n\n\t\tlet tempZoom = Math.pow(19 - currentZoom, 4.85);\n\t\tlet radius = tempZoom;\n\t\tlet minRadius = 1500;\n\t\tlet maxRadius = 800000;\n\n\t\tif (radius < minRadius) radius = minRadius;\n\t\telse if (radius > maxRadius) radius = maxRadius;\n\n\t\treturn radius;\n\t}, [currentZoom]);\n\n\tuseEffect(() => {\n\t\tif (!selectedPlaces || (!selectedPlaces.length > 0) || !center || currentZoom < 12) {\n\t\t\tsetPoiMarkers({ markers: [], icon: null });\n\t\t\treturn;\n\t\t}\n\t\tconst fetchPlaces = async () => {\n\t\t\tlet poiTypes = [];\n\t\t\tconst selectedPOICategories = selectedPlaces;\n\t\t\tselectedPOICategories.forEach(pointOfInterest => {\n\t\t\t\tpoiTypes = poiTypes.concat(placeMappings[pointOfInterest]);\n\t\t\t});\n\n\t\t\tconst radius = getRadiusForZoom();\n\t\t\tconst location = { latitude: currentCenter.lat, longitude: currentCenter.lng };\n\n\t\t\ttry {\n\t\t\t\tconst response = await searchNearbyPlaces(poiTypes, location, radius, googleMapsApiKey || process.env.GOOGLE_MAPS_API_KEY);\n\t\t\t\tconst newMarkers = response.places.map(place => {\n\t\t\t\t\tconst getParentCategory = types => {\n\t\t\t\t\t\tconst selectedTypes = selectedPOICategories.reduce((acc, category) => {\n\t\t\t\t\t\t\treturn acc.concat(placeMappings[category]);\n\t\t\t\t\t\t}, []);\n\n\t\t\t\t\t\tfor (const type of types) {\n\t\t\t\t\t\t\tif (!selectedTypes.includes(type)) continue;\n\t\t\t\t\t\t\tfor (const category in placeMappings) {\n\t\t\t\t\t\t\t\tif (placeMappings[category].includes(type)) {\n\t\t\t\t\t\t\t\t\treturn category;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst icon = markerIconProps(markerColors.placeMarkers, getParentCategory(place.types));\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tposition: { lat: place.location.latitude, lng: place.location.longitude },\n\t\t\t\t\t\ttitle: place.displayName.text,\n\t\t\t\t\t\ticon: icon\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t\tsetPoiMarkers({ markers: newMarkers, icon: null });\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Failed to fetch places:', error);\n\t\t\t}\n\t\t};\n\n\t\tfetchPlaces();\n\t}, [selectedPlaces, currentZoom, currentCenter, placeMappings, markerColors.placeMarkers, googleMapsApiKey, getRadiusForZoom, center]);\n\n\treturn (\n\t\t<PlacesContext.Provider value={{\n\t\t\tpoiMarkers,\n\t\t\tsetCurrentCenter,\n\t\t\tcurrentCenter,\n\t\t\tsetCurrentZoom,\n\t\t\tcurrentZoom,\n\t\t\tplacesWindow,\n\t\t\tsetPlacesWindow,\n\t\t\tselectedPlaceMarker,\n\t\t\tsetSelectedPlaceMarker,\n\t\t\tadditionalMapMarkers\n\t\t}}>\n\t\t\t{children}\n\t\t</PlacesContext.Provider>\n\t);\n};\n"],"names":["PlacesContext","createContext","usePlaces","useContext","PlacesProvider","_ref","children","placeMappings","markerColors","additionalMapMarkers","googleMapsApiKey","_useMap","useMap","selectedPlaces","zoom","center","_useState","useState","markers","icon","_useState2","_slicedToArray","poiMarkers","setPoiMarkers","_useState3","_useState4","currentCenter","setCurrentCenter","_useState5","_useState6","currentZoom","setCurrentZoom","_useState7","_useState8","placesWindow","setPlacesWindow","_useState9","_useState10","selectedPlaceMarker","setSelectedPlaceMarker","getRadiusForZoom","useCallback","tempZoom","Math","pow","radius","minRadius","maxRadius","useEffect","length","fetchPlaces","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","poiTypes","selectedPOICategories","location","response","newMarkers","wrap","_callee$","_context","prev","next","forEach","pointOfInterest","concat","latitude","lat","longitude","lng","searchNearbyPlaces","process","env","GOOGLE_MAPS_API_KEY","sent","places","map","place","getParentCategory","types","selectedTypes","reduce","acc","category","_iterator","_createForOfIteratorHelper","_step","s","n","done","type","value","includes","err","e","f","markerIconProps","placeMarkers","position","title","displayName","text","t0","console","error","stop","apply","arguments","React","createElement","Provider"],"mappings":";;;;;;AAQA,IAAMA,aAAa,gBAAGC,aAAa,EAAE,CAAA;AAExBC,IAAAA,SAAS,GAAG,SAAZA,SAASA,GAAA;EAAA,OAASC,UAAU,CAACH,aAAa,CAAC,CAAA;AAAA,EAAA;IAE3CI,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAA0F;AAAA,EAAA,IAApFC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,aAAa,GAAAF,IAAA,CAAbE,aAAa;IAAEC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IAAEC,oBAAoB,GAAAJ,IAAA,CAApBI,oBAAoB;IAAEC,gBAAgB,GAAAL,IAAA,CAAhBK,gBAAgB,CAAA;AAC7G,EAAA,IAAAC,OAAA,GAAyCC,MAAM,EAAE;IAAzCC,cAAc,GAAAF,OAAA,CAAdE,cAAc;IAAEC,IAAI,GAAAH,OAAA,CAAJG,IAAI;IAAEC,MAAM,GAAAJ,OAAA,CAANI,MAAM,CAAA;EACpC,IAAAC,SAAA,GAAoCC,QAAQ,CAAC;AA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,EAAnBA,mBAAmB;AACnBC,MAAAA,sBAAsB,EAAtBA,sBAAsB;AACtB9B,MAAAA,oBAAoB,EAApBA,oBAAAA;AACD,KAAA;AAAE,GAAA,EACAH,QACsB,CAAC,CAAA;AAE3B;;;;"}
|
|
1
|
+
{"version":3,"file":"placesContext.js","sources":["../../src/contexts/placesContext.js"],"sourcesContent":["import React, { createContext, useContext, useEffect, useState, useCallback } from 'react';\n\nimport { markerIconProps } from '~/util/mapIconUtil';\n\nimport { useMap } from '~/contexts/mapContext';\n\nimport { searchNearbyPlaces } from '~/services/googlePlacesNearbyService';\n\nconst PlacesContext = createContext();\n\nexport const usePlaces = () => useContext(PlacesContext);\n\nexport const PlacesProvider = ({ children, placeMappings, markerColors, additionalMapMarkers, googleMapsApiKey }) => {\n\tconst { selectedPlaces, zoom, center } = useMap();\n\tconst [poiMarkers, setPoiMarkers] = useState({ markers: [], icon: null });\n\tconst [currentCenter, setCurrentCenter] = useState(center);\n\tconst [currentZoom, setCurrentZoom] = useState(zoom);\n\tconst [placesWindow, setPlacesWindow] = useState(false);\n\tconst [selectedPlaceMarker, setSelectedPlaceMarker] = useState(null);\n\n\tconst getRadiusForZoom = useCallback(() => {\n\t\tif (currentZoom >= 18) return 1000;\n\t\tif (currentZoom <= 10) return 0;\n\n\t\tlet tempZoom = Math.pow(19 - currentZoom, 4.85);\n\t\tlet radius = tempZoom;\n\t\tlet minRadius = 1500;\n\t\tlet maxRadius = 800000;\n\n\t\tif (radius < minRadius) radius = minRadius;\n\t\telse if (radius > maxRadius) radius = maxRadius;\n\n\t\treturn radius;\n\t}, [currentZoom]);\n\n\tuseEffect(() => {\n\t\tif (!selectedPlaces || (!selectedPlaces.length > 0) || !center || currentZoom < 12) {\n\t\t\tsetPoiMarkers({ markers: [], icon: null });\n\t\t\treturn;\n\t\t}\n\t\tconst fetchPlaces = async () => {\n\t\t\tlet poiTypes = [];\n\t\t\tconst selectedPOICategories = selectedPlaces;\n\t\t\tselectedPOICategories.forEach(pointOfInterest => {\n\t\t\t\tpoiTypes = poiTypes.concat(placeMappings[pointOfInterest]);\n\t\t\t});\n\n\t\t\tconst radius = getRadiusForZoom();\n\t\t\tconst location = { latitude: currentCenter.lat, longitude: currentCenter.lng };\n\n\t\t\ttry {\n\t\t\t\tconst response = await searchNearbyPlaces(poiTypes, location, radius, googleMapsApiKey || process.env.GOOGLE_MAPS_API_KEY);\n\t\t\t\tconst newMarkers = response.places.map(place => {\n\t\t\t\t\tconst getParentCategory = types => {\n\t\t\t\t\t\tconst selectedTypes = selectedPOICategories.reduce((acc, category) => {\n\t\t\t\t\t\t\treturn acc.concat(placeMappings[category]);\n\t\t\t\t\t\t}, []);\n\n\t\t\t\t\t\tfor (const type of types) {\n\t\t\t\t\t\t\tif (!selectedTypes.includes(type)) continue;\n\t\t\t\t\t\t\tfor (const category in placeMappings) {\n\t\t\t\t\t\t\t\tif (placeMappings[category].includes(type)) {\n\t\t\t\t\t\t\t\t\treturn category;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst icon = markerIconProps(markerColors.placeMarkers, getParentCategory(place.types));\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tposition: { lat: place.location.latitude, lng: place.location.longitude },\n\t\t\t\t\t\ttitle: place.displayName.text,\n\t\t\t\t\t\ticon: icon\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t\tsetPoiMarkers({ markers: newMarkers, icon: null });\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Failed to fetch places:', error);\n\t\t\t}\n\t\t};\n\n\t\tfetchPlaces();\n\t}, [selectedPlaces, currentZoom, currentCenter, placeMappings, markerColors.placeMarkers, googleMapsApiKey, getRadiusForZoom, center]);\n\n\treturn (\n\t\t<PlacesContext.Provider value={{\n\t\t\tpoiMarkers,\n\t\t\tsetCurrentCenter,\n\t\t\tcurrentCenter,\n\t\t\tsetCurrentZoom,\n\t\t\tcurrentZoom,\n\t\t\tplacesWindow,\n\t\t\tsetPlacesWindow,\n\t\t\tselectedPlaceMarker,\n\t\t\tsetSelectedPlaceMarker,\n\t\t\tadditionalMapMarkers\n\t\t}}>\n\t\t\t{children}\n\t\t</PlacesContext.Provider>\n\t);\n};\n"],"names":["PlacesContext","createContext","usePlaces","useContext","PlacesProvider","_ref","children","placeMappings","markerColors","additionalMapMarkers","googleMapsApiKey","_useMap","useMap","selectedPlaces","zoom","center","_useState","useState","markers","icon","_useState2","_slicedToArray","poiMarkers","setPoiMarkers","_useState3","_useState4","currentCenter","setCurrentCenter","_useState5","_useState6","currentZoom","setCurrentZoom","_useState7","_useState8","placesWindow","setPlacesWindow","_useState9","_useState10","selectedPlaceMarker","setSelectedPlaceMarker","getRadiusForZoom","useCallback","tempZoom","Math","pow","radius","minRadius","maxRadius","useEffect","length","fetchPlaces","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","poiTypes","selectedPOICategories","location","response","newMarkers","wrap","_callee$","_context","prev","next","forEach","pointOfInterest","concat","latitude","lat","longitude","lng","searchNearbyPlaces","process","env","GOOGLE_MAPS_API_KEY","sent","places","map","place","getParentCategory","types","selectedTypes","reduce","acc","category","_iterator","_createForOfIteratorHelper","_step","s","n","done","type","value","includes","err","e","f","markerIconProps","placeMarkers","position","title","displayName","text","t0","console","error","stop","apply","arguments","React","createElement","Provider"],"mappings":";;;;;;AAQA,IAAMA,aAAa,gBAAGC,aAAa,EAAE,CAAA;AAExBC,IAAAA,SAAS,GAAG,SAAZA,SAASA,GAAA;EAAA,OAASC,UAAU,CAACH,aAAa,CAAC,CAAA;AAAA,EAAA;IAE3CI,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAA0F;AAAA,EAAA,IAApFC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,aAAa,GAAAF,IAAA,CAAbE,aAAa;IAAEC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IAAEC,oBAAoB,GAAAJ,IAAA,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AACnB,IAAAA,KAAK,EAAE;AAC9BxE,MAAAA,UAAU,EAAVA,UAAU;AACVK,MAAAA,gBAAgB,EAAhBA,gBAAgB;AAChBD,MAAAA,aAAa,EAAbA,aAAa;AACbK,MAAAA,cAAc,EAAdA,cAAc;AACdD,MAAAA,WAAW,EAAXA,WAAW;AACXI,MAAAA,YAAY,EAAZA,YAAY;AACZC,MAAAA,eAAe,EAAfA,eAAe;AACfG,MAAAA,mBAAmB,EAAnBA,mBAAmB;AACnBC,MAAAA,sBAAsB,EAAtBA,sBAAsB;AACtB9B,MAAAA,oBAAoB,EAApBA,oBAAAA;AACD,KAAA;AAAE,GAAA,EACAH,QACsB,CAAC,CAAA;AAE3B;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { useEffect, createContext } from 'react';
|
|
2
2
|
|
|
3
3
|
var ThemeContext = /*#__PURE__*/createContext();
|
|
4
4
|
var ThemeProvider = function ThemeProvider(_ref) {
|
|
@@ -17,7 +17,7 @@ var ThemeProvider = function ThemeProvider(_ref) {
|
|
|
17
17
|
document.documentElement.style.setProperty('--secondary', secondary);
|
|
18
18
|
document.documentElement.style.setProperty('--secondary-dark', secondaryDark);
|
|
19
19
|
}, [uiText, uiAccent, primary, primaryDark, secondary, secondaryDark]);
|
|
20
|
-
return /*#__PURE__*/
|
|
20
|
+
return /*#__PURE__*/React__default.createElement(ThemeContext.Provider, {
|
|
21
21
|
value: {
|
|
22
22
|
uiText: uiText,
|
|
23
23
|
uiAccent: uiAccent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeContext.js","sources":["../../src/contexts/themeContext.js"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { createContext, useContext } from 'react';\n\nconst ThemeContext = createContext();\n\nexport const ThemeProvider = ({\n\tchildren,\n\tuiText,\n\tuiAccent,\n\tprimary,\n\tprimaryDark,\n\tsecondary,\n\tsecondaryDark\n}) => {\n\tuseEffect(() => {\n\t\tdocument.documentElement.style.setProperty('--ui-text', uiText);\n\t\tdocument.documentElement.style.setProperty('--ui-accent', uiAccent);\n\t\tdocument.documentElement.style.setProperty('--primary', primary);\n\t\tdocument.documentElement.style.setProperty('--primary-dark', primaryDark);\n\t\tdocument.documentElement.style.setProperty('--secondary', secondary);\n\t\tdocument.documentElement.style.setProperty('--secondary-dark', secondaryDark);\n\t}, [uiText, uiAccent, primary, primaryDark, secondary, secondaryDark]);\n\n\treturn (\n\t\t<ThemeContext.Provider\n\t\t\tvalue={{\n\t\t\t\tuiText,\n\t\t\t\tuiAccent,\n\t\t\t\tprimary,\n\t\t\t\tprimaryDark,\n\t\t\t\tsecondary,\n\t\t\t\tsecondaryDark\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</ThemeContext.Provider>\n\t);\n};\n\nexport const useTheme = () => useContext(ThemeContext);\n"],"names":["ThemeContext","createContext","ThemeProvider","_ref","children","uiText","uiAccent","primary","primaryDark","secondary","secondaryDark","useEffect","document","documentElement","style","setProperty","React","createElement","Provider","value"],"mappings":";;AAGA,IAAMA,YAAY,gBAAGC,aAAa,EAAE,CAAA;IAEvBC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAQpB;AAAA,EAAA,IAPLC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IACPC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IACXC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,aAAa,GAAAP,IAAA,CAAbO,aAAa,CAAA;AAEbC,EAAAA,SAAS,CAAC,YAAM;IACfC,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,WAAW,EAAEV,MAAM,CAAC,CAAA;IAC/DO,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,aAAa,EAAET,QAAQ,CAAC,CAAA;IACnEM,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,WAAW,EAAER,OAAO,CAAC,CAAA;IAChEK,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,gBAAgB,EAAEP,WAAW,CAAC,CAAA;IACzEI,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,aAAa,EAAEN,SAAS,CAAC,CAAA;IACpEG,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,kBAAkB,EAAEL,aAAa,CAAC,CAAA;AAC9E,GAAC,EAAE,CAACL,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,EAAEC,aAAa,CAAC,CAAC,CAAA;AAEtE,EAAA,oBACCM,
|
|
1
|
+
{"version":3,"file":"themeContext.js","sources":["../../src/contexts/themeContext.js"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { createContext, useContext } from 'react';\n\nconst ThemeContext = createContext();\n\nexport const ThemeProvider = ({\n\tchildren,\n\tuiText,\n\tuiAccent,\n\tprimary,\n\tprimaryDark,\n\tsecondary,\n\tsecondaryDark\n}) => {\n\tuseEffect(() => {\n\t\tdocument.documentElement.style.setProperty('--ui-text', uiText);\n\t\tdocument.documentElement.style.setProperty('--ui-accent', uiAccent);\n\t\tdocument.documentElement.style.setProperty('--primary', primary);\n\t\tdocument.documentElement.style.setProperty('--primary-dark', primaryDark);\n\t\tdocument.documentElement.style.setProperty('--secondary', secondary);\n\t\tdocument.documentElement.style.setProperty('--secondary-dark', secondaryDark);\n\t}, [uiText, uiAccent, primary, primaryDark, secondary, secondaryDark]);\n\n\treturn (\n\t\t<ThemeContext.Provider\n\t\t\tvalue={{\n\t\t\t\tuiText,\n\t\t\t\tuiAccent,\n\t\t\t\tprimary,\n\t\t\t\tprimaryDark,\n\t\t\t\tsecondary,\n\t\t\t\tsecondaryDark\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</ThemeContext.Provider>\n\t);\n};\n\nexport const useTheme = () => useContext(ThemeContext);\n"],"names":["ThemeContext","createContext","ThemeProvider","_ref","children","uiText","uiAccent","primary","primaryDark","secondary","secondaryDark","useEffect","document","documentElement","style","setProperty","React","createElement","Provider","value"],"mappings":";;AAGA,IAAMA,YAAY,gBAAGC,aAAa,EAAE,CAAA;IAEvBC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAQpB;AAAA,EAAA,IAPLC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IACPC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IACXC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,aAAa,GAAAP,IAAA,CAAbO,aAAa,CAAA;AAEbC,EAAAA,SAAS,CAAC,YAAM;IACfC,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,WAAW,EAAEV,MAAM,CAAC,CAAA;IAC/DO,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,aAAa,EAAET,QAAQ,CAAC,CAAA;IACnEM,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,WAAW,EAAER,OAAO,CAAC,CAAA;IAChEK,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,gBAAgB,EAAEP,WAAW,CAAC,CAAA;IACzEI,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,aAAa,EAAEN,SAAS,CAAC,CAAA;IACpEG,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAAC,kBAAkB,EAAEL,aAAa,CAAC,CAAA;AAC9E,GAAC,EAAE,CAACL,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,EAAEC,aAAa,CAAC,CAAC,CAAA;AAEtE,EAAA,oBACCM,cAAA,CAAAC,aAAA,CAACjB,YAAY,CAACkB,QAAQ,EAAA;AACrBC,IAAAA,KAAK,EAAE;AACNd,MAAAA,MAAM,EAANA,MAAM;AACNC,MAAAA,QAAQ,EAARA,QAAQ;AACRC,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,WAAW,EAAXA,WAAW;AACXC,MAAAA,SAAS,EAATA,SAAS;AACTC,MAAAA,aAAa,EAAbA,aAAAA;AACD,KAAA;AAAE,GAAA,EAEDN,QACqB,CAAC,CAAA;AAE1B;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { useContext, createContext } from 'react';
|
|
2
2
|
import { eventTypes } from '../constants/eventTypes.js';
|
|
3
3
|
|
|
4
4
|
var TrackEventContext = /*#__PURE__*/createContext();
|
|
@@ -8,7 +8,7 @@ var useTrackEvent = function useTrackEvent() {
|
|
|
8
8
|
var TrackEventProvider = function TrackEventProvider(_ref) {
|
|
9
9
|
var children = _ref.children,
|
|
10
10
|
trackEvent = _ref.trackEvent;
|
|
11
|
-
return /*#__PURE__*/
|
|
11
|
+
return /*#__PURE__*/React__default.createElement(TrackEventContext.Provider, {
|
|
12
12
|
value: {
|
|
13
13
|
trackEvent: trackEvent,
|
|
14
14
|
eventTypes: eventTypes
|