@abcagency/hc-ui-components 1.3.13 → 1.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/apis/hcApi.js +1 -1
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/clientToken.js.map +1 -1
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/accordions/default.js.map +1 -1
- package/dist/components/modules/accordions/filterItem.js +2 -1
- package/dist/components/modules/accordions/filterItem.js.map +1 -1
- package/dist/components/modules/accordions/filters.js +0 -3
- package/dist/components/modules/accordions/filters.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/components/modules/buttons/commute-pill.js.map +1 -1
- package/dist/components/modules/buttons/default.js.map +1 -1
- package/dist/components/modules/buttons/items-pill.js.map +1 -1
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
- package/dist/components/modules/buttons/show-all-button.js.map +1 -1
- package/dist/components/modules/cards/default.js.map +1 -1
- package/dist/components/modules/cards/filter.js.map +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
- package/dist/components/modules/filter/commute.js.map +1 -1
- package/dist/components/modules/filter/item.js +6 -1
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/location.js +5 -3
- package/dist/components/modules/filter/location.js.map +1 -1
- package/dist/components/modules/filter/points-of-interest.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js.map +1 -1
- package/dist/components/modules/filter/search.js.map +1 -1
- package/dist/components/modules/filter/sort.js.map +1 -1
- package/dist/components/modules/grid.js.map +1 -1
- package/dist/components/modules/icon.js.map +1 -1
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/components/modules/maps/list/field-mapper.js.map +1 -1
- package/dist/components/modules/maps/list/header-item.js.map +1 -1
- package/dist/components/modules/maps/list/header.js.map +1 -1
- package/dist/components/modules/maps/list/index.js +11 -10
- package/dist/components/modules/maps/list/index.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/index.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +1 -1
- package/dist/components/modules/maps/list/list-item/index.js.map +1 -1
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/components/modules/maps/map-marker.js.map +1 -1
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/components/modules/maps/place-marker.js.map +1 -1
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/constants/placeTypes.js.map +1 -1
- package/dist/contexts/mapContext.js +9 -27
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +54 -37
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/hooks/useList.js +3 -15
- package/dist/hooks/useList.js.map +1 -1
- package/dist/services/apis/hcApi.js +1 -1
- package/dist/services/apis/hcApi.js.map +1 -1
- package/dist/services/clientToken.js.map +1 -1
- package/dist/services/configService.js.map +1 -1
- package/dist/services/googlePlacesNearbyService.js.map +1 -1
- package/dist/services/listingAggregatorService.js +43 -16
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js.map +1 -1
- package/dist/services/recruiterService.js.map +1 -1
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/loading.js.map +1 -1
- package/dist/util/localStorageUtil.js.map +1 -1
- package/dist/util/mapIconUtil.js.map +1 -1
- package/dist/util/mapUtil.js.map +1 -1
- package/dist/util/sortUtil.js.map +1 -1
- package/dist/util/stringUtils.js.map +1 -1
- package/jsconfig.json +7 -7
- package/package.json +7 -7
- package/postcss.config.js +13 -13
- package/preset.default.js +15 -15
- package/rollup.config.mjs +88 -87
- package/src/apis/hcApi.js +93 -93
- package/src/clientToken.js +9 -9
- package/src/components/HireControlMap.js +124 -124
- package/src/components/modules/accordions/MapAccordionItem.js +72 -72
- package/src/components/modules/accordions/default.js +171 -171
- package/src/components/modules/accordions/filterItem.js +3 -1
- package/src/components/modules/accordions/filters.js +1 -1
- package/src/components/modules/buttons/button-group-apply.js +116 -116
- package/src/components/modules/buttons/commute-pill.js +22 -22
- package/src/components/modules/buttons/default.js +194 -194
- package/src/components/modules/buttons/items-pill.js +35 -35
- package/src/components/modules/buttons/pill-wrapper.js +27 -27
- package/src/components/modules/buttons/show-all-button.js +20 -20
- package/src/components/modules/cards/default.js +167 -167
- package/src/components/modules/cards/filter.js +56 -56
- package/src/components/modules/dialogs/apply-dialog.js +48 -48
- package/src/components/modules/filter/commute.js +149 -149
- package/src/components/modules/filter/item.js +5 -0
- package/src/components/modules/filter/location.js +5 -3
- package/src/components/modules/filter/points-of-interest.js +44 -44
- package/src/components/modules/filter/radio-item.js +53 -53
- package/src/components/modules/filter/search.js +92 -92
- package/src/components/modules/filter/sort.js +83 -83
- package/src/components/modules/grid.js +54 -54
- package/src/components/modules/icon.js +33 -33
- package/src/components/modules/jobListing/listing-details.js +95 -95
- package/src/components/modules/maps/info-window-card.js +17 -17
- package/src/components/modules/maps/info-window-content.js +74 -74
- package/src/components/modules/maps/list/field-mapper.js +112 -112
- package/src/components/modules/maps/list/header-item.js +91 -91
- package/src/components/modules/maps/list/header.js +47 -47
- package/src/components/modules/maps/list/index.js +7 -7
- package/src/components/modules/maps/list/item-expand-card/index.js +22 -22
- package/src/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +50 -50
- package/src/components/modules/maps/list/item-expand-card/recruiter-details.js +68 -68
- package/src/components/modules/maps/list/item-expand-card/recruiter-headshot.js +22 -22
- package/src/components/modules/maps/list/list-item/index.js +133 -133
- package/src/components/modules/maps/map-list.js +74 -74
- package/src/components/modules/maps/map-marker.js +86 -86
- package/src/components/modules/maps/map.js +230 -230
- package/src/components/modules/maps/place-marker.js +41 -41
- package/src/components/modules/maps/tabs.js +81 -81
- package/src/constants/placeTypes.js +8 -8
- package/src/contexts/mapContext.js +0 -14
- package/src/contexts/mapListContext.js +26 -8
- package/src/contexts/placesContext.js +102 -102
- package/src/hooks/useList.js +4 -16
- package/src/index.js +3 -3
- package/src/services/configService.js +16 -16
- package/src/services/googlePlacesNearbyService.js +33 -33
- package/src/services/listingAggregatorService.js +9 -4
- package/src/services/listingEntityService.js +15 -15
- package/src/services/listingService.js +26 -26
- package/src/services/recruiterService.js +17 -17
- package/src/styles/index.css +23 -23
- package/src/util/arrayUtil.js +3 -3
- package/src/util/fieldMapper.js +22 -22
- package/src/util/filterUtil.js +195 -195
- package/src/util/loading.js +17 -17
- package/src/util/localStorageUtil.js +26 -26
- package/src/util/mapIconUtil.js +180 -180
- package/src/util/mapUtil.js +91 -91
- package/src/util/sortUtil.js +32 -32
- package/src/util/stringUtils.js +6 -6
- package/tailwind.config.js +126 -126
- package/.editorconfig +0 -12
- package/.eslintrc +0 -105
- package/.prettierignore +0 -3
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import * as Tabs from '@radix-ui/react-tabs';
|
|
3
|
-
|
|
4
|
-
import Button from '~/components/modules/buttons/default';
|
|
5
|
-
|
|
6
|
-
import { useMapList } from '~/contexts/mapListContext';
|
|
7
|
-
|
|
8
|
-
const MapTabs = ({
|
|
9
|
-
map,
|
|
10
|
-
list,
|
|
11
|
-
filter,
|
|
12
|
-
className,
|
|
13
|
-
showMap
|
|
14
|
-
}) => {
|
|
15
|
-
const tabButtonClasses =
|
|
16
|
-
"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";
|
|
17
|
-
const { mobileTab, setMobileTab } = useMapList();
|
|
18
|
-
return (
|
|
19
|
-
<div
|
|
20
|
-
className={`
|
|
21
|
-
hc-relative hc-overflow-hidden
|
|
22
|
-
${className ?? ""}
|
|
23
|
-
`}
|
|
24
|
-
>
|
|
25
|
-
<Tabs.Root
|
|
26
|
-
className="hc-flex hc-flex-col hc-h-screen hc-min-h-screen"
|
|
27
|
-
//defaultValue="listTab"
|
|
28
|
-
value={mobileTab}
|
|
29
|
-
>
|
|
30
|
-
<Tabs.List
|
|
31
|
-
className="hc-w-full hc-shrink-0 hc-flex hc-divide-x hc-divide-primary"
|
|
32
|
-
aria-label="Review positions"
|
|
33
|
-
>
|
|
34
|
-
<Tabs.Trigger value="listTab" asChild onClick={() => setMobileTab("listTab")}>
|
|
35
|
-
<Button.Btn variant="outline" isBlock className={tabButtonClasses}>
|
|
36
|
-
<Button.Body className="hc-justify-center">
|
|
37
|
-
<Button.Icon icon="mdi:view-list" size="hc-size-5" />
|
|
38
|
-
List
|
|
39
|
-
</Button.Body>
|
|
40
|
-
</Button.Btn>
|
|
41
|
-
</Tabs.Trigger>
|
|
42
|
-
{showMap && (
|
|
43
|
-
<Tabs.Trigger value="mapTab" asChild onClick={() => setMobileTab("mapTab")}>
|
|
44
|
-
<Button.Btn
|
|
45
|
-
variant="outline"
|
|
46
|
-
isBlock
|
|
47
|
-
className={tabButtonClasses}
|
|
48
|
-
>
|
|
49
|
-
<Button.Body className="hc-justify-center">
|
|
50
|
-
<Button.Icon icon="mdi:map" size="hc-size-5" />
|
|
51
|
-
Map
|
|
52
|
-
</Button.Body>
|
|
53
|
-
</Button.Btn>
|
|
54
|
-
</Tabs.Trigger>
|
|
55
|
-
)}
|
|
56
|
-
<Tabs.Trigger value="filterTab" asChild onClick={() => setMobileTab("filterTab")}>
|
|
57
|
-
<Button.Btn variant="outline" isBlock className={tabButtonClasses}>
|
|
58
|
-
<Button.Body className="hc-justify-center">
|
|
59
|
-
<Button.Icon icon="fluent:search-12-filled" size="hc-size-5" />
|
|
60
|
-
Filter
|
|
61
|
-
</Button.Body>
|
|
62
|
-
</Button.Btn>
|
|
63
|
-
</Tabs.Trigger>
|
|
64
|
-
</Tabs.List>
|
|
65
|
-
<Tabs.Content className="hc-grow hc-bg-white hc-outline-none" value="listTab">
|
|
66
|
-
{list}
|
|
67
|
-
</Tabs.Content>
|
|
68
|
-
{showMap && (
|
|
69
|
-
<Tabs.Content className="hc-grow hc-bg-white hc-outline-none" value="mapTab">
|
|
70
|
-
{map}
|
|
71
|
-
</Tabs.Content>
|
|
72
|
-
)}
|
|
73
|
-
<Tabs.Content className="hc-grow hc-bg-white hc-outline-none hc-p-2" value="filterTab">
|
|
74
|
-
{filter}
|
|
75
|
-
</Tabs.Content>
|
|
76
|
-
</Tabs.Root>
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default MapTabs;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Tabs from '@radix-ui/react-tabs';
|
|
3
|
+
|
|
4
|
+
import Button from '~/components/modules/buttons/default';
|
|
5
|
+
|
|
6
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
7
|
+
|
|
8
|
+
const MapTabs = ({
|
|
9
|
+
map,
|
|
10
|
+
list,
|
|
11
|
+
filter,
|
|
12
|
+
className,
|
|
13
|
+
showMap
|
|
14
|
+
}) => {
|
|
15
|
+
const tabButtonClasses =
|
|
16
|
+
"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";
|
|
17
|
+
const { mobileTab, setMobileTab } = useMapList();
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
className={`
|
|
21
|
+
hc-relative hc-overflow-hidden
|
|
22
|
+
${className ?? ""}
|
|
23
|
+
`}
|
|
24
|
+
>
|
|
25
|
+
<Tabs.Root
|
|
26
|
+
className="hc-flex hc-flex-col hc-h-screen hc-min-h-screen"
|
|
27
|
+
//defaultValue="listTab"
|
|
28
|
+
value={mobileTab}
|
|
29
|
+
>
|
|
30
|
+
<Tabs.List
|
|
31
|
+
className="hc-w-full hc-shrink-0 hc-flex hc-divide-x hc-divide-primary"
|
|
32
|
+
aria-label="Review positions"
|
|
33
|
+
>
|
|
34
|
+
<Tabs.Trigger value="listTab" asChild onClick={() => setMobileTab("listTab")}>
|
|
35
|
+
<Button.Btn variant="outline" isBlock className={tabButtonClasses}>
|
|
36
|
+
<Button.Body className="hc-justify-center">
|
|
37
|
+
<Button.Icon icon="mdi:view-list" size="hc-size-5" />
|
|
38
|
+
List
|
|
39
|
+
</Button.Body>
|
|
40
|
+
</Button.Btn>
|
|
41
|
+
</Tabs.Trigger>
|
|
42
|
+
{showMap && (
|
|
43
|
+
<Tabs.Trigger value="mapTab" asChild onClick={() => setMobileTab("mapTab")}>
|
|
44
|
+
<Button.Btn
|
|
45
|
+
variant="outline"
|
|
46
|
+
isBlock
|
|
47
|
+
className={tabButtonClasses}
|
|
48
|
+
>
|
|
49
|
+
<Button.Body className="hc-justify-center">
|
|
50
|
+
<Button.Icon icon="mdi:map" size="hc-size-5" />
|
|
51
|
+
Map
|
|
52
|
+
</Button.Body>
|
|
53
|
+
</Button.Btn>
|
|
54
|
+
</Tabs.Trigger>
|
|
55
|
+
)}
|
|
56
|
+
<Tabs.Trigger value="filterTab" asChild onClick={() => setMobileTab("filterTab")}>
|
|
57
|
+
<Button.Btn variant="outline" isBlock className={tabButtonClasses}>
|
|
58
|
+
<Button.Body className="hc-justify-center">
|
|
59
|
+
<Button.Icon icon="fluent:search-12-filled" size="hc-size-5" />
|
|
60
|
+
Filter
|
|
61
|
+
</Button.Body>
|
|
62
|
+
</Button.Btn>
|
|
63
|
+
</Tabs.Trigger>
|
|
64
|
+
</Tabs.List>
|
|
65
|
+
<Tabs.Content className="hc-grow hc-bg-white hc-outline-none" value="listTab">
|
|
66
|
+
{list}
|
|
67
|
+
</Tabs.Content>
|
|
68
|
+
{showMap && (
|
|
69
|
+
<Tabs.Content className="hc-grow hc-bg-white hc-outline-none" value="mapTab">
|
|
70
|
+
{map}
|
|
71
|
+
</Tabs.Content>
|
|
72
|
+
)}
|
|
73
|
+
<Tabs.Content className="hc-grow hc-bg-white hc-outline-none hc-p-2" value="filterTab">
|
|
74
|
+
{filter}
|
|
75
|
+
</Tabs.Content>
|
|
76
|
+
</Tabs.Root>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default MapTabs;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const placeTypes = {
|
|
2
|
-
FOOD: "food",
|
|
3
|
-
STORE: "shopping",
|
|
4
|
-
TOURIST_ATTRACTION: "attractions",
|
|
5
|
-
TRANSIT_STATION: "transit",
|
|
6
|
-
SCHOOL: "schools",
|
|
7
|
-
PLACE_OF_WORSHIP: "worship"
|
|
8
|
-
};
|
|
1
|
+
export const placeTypes = {
|
|
2
|
+
FOOD: "food",
|
|
3
|
+
STORE: "shopping",
|
|
4
|
+
TOURIST_ATTRACTION: "attractions",
|
|
5
|
+
TRANSIT_STATION: "transit",
|
|
6
|
+
SCHOOL: "schools",
|
|
7
|
+
PLACE_OF_WORSHIP: "worship"
|
|
8
|
+
};
|
|
@@ -16,20 +16,11 @@ export const MapProvider = ({ children, resetFilters }) => {
|
|
|
16
16
|
const [location, setLocation] = useState(getStorageObject('location'));
|
|
17
17
|
const [center, setCenter] = useState(getStorageObject("center", { lat: 39.8283, lng: -98.5795 }));
|
|
18
18
|
const [zoom, setZoom] = useState(getStorageObject("zoom", 10));
|
|
19
|
-
const [commuteLocation, setCommuteLocation] = useState(getStorageObject('commuteLocation'));
|
|
20
19
|
const [selectedPlaces, setSelectedPlaces] = useState([]);
|
|
21
20
|
const [mapInteracted, setMapInteracted] = useState(false);
|
|
22
21
|
const [firstLoadListItem] = useState(getStorageObject('selectedListItem') ?? { id: "defaultId" });
|
|
23
|
-
const [travelTime, setTravelTime] = useState(null);
|
|
24
22
|
const userSetZoom = useRef(true);
|
|
25
23
|
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
setStorageObject("commuteLocation", commuteLocation);
|
|
28
|
-
if (!commuteLocation) {
|
|
29
|
-
setTravelTime(null);
|
|
30
|
-
}
|
|
31
|
-
}, [commuteLocation]);
|
|
32
|
-
|
|
33
24
|
useEffect(() => {
|
|
34
25
|
setStorageObject("selectedListItem", selectedListItem);
|
|
35
26
|
}, [selectedListItem]);
|
|
@@ -63,7 +54,6 @@ export const MapProvider = ({ children, resetFilters }) => {
|
|
|
63
54
|
setZoom(zoom);
|
|
64
55
|
|
|
65
56
|
}
|
|
66
|
-
|
|
67
57
|
};
|
|
68
58
|
|
|
69
59
|
const filterReset = () => {
|
|
@@ -94,8 +84,6 @@ export const MapProvider = ({ children, resetFilters }) => {
|
|
|
94
84
|
zoom,
|
|
95
85
|
setZoom,
|
|
96
86
|
selectItem,
|
|
97
|
-
commuteLocation,
|
|
98
|
-
setCommuteLocation,
|
|
99
87
|
setSelectedPlaces,
|
|
100
88
|
selectedPlaces,
|
|
101
89
|
selectLocationEntity,
|
|
@@ -104,8 +92,6 @@ export const MapProvider = ({ children, resetFilters }) => {
|
|
|
104
92
|
mapInteracted,
|
|
105
93
|
userSetZoom,
|
|
106
94
|
firstLoadListItem,
|
|
107
|
-
travelTime,
|
|
108
|
-
setTravelTime,
|
|
109
95
|
filterReset
|
|
110
96
|
}}
|
|
111
97
|
>
|
|
@@ -37,9 +37,10 @@ export const MapListProvider = ({
|
|
|
37
37
|
const [loading, setLoading] = useState(false);
|
|
38
38
|
const [mapItems, setMapItems] = useState(getStorageObject('mapItems', []));
|
|
39
39
|
const [query, setQuery] = useState(() => resetFilters ? null : getQuery());
|
|
40
|
+
const [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', null));
|
|
40
41
|
const [listingEntities, setListingEntities] = useState(getStorageObject("listingEntities", null));
|
|
41
42
|
const [firstLoad, setFirstLoad] = useState(true);
|
|
42
|
-
const [commuteLocation, setCommuteLocation] = useState(
|
|
43
|
+
const [commuteLocation, setCommuteLocation] = useState(getStorageObject('commuteLocation'));
|
|
43
44
|
const [selectedFilters, setSelectedFilters] = useState(() => resetFilters ? {} : getStorageObject('selectedFilters', {}));//hasFiltersInURL(location) ? filtersFromURL(location).filters : getStorageObject('selectedFilters', {}));
|
|
44
45
|
const [filterOptions, setFilterOptions] = useState();
|
|
45
46
|
const [recruiters, setRecruiters] = useState(getStorageObject("recruiters", {}));
|
|
@@ -48,11 +49,25 @@ export const MapListProvider = ({
|
|
|
48
49
|
const [favorites, setFavorites] = useState([]);
|
|
49
50
|
const [filterByFavorites, setFilterByFavorites] = useState(false);
|
|
50
51
|
|
|
52
|
+
const setNewFilteredListings = filteredListings =>{
|
|
53
|
+
setFilteredListings(filteredListings);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!sortSetting) return;
|
|
58
|
+
localStorage.setItem('sortSetting', JSON.stringify(sortSetting));
|
|
59
|
+
setNewFilteredListings(filteredListings);
|
|
60
|
+
}, [sortSetting]);
|
|
61
|
+
|
|
51
62
|
useEffect(() => {
|
|
52
63
|
const loadedFavorites = JSON.parse(localStorage.getItem('favorites')) || [];
|
|
53
64
|
setFavorites(loadedFavorites);
|
|
54
65
|
}, []);
|
|
55
66
|
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
setStorageObject("commuteLocation", commuteLocation);
|
|
69
|
+
}, [commuteLocation]);
|
|
70
|
+
|
|
56
71
|
useEffect(() => {
|
|
57
72
|
if (commuteLocation === null || commuteLocation === '') return;
|
|
58
73
|
async function fetchEntities() {
|
|
@@ -77,7 +92,7 @@ export const MapListProvider = ({
|
|
|
77
92
|
newFilteredListings[j].fields.travelTime = fetchedEntities[newFilteredListings[j].entityId].travelTime;
|
|
78
93
|
}
|
|
79
94
|
}
|
|
80
|
-
|
|
95
|
+
setNewFilteredListings(newFilteredListings);
|
|
81
96
|
} catch (error) {
|
|
82
97
|
console.error("Failed to fetch listing entities:", error);
|
|
83
98
|
}
|
|
@@ -98,7 +113,7 @@ export const MapListProvider = ({
|
|
|
98
113
|
fetchedRecruiters,
|
|
99
114
|
fetchedEntities,
|
|
100
115
|
distinctItems
|
|
101
|
-
} = await fetchListings(query, siteConfig);
|
|
116
|
+
} = await fetchListings(query, siteConfig, commuteLocation);
|
|
102
117
|
setAllListings(listingsResult);
|
|
103
118
|
setRecruiters(fetchedRecruiters);
|
|
104
119
|
setListingEntities(fetchedEntities);
|
|
@@ -128,7 +143,7 @@ export const MapListProvider = ({
|
|
|
128
143
|
if (filterByFavorites) {
|
|
129
144
|
filteredListings = filteredListings.filter(x => favorites.includes(x.id));
|
|
130
145
|
}
|
|
131
|
-
|
|
146
|
+
setNewFilteredListings(filteredListings);
|
|
132
147
|
// if (firstLoad && hasFiltersInURL(location)) {
|
|
133
148
|
// const { filters } = filtersFromURL(location);
|
|
134
149
|
// setSelectedFilters(filters);
|
|
@@ -167,12 +182,13 @@ export const MapListProvider = ({
|
|
|
167
182
|
}, [selectedFilters, query, listingEntities, filterByFavorites, favorites]);
|
|
168
183
|
|
|
169
184
|
const handleFilterListingsByLocation = selectedLocation => {
|
|
170
|
-
|
|
185
|
+
let { filteredListings } = filterListingsByLocation(
|
|
171
186
|
allListings,
|
|
172
187
|
selectedLocation,
|
|
173
188
|
listingEntities
|
|
174
189
|
);
|
|
175
|
-
|
|
190
|
+
|
|
191
|
+
setNewFilteredListings(filteredListings);
|
|
176
192
|
//setMapItems(mapItems);
|
|
177
193
|
};
|
|
178
194
|
|
|
@@ -192,7 +208,7 @@ export const MapListProvider = ({
|
|
|
192
208
|
filteredListings,
|
|
193
209
|
mapItems,
|
|
194
210
|
query,
|
|
195
|
-
|
|
211
|
+
setNewFilteredListings,
|
|
196
212
|
setQuery,
|
|
197
213
|
listingEntities,
|
|
198
214
|
selectedFilters,
|
|
@@ -214,7 +230,9 @@ export const MapListProvider = ({
|
|
|
214
230
|
navigateToDetails,
|
|
215
231
|
navigateToEasyApply,
|
|
216
232
|
Link,
|
|
217
|
-
linkFormat
|
|
233
|
+
linkFormat,
|
|
234
|
+
sortSetting,
|
|
235
|
+
setSortSetting
|
|
218
236
|
}}>
|
|
219
237
|
{children}
|
|
220
238
|
</MapListContext.Provider>
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { markerIconProps } from '~/util/mapIconUtil';
|
|
4
|
-
|
|
5
|
-
import { useMap } from '~/contexts/mapContext';
|
|
6
|
-
|
|
7
|
-
import { searchNearbyPlaces } from '~/services/googlePlacesNearbyService';
|
|
8
|
-
|
|
9
|
-
const PlacesContext = createContext();
|
|
10
|
-
|
|
11
|
-
export const usePlaces = () => useContext(PlacesContext);
|
|
12
|
-
|
|
13
|
-
export const PlacesProvider = ({ children, placeMappings, markerColors }) => {
|
|
14
|
-
const { selectedPlaces, zoom, center } = useMap();
|
|
15
|
-
const [poiMarkers, setPoiMarkers] = useState({ markers: [], icon: null });
|
|
16
|
-
const [currentCenter, setCurrentCenter] = useState(center);
|
|
17
|
-
const [currentZoom, setCurrentZoom] = useState(zoom);
|
|
18
|
-
const [placesWindow, setPlacesWindow] = useState(false);
|
|
19
|
-
const [selectedPlaceMarker, setSelectedPlaceMarker] = useState(null);
|
|
20
|
-
|
|
21
|
-
const getRadiusForZoom = () => {
|
|
22
|
-
if (currentZoom >= 18) return 1000;
|
|
23
|
-
if (currentZoom <= 10) return 0;
|
|
24
|
-
|
|
25
|
-
let tempZoom = Math.pow(19 - currentZoom, 4.85);
|
|
26
|
-
let radius = tempZoom;
|
|
27
|
-
let minRadius = 1500;
|
|
28
|
-
let maxRadius = 800000;
|
|
29
|
-
|
|
30
|
-
if (radius < minRadius) radius = minRadius;
|
|
31
|
-
else if (radius > maxRadius) radius = maxRadius;
|
|
32
|
-
|
|
33
|
-
return radius;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (!selectedPlaces || (!selectedPlaces.length > 0) || !center || currentZoom < 12) {
|
|
38
|
-
setPoiMarkers({ markers: [], icon: null });
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const fetchPlaces = async () => {
|
|
42
|
-
let poiTypes = [];
|
|
43
|
-
const selectedPOICategories = selectedPlaces;
|
|
44
|
-
selectedPOICategories.forEach(pointOfInterest => {
|
|
45
|
-
poiTypes = poiTypes.concat(placeMappings[pointOfInterest]);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const radius = getRadiusForZoom();
|
|
49
|
-
const location = { latitude: currentCenter.lat, longitude: currentCenter.lng };
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
const response = await searchNearbyPlaces(poiTypes, location, radius);
|
|
53
|
-
const newMarkers = response.places.map(place => {
|
|
54
|
-
const getParentCategory = types => {
|
|
55
|
-
const selectedTypes = selectedPOICategories.reduce((acc, category) => {
|
|
56
|
-
return acc.concat(placeMappings[category]);
|
|
57
|
-
}, []);
|
|
58
|
-
|
|
59
|
-
for (const type of types) {
|
|
60
|
-
if (!selectedTypes.includes(type)) continue;
|
|
61
|
-
for (const category in placeMappings) {
|
|
62
|
-
if (placeMappings[category].includes(type)) {
|
|
63
|
-
return category;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const icon = markerIconProps(markerColors.placeMarkers, getParentCategory(place.types));
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
position: { lat: place.location.latitude, lng: place.location.longitude },
|
|
74
|
-
title: place.displayName.text,
|
|
75
|
-
icon: icon
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
setPoiMarkers({ markers: newMarkers, icon: null });
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error('Failed to fetch places:', error);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
fetchPlaces();
|
|
85
|
-
}, [selectedPlaces, currentZoom, currentCenter]);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<PlacesContext.Provider value={{
|
|
89
|
-
poiMarkers,
|
|
90
|
-
setCurrentCenter,
|
|
91
|
-
currentCenter,
|
|
92
|
-
setCurrentZoom,
|
|
93
|
-
currentZoom,
|
|
94
|
-
placesWindow,
|
|
95
|
-
setPlacesWindow,
|
|
96
|
-
selectedPlaceMarker,
|
|
97
|
-
setSelectedPlaceMarker
|
|
98
|
-
}}>
|
|
99
|
-
{children}
|
|
100
|
-
</PlacesContext.Provider>
|
|
101
|
-
);
|
|
102
|
-
};
|
|
1
|
+
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { markerIconProps } from '~/util/mapIconUtil';
|
|
4
|
+
|
|
5
|
+
import { useMap } from '~/contexts/mapContext';
|
|
6
|
+
|
|
7
|
+
import { searchNearbyPlaces } from '~/services/googlePlacesNearbyService';
|
|
8
|
+
|
|
9
|
+
const PlacesContext = createContext();
|
|
10
|
+
|
|
11
|
+
export const usePlaces = () => useContext(PlacesContext);
|
|
12
|
+
|
|
13
|
+
export const PlacesProvider = ({ children, placeMappings, markerColors }) => {
|
|
14
|
+
const { selectedPlaces, zoom, center } = useMap();
|
|
15
|
+
const [poiMarkers, setPoiMarkers] = useState({ markers: [], icon: null });
|
|
16
|
+
const [currentCenter, setCurrentCenter] = useState(center);
|
|
17
|
+
const [currentZoom, setCurrentZoom] = useState(zoom);
|
|
18
|
+
const [placesWindow, setPlacesWindow] = useState(false);
|
|
19
|
+
const [selectedPlaceMarker, setSelectedPlaceMarker] = useState(null);
|
|
20
|
+
|
|
21
|
+
const getRadiusForZoom = () => {
|
|
22
|
+
if (currentZoom >= 18) return 1000;
|
|
23
|
+
if (currentZoom <= 10) return 0;
|
|
24
|
+
|
|
25
|
+
let tempZoom = Math.pow(19 - currentZoom, 4.85);
|
|
26
|
+
let radius = tempZoom;
|
|
27
|
+
let minRadius = 1500;
|
|
28
|
+
let maxRadius = 800000;
|
|
29
|
+
|
|
30
|
+
if (radius < minRadius) radius = minRadius;
|
|
31
|
+
else if (radius > maxRadius) radius = maxRadius;
|
|
32
|
+
|
|
33
|
+
return radius;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!selectedPlaces || (!selectedPlaces.length > 0) || !center || currentZoom < 12) {
|
|
38
|
+
setPoiMarkers({ markers: [], icon: null });
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const fetchPlaces = async () => {
|
|
42
|
+
let poiTypes = [];
|
|
43
|
+
const selectedPOICategories = selectedPlaces;
|
|
44
|
+
selectedPOICategories.forEach(pointOfInterest => {
|
|
45
|
+
poiTypes = poiTypes.concat(placeMappings[pointOfInterest]);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const radius = getRadiusForZoom();
|
|
49
|
+
const location = { latitude: currentCenter.lat, longitude: currentCenter.lng };
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const response = await searchNearbyPlaces(poiTypes, location, radius);
|
|
53
|
+
const newMarkers = response.places.map(place => {
|
|
54
|
+
const getParentCategory = types => {
|
|
55
|
+
const selectedTypes = selectedPOICategories.reduce((acc, category) => {
|
|
56
|
+
return acc.concat(placeMappings[category]);
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
for (const type of types) {
|
|
60
|
+
if (!selectedTypes.includes(type)) continue;
|
|
61
|
+
for (const category in placeMappings) {
|
|
62
|
+
if (placeMappings[category].includes(type)) {
|
|
63
|
+
return category;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const icon = markerIconProps(markerColors.placeMarkers, getParentCategory(place.types));
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
position: { lat: place.location.latitude, lng: place.location.longitude },
|
|
74
|
+
title: place.displayName.text,
|
|
75
|
+
icon: icon
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
setPoiMarkers({ markers: newMarkers, icon: null });
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error('Failed to fetch places:', error);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
fetchPlaces();
|
|
85
|
+
}, [selectedPlaces, currentZoom, currentCenter]);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<PlacesContext.Provider value={{
|
|
89
|
+
poiMarkers,
|
|
90
|
+
setCurrentCenter,
|
|
91
|
+
currentCenter,
|
|
92
|
+
setCurrentZoom,
|
|
93
|
+
currentZoom,
|
|
94
|
+
placesWindow,
|
|
95
|
+
setPlacesWindow,
|
|
96
|
+
selectedPlaceMarker,
|
|
97
|
+
setSelectedPlaceMarker
|
|
98
|
+
}}>
|
|
99
|
+
{children}
|
|
100
|
+
</PlacesContext.Provider>
|
|
101
|
+
);
|
|
102
|
+
};
|
package/src/hooks/useList.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import { getStorageObject } from '~/util/localStorageUtil';
|
|
4
|
-
import { dynamicSort } from '~/util/sortUtil';
|
|
5
|
-
|
|
6
|
-
import { useMapList } from '~/contexts/mapListContext';
|
|
7
4
|
|
|
8
5
|
const getDefaultItemId = () => {
|
|
9
6
|
let item = getStorageObject("selectedListItem");
|
|
@@ -14,7 +11,7 @@ const getDefaultItemId = () => {
|
|
|
14
11
|
}
|
|
15
12
|
};
|
|
16
13
|
|
|
17
|
-
const useListLogic =
|
|
14
|
+
const useListLogic = filteredListings => {
|
|
18
15
|
const [itemLimit, setItemLimit] = useState(100);
|
|
19
16
|
const [expandedId] = useState(getDefaultItemId());
|
|
20
17
|
const [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', null));
|
|
@@ -23,14 +20,6 @@ const useListLogic = () => {
|
|
|
23
20
|
const scrollContainerRef = useRef(null);
|
|
24
21
|
const itemRefs = useRef({});
|
|
25
22
|
const observer = useRef(null);
|
|
26
|
-
const { filteredListings, setFilteredListings } = useMapList();
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (!sortSetting) return;
|
|
30
|
-
localStorage.setItem('sortSetting', JSON.stringify(sortSetting));
|
|
31
|
-
let listingFiltered = dynamicSort(filteredListings, sortSetting.field, sortSetting.type);
|
|
32
|
-
setFilteredListings(listingFiltered);
|
|
33
|
-
}, [sortSetting]);
|
|
34
23
|
|
|
35
24
|
useEffect(() => {
|
|
36
25
|
observer.current = new IntersectionObserver(handleObserver, {
|
|
@@ -59,10 +48,9 @@ const useListLogic = () => {
|
|
|
59
48
|
if (parseInt(savedScrollPosition) > 3000) {
|
|
60
49
|
setItemLimit(savedScrollPosition / 10);
|
|
61
50
|
}
|
|
62
|
-
if (savedScrollPosition &&
|
|
63
|
-
let scrollContainerRefCurrent = scrollContainerRef.current;
|
|
51
|
+
if (savedScrollPosition && scrollContainerRef.current) {
|
|
64
52
|
setTimeout(() => {
|
|
65
|
-
|
|
53
|
+
scrollContainerRef.current.scrollTop = parseInt(savedScrollPosition, 10);
|
|
66
54
|
}, 300);
|
|
67
55
|
}
|
|
68
56
|
}, []);
|
|
@@ -95,7 +83,7 @@ const useListLogic = () => {
|
|
|
95
83
|
}
|
|
96
84
|
};
|
|
97
85
|
|
|
98
|
-
return { itemLimit, expandedId, sortSetting, scrollPosition, loader, scrollContainerRef, itemRefs, setSortSetting, setScrollPosition,
|
|
86
|
+
return { itemLimit, expandedId, sortSetting, scrollPosition, loader, scrollContainerRef, itemRefs, setSortSetting, setScrollPosition, filteredListings };
|
|
99
87
|
};
|
|
100
88
|
|
|
101
89
|
export default useListLogic;
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import HireControlMap from '~/components/HireControlMap';
|
|
2
|
-
|
|
3
|
-
export { HireControlMap };
|
|
1
|
+
import HireControlMap from '~/components/HireControlMap';
|
|
2
|
+
|
|
3
|
+
export { HireControlMap };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import api from '~/apis/hcApi';
|
|
2
|
-
|
|
3
|
-
export const getMapConfig = async () => {
|
|
4
|
-
|
|
5
|
-
try {
|
|
6
|
-
const response = await api.get(`/MapConfig`);
|
|
7
|
-
return response;
|
|
8
|
-
} catch (error) {
|
|
9
|
-
console.error("Error retrieving map configuration:", error);
|
|
10
|
-
throw error;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
getMapConfig
|
|
16
|
-
};
|
|
1
|
+
import api from '~/apis/hcApi';
|
|
2
|
+
|
|
3
|
+
export const getMapConfig = async () => {
|
|
4
|
+
|
|
5
|
+
try {
|
|
6
|
+
const response = await api.get(`/MapConfig`);
|
|
7
|
+
return response;
|
|
8
|
+
} catch (error) {
|
|
9
|
+
console.error("Error retrieving map configuration:", error);
|
|
10
|
+
throw error;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
getMapConfig
|
|
16
|
+
};
|