@abcagency/hc-ui-components 1.3.23 → 1.3.25
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/package.json +4 -5
- package/src/.editorconfig +12 -0
- package/src/apis/hcApi.ts +109 -0
- package/src/bundleIndex.js +14 -0
- package/src/clientToken.js +9 -0
- package/src/components/HireControlMap.js +135 -0
- package/src/components/containers/accordions/filter-container.js +48 -0
- package/src/components/containers/accordions/filter-item-container.js +66 -0
- package/src/components/containers/accordions/map-accordion-item-container.js +70 -0
- package/src/components/containers/filter/commute-container.js +89 -0
- package/src/components/containers/filter/filter-container.js +76 -0
- package/src/components/containers/filter/filter-item-container.js +71 -0
- package/src/components/containers/filter/location-container.js +45 -0
- package/src/components/containers/filter/points-of-interest-container.js +33 -0
- package/src/components/containers/filter/points-of-interest-radio-item-container.js +35 -0
- package/src/components/containers/filter/search-container.js +50 -0
- package/src/components/containers/jobListing/listing-details-container.js +40 -0
- package/src/components/containers/list/item-list-container.tsx +81 -0
- package/src/components/containers/list/list-item/list-item-container.js +43 -0
- package/src/components/containers/maps/info-window-content-container.js +51 -0
- package/src/components/containers/maps/map-container.js +204 -0
- package/src/components/containers/maps/map-list-container.js +48 -0
- package/src/components/containers/maps/map-marker-container.js +78 -0
- package/src/components/modules/accordions/MapAccordionItem.js +30 -0
- package/src/components/modules/accordions/default.js +171 -0
- package/src/components/modules/accordions/filterItem.js +27 -0
- package/src/components/modules/accordions/filters.js +32 -0
- package/src/components/modules/buttons/button-group-apply.js +123 -0
- package/src/components/modules/buttons/commute-pill.js +22 -0
- package/src/components/modules/buttons/default.js +194 -0
- package/src/components/modules/buttons/items-pill.js +35 -0
- package/src/components/modules/buttons/pill-wrapper.js +27 -0
- package/src/components/modules/buttons/show-all-button.js +20 -0
- package/src/components/modules/cards/default.js +167 -0
- package/src/components/modules/cards/filter.js +56 -0
- package/src/components/modules/dialogs/apply-dialog.js +48 -0
- package/src/components/modules/filter/commute.js +108 -0
- package/src/components/modules/filter/index.js +55 -0
- package/src/components/modules/filter/item.js +48 -0
- package/src/components/modules/filter/location.js +48 -0
- package/src/components/modules/filter/radio-item.js +42 -0
- package/src/components/modules/filter/search.js +65 -0
- package/src/components/modules/filter/sort.js +83 -0
- package/src/components/modules/grid.js +54 -0
- package/src/components/modules/icon.js +33 -0
- package/src/components/modules/jobListing/listing-details.js +109 -0
- package/src/components/modules/list/field-mapper.js +114 -0
- package/src/components/modules/list/header-item.js +91 -0
- package/src/components/modules/list/header.js +49 -0
- package/src/components/modules/list/item-expand-card/index.js +22 -0
- package/src/components/modules/list/item-expand-card/recruiter-contact-nav.js +50 -0
- package/src/components/modules/list/item-expand-card/recruiter-details.js +68 -0
- package/src/components/modules/list/item-expand-card/recruiter-headshot.js +22 -0
- package/src/components/modules/list/item-list.tsx +84 -0
- package/src/components/modules/list/list-item/list-item.js +130 -0
- package/src/components/modules/maps/info-window-card.js +17 -0
- package/src/components/modules/maps/info-window-content.js +35 -0
- package/src/components/modules/maps/map-list.js +28 -0
- package/src/components/modules/maps/map-marker.js +29 -0
- package/src/components/modules/maps/map.js +76 -0
- package/src/components/modules/maps/place-marker.js +41 -0
- package/src/components/modules/maps/tabs.js +81 -0
- package/src/constants/eventTypes.js +13 -0
- package/src/constants/placeTypes.js +8 -0
- package/src/contexts/mapContext.tsx +129 -0
- package/src/contexts/mapListContext.tsx +311 -0
- package/src/contexts/placesContext.js +102 -0
- package/src/contexts/trackEventContext.js +14 -0
- package/src/enums/SectionType.ts +9 -0
- package/src/hooks/useList.js +89 -0
- package/src/index.js +3 -0
- package/src/services/configService.ts +16 -0
- package/src/services/googlePlacesNearbyService.ts +42 -0
- package/src/services/listingAggregatorService.ts +76 -0
- package/src/services/listingEntityService.ts +16 -0
- package/src/services/listingService.ts +40 -0
- package/src/services/recruiterService.ts +18 -0
- package/src/styles/bundle.css +268 -0
- package/src/styles/index.css +24 -0
- package/src/types/Address.ts +7 -0
- package/src/types/ContentSection.ts +9 -0
- package/src/types/GetListingParams.ts +8 -0
- package/src/types/LatLng.ts +4 -0
- package/src/types/ListingEntity.ts +11 -0
- package/src/types/ListingFields.ts +25 -0
- package/src/types/Listings.ts +32 -0
- package/src/types/Recruiter.ts +9 -0
- package/src/types/SimilarListing.ts +24 -0
- package/src/types/config/Colors.ts +8 -0
- package/src/types/config/MapConfig.ts +31 -0
- package/src/types/config/PointsOfInterestConfig.ts +13 -0
- package/src/types/config/SearchConfig.ts +4 -0
- package/src/util/arrayUtil.js +3 -0
- package/src/util/fieldMapper.js +22 -0
- package/src/util/filterUtil.js +239 -0
- package/src/util/loading.js +17 -0
- package/src/util/localStorageUtil.ts +34 -0
- package/src/util/mapIconUtil.js +180 -0
- package/src/util/mapUtil.js +91 -0
- package/src/util/sortUtil.js +33 -0
- package/src/util/stringUtils.js +6 -0
- package/src/util/urlFilterUtil.js +85 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { useTrackEvent } from '~/contexts/trackEventContext';
|
|
3
|
+
import FilterItem from '~/components/modules/filter/item';
|
|
4
|
+
|
|
5
|
+
const FilterItemContainer = ({
|
|
6
|
+
className,
|
|
7
|
+
item,
|
|
8
|
+
type = 'checkbox',
|
|
9
|
+
itemKey = null,
|
|
10
|
+
hasCount = true,
|
|
11
|
+
field,
|
|
12
|
+
selectedFilters,
|
|
13
|
+
setSelectedFilters,
|
|
14
|
+
...rest
|
|
15
|
+
}) => {
|
|
16
|
+
const { trackEvent, eventTypes } = useTrackEvent();
|
|
17
|
+
const itemName = item.name ? item.name : item;
|
|
18
|
+
itemKey = itemKey === null ? itemName : itemKey;
|
|
19
|
+
const isActive = selectedFilters != undefined && !!selectedFilters[field]?.[itemKey];
|
|
20
|
+
const [activeItem, setActiveItem] = useState(isActive);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!selectedFilters) return;
|
|
24
|
+
setActiveItem(!!selectedFilters[field]?.[itemKey]);
|
|
25
|
+
}, [selectedFilters, field, itemKey]);
|
|
26
|
+
|
|
27
|
+
const changeHandler = () => {
|
|
28
|
+
if (!isActive) {
|
|
29
|
+
trackEvent(eventTypes.FILTER_APPLIED, { filterType: field, filterChecked: itemKey });
|
|
30
|
+
}
|
|
31
|
+
setSelectedFilters(prevFilters => {
|
|
32
|
+
const updatedFilters = { ...prevFilters };
|
|
33
|
+
if (!isActive) {
|
|
34
|
+
if (!updatedFilters[field]) {
|
|
35
|
+
updatedFilters[field] = {};
|
|
36
|
+
}
|
|
37
|
+
updatedFilters[field][itemKey] = true;
|
|
38
|
+
return updatedFilters;
|
|
39
|
+
}
|
|
40
|
+
delete updatedFilters[field][itemKey];
|
|
41
|
+
if (Object.keys(updatedFilters[field]).length === 0) {
|
|
42
|
+
delete updatedFilters[field];
|
|
43
|
+
}
|
|
44
|
+
return updatedFilters;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (selectedFilters && selectedFilters[field] && Object.keys(selectedFilters[field])?.length > 0) return;
|
|
50
|
+
else if (activeItem === true) {
|
|
51
|
+
setActiveItem(false);
|
|
52
|
+
}
|
|
53
|
+
}, [selectedFilters]);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<FilterItem
|
|
57
|
+
className={className}
|
|
58
|
+
item={item}
|
|
59
|
+
type={type}
|
|
60
|
+
itemKey={itemKey}
|
|
61
|
+
hasCount={hasCount}
|
|
62
|
+
field={field}
|
|
63
|
+
activeItem={activeItem}
|
|
64
|
+
setActiveItem={setActiveItem}
|
|
65
|
+
changeHandler={changeHandler}
|
|
66
|
+
{...rest}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default FilterItemContainer;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FilterLocation from '~/components/modules/filter/location';
|
|
3
|
+
import FilterCommute from '~/components/containers/filter/commute-container';
|
|
4
|
+
import FilterPointsOfInterest from '~/components/containers/filter/points-of-interest-container';
|
|
5
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
6
|
+
|
|
7
|
+
const FilterLocationContainer = ({
|
|
8
|
+
className,
|
|
9
|
+
defaultValue,
|
|
10
|
+
setDefaultValue,
|
|
11
|
+
showMap = false,
|
|
12
|
+
setLocation,
|
|
13
|
+
setSelectedListItem
|
|
14
|
+
}) => {
|
|
15
|
+
const { setSelectedFilters, selectedFilters, filterOptions } = useMapList();
|
|
16
|
+
|
|
17
|
+
const locations = filterOptions?.locations;
|
|
18
|
+
const pointsOfInterest = filterOptions?.pointsOfInterest;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<FilterLocation
|
|
22
|
+
className={className}
|
|
23
|
+
defaultValue={defaultValue}
|
|
24
|
+
setDefaultValue={setDefaultValue}
|
|
25
|
+
showMap={showMap}
|
|
26
|
+
setLocation={setLocation}
|
|
27
|
+
setSelectedListItem={setSelectedListItem}
|
|
28
|
+
locations={locations}
|
|
29
|
+
setSelectedFilters={setSelectedFilters}
|
|
30
|
+
selectedFilters={selectedFilters}
|
|
31
|
+
>
|
|
32
|
+
{showMap && <FilterCommute className="hc-mt-6" />}
|
|
33
|
+
{showMap && (
|
|
34
|
+
<FilterPointsOfInterest
|
|
35
|
+
className="hc-mt-4"
|
|
36
|
+
pointsOfInterest={pointsOfInterest}
|
|
37
|
+
setDefaultValue={setDefaultValue}
|
|
38
|
+
defaultValue={defaultValue}
|
|
39
|
+
/>
|
|
40
|
+
)}
|
|
41
|
+
</FilterLocation>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default FilterLocationContainer;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Accordion from '~/components/modules/accordions/default';
|
|
3
|
+
import AccordionFilterItem from '~/components/modules/accordions/filterItem';
|
|
4
|
+
import RadioItemContainer from '~/components/containers/filter/points-of-interest-radio-item-container';
|
|
5
|
+
|
|
6
|
+
const FilterPointsOfInterestContainer = ({
|
|
7
|
+
title = "Points of interest",
|
|
8
|
+
pointsOfInterest,
|
|
9
|
+
setDefaultValue,
|
|
10
|
+
className,
|
|
11
|
+
defaultValue
|
|
12
|
+
}) => {
|
|
13
|
+
const renderRadioItem = (item, index) => (
|
|
14
|
+
<RadioItemContainer key={item.key + index} item={item} field={item.id} />
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const body = pointsOfInterest.items.map((item, index) => renderRadioItem(item, index));
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={`hc-relative ${className ?? ""}`}>
|
|
21
|
+
<Accordion defaultValue={defaultValue} className="hc-space-y-4">
|
|
22
|
+
<AccordionFilterItem
|
|
23
|
+
id="points-of-interest"
|
|
24
|
+
setDefaultValue={setDefaultValue}
|
|
25
|
+
header={title}
|
|
26
|
+
body={body}
|
|
27
|
+
/>
|
|
28
|
+
</Accordion>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default FilterPointsOfInterestContainer;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import RadioItem from '~/components/modules/filter/radio-item';
|
|
3
|
+
import { useMap } from '~/contexts/mapContext';
|
|
4
|
+
import { useTrackEvent } from '~/contexts/trackEventContext';
|
|
5
|
+
|
|
6
|
+
const RadioItemContainer = ({
|
|
7
|
+
className,
|
|
8
|
+
item,
|
|
9
|
+
field,
|
|
10
|
+
...rest
|
|
11
|
+
}) => {
|
|
12
|
+
const { trackEvent, eventTypes } = useTrackEvent();
|
|
13
|
+
const { selectedPlaces, setSelectedPlaces } = useMap();
|
|
14
|
+
const chosenPlace = item.key.toLowerCase();
|
|
15
|
+
const isActive = selectedPlaces.includes(chosenPlace);
|
|
16
|
+
|
|
17
|
+
const changeHandler = () => {
|
|
18
|
+
if (!isActive)
|
|
19
|
+
trackEvent(eventTypes.POI_APPLIED, { chosenPlace });
|
|
20
|
+
setSelectedPlaces([isActive ? '' : chosenPlace]);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<RadioItem
|
|
25
|
+
className={className}
|
|
26
|
+
item={item}
|
|
27
|
+
field={field}
|
|
28
|
+
isActive={isActive}
|
|
29
|
+
changeHandler={changeHandler}
|
|
30
|
+
{...rest}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default RadioItemContainer;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
3
|
+
import Search from '~/components/modules/filter/search';
|
|
4
|
+
|
|
5
|
+
const SearchContainer = ({
|
|
6
|
+
inputPlaceholder = "Keywords",
|
|
7
|
+
showSearchIcon = false,
|
|
8
|
+
className,
|
|
9
|
+
labelClassName
|
|
10
|
+
}) => {
|
|
11
|
+
const { query, setQuery, siteConfig } = useMapList();
|
|
12
|
+
const [inputValue, setInputValue] = useState(query != null ? query : "");
|
|
13
|
+
const debounceTimer = useRef(null);
|
|
14
|
+
|
|
15
|
+
const handleInputChange = e => {
|
|
16
|
+
setInputValue(e.target.value);
|
|
17
|
+
if (debounceTimer.current) {
|
|
18
|
+
clearTimeout(debounceTimer.current);
|
|
19
|
+
}
|
|
20
|
+
debounceTimer.current = setTimeout(() => {
|
|
21
|
+
setQuery(e.target.value);
|
|
22
|
+
}, 500);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const handleReset = () => {
|
|
26
|
+
setInputValue("");
|
|
27
|
+
setQuery("");
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (query == null) {
|
|
32
|
+
setInputValue("");
|
|
33
|
+
}
|
|
34
|
+
}, [query]);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Search
|
|
38
|
+
inputPlaceholder={siteConfig.searchConfig.placeholder || inputPlaceholder}
|
|
39
|
+
showSearchIcon={showSearchIcon}
|
|
40
|
+
className={className}
|
|
41
|
+
labelClassName={labelClassName}
|
|
42
|
+
inputValue={inputValue}
|
|
43
|
+
handleInputChange={handleInputChange}
|
|
44
|
+
handleReset={handleReset}
|
|
45
|
+
label={siteConfig.searchConfig.label}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default SearchContainer;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useMap } from '~/contexts/mapContext';
|
|
3
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
4
|
+
import { useTrackEvent } from '~/contexts/trackEventContext';
|
|
5
|
+
import ListingDetails from '~/components/modules/jobListing/listing-details';
|
|
6
|
+
|
|
7
|
+
const ListingDetailsContainer = ({ item, recruiter }) => {
|
|
8
|
+
const { trackEvent, eventTypes } = useTrackEvent();
|
|
9
|
+
const { travelTime } = useMap();
|
|
10
|
+
const { siteConfig, navigateToDetails, navigateToEasyApply, Link, linkFormat } = useMapList();
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
useDetailsPostMessage,
|
|
14
|
+
useApplyDialog,
|
|
15
|
+
internalApplyLink,
|
|
16
|
+
companyName,
|
|
17
|
+
jobsDomain
|
|
18
|
+
} = siteConfig;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<ListingDetails
|
|
22
|
+
item={item}
|
|
23
|
+
recruiter={recruiter}
|
|
24
|
+
travelTime={travelTime}
|
|
25
|
+
useDetailsPostMessage={useDetailsPostMessage}
|
|
26
|
+
navigateToDetails={navigateToDetails}
|
|
27
|
+
navigateToEasyApply={navigateToEasyApply}
|
|
28
|
+
Link={Link}
|
|
29
|
+
linkFormat={linkFormat}
|
|
30
|
+
useApplyDialog={useApplyDialog}
|
|
31
|
+
internalApplyLink={internalApplyLink}
|
|
32
|
+
companyName={companyName}
|
|
33
|
+
jobsDomain={jobsDomain}
|
|
34
|
+
trackEvent={trackEvent}
|
|
35
|
+
eventTypes={eventTypes}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default ListingDetailsContainer;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import useListLogic from '~/hooks/useList';
|
|
3
|
+
import { useMap } from '~/contexts/mapContext';
|
|
4
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
5
|
+
import { useTrackEvent } from '~/contexts/trackEventContext';
|
|
6
|
+
import ItemsList from '~/components/modules/list/item-list';
|
|
7
|
+
import Accordion from '~/components/modules/accordions/default';
|
|
8
|
+
import MapAccordionItemContainer from '~/components/containers/accordions/map-accordion-item-container';
|
|
9
|
+
import { dynamicSort } from '~/util/sortUtil';
|
|
10
|
+
import { Listing } from '~/types/Listings';
|
|
11
|
+
import ListingDetailsContainer from '../jobListing/listing-details-container';
|
|
12
|
+
|
|
13
|
+
interface ItemsListContainerProps {
|
|
14
|
+
fieldNames: Record<string, string>;
|
|
15
|
+
showMap: boolean;
|
|
16
|
+
fieldsShown: string[];
|
|
17
|
+
specialFeatures: any;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const ItemsListContainer: React.FC<ItemsListContainerProps> = ({
|
|
21
|
+
fieldNames,
|
|
22
|
+
showMap,
|
|
23
|
+
fieldsShown,
|
|
24
|
+
specialFeatures
|
|
25
|
+
}) => {
|
|
26
|
+
const { filteredListings, loading, commuteLocation, sortSetting, setSortSetting } = useMapList();
|
|
27
|
+
const { itemLimit, loader, scrollContainerRef, itemRefs } = useListLogic(filteredListings as any);
|
|
28
|
+
const { selectedListItem } = useMap();
|
|
29
|
+
const { trackEvent, eventTypes } = useTrackEvent() as any;
|
|
30
|
+
const itemExpandedContent = (item: any, recruiter: any) =>
|
|
31
|
+
item ? <ListingDetailsContainer item={item} recruiter={recruiter} /> : null;
|
|
32
|
+
|
|
33
|
+
if (!fieldsShown.includes('travelTime') && commuteLocation != null && Object.entries(commuteLocation).length > 0) {
|
|
34
|
+
fieldsShown.push('travelTime');
|
|
35
|
+
fieldNames['travelTime'] = 'Commute';
|
|
36
|
+
} else if (fieldsShown.includes('travelTime') && !commuteLocation) {
|
|
37
|
+
fieldsShown = fieldsShown.filter(x => x !== 'travelTime');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const setTrackedSortSetting = (sortSetting: { field: string; type: string }) => {
|
|
41
|
+
trackEvent(eventTypes.LIST_SORTED, sortSetting);
|
|
42
|
+
setSortSetting(sortSetting);
|
|
43
|
+
};
|
|
44
|
+
return (
|
|
45
|
+
<ItemsList
|
|
46
|
+
fieldNames={fieldNames}
|
|
47
|
+
showMap={showMap}
|
|
48
|
+
fieldsShown={fieldsShown}
|
|
49
|
+
filteredListings={filteredListings}
|
|
50
|
+
loading={loading}
|
|
51
|
+
sortSetting={sortSetting}
|
|
52
|
+
setSortSetting={setTrackedSortSetting}
|
|
53
|
+
itemLimit={itemLimit}
|
|
54
|
+
loader={loader}
|
|
55
|
+
scrollContainerRef={scrollContainerRef}
|
|
56
|
+
itemRefs={itemRefs}
|
|
57
|
+
selectedListItem={selectedListItem}
|
|
58
|
+
includeFavorite={true}
|
|
59
|
+
>
|
|
60
|
+
<Accordion className="hc-divide-y hc-divide-uiAccent/10 hc-z-[1000]" defaultValue={selectedListItem?.id}>
|
|
61
|
+
{(sortSetting ? dynamicSort(filteredListings, sortSetting.field, sortSetting.type) : filteredListings)
|
|
62
|
+
.slice(0, itemLimit)
|
|
63
|
+
.map((item: Listing) => (
|
|
64
|
+
<MapAccordionItemContainer
|
|
65
|
+
key={item.id}
|
|
66
|
+
showMap={showMap}
|
|
67
|
+
item={item}
|
|
68
|
+
itemRefs={itemRefs}
|
|
69
|
+
fieldsShown={fieldsShown}
|
|
70
|
+
itemExpandedContent={itemExpandedContent}
|
|
71
|
+
specialFeatures={specialFeatures}
|
|
72
|
+
isActive={selectedListItem?.id === item.id}
|
|
73
|
+
hasListItemSelected={selectedListItem != null}
|
|
74
|
+
/>
|
|
75
|
+
))}
|
|
76
|
+
</Accordion>
|
|
77
|
+
</ItemsList>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default ItemsListContainer;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
3
|
+
import { useTrackEvent } from '~/contexts/trackEventContext';
|
|
4
|
+
import ListItem from '~/components/modules/list/list-item/list-item';
|
|
5
|
+
|
|
6
|
+
const ListItemContainer = ({
|
|
7
|
+
isActive,
|
|
8
|
+
showMap,
|
|
9
|
+
item,
|
|
10
|
+
itemRefs,
|
|
11
|
+
fieldsShown,
|
|
12
|
+
specialFeatures,
|
|
13
|
+
className,
|
|
14
|
+
bodyClassName,
|
|
15
|
+
onItemSelected,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const { siteConfig, favorites, handleSettingFavorites, setMobileTab } = useMapList();
|
|
19
|
+
const { trackEvent, eventTypes } = useTrackEvent();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<ListItem
|
|
23
|
+
isActive={isActive}
|
|
24
|
+
showMap={showMap}
|
|
25
|
+
item={item}
|
|
26
|
+
itemRefs={itemRefs}
|
|
27
|
+
fieldsShown={fieldsShown}
|
|
28
|
+
specialFeatures={specialFeatures}
|
|
29
|
+
className={isActive ? "!hc-border-secondary hc-border hc-border-b-0" : "hc-opacity-85"}
|
|
30
|
+
bodyClassName={bodyClassName}
|
|
31
|
+
onItemSelected={onItemSelected}
|
|
32
|
+
setMobileTab={setMobileTab}
|
|
33
|
+
siteConfig={siteConfig}
|
|
34
|
+
trackEvent={trackEvent}
|
|
35
|
+
eventTypes={eventTypes}
|
|
36
|
+
favorites={favorites}
|
|
37
|
+
handleSettingFavorites={handleSettingFavorites}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default ListItemContainer;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import InfoWindowContent from '~/components/modules/maps/info-window-content';
|
|
3
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
4
|
+
import { useTrackEvent } from '~/contexts/trackEventContext';
|
|
5
|
+
|
|
6
|
+
const InfoWindowContentContainer = ({
|
|
7
|
+
item,
|
|
8
|
+
filterListingsByLocation
|
|
9
|
+
}) => {
|
|
10
|
+
const { trackEvent, eventTypes } = useTrackEvent();
|
|
11
|
+
const { setSelectedFilters, setMobileTab, selectedFilters, siteConfig } = useMapList();
|
|
12
|
+
const fieldsShown = siteConfig.fieldsShown;
|
|
13
|
+
let items = item && item.items ? Object.values(item.items) : null;
|
|
14
|
+
|
|
15
|
+
const addressParts = [
|
|
16
|
+
items[0].mapDetails?.address?.street,
|
|
17
|
+
items[0].mapDetails?.address?.city,
|
|
18
|
+
items[0].mapDetails?.address?.state,
|
|
19
|
+
items[0].mapDetails?.address?.zip
|
|
20
|
+
];
|
|
21
|
+
const fullAddress = addressParts.filter(Boolean).join(', ');
|
|
22
|
+
|
|
23
|
+
const applyFilters = () => {
|
|
24
|
+
setMobileTab("listTab");
|
|
25
|
+
const newFilters = { ...selectedFilters };
|
|
26
|
+
let filters = [];
|
|
27
|
+
|
|
28
|
+
if (fieldsShown.includes('cityState')) {
|
|
29
|
+
newFilters.cityState = { [items[0].fields.cityState]: true };
|
|
30
|
+
filters.push({ filterType: 'cityState', filterChecked: items[0].fields.cityState });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (fieldsShown.includes('city')) {
|
|
34
|
+
newFilters.city = { [items[0].fields.city]: true };
|
|
35
|
+
filters.push({ filterType: 'city', filterChecked: items[0].fields.city });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (fieldsShown.includes('state')) {
|
|
39
|
+
newFilters.state = { [items[0].fields.state]: true };
|
|
40
|
+
filters.push({ filterType: 'state', filterChecked: items[0].fields.state });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
trackEvent(eventTypes.VIEW_JOBS_AT_Location, { filtersApplied: filters });
|
|
44
|
+
setSelectedFilters(newFilters);
|
|
45
|
+
filterListingsByLocation();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return <InfoWindowContent items={items} fullAddress={fullAddress} applyFilters={applyFilters} />;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default InfoWindowContentContainer;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import MapMarker from "~/components/containers/maps/map-marker-container";
|
|
5
|
+
import PlaceMarker from "~/components/modules/maps/place-marker";
|
|
6
|
+
|
|
7
|
+
import { usePlaces } from "~/contexts/placesContext";
|
|
8
|
+
import { useMap } from "~/contexts/mapContext";
|
|
9
|
+
import { useMapList } from "~/contexts/mapListContext";
|
|
10
|
+
|
|
11
|
+
import { markerIconSelected, markerIcon, pinIcon } from "~/util/mapIconUtil";
|
|
12
|
+
|
|
13
|
+
import Map from "~/components/modules/maps/map";
|
|
14
|
+
|
|
15
|
+
const MapContainer = ({
|
|
16
|
+
markerConfigs,
|
|
17
|
+
infoWindowClasses,
|
|
18
|
+
clusterGridSize = 60
|
|
19
|
+
}) => {
|
|
20
|
+
const {
|
|
21
|
+
location,
|
|
22
|
+
zoom,
|
|
23
|
+
center,
|
|
24
|
+
commuteLocation,
|
|
25
|
+
selectLocationEntity,
|
|
26
|
+
setLocation,
|
|
27
|
+
mapInteracted,
|
|
28
|
+
setMapInteracted
|
|
29
|
+
} = useMap();
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
mapItems, filteredListings, setSelectedFilters,
|
|
33
|
+
setQuery
|
|
34
|
+
} = useMapList();
|
|
35
|
+
|
|
36
|
+
const mapRef = useRef();
|
|
37
|
+
const markerRefs = useRef({});
|
|
38
|
+
const mapContainerRef = useRef(null);
|
|
39
|
+
const {
|
|
40
|
+
poiMarkers,
|
|
41
|
+
setCurrentCenter,
|
|
42
|
+
currentCenter,
|
|
43
|
+
setCurrentZoom,
|
|
44
|
+
currentZoom,
|
|
45
|
+
selectedPlaceMarker,
|
|
46
|
+
setSelectedPlaceMarker,
|
|
47
|
+
placesWindow,
|
|
48
|
+
setPlacesWindow } = usePlaces();
|
|
49
|
+
|
|
50
|
+
const onIdle = () => {
|
|
51
|
+
if (!currentCenter || !mapRef.current) return;
|
|
52
|
+
const newCenter = mapRef.current.getCenter().toJSON();
|
|
53
|
+
const newZoom = mapRef.current.zoom;
|
|
54
|
+
|
|
55
|
+
setCurrentCenter(newCenter);
|
|
56
|
+
|
|
57
|
+
if (newZoom !== currentZoom) {
|
|
58
|
+
setCurrentZoom(newZoom);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (mapContainerRef.current) {
|
|
64
|
+
const handleScroll = () => {
|
|
65
|
+
setMapInteracted(true);
|
|
66
|
+
};
|
|
67
|
+
var mapContainerRefCurrent = mapContainerRef.current;
|
|
68
|
+
mapContainerRef.current.addEventListener('wheel', handleScroll);
|
|
69
|
+
return () => mapContainerRefCurrent.removeEventListener('wheel', handleScroll);
|
|
70
|
+
}
|
|
71
|
+
}, [mapContainerRef.current]);
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (mapRef.current) {
|
|
75
|
+
const mapInstance = mapRef.current;
|
|
76
|
+
const dragStartListener = mapInstance.addListener('dragstart', () => setMapInteracted(true));
|
|
77
|
+
const mouseDownListener = mapInstance.addListener('mousedown', () => setMapInteracted(true));
|
|
78
|
+
return () => {
|
|
79
|
+
google.maps.event.removeListener(dragStartListener);
|
|
80
|
+
google.maps.event.removeListener(mouseDownListener);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}, [mapRef.current, mapContainerRef.current]);
|
|
84
|
+
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if ((mapItems && mapItems.length > 0 || poiMarkers.length > 0) && mapRef.current) {
|
|
87
|
+
fitBounds(mapRef.current);
|
|
88
|
+
}
|
|
89
|
+
}, [mapItems, mapRef.current, location]);
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if ((mapItems && mapItems.length > 0 || poiMarkers.length > 0) && mapRef.current && mapInteracted) {
|
|
93
|
+
fitBounds(mapRef.current, true);
|
|
94
|
+
}
|
|
95
|
+
if (mapRef.current) {
|
|
96
|
+
let currZoom = mapRef.current.zoom;
|
|
97
|
+
let setZoomVal = currZoom < 13 ? currZoom : 12;
|
|
98
|
+
mapRef.current.setZoom(setZoomVal);
|
|
99
|
+
}
|
|
100
|
+
}, [filteredListings]);
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (!mapRef.current || !location || mapInteracted) return;
|
|
104
|
+
mapRef.current.panTo(
|
|
105
|
+
new google.maps.LatLng(location.latitude, location.longitude)
|
|
106
|
+
);
|
|
107
|
+
if (mapRef.current) {
|
|
108
|
+
let setZoomVal = zoom < 13 ? zoom : 12;
|
|
109
|
+
mapRef.current.setZoom(setZoomVal);
|
|
110
|
+
}
|
|
111
|
+
}, [location, zoom, mapRef.current]);
|
|
112
|
+
|
|
113
|
+
const fitBounds = (map, overload = false) => {
|
|
114
|
+
if ((mapInteracted === false || overload) && mapItems != null) {
|
|
115
|
+
const bounds = new window.google.maps.LatLngBounds();
|
|
116
|
+
mapItems.forEach(item => {
|
|
117
|
+
bounds.extend(new google.maps.LatLng(item.latitude, item.longitude));
|
|
118
|
+
});
|
|
119
|
+
if (!map) return;
|
|
120
|
+
map.fitBounds(bounds);
|
|
121
|
+
}
|
|
122
|
+
if (mapRef.current.zoom > 17) {
|
|
123
|
+
mapRef.current.setZoom(16);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const markerClickHandler = mapLocation => {
|
|
128
|
+
setMapInteracted(true);
|
|
129
|
+
selectLocationEntity(mapLocation);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const onLoad = map => {
|
|
133
|
+
if (!location || location === null) {
|
|
134
|
+
mapRef.current = map;
|
|
135
|
+
fitBounds(map, true);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
mapRef.current = map;
|
|
139
|
+
|
|
140
|
+
if (mapInteracted === false) {
|
|
141
|
+
mapRef.current.panTo(
|
|
142
|
+
new google.maps.LatLng(location.latitude, location.longitude)
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
mapRef.current.setZoom(zoom);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const pinIconUrl = pinIcon({
|
|
150
|
+
fillColor: markerConfigs.fillColor,
|
|
151
|
+
strokeColor: markerConfigs.strokeColor
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const mapMarkers = mapItems.map(item => (
|
|
155
|
+
<MapMarker
|
|
156
|
+
key={item.id}
|
|
157
|
+
item={item}
|
|
158
|
+
selectedLocation={location}
|
|
159
|
+
markerRefs={markerRefs}
|
|
160
|
+
infoWindowClasses={infoWindowClasses}
|
|
161
|
+
setSelectedLocation={setLocation}
|
|
162
|
+
markerClickHandler={markerClickHandler}
|
|
163
|
+
markerIcon={markerIcon(markerConfigs)}
|
|
164
|
+
markerIconSelected={markerIconSelected(markerConfigs)}
|
|
165
|
+
setMapInteracted={setMapInteracted}
|
|
166
|
+
/>
|
|
167
|
+
));
|
|
168
|
+
|
|
169
|
+
const placeMarkers = poiMarkers.markers.map((marker, index) => (
|
|
170
|
+
<PlaceMarker
|
|
171
|
+
key={`marker-${marker.title}-${index}`}
|
|
172
|
+
marker={marker}
|
|
173
|
+
index={index}
|
|
174
|
+
selectedPlaceMarker={selectedPlaceMarker}
|
|
175
|
+
placesWindow={placesWindow}
|
|
176
|
+
setPlacesWindow={setPlacesWindow}
|
|
177
|
+
setSelectedPlaceMarker={setSelectedPlaceMarker}
|
|
178
|
+
/>
|
|
179
|
+
));
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<Map
|
|
183
|
+
zoom={zoom}
|
|
184
|
+
center={center}
|
|
185
|
+
mapContainerRef={mapContainerRef}
|
|
186
|
+
onLoad={onLoad}
|
|
187
|
+
onIdle={onIdle}
|
|
188
|
+
clusterGridSize={clusterGridSize}
|
|
189
|
+
markerConfigs={markerConfigs}
|
|
190
|
+
mapMarkers={mapMarkers}
|
|
191
|
+
placeMarkers={placeMarkers}
|
|
192
|
+
mapInteracted={mapInteracted}
|
|
193
|
+
pinIconUrl={pinIconUrl}
|
|
194
|
+
setMapInteracted={setMapInteracted}
|
|
195
|
+
fitBounds={fitBounds}
|
|
196
|
+
mapRef={mapRef}
|
|
197
|
+
setQuery={setQuery}
|
|
198
|
+
filteredListingsLength={filteredListings.length}
|
|
199
|
+
setSelectedFilters={setSelectedFilters}
|
|
200
|
+
/>
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export default MapContainer;
|