@abcagency/hc-ui-components 1.4.8 → 1.4.11
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 +30 -5
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/containers/accordions/filter-item-container.js +2 -2
- package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
- package/dist/components/containers/accordions/map-accordion-item-container.js +6 -2
- package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
- package/dist/components/containers/filter/filter-item-container.js +10 -10
- package/dist/components/containers/filter/filter-item-container.js.map +1 -1
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +0 -1
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js +12 -12
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js +4 -4
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
- package/dist/components/modules/list/field-mapper-desktop.js +2 -2
- package/dist/components/modules/list/field-mapper-desktop.js.map +1 -1
- package/dist/components/modules/list/field-mapper-mobile.js +8 -8
- package/dist/components/modules/list/field-mapper-mobile.js.map +1 -1
- package/dist/components/modules/list/header-item.js +1 -1
- package/dist/components/modules/list/header-item.js.map +1 -1
- package/dist/contexts/mapListContext.js +17 -15
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js +7 -6
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/services/googlePlacesNearbyService.js +2 -2
- package/dist/services/googlePlacesNearbyService.js.map +1 -1
- package/dist/services/listingAggregatorService.js +7 -8
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +3 -2
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js +1 -16
- package/dist/services/listingService.js.map +1 -1
- package/dist/types/contexts/mapListContext.d.ts +1 -1
- package/dist/types/services/googlePlacesNearbyService.d.ts +1 -1
- package/dist/types/services/listingAggregatorService.d.ts +2 -2
- package/dist/types/services/listingEntityService.d.ts +2 -3
- package/dist/types/types/GetListingParams.d.ts +1 -1
- package/dist/types/types/ListingEntity.d.ts +2 -1
- package/dist/types/types/ListingFields.d.ts +4 -2
- package/dist/types/types/Listings.d.ts +0 -1
- package/dist/types/util/mapUtil.d.ts +3 -3
- package/dist/util/filterUtil.js +5 -5
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/mapUtil.js +33 -25
- package/dist/util/mapUtil.js.map +1 -1
- package/package.json +7 -2
- package/src/components/HireControlMap.js +21 -3
- package/src/components/containers/accordions/filter-item-container.js +2 -2
- package/src/components/containers/accordions/map-accordion-item-container.js +6 -2
- package/src/components/containers/filter/filter-item-container.js +10 -10
- package/src/components/containers/maps/info-window-content-container.js +1 -1
- package/src/components/containers/maps/map-container.js +2 -1
- 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/contexts/mapListContext.tsx +37 -40
- package/src/contexts/placesContext.js +6 -6
- package/src/services/googlePlacesNearbyService.ts +3 -2
- package/src/services/listingAggregatorService.ts +12 -11
- package/src/services/listingEntityService.ts +3 -3
- package/src/services/listingService.ts +1 -11
- package/src/types/GetListingParams.ts +1 -1
- package/src/types/ListingEntity.ts +2 -1
- package/src/types/ListingFields.ts +4 -2
- package/src/types/Listings.ts +0 -1
- package/src/util/filterUtil.js +6 -6
- package/src/util/mapUtil.js +48 -41
|
@@ -5,18 +5,8 @@ import { Listing } from '../types/Listings';
|
|
|
5
5
|
|
|
6
6
|
export const getListings = async (params?: GetListingsParams): Promise<Listing[]> => {
|
|
7
7
|
try {
|
|
8
|
-
const
|
|
8
|
+
const response = await api.get(`/joblistings/maplistings`);
|
|
9
9
|
|
|
10
|
-
if (params) {
|
|
11
|
-
if (params.location) params.location.forEach(loc => query.append('location', loc));
|
|
12
|
-
if (params.category) params.category.forEach(cat => query.append('category', cat));
|
|
13
|
-
if (params.categoryClass) params.categoryClass.forEach(catClass => query.append('categoryClass', catClass));
|
|
14
|
-
if (params.education) params.education.forEach(edu => query.append('education', edu));
|
|
15
|
-
if (params.city) params.city.forEach(cty => query.append('city', cty));
|
|
16
|
-
if (params.state) params.state.forEach(st => query.append('state', st));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const response = await api.get(`/Listings?${query.toString()}`);
|
|
20
10
|
return response as Listing[];
|
|
21
11
|
} catch (error) {
|
|
22
12
|
console.error(error);
|
|
@@ -2,9 +2,10 @@ export type ListingFields = {
|
|
|
2
2
|
posted?: string;
|
|
3
3
|
subTitle?: string;
|
|
4
4
|
education?: string;
|
|
5
|
-
|
|
5
|
+
title?: string;
|
|
6
6
|
category?: string;
|
|
7
|
-
|
|
7
|
+
subCategory?: string;
|
|
8
|
+
applyUrl?: string;
|
|
8
9
|
shift?: string;
|
|
9
10
|
custom1?: string;
|
|
10
11
|
custom2?: string;
|
|
@@ -22,5 +23,6 @@ export type ListingFields = {
|
|
|
22
23
|
useClientJobUrl?: boolean;
|
|
23
24
|
dateCreated: Date;
|
|
24
25
|
dateLastEdited?: Date;
|
|
26
|
+
entityKey: string;
|
|
25
27
|
travelTime?: string;
|
|
26
28
|
}
|
package/src/types/Listings.ts
CHANGED
package/src/util/filterUtil.js
CHANGED
|
@@ -82,17 +82,17 @@ export const generateFilterOptions = (
|
|
|
82
82
|
if (fieldName === parentField && filterOptions?.filters) {
|
|
83
83
|
return filterOptions.filters.find(filter => filter.id === fieldName);
|
|
84
84
|
}
|
|
85
|
-
if(fieldName == '
|
|
85
|
+
if(fieldName == 'category'){
|
|
86
86
|
return {
|
|
87
87
|
id: fieldName,
|
|
88
88
|
title: siteConfig.fieldNames[fieldName],
|
|
89
89
|
items: getFilterOptions(allListings, allListings, fieldName)
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
if(fieldName == '
|
|
93
|
-
const
|
|
92
|
+
if(fieldName == 'subCategory' && selectedFilters.category){
|
|
93
|
+
const categoryKeys = Object.keys(selectedFilters.category);
|
|
94
94
|
const filteredListings = allListings.filter(
|
|
95
|
-
x =>
|
|
95
|
+
x => categoryKeys.includes(x.fields?.category)
|
|
96
96
|
);
|
|
97
97
|
return {
|
|
98
98
|
id: fieldName,
|
|
@@ -255,9 +255,9 @@ function searchResults(results, query) {
|
|
|
255
255
|
'fields.posted',
|
|
256
256
|
'fields.subtitle',
|
|
257
257
|
'fields.education',
|
|
258
|
-
'fields.
|
|
258
|
+
'fields.title',
|
|
259
259
|
'fields.category',
|
|
260
|
-
'fields.
|
|
260
|
+
'fields.subCategory',
|
|
261
261
|
'fields.shift',
|
|
262
262
|
'fields.citystate',
|
|
263
263
|
'fields.city',
|
package/src/util/mapUtil.js
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
export const getDistinctItemsByProximity = (items,
|
|
1
|
+
export const getDistinctItemsByProximity = (items, listingEntitiesDetailsInput) => {
|
|
2
2
|
const clusters = {};
|
|
3
3
|
|
|
4
|
-
if (!
|
|
4
|
+
if (!listingEntitiesDetailsInput) return [];
|
|
5
|
+
|
|
6
|
+
const listingEntitiesDetails = Array.isArray(listingEntitiesDetailsInput)
|
|
7
|
+
? listingEntitiesDetailsInput.reduce((acc, entity) => {
|
|
8
|
+
if (entity?.entityKey) acc[entity.entityKey] = entity;
|
|
9
|
+
return acc;
|
|
10
|
+
}, {})
|
|
11
|
+
: listingEntitiesDetailsInput;
|
|
5
12
|
|
|
6
13
|
const closeItemPairs = findCloseItems(listingEntitiesDetails);
|
|
7
14
|
if (closeItemPairs.length > 0) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
closeItemPairs
|
|
11
|
-
);
|
|
15
|
+
const adjusted = adjustItemPositions(listingEntitiesDetails, closeItemPairs);
|
|
16
|
+
Object.assign(listingEntitiesDetails, adjusted);
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
items?.forEach(item => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
20
|
+
const entityKey = item?.fields?.entityKey;
|
|
21
|
+
if (!entityKey || entityKey === '-1') return;
|
|
22
|
+
const entityDetails = listingEntitiesDetails[entityKey];
|
|
23
|
+
if (!entityDetails) {
|
|
24
|
+
console.error(`Details not found for entityKey: ${entityKey}`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
item.mapDetails = entityDetails;
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if (!clusters[entityKey]) {
|
|
31
|
+
clusters[entityKey] = {
|
|
32
|
+
...entityDetails,
|
|
33
|
+
items: { [item.id]: item }
|
|
34
|
+
};
|
|
35
|
+
} else {
|
|
36
|
+
clusters[entityKey].items[item.id] = item;
|
|
37
|
+
}
|
|
34
38
|
});
|
|
35
39
|
|
|
36
40
|
return Object.values(clusters);
|
|
37
41
|
};
|
|
38
42
|
|
|
39
|
-
export const findCloseItems =
|
|
43
|
+
export const findCloseItems = entitiesByKey => {
|
|
40
44
|
const closeItems = [];
|
|
41
|
-
const items = Object.values(
|
|
45
|
+
const items = Object.values(entitiesByKey); // Convert object to array
|
|
42
46
|
const proximityThreshold = 0.0001;
|
|
43
47
|
|
|
44
48
|
for (let i = 0; i < items.length; i++) {
|
|
45
49
|
for (let j = i + 1; j < items.length; j++) {
|
|
46
50
|
const distanceLat = Math.abs(items[i].latitude - items[j].latitude);
|
|
47
51
|
const distanceLng = Math.abs(items[i].longitude - items[j].longitude);
|
|
48
|
-
if (
|
|
49
|
-
distanceLat < proximityThreshold &&
|
|
50
|
-
distanceLng < proximityThreshold
|
|
51
|
-
) {
|
|
52
|
+
if (distanceLat < proximityThreshold && distanceLng < proximityThreshold) {
|
|
52
53
|
closeItems.push({ item1: items[i], item2: items[j] });
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -57,14 +58,18 @@ export const findCloseItems = itemsObj => {
|
|
|
57
58
|
return closeItems;
|
|
58
59
|
};
|
|
59
60
|
|
|
60
|
-
export const adjustItemPositions = (
|
|
61
|
+
export const adjustItemPositions = (entitiesByKey, closeItemPairs) => {
|
|
61
62
|
const adjustmentValue = 0.0001;
|
|
62
|
-
const adjustedItems = { ...
|
|
63
|
+
const adjustedItems = { ...entitiesByKey };
|
|
63
64
|
|
|
64
65
|
closeItemPairs.forEach(pair => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
adjustedItems[
|
|
66
|
+
const key2 = pair.item2.entityKey;
|
|
67
|
+
if (adjustedItems[key2]) {
|
|
68
|
+
adjustedItems[key2] = {
|
|
69
|
+
...adjustedItems[key2],
|
|
70
|
+
latitude: adjustedItems[key2].latitude + adjustmentValue,
|
|
71
|
+
longitude: adjustedItems[key2].longitude + adjustmentValue
|
|
72
|
+
};
|
|
68
73
|
}
|
|
69
74
|
});
|
|
70
75
|
|
|
@@ -74,13 +79,15 @@ export const adjustItemPositions = (itemsObj, closeItemPairs) => {
|
|
|
74
79
|
export const clusterOptions = (clusterGridSize, fillColor) => {
|
|
75
80
|
return {
|
|
76
81
|
gridSize: clusterGridSize,
|
|
77
|
-
maxZoom:15,
|
|
78
|
-
styles:[
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
maxZoom: 15,
|
|
83
|
+
styles: [
|
|
84
|
+
{
|
|
85
|
+
url: createSvgDataUri(fillColor),
|
|
86
|
+
textColor: 'white',
|
|
87
|
+
height: 40,
|
|
88
|
+
width: 40
|
|
89
|
+
}
|
|
90
|
+
]
|
|
84
91
|
};
|
|
85
92
|
};
|
|
86
93
|
|