@abcagency/hc-ui-components 1.3.17 → 1.3.19
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/apis/hcApi.js +85 -183
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/components/HireControlMap.js +10 -5
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js +10 -67
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/filter/index.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js +1 -2
- package/dist/components/modules/filter/radio-item.js.map +1 -1
- package/dist/components/modules/filter/search.js +4 -4
- package/dist/components/modules/filter/search.js.map +1 -1
- package/dist/components/modules/jobListing/listing-details-container.js +45 -0
- package/dist/components/modules/jobListing/listing-details-container.js.map +1 -0
- package/dist/components/modules/jobListing/listing-details.js +24 -24
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/{maps/list → list}/field-mapper.js +8 -7
- package/dist/components/modules/list/field-mapper.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/header-item.js +2 -2
- package/dist/components/modules/list/header-item.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/header.js +6 -4
- package/dist/components/modules/list/header.js.map +1 -0
- package/dist/components/modules/list/index.js +36 -0
- package/dist/components/modules/list/index.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/item-expand-card/index.js +3 -1
- package/dist/components/modules/list/item-expand-card/index.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/item-expand-card/recruiter-contact-nav.js +2 -2
- package/dist/components/modules/list/item-expand-card/recruiter-contact-nav.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/item-expand-card/recruiter-details.js +1 -1
- package/dist/components/modules/list/item-expand-card/recruiter-details.js.map +1 -0
- package/dist/components/modules/list/item-expand-card/recruiter-headshot.js.map +1 -0
- package/dist/components/modules/list/item-list.js +28 -0
- package/dist/components/modules/list/item-list.js.map +1 -0
- package/dist/components/modules/list/list-item/index.js +75 -0
- package/dist/components/modules/list/list-item/index.js.map +1 -0
- package/dist/components/modules/list/list-item/list-item-container.js +47 -0
- package/dist/components/modules/list/list-item/list-item-container.js.map +1 -0
- package/dist/components/modules/{maps/list/list-item/index.js → list/list-item/list-item.js} +29 -33
- package/dist/components/modules/list/list-item/list-item.js.map +1 -0
- package/dist/components/modules/maps/map-list.js +3 -3
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/constants/eventTypes.js +1 -1
- package/dist/constants/eventTypes.js.map +1 -1
- package/dist/contexts/mapContext.js +84 -113
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +181 -290
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/trackEventContext.js +1 -1
- package/dist/services/configService.js +10 -28
- package/dist/services/configService.js.map +1 -1
- package/dist/services/googlePlacesNearbyService.js +33 -58
- package/dist/services/googlePlacesNearbyService.js.map +1 -1
- package/dist/services/listingAggregatorService.js +35 -75
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +10 -31
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js +26 -60
- package/dist/services/listingService.js.map +1 -1
- package/dist/services/recruiterService.js +11 -31
- package/dist/services/recruiterService.js.map +1 -1
- package/dist/types/apis/hcApi.d.ts +5 -0
- package/dist/types/clientToken.d.ts +2 -0
- package/dist/types/components/modules/accordions/MapAccordionItem.d.ts +9 -0
- package/dist/types/components/modules/accordions/default.d.ts +19 -0
- package/dist/types/components/modules/buttons/button-group-apply.d.ts +24 -0
- package/dist/types/components/modules/buttons/commute-pill.d.ts +5 -0
- package/dist/types/components/modules/buttons/default.d.ts +48 -0
- package/dist/types/components/modules/buttons/pill-wrapper.d.ts +3 -0
- package/dist/types/components/modules/dialogs/apply-dialog.d.ts +8 -0
- package/dist/types/components/modules/filter/sort.d.ts +8 -0
- package/dist/types/components/modules/grid.d.ts +8 -0
- package/dist/types/components/modules/icon.d.ts +10 -0
- package/dist/types/components/modules/jobListing/listing-details-container.d.ts +6 -0
- package/dist/types/components/modules/jobListing/listing-details.d.ts +18 -0
- package/dist/types/components/modules/list/field-mapper.d.ts +10 -0
- package/dist/types/components/modules/list/header-item.d.ts +11 -0
- package/dist/types/components/modules/list/header.d.ts +11 -0
- package/dist/types/components/modules/list/index.d.ts +9 -0
- package/dist/types/components/modules/list/item-expand-card/index.d.ts +7 -0
- package/dist/types/components/modules/list/item-expand-card/recruiter-contact-nav.d.ts +17 -0
- package/dist/types/components/modules/list/item-expand-card/recruiter-details.d.ts +21 -0
- package/dist/types/components/modules/list/item-expand-card/recruiter-headshot.d.ts +8 -0
- package/dist/types/components/modules/list/item-list.d.ts +21 -0
- package/dist/types/components/modules/list/list-item/index.d.ts +12 -0
- package/dist/types/components/modules/list/list-item/list-item-container.d.ts +14 -0
- package/dist/types/components/modules/list/list-item/list-item.d.ts +3 -0
- package/dist/types/constants/eventTypes.d.ts +13 -0
- package/dist/types/contexts/mapContext.d.ts +29 -0
- package/dist/types/contexts/mapListContext.d.ts +58 -0
- package/dist/types/contexts/trackEventContext.d.ts +6 -0
- package/dist/types/enums/SectionType.d.ts +9 -0
- package/dist/types/hooks/useList.d.ts +13 -0
- package/dist/types/services/configService.d.ts +6 -0
- package/dist/types/services/googlePlacesNearbyService.d.ts +5 -0
- package/dist/types/services/listingAggregatorService.d.ts +12 -0
- package/dist/types/services/listingEntityService.d.ts +6 -0
- package/dist/types/services/listingService.d.ts +9 -0
- package/dist/types/services/recruiterService.d.ts +6 -0
- package/dist/types/types/Address.d.ts +7 -0
- package/dist/types/types/ContentSection.d.ts +8 -0
- package/dist/types/types/GetListingParams.d.ts +8 -0
- package/dist/types/types/LatLng.d.ts +4 -0
- package/dist/types/types/ListingEntity.d.ts +10 -0
- package/dist/types/types/ListingFields.d.ts +20 -0
- package/dist/types/types/Listings.d.ts +31 -0
- package/dist/types/types/Recruiter.d.ts +9 -0
- package/dist/types/types/SimilarListing.d.ts +24 -0
- package/dist/types/types/config/Colors.d.ts +8 -0
- package/dist/types/types/config/MapConfig.d.ts +29 -0
- package/dist/types/types/config/PointsOfInterestConfig.d.ts +13 -0
- package/dist/types/types/config/SearchConfig.d.ts +4 -0
- package/dist/types/util/filterUtil.d.ts +28 -0
- package/dist/types/util/loading.d.ts +3 -0
- package/dist/types/util/localStorageUtil.d.ts +3 -0
- package/dist/types/util/mapUtil.d.ts +15 -0
- package/dist/types/util/sortUtil.d.ts +1 -0
- package/dist/types/util/stringUtils.d.ts +1 -0
- package/dist/util/filterUtil.js +34 -10
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/localStorageUtil.js +37 -28
- package/dist/util/localStorageUtil.js.map +1 -1
- package/dist/util/mapUtil.js.map +1 -1
- package/package.json +22 -14
- package/rollup.config.mjs +23 -19
- package/src/apis/{hcApi.js → hcApi.ts} +27 -11
- package/src/components/HireControlMap.js +132 -129
- package/src/components/modules/accordions/MapAccordionItem.js +32 -74
- package/src/components/modules/filter/index.js +89 -89
- package/src/components/modules/filter/radio-item.js +0 -1
- package/src/components/modules/filter/search.js +93 -92
- package/src/components/modules/jobListing/listing-details-container.js +40 -0
- package/src/components/modules/jobListing/listing-details.js +209 -99
- package/src/components/modules/{maps/list → list}/field-mapper.js +114 -112
- package/src/components/modules/{maps/list → list}/header.js +49 -47
- package/src/components/modules/list/index.tsx +83 -0
- package/src/components/modules/{maps/list → list}/item-expand-card/index.js +24 -22
- package/src/components/modules/list/item-list.tsx +198 -0
- package/src/components/modules/list/list-item/index.js +70 -0
- package/src/components/modules/list/list-item/list-item-container.js +43 -0
- package/src/components/modules/{maps/list/list-item/index.js → list/list-item/list-item.js} +129 -135
- package/src/components/modules/maps/map-list.js +74 -74
- package/src/constants/eventTypes.js +13 -13
- package/src/contexts/mapContext.tsx +129 -0
- package/src/contexts/mapListContext.tsx +297 -0
- package/src/enums/SectionType.ts +9 -0
- package/src/services/{configService.js → configService.ts} +16 -16
- package/src/services/{googlePlacesNearbyService.js → googlePlacesNearbyService.ts} +11 -2
- 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.js → recruiterService.ts} +18 -17
- 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 +20 -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 +30 -0
- package/src/types/config/PointsOfInterestConfig.ts +13 -0
- package/src/types/config/SearchConfig.ts +4 -0
- package/src/util/filterUtil.js +50 -6
- package/src/util/localStorageUtil.ts +34 -0
- package/src/util/mapUtil.js +91 -91
- package/tsconfig.json +23 -0
- package/dist/components/modules/maps/list/field-mapper.js.map +0 -1
- package/dist/components/modules/maps/list/header-item.js.map +0 -1
- package/dist/components/modules/maps/list/header.js.map +0 -1
- package/dist/components/modules/maps/list/index.js +0 -102
- package/dist/components/modules/maps/list/index.js.map +0 -1
- package/dist/components/modules/maps/list/item-expand-card/index.js.map +0 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +0 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +0 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +0 -1
- package/dist/components/modules/maps/list/list-item/index.js.map +0 -1
- package/dist/services/_virtual/_rollupPluginBabelHelpers.js +0 -372
- package/dist/services/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/dist/services/apis/hcApi.js +0 -189
- package/dist/services/apis/hcApi.js.map +0 -1
- package/dist/services/clientToken.js +0 -7
- package/dist/services/clientToken.js.map +0 -1
- package/dist/services/styles/index.css +0 -3
- package/src/components/modules/maps/list/index.js +0 -112
- package/src/contexts/mapContext.js +0 -101
- package/src/contexts/mapListContext.js +0 -242
- package/src/services/listingAggregatorService.js +0 -50
- package/src/services/listingEntityService.js +0 -15
- package/src/services/listingService.js +0 -26
- package/src/util/localStorageUtil.js +0 -27
- /package/dist/components/modules/{maps/list → list}/item-expand-card/recruiter-headshot.js +0 -0
- /package/src/components/modules/{maps/list → list}/header-item.js +0 -0
- /package/src/components/modules/{maps/list → list}/item-expand-card/recruiter-contact-nav.js +0 -0
- /package/src/components/modules/{maps/list → list}/item-expand-card/recruiter-details.js +0 -0
- /package/src/components/modules/{maps/list → list}/item-expand-card/recruiter-headshot.js +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
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/modules/list/list-item';
|
|
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 { mapItems, 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, recruiters: any) =>
|
|
31
|
+
item ? <ListingDetailsContainer item={item} recruiters={recruiters} /> : 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
|
+
|
|
45
|
+
return (
|
|
46
|
+
<ItemsList
|
|
47
|
+
fieldNames={fieldNames}
|
|
48
|
+
showMap={showMap}
|
|
49
|
+
fieldsShown={fieldsShown}
|
|
50
|
+
filteredListings={filteredListings}
|
|
51
|
+
loading={loading}
|
|
52
|
+
sortSetting={sortSetting}
|
|
53
|
+
setSortSetting={setTrackedSortSetting}
|
|
54
|
+
itemLimit={itemLimit}
|
|
55
|
+
loader={loader}
|
|
56
|
+
scrollContainerRef={scrollContainerRef}
|
|
57
|
+
itemRefs={itemRefs}
|
|
58
|
+
selectedListItem={selectedListItem}
|
|
59
|
+
itemExpandedContent={itemExpandedContent}
|
|
60
|
+
includeFavorite={true}
|
|
61
|
+
>
|
|
62
|
+
<Accordion className="hc-divide-y hc-divide-uiAccent/10 hc-z-[1000]" defaultValue={selectedListItem?.id}>
|
|
63
|
+
{(sortSetting ? dynamicSort(filteredListings, sortSetting.field, sortSetting.type) : filteredListings)
|
|
64
|
+
.slice(0, itemLimit)
|
|
65
|
+
.map((item: Listing) => (
|
|
66
|
+
<MapAccordionItemContainer
|
|
67
|
+
key={item.id}
|
|
68
|
+
showMap={showMap}
|
|
69
|
+
item={item}
|
|
70
|
+
itemRefs={itemRefs}
|
|
71
|
+
fieldsShown={fieldsShown}
|
|
72
|
+
itemExpandedContent={itemExpandedContent}
|
|
73
|
+
specialFeatures={specialFeatures}
|
|
74
|
+
isActive={selectedListItem?.id === item.id}
|
|
75
|
+
hasListItemSelected={selectedListItem != null}
|
|
76
|
+
/>
|
|
77
|
+
))}
|
|
78
|
+
</Accordion>
|
|
79
|
+
</ItemsList>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default ItemsListContainer;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { twMerge } from 'tailwind-merge';
|
|
3
|
-
|
|
4
|
-
const CardItemExpand = ({
|
|
5
|
-
className,
|
|
6
|
-
content,
|
|
7
|
-
...props
|
|
8
|
-
}) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
const CardItemExpand = ({
|
|
5
|
+
className,
|
|
6
|
+
content,
|
|
7
|
+
...props
|
|
8
|
+
}) => {
|
|
9
|
+
console.log(content);
|
|
10
|
+
console.log("cardItem render");
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
className={twMerge(
|
|
14
|
+
'hc-flex hc-flex-col lg:hc-flex-row hc-flex-wrap hc-items-stretch hc-gap-x-4 hc-w-full lg:hc-pt-2 hc-border-t hc-border-uiAccent/20',
|
|
15
|
+
className ?? ''
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
{content}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default CardItemExpand;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
// import React, { RefObject } from 'react';
|
|
2
|
+
// import Accordion from '~/components/modules/accordions/default';
|
|
3
|
+
// import Header from '~/components/modules/list/header';
|
|
4
|
+
// import MapAccordionItemContainer from '~/components/modules/list/list-item';
|
|
5
|
+
// import Sort from '~/components/modules/filter/sort';
|
|
6
|
+
// import ListingDetails from '~/components/modules/jobListing/listing-details';
|
|
7
|
+
// import Loading from "~/util/loading";
|
|
8
|
+
// import { dynamicSort } from '~/util/sortUtil';
|
|
9
|
+
// import { IListing } from '~/interfaces/IListings';
|
|
10
|
+
// import { IMapConfig } from '~/interfaces/config/IMapConfig';
|
|
11
|
+
|
|
12
|
+
// interface ItemsListProps {
|
|
13
|
+
// fieldNames: Record<string, string>;
|
|
14
|
+
// showMap: boolean;
|
|
15
|
+
// fieldsShown: string[];
|
|
16
|
+
// specialFeatures: any;
|
|
17
|
+
// mapItems: any;
|
|
18
|
+
// filteredListings: IListing[];
|
|
19
|
+
// loading: boolean;
|
|
20
|
+
// sortSetting: any;
|
|
21
|
+
// setSortSetting: (setting: any) => void;
|
|
22
|
+
// itemLimit: number;
|
|
23
|
+
// loader: RefObject<HTMLDivElement>;
|
|
24
|
+
// scrollContainerRef: RefObject<HTMLDivElement>;
|
|
25
|
+
// itemRefs: any;
|
|
26
|
+
// selectedListItem: IListing | null;
|
|
27
|
+
// itemExpandedContent: (item: IListing, recruiters: any) => JSX.Element | null;
|
|
28
|
+
// }
|
|
29
|
+
|
|
30
|
+
// const ItemsList: React.FC<ItemsListProps> = ({
|
|
31
|
+
// fieldNames,
|
|
32
|
+
// showMap,
|
|
33
|
+
// fieldsShown,
|
|
34
|
+
// specialFeatures,
|
|
35
|
+
// mapItems,
|
|
36
|
+
// filteredListings,
|
|
37
|
+
// loading,
|
|
38
|
+
// sortSetting,
|
|
39
|
+
// setSortSetting,
|
|
40
|
+
// itemLimit,
|
|
41
|
+
// loader,
|
|
42
|
+
// scrollContainerRef,
|
|
43
|
+
// itemRefs,
|
|
44
|
+
// selectedListItem,
|
|
45
|
+
// itemExpandedContent
|
|
46
|
+
// }) => (
|
|
47
|
+
// <div className="hc-relative hc-bg-white md:hc-px-4 hc-flex hc-flex-col">
|
|
48
|
+
// <div className="hc-flex hc-flex-wrap hc-items-center hc-justify-between hc-gap-4 md:hc-mb-2 hc-p-3 md:hc-p-0 hc-bg-uiAccent/10 md:hc-bg-transparent hc-border-b md:hc-border-none hc-border-uiAccent/20">
|
|
49
|
+
// <h2 className="hc-text-gray-500 hc-font-semibold hc-text-xs md:hc-text-sm">
|
|
50
|
+
// {loading && <span>Loading...</span>}
|
|
51
|
+
// {!loading && <span>{filteredListings.length} results</span>}
|
|
52
|
+
// </h2>
|
|
53
|
+
// <div className="hc-block md:hc-hidden">
|
|
54
|
+
// <Sort
|
|
55
|
+
// className={''}
|
|
56
|
+
// fields={fieldsShown}
|
|
57
|
+
// setSortSetting={setSortSetting}
|
|
58
|
+
// fieldNames={fieldNames}
|
|
59
|
+
// />
|
|
60
|
+
// </div>
|
|
61
|
+
// </div>
|
|
62
|
+
// <div>
|
|
63
|
+
// <Header
|
|
64
|
+
// className={''}
|
|
65
|
+
// setSortSetting={setSortSetting}
|
|
66
|
+
// sortSetting={sortSetting}
|
|
67
|
+
// fieldsShown={fieldsShown}
|
|
68
|
+
// fieldNames={fieldNames}
|
|
69
|
+
// />
|
|
70
|
+
// </div>
|
|
71
|
+
// <div
|
|
72
|
+
// ref={scrollContainerRef}
|
|
73
|
+
// className={`
|
|
74
|
+
// hc-flex-grow hc-overflow-y-auto
|
|
75
|
+
// ${showMap ? "md:hc-max-h-45vh hc-max-h-[100vh]" : "md:hc-max-h-95vh hc-max-h-[95vh]"}
|
|
76
|
+
// `}
|
|
77
|
+
// >
|
|
78
|
+
// {loading ? (
|
|
79
|
+
// <div className="hc-flex hc-justify-center hc-items-center hc-pt-20">
|
|
80
|
+
// <Loading />
|
|
81
|
+
// </div>
|
|
82
|
+
// ) : (
|
|
83
|
+
// <Accordion className="hc-divide-y hc-divide-uiAccent/10 hc-z-[1000]" defaultValue={selectedListItem?.id}>
|
|
84
|
+
// {(sortSetting ? dynamicSort(filteredListings, sortSetting.field, sortSetting.type) : filteredListings).slice(0, itemLimit).map((item: IListing) => (
|
|
85
|
+
// <MapAccordionItemContainer
|
|
86
|
+
// key={item.id}
|
|
87
|
+
// showMap={showMap}
|
|
88
|
+
// item={item}
|
|
89
|
+
// itemRefs={itemRefs}
|
|
90
|
+
// fieldsShown={fieldsShown}
|
|
91
|
+
// itemExpandedContent={itemExpandedContent}
|
|
92
|
+
// specialFeatures={specialFeatures}
|
|
93
|
+
// mapItems={mapItems}
|
|
94
|
+
// isActive={selectedListItem?.id === item.id}
|
|
95
|
+
// hasListItemSelected={selectedListItem != null}
|
|
96
|
+
// />
|
|
97
|
+
// ))}
|
|
98
|
+
|
|
99
|
+
// </Accordion>
|
|
100
|
+
// )}
|
|
101
|
+
// <div ref={loader} style={{ height: "100px", textAlign: "center" }}>
|
|
102
|
+
// {filteredListings.length >= itemLimit && <Loading />}
|
|
103
|
+
// </div>
|
|
104
|
+
// </div>
|
|
105
|
+
// </div>
|
|
106
|
+
// );
|
|
107
|
+
|
|
108
|
+
// export default ItemsList;
|
|
109
|
+
import React, { RefObject, ReactNode } from 'react';
|
|
110
|
+
import Header from '~/components/modules/list/header';
|
|
111
|
+
import MapAccordionItemContainer from '~/components/modules/list/list-item';
|
|
112
|
+
import Sort from '~/components/modules/filter/sort';
|
|
113
|
+
import Loading from "~/util/loading";
|
|
114
|
+
import { dynamicSort } from '~/util/sortUtil';
|
|
115
|
+
import { Listing } from '~/types/Listings';
|
|
116
|
+
|
|
117
|
+
interface ItemsListProps {
|
|
118
|
+
fieldNames: Record<string, string>;
|
|
119
|
+
showMap: boolean;
|
|
120
|
+
fieldsShown: string[];
|
|
121
|
+
filteredListings: Listing[];
|
|
122
|
+
loading: boolean;
|
|
123
|
+
sortSetting: any;
|
|
124
|
+
setSortSetting: (setting: any) => void;
|
|
125
|
+
itemLimit: number;
|
|
126
|
+
loader: RefObject<HTMLDivElement>;
|
|
127
|
+
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
128
|
+
itemRefs: any;
|
|
129
|
+
selectedListItem: Listing | null;
|
|
130
|
+
itemExpandedContent: (item: Listing, recruiters: any) => JSX.Element | null;
|
|
131
|
+
children: ReactNode;
|
|
132
|
+
includeFavorite: boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const ItemsList: React.FC<ItemsListProps> = ({
|
|
136
|
+
fieldNames,
|
|
137
|
+
showMap,
|
|
138
|
+
fieldsShown,
|
|
139
|
+
filteredListings,
|
|
140
|
+
loading,
|
|
141
|
+
sortSetting,
|
|
142
|
+
setSortSetting,
|
|
143
|
+
itemLimit,
|
|
144
|
+
loader,
|
|
145
|
+
scrollContainerRef,
|
|
146
|
+
itemRefs,
|
|
147
|
+
selectedListItem,
|
|
148
|
+
itemExpandedContent,
|
|
149
|
+
includeFavorite = false,
|
|
150
|
+
children // Destructure children
|
|
151
|
+
}) => (
|
|
152
|
+
<div className="hc-relative hc-bg-white md:hc-px-4 hc-flex hc-flex-col">
|
|
153
|
+
<div className="hc-flex hc-flex-wrap hc-items-center hc-justify-between hc-gap-4 md:hc-mb-2 hc-p-3 md:hc-p-0 hc-bg-uiAccent/10 md:hc-bg-transparent hc-border-b md:hc-border-none hc-border-uiAccent/20">
|
|
154
|
+
<h2 className="hc-text-gray-500 hc-font-semibold hc-text-xs md:hc-text-sm">
|
|
155
|
+
{loading && <span>Loading...</span>}
|
|
156
|
+
{!loading && <span>{filteredListings.length} results</span>}
|
|
157
|
+
</h2>
|
|
158
|
+
<div className="hc-block md:hc-hidden">
|
|
159
|
+
<Sort
|
|
160
|
+
className={''}
|
|
161
|
+
fields={fieldsShown}
|
|
162
|
+
setSortSetting={setSortSetting}
|
|
163
|
+
fieldNames={fieldNames}
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
<div>
|
|
168
|
+
<Header
|
|
169
|
+
className={''}
|
|
170
|
+
setSortSetting={setSortSetting}
|
|
171
|
+
sortSetting={sortSetting}
|
|
172
|
+
fieldsShown={fieldsShown}
|
|
173
|
+
fieldNames={fieldNames}
|
|
174
|
+
includeFavorite={includeFavorite}
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
<div
|
|
178
|
+
ref={scrollContainerRef}
|
|
179
|
+
className={`
|
|
180
|
+
hc-flex-grow hc-overflow-y-auto
|
|
181
|
+
${showMap ? "md:hc-max-h-45vh hc-max-h-[100vh]" : "md:hc-max-h-95vh hc-max-h-[95vh]"}
|
|
182
|
+
`}
|
|
183
|
+
>
|
|
184
|
+
{loading ? (
|
|
185
|
+
<div className="hc-flex hc-justify-center hc-items-center hc-pt-20">
|
|
186
|
+
<Loading />
|
|
187
|
+
</div>
|
|
188
|
+
) : (
|
|
189
|
+
children
|
|
190
|
+
)}
|
|
191
|
+
<div ref={loader} style={{ height: "100px", textAlign: "center" }}>
|
|
192
|
+
{filteredListings.length >= itemLimit && <Loading />}
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
export default ItemsList;
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { setStorageObject } from '~/util/localStorageUtil';
|
|
6
|
+
import MapAccordionItem from '~/components/modules/accordions/MapAccordionItem';
|
|
7
|
+
import ListItemContainer from '~/components/modules/list/list-item/list-item-container';
|
|
8
|
+
|
|
9
|
+
const MapAccordionItemContainer = ({
|
|
10
|
+
showMap,
|
|
11
|
+
item,
|
|
12
|
+
itemRefs,
|
|
13
|
+
fieldsShown,
|
|
14
|
+
itemExpandedContent,
|
|
15
|
+
specialFeatures,
|
|
16
|
+
isActive,
|
|
17
|
+
hasListItemSelected
|
|
18
|
+
}) => {
|
|
19
|
+
const { mapItems } = useMapList();
|
|
20
|
+
const { selectItem } = useMap();
|
|
21
|
+
const { trackEvent, eventTypes } = useTrackEvent();
|
|
22
|
+
|
|
23
|
+
const setSelectedItemAndZoomMap = (item, isActive) => {
|
|
24
|
+
if (isActive) {
|
|
25
|
+
localStorage.removeItem("selectedListItem");
|
|
26
|
+
const location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.id)) || null;
|
|
27
|
+
selectItem(null, null, 9, { lat: 39.8283, lng: -98.5795 });
|
|
28
|
+
} else {
|
|
29
|
+
setStorageObject("selectedListItem", item);
|
|
30
|
+
const location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.id)) || null;
|
|
31
|
+
selectItem(item, location, 12, {
|
|
32
|
+
lat: location?.latitude,
|
|
33
|
+
lng: location?.longitude
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const handleItemClick = item => {
|
|
39
|
+
trackEvent(eventTypes.JOB_LISTING_SELECTED, {
|
|
40
|
+
jobTitle: item.fields.position,
|
|
41
|
+
jobCategory: item.fields.category,
|
|
42
|
+
entityDisplayName: item?.mapDetails?.entityDisplayName
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
setSelectedItemAndZoomMap(item, isActive);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<MapAccordionItem
|
|
50
|
+
item={item}
|
|
51
|
+
itemRefs={itemRefs}
|
|
52
|
+
itemExpandedContent={itemExpandedContent}
|
|
53
|
+
isActive={isActive}
|
|
54
|
+
|
|
55
|
+
>
|
|
56
|
+
<ListItemContainer
|
|
57
|
+
showMap={showMap}
|
|
58
|
+
item={item}
|
|
59
|
+
itemRefs={itemRefs}
|
|
60
|
+
fieldsShown={fieldsShown}
|
|
61
|
+
specialFeatures={specialFeatures}
|
|
62
|
+
isActive={isActive}
|
|
63
|
+
hasListItemSelected={hasListItemSelected}
|
|
64
|
+
onClick={() => handleItemClick(item)}
|
|
65
|
+
/>
|
|
66
|
+
</MapAccordionItem>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default MapAccordionItemContainer;
|
|
@@ -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;
|