@abcagency/hc-ui-components 1.3.58 → 1.3.60

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.
Files changed (139) hide show
  1. package/dist/components/HireControlMap.js +11 -1
  2. package/dist/components/HireControlMap.js.map +1 -1
  3. package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
  4. package/dist/components/containers/filter/commute-container.js +1 -1
  5. package/dist/components/containers/filter/commute-container.js.map +1 -1
  6. package/dist/components/containers/filter/filter-container.js.map +1 -1
  7. package/dist/components/containers/filter/filter-item-container.js.map +1 -1
  8. package/dist/components/containers/filter/location-container.js.map +1 -1
  9. package/dist/components/containers/filter/points-of-interest-container.js.map +1 -1
  10. package/dist/components/containers/filter/points-of-interest-radio-item-container.js.map +1 -1
  11. package/dist/components/containers/filter/search-container.js.map +1 -1
  12. package/dist/components/containers/jobListing/listing-details-container.js +5 -1
  13. package/dist/components/containers/jobListing/listing-details-container.js.map +1 -1
  14. package/dist/components/containers/list/item-list-container.js.map +1 -1
  15. package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
  16. package/dist/components/containers/maps/map-container.js +1 -1
  17. package/dist/components/containers/maps/map-list-container.js.map +1 -1
  18. package/dist/components/containers/maps/map-marker-container.js +1 -1
  19. package/dist/components/containers/maps/map-marker-container.js.map +1 -1
  20. package/dist/components/modules/accordions/default.js +2 -2
  21. package/dist/components/modules/accordions/filterItem.js.map +1 -1
  22. package/dist/components/modules/accordions/filters.js.map +1 -1
  23. package/dist/components/modules/buttons/button-group-apply.js +48 -54
  24. package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
  25. package/dist/components/modules/buttons/default.js +2 -2
  26. package/dist/components/modules/cards/default.js +2 -2
  27. package/dist/components/modules/dialogs/apply-dialog.js +1 -1
  28. package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
  29. package/dist/components/modules/filter/commute.js +2 -2
  30. package/dist/components/modules/filter/commute.js.map +1 -1
  31. package/dist/components/modules/filter/index.js.map +1 -1
  32. package/dist/components/modules/filter/location.js.map +1 -1
  33. package/dist/components/modules/filter/radio-item.js.map +1 -1
  34. package/dist/components/modules/filter/search.js.map +1 -1
  35. package/dist/components/modules/filter/sort.js +2 -2
  36. package/dist/components/modules/grid.js +1 -1
  37. package/dist/components/modules/icon.js +1 -1
  38. package/dist/components/modules/jobListing/listing-details.js +8 -7
  39. package/dist/components/modules/jobListing/listing-details.js.map +1 -1
  40. package/dist/components/modules/list/field-mapper.js.map +1 -1
  41. package/dist/components/modules/list/header-item.js.map +1 -1
  42. package/dist/components/modules/list/header.js +1 -1
  43. package/dist/components/modules/list/item-expand-card/index.js +1 -1
  44. package/dist/components/modules/list/item-expand-card/index.js.map +1 -1
  45. package/dist/components/modules/list/item-expand-card/recruiter-contact-nav.js +38 -38
  46. package/dist/components/modules/list/item-expand-card/recruiter-details.js +40 -40
  47. package/dist/components/modules/list/item-expand-card/recruiter-headshot.js +20 -20
  48. package/dist/components/modules/list/item-list.js +3 -3
  49. package/dist/components/modules/list/item-list.js.map +1 -1
  50. package/dist/components/modules/list/list-item/list-item.js.map +1 -1
  51. package/dist/components/modules/maps/info-window-content.js.map +1 -1
  52. package/dist/components/modules/maps/map-list.js.map +1 -1
  53. package/dist/components/modules/maps/map-marker.js +1 -1
  54. package/dist/components/modules/maps/map-marker.js.map +1 -1
  55. package/dist/components/modules/maps/map.js +1 -1
  56. package/dist/components/modules/maps/place-marker.js +1 -1
  57. package/dist/components/modules/maps/tabs.js +1 -1
  58. package/dist/constants/eventTypes.js +1 -0
  59. package/dist/constants/eventTypes.js.map +1 -1
  60. package/dist/contexts/mapContext.js.map +1 -1
  61. package/dist/contexts/mapListContext.js +3 -1
  62. package/dist/contexts/mapListContext.js.map +1 -1
  63. package/dist/contexts/placesContext.js.map +1 -1
  64. package/dist/contexts/themeContext.js.map +1 -1
  65. package/dist/services/configService.js.map +1 -1
  66. package/dist/services/listingEntityService.js.map +1 -1
  67. package/dist/services/listingService.js.map +1 -1
  68. package/dist/services/recruiterService.js.map +1 -1
  69. package/dist/types/components/modules/buttons/button-group-apply.d.ts +4 -4
  70. package/dist/types/components/modules/jobListing/listing-details.d.ts +3 -1
  71. package/dist/types/constants/eventTypes.d.ts +1 -0
  72. package/dist/types/contexts/mapListContext.d.ts +4 -0
  73. package/dist/util/filterUtil.js +3 -3
  74. package/dist/util/filterUtil.js.map +1 -1
  75. package/dist/util/mapIconUtil.js.map +1 -1
  76. package/dist/util/mapUtil.js.map +1 -1
  77. package/package.json +90 -90
  78. package/src/.editorconfig +12 -12
  79. package/src/bundleIndex.js +14 -14
  80. package/src/components/HireControlMap.js +148 -142
  81. package/src/components/containers/accordions/filter-item-container.js +83 -83
  82. package/src/components/containers/filter/commute-container.js +89 -89
  83. package/src/components/containers/filter/filter-container.js +76 -76
  84. package/src/components/containers/filter/filter-item-container.js +117 -117
  85. package/src/components/containers/filter/location-container.js +45 -45
  86. package/src/components/containers/filter/points-of-interest-container.js +33 -33
  87. package/src/components/containers/filter/points-of-interest-radio-item-container.js +35 -35
  88. package/src/components/containers/filter/search-container.js +61 -61
  89. package/src/components/containers/jobListing/listing-details-container.js +3 -1
  90. package/src/components/containers/list/item-list-container.tsx +81 -81
  91. package/src/components/containers/maps/info-window-content-container.js +53 -53
  92. package/src/components/containers/maps/map-list-container.js +50 -50
  93. package/src/components/containers/maps/map-marker-container.js +78 -78
  94. package/src/components/modules/accordions/filterItem.js +27 -27
  95. package/src/components/modules/accordions/filters.js +32 -32
  96. package/src/components/modules/buttons/button-group-apply.js +115 -135
  97. package/src/components/modules/dialogs/apply-dialog.js +48 -48
  98. package/src/components/modules/filter/commute.js +108 -108
  99. package/src/components/modules/filter/index.js +55 -55
  100. package/src/components/modules/filter/location.js +51 -51
  101. package/src/components/modules/filter/radio-item.js +42 -42
  102. package/src/components/modules/filter/search.js +79 -79
  103. package/src/components/modules/jobListing/listing-details.js +110 -108
  104. package/src/components/modules/list/field-mapper.js +130 -130
  105. package/src/components/modules/list/header-item.js +92 -92
  106. package/src/components/modules/list/item-expand-card/index.js +22 -22
  107. package/src/components/modules/list/item-list.tsx +117 -117
  108. package/src/components/modules/list/list-item/list-item.js +130 -130
  109. package/src/components/modules/maps/info-window-content.js +64 -64
  110. package/src/components/modules/maps/map-list.js +38 -38
  111. package/src/components/modules/maps/map-marker.js +29 -29
  112. package/src/constants/eventTypes.js +15 -14
  113. package/src/contexts/mapContext.tsx +129 -129
  114. package/src/contexts/mapListContext.tsx +326 -318
  115. package/src/contexts/placesContext.js +102 -102
  116. package/src/contexts/themeContext.js +40 -40
  117. package/src/services/configService.ts +16 -16
  118. package/src/services/listingEntityService.ts +16 -16
  119. package/src/services/listingService.ts +40 -40
  120. package/src/services/recruiterService.ts +18 -18
  121. package/src/styles/bundle.css +268 -268
  122. package/src/styles/index.css +33 -33
  123. package/src/types/Address.ts +7 -7
  124. package/src/types/ContentSection.ts +9 -9
  125. package/src/types/GetListingParams.ts +8 -8
  126. package/src/types/LatLng.ts +4 -4
  127. package/src/types/ListingEntity.ts +11 -11
  128. package/src/types/ListingFields.ts +25 -25
  129. package/src/types/Listings.ts +32 -32
  130. package/src/types/Recruiter.ts +9 -9
  131. package/src/types/SimilarListing.ts +24 -24
  132. package/src/types/config/Colors.ts +8 -8
  133. package/src/types/config/MapConfig.ts +31 -31
  134. package/src/types/config/PointsOfInterestConfig.ts +13 -13
  135. package/src/types/config/SearchConfig.ts +4 -4
  136. package/src/util/filterUtil.js +2 -1
  137. package/src/util/mapIconUtil.js +180 -180
  138. package/src/util/mapUtil.js +92 -92
  139. package/dist/types/contexts/themeContext.d.ts +0 -11
@@ -1,22 +1,22 @@
1
- import React from 'react';
2
- import { twMerge } from 'tailwind-merge';
3
-
4
- const CardItemExpand = ({
5
- className,
6
- content,
7
- ...props
8
- }) => {
9
- return (
10
- <div
11
- className={twMerge(
12
- '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',
13
- className ?? ''
14
- )}
15
- {...props}
16
- >
17
- {content}
18
- </div>
19
- );
20
- };
21
-
22
- export default CardItemExpand;
1
+ import React from 'react';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ const CardItemExpand = ({
5
+ className,
6
+ content,
7
+ ...props
8
+ }) => {
9
+ return (
10
+ <div
11
+ className={twMerge(
12
+ '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',
13
+ className ?? ''
14
+ )}
15
+ {...props}
16
+ >
17
+ {content}
18
+ </div>
19
+ );
20
+ };
21
+
22
+ export default CardItemExpand;
@@ -1,117 +1,117 @@
1
- import React, { useEffect, useRef, useState, RefObject, ReactNode } from 'react';
2
- import Header from '~/components/modules/list/header';
3
- import Sort from '~/components/modules/filter/sort';
4
- import Loading from "~/util/loading";
5
- import { Listing } from '~/types/Listings';
6
-
7
- interface ItemsListProps {
8
- fieldNames: Record<string, string>;
9
- showMap: boolean;
10
- fieldsShown: string[];
11
- filteredListings: Listing[];
12
- loading: boolean;
13
- sortSetting: any;
14
- setSortSetting: (setting: any) => void;
15
- itemLimit: number;
16
- loader: RefObject<HTMLDivElement>;
17
- scrollContainerRef: RefObject<HTMLDivElement>;
18
- itemRefs: any;
19
- selectedListItem: Listing | null;
20
- children: ReactNode;
21
- includeFavorite: boolean;
22
- }
23
-
24
- const ItemsList: React.FC<ItemsListProps> = ({
25
- fieldNames,
26
- showMap,
27
- fieldsShown,
28
- filteredListings,
29
- loading,
30
- sortSetting,
31
- setSortSetting,
32
- itemLimit,
33
- loader,
34
- scrollContainerRef,
35
- includeFavorite = false,
36
- children
37
- }) => {
38
- const [scrollbarWidth, setScrollbarWidth] = useState<number>(0);
39
-
40
- const checkScrollbar = () => {
41
- if (scrollContainerRef.current) {
42
- const { scrollHeight, clientHeight, offsetWidth, clientWidth } = scrollContainerRef.current;
43
- const hasVerticalScrollbar = scrollHeight > clientHeight;
44
- const newScrollbarWidth = hasVerticalScrollbar ? offsetWidth - clientWidth : 0;
45
- setScrollbarWidth(newScrollbarWidth);
46
- }
47
- };
48
-
49
- useEffect(() => {
50
- checkScrollbar();
51
-
52
- const resizeObserver = new ResizeObserver(() => checkScrollbar());
53
- const mutationObserver = new MutationObserver(() => checkScrollbar());
54
-
55
- if (scrollContainerRef.current) {
56
- resizeObserver.observe(scrollContainerRef.current);
57
- mutationObserver.observe(scrollContainerRef.current, { childList: true, subtree: true, attributes: true });
58
- }
59
-
60
- return () => {
61
- if (scrollContainerRef.current) {
62
- resizeObserver.unobserve(scrollContainerRef.current);
63
- mutationObserver.disconnect();
64
- }
65
- };
66
- }, [scrollContainerRef]);
67
-
68
- return (
69
- <div className="hc-relative hc-bg-white md:hc-px-4 hc-flex hc-flex-col">
70
- <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">
71
- <h2 className="hc-text-gray-500 hc-font-semibold hc-text-xs md:hc-text-sm">
72
- {loading && <span>Loading...</span>}
73
- {!loading && <span>{filteredListings.length} results</span>}
74
- </h2>
75
- <div className="hc-block md:hc-hidden">
76
- <Sort
77
- className={''}
78
- fields={fieldsShown}
79
- setSortSetting={setSortSetting}
80
- fieldNames={fieldNames}
81
- />
82
- </div>
83
- </div>
84
- <div>
85
- <Header
86
- className={''}
87
- setSortSetting={setSortSetting}
88
- sortSetting={sortSetting}
89
- fieldsShown={fieldsShown}
90
- fieldNames={fieldNames}
91
- includeFavorite={includeFavorite}
92
- scrollbarWidth={scrollbarWidth}
93
- />
94
- </div>
95
- <div
96
- ref={scrollContainerRef}
97
- className={`
98
- hc-flex-grow hc-overflow-y-auto
99
- ${showMap ? "md:hc-max-h-45vh hc-max-h-[100vh]" : "md:hc-max-h-95vh hc-max-h-[95vh]"}
100
- `}
101
- >
102
- {loading ? (
103
- <div className="hc-flex hc-justify-center hc-items-center hc-pt-20">
104
- <Loading />
105
- </div>
106
- ) : (
107
- children
108
- )}
109
- <div ref={loader} style={{ height: "100px", textAlign: "center" }}>
110
- {filteredListings.length >= itemLimit && <Loading />}
111
- </div>
112
- </div>
113
- </div>
114
- );
115
- };
116
-
117
- export default ItemsList;
1
+ import React, { useEffect, useRef, useState, RefObject, ReactNode } from 'react';
2
+ import Header from '~/components/modules/list/header';
3
+ import Sort from '~/components/modules/filter/sort';
4
+ import Loading from "~/util/loading";
5
+ import { Listing } from '~/types/Listings';
6
+
7
+ interface ItemsListProps {
8
+ fieldNames: Record<string, string>;
9
+ showMap: boolean;
10
+ fieldsShown: string[];
11
+ filteredListings: Listing[];
12
+ loading: boolean;
13
+ sortSetting: any;
14
+ setSortSetting: (setting: any) => void;
15
+ itemLimit: number;
16
+ loader: RefObject<HTMLDivElement>;
17
+ scrollContainerRef: RefObject<HTMLDivElement>;
18
+ itemRefs: any;
19
+ selectedListItem: Listing | null;
20
+ children: ReactNode;
21
+ includeFavorite: boolean;
22
+ }
23
+
24
+ const ItemsList: React.FC<ItemsListProps> = ({
25
+ fieldNames,
26
+ showMap,
27
+ fieldsShown,
28
+ filteredListings,
29
+ loading,
30
+ sortSetting,
31
+ setSortSetting,
32
+ itemLimit,
33
+ loader,
34
+ scrollContainerRef,
35
+ includeFavorite = false,
36
+ children
37
+ }) => {
38
+ const [scrollbarWidth, setScrollbarWidth] = useState<number>(0);
39
+
40
+ const checkScrollbar = () => {
41
+ if (scrollContainerRef.current) {
42
+ const { scrollHeight, clientHeight, offsetWidth, clientWidth } = scrollContainerRef.current;
43
+ const hasVerticalScrollbar = scrollHeight > clientHeight;
44
+ const newScrollbarWidth = hasVerticalScrollbar ? offsetWidth - clientWidth : 0;
45
+ setScrollbarWidth(newScrollbarWidth);
46
+ }
47
+ };
48
+
49
+ useEffect(() => {
50
+ checkScrollbar();
51
+
52
+ const resizeObserver = new ResizeObserver(() => checkScrollbar());
53
+ const mutationObserver = new MutationObserver(() => checkScrollbar());
54
+
55
+ if (scrollContainerRef.current) {
56
+ resizeObserver.observe(scrollContainerRef.current);
57
+ mutationObserver.observe(scrollContainerRef.current, { childList: true, subtree: true, attributes: true });
58
+ }
59
+
60
+ return () => {
61
+ if (scrollContainerRef.current) {
62
+ resizeObserver.unobserve(scrollContainerRef.current);
63
+ mutationObserver.disconnect();
64
+ }
65
+ };
66
+ }, [scrollContainerRef]);
67
+
68
+ return (
69
+ <div className="hc-relative hc-bg-white md:hc-px-4 hc-flex hc-flex-col">
70
+ <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">
71
+ <h2 className="hc-text-gray-500 hc-font-semibold hc-text-xs md:hc-text-sm">
72
+ {loading && <span>Loading...</span>}
73
+ {!loading && <span>{filteredListings.length} results</span>}
74
+ </h2>
75
+ <div className="hc-block md:hc-hidden">
76
+ <Sort
77
+ className={''}
78
+ fields={fieldsShown}
79
+ setSortSetting={setSortSetting}
80
+ fieldNames={fieldNames}
81
+ />
82
+ </div>
83
+ </div>
84
+ <div>
85
+ <Header
86
+ className={''}
87
+ setSortSetting={setSortSetting}
88
+ sortSetting={sortSetting}
89
+ fieldsShown={fieldsShown}
90
+ fieldNames={fieldNames}
91
+ includeFavorite={includeFavorite}
92
+ scrollbarWidth={scrollbarWidth}
93
+ />
94
+ </div>
95
+ <div
96
+ ref={scrollContainerRef}
97
+ className={`
98
+ hc-flex-grow hc-overflow-y-auto
99
+ ${showMap ? "md:hc-max-h-45vh hc-max-h-[100vh]" : "md:hc-max-h-95vh hc-max-h-[95vh]"}
100
+ `}
101
+ >
102
+ {loading ? (
103
+ <div className="hc-flex hc-justify-center hc-items-center hc-pt-20">
104
+ <Loading />
105
+ </div>
106
+ ) : (
107
+ children
108
+ )}
109
+ <div ref={loader} style={{ height: "100px", textAlign: "center" }}>
110
+ {filteredListings.length >= itemLimit && <Loading />}
111
+ </div>
112
+ </div>
113
+ </div>
114
+ );
115
+ };
116
+
117
+ export default ItemsList;
@@ -1,130 +1,130 @@
1
- import React, { forwardRef } from 'react';
2
- import Grid from '~/components/modules/grid';
3
- import Icon from '~/components/modules/icon';
4
- import FieldMapper from '~/components/modules/list/field-mapper';
5
-
6
- const ListItem = forwardRef(
7
- (
8
- {
9
- isActive,
10
- bodyClassName,
11
- className,
12
- item,
13
- fieldsShown,
14
- specialFeatures,
15
- onItemSelected,
16
- showMap,
17
- setMobileTab,
18
- handleSettingFavorites,
19
- favorites,
20
- includeFavorite = true,
21
- siteConfig,
22
- trackEvent,
23
- eventTypes,
24
- ...props
25
- },
26
- ref
27
- ) => {
28
- const mapPinColor = !showMap ? null : siteConfig.colors.primary.replace("#", "");
29
-
30
- const handleClick = () => {
31
- if (onItemSelected) {
32
- onItemSelected(item);
33
- }
34
- };
35
- let isFavorite = favorites.includes(item.id);
36
-
37
- const handleFavouriteClick = (event, item) => {
38
- if(!includeFavorite)return;
39
- event.stopPropagation();
40
- let updatedFavorites;
41
- if (isFavorite) {
42
- updatedFavorites = favorites.filter(fav => fav !== item.id);
43
- } else {
44
- updatedFavorites = [...favorites, item.id];
45
- }
46
- isFavorite = !isFavorite;
47
- handleSettingFavorites(updatedFavorites);
48
- };
49
- return (
50
- <button
51
- ref={ref}
52
- onClick={() => { handleClick(); }}
53
- className={`
54
- hc-group hc-relative hc-flex md:hc-flex-col hc-w-full hc-text-left hc-bg-clip-border hc-border hc-border-transparent hc-break-words hc-overflow-hidden hc-cursor-pointer hc-transition-colors hover:hc-bg-uiAccent/5 focus:hover:hc-bg-uiAccent/5
55
- ${isActive ? "hc-bg-uiAccent/5 hc-border-secondary hc-border" : "hc-text-uiText hc-bg-white"}
56
- ${className ?? ""}
57
- `}
58
- {...props}
59
- >
60
- <Grid
61
- columns="hc-pl-2 hc-md-pl-0 hc-grid-flow-col hc-auto-cols-fr"
62
- gap="hc-gap-0"
63
- isAnimated={false}
64
- className={`
65
- hc-block md:hc-grid hc-py-2 hc-w-full hc-grow hc-leading-tight hc-text-sm md:hc-text-xs lg:hc-text-sm
66
- ${bodyClassName ?? ""}
67
- `}
68
- >
69
- <Grid.Item className="hc-hidden md:hc-block md:hc-absolute md:hc-left-1.5 hc-top-1.5">
70
- <span className="hc-sr-only">Expand row</span>
71
- <Icon
72
- icon="fluent-emoji-high-contrast:plus"
73
- size="hc-size-2.5"
74
- className={`
75
- hc-opacity-0 hc-text-uiText/60 hc-transition group-hover:hc-opacity-100 group-active:hc-opacity-100
76
- ${isActive ? "hc-opacity-100 hc-rotate-45" : ""}
77
- `}
78
- />
79
- </Grid.Item>
80
- <FieldMapper
81
- item={item}
82
- fieldsShown={fieldsShown}
83
- specialFeatures={specialFeatures}
84
- isFavorite={isFavorite}
85
- includeFavorite={includeFavorite}
86
- handleFavouriteClick={handleFavouriteClick}
87
- />
88
- {includeFavorite &&
89
- <Grid.Item
90
- key={"favorites"}
91
- className="hc-hidden md:hc-block hc-col-span-1 hc-px-2"
92
- >
93
- <Icon
94
- icon={isFavorite ? "mdi:heart" : "mdi:heart-outline"}
95
- size="hc-size-3.5"
96
- iconClasses={isFavorite ? "hc-text-primary" : ""}
97
- title={!isFavorite ? 'Add job to favorites' : 'Remove job from favorites'}
98
- className="hc-pr-2 hc-transition-opacity hc-duration-300 hc-cursor-pointer hc-opacity-100"
99
- onClick={e => {handleFavouriteClick(e, item);}}
100
- />
101
- </Grid.Item>
102
- }
103
- </Grid>
104
- {showMap && (
105
- <div onClick={() => { setMobileTab("mapTab"); handleClick(); }} className="md:hc-hidden hc-w-2/5 sm:hc-w-1/3 hc-p-1.5 hc-my-1 hc-bg-uiAccent/5 hc-border hc-border-uiAccent/10 hc-rounded-sm">
106
- <img
107
- src={`https://maps.googleapis.com/maps/api/staticmap?scale=2&center=${item.mapDetails?.latitude},${item.mapDetails?.longitude}&zoom=10&size=240x180&maptype=roadmap&markers=color:0x${mapPinColor}%7Clabel:•%7C${item.mapDetails?.latitude},${item.mapDetails?.longitude}&key=${process.env.GOOGLE_MAPS_API_KEY}`}
108
- alt={`Map of location for ${item.fields.position}`}
109
- className="hc-w-full hc-h-full hc-object-cover"
110
- />
111
- </div>
112
- )}
113
- </button>
114
- );
115
- }
116
- );
117
-
118
- ListItem.displayName = "ListItem";
119
-
120
- export default React.memo(ListItem, (prevProps, nextProps) => {
121
- return (
122
- prevProps.isActive === nextProps.isActive &&
123
- prevProps.favorites === nextProps.favorites &&
124
- prevProps.item.id === nextProps.item.id &&
125
- prevProps.item.fields.travelTime === nextProps.item.fields.travelTime &&
126
- prevProps.fieldsShown === nextProps.fieldsShown &&
127
- prevProps.bodyClassName === nextProps.bodyClassName &&
128
- prevProps.className === nextProps.className
129
- );
130
- });
1
+ import React, { forwardRef } from 'react';
2
+ import Grid from '~/components/modules/grid';
3
+ import Icon from '~/components/modules/icon';
4
+ import FieldMapper from '~/components/modules/list/field-mapper';
5
+
6
+ const ListItem = forwardRef(
7
+ (
8
+ {
9
+ isActive,
10
+ bodyClassName,
11
+ className,
12
+ item,
13
+ fieldsShown,
14
+ specialFeatures,
15
+ onItemSelected,
16
+ showMap,
17
+ setMobileTab,
18
+ handleSettingFavorites,
19
+ favorites,
20
+ includeFavorite = true,
21
+ siteConfig,
22
+ trackEvent,
23
+ eventTypes,
24
+ ...props
25
+ },
26
+ ref
27
+ ) => {
28
+ const mapPinColor = !showMap ? null : siteConfig.colors.primary.replace("#", "");
29
+
30
+ const handleClick = () => {
31
+ if (onItemSelected) {
32
+ onItemSelected(item);
33
+ }
34
+ };
35
+ let isFavorite = favorites.includes(item.id);
36
+
37
+ const handleFavouriteClick = (event, item) => {
38
+ if(!includeFavorite)return;
39
+ event.stopPropagation();
40
+ let updatedFavorites;
41
+ if (isFavorite) {
42
+ updatedFavorites = favorites.filter(fav => fav !== item.id);
43
+ } else {
44
+ updatedFavorites = [...favorites, item.id];
45
+ }
46
+ isFavorite = !isFavorite;
47
+ handleSettingFavorites(updatedFavorites);
48
+ };
49
+ return (
50
+ <button
51
+ ref={ref}
52
+ onClick={() => { handleClick(); }}
53
+ className={`
54
+ hc-group hc-relative hc-flex md:hc-flex-col hc-w-full hc-text-left hc-bg-clip-border hc-border hc-border-transparent hc-break-words hc-overflow-hidden hc-cursor-pointer hc-transition-colors hover:hc-bg-uiAccent/5 focus:hover:hc-bg-uiAccent/5
55
+ ${isActive ? "hc-bg-uiAccent/5 hc-border-secondary hc-border" : "hc-text-uiText hc-bg-white"}
56
+ ${className ?? ""}
57
+ `}
58
+ {...props}
59
+ >
60
+ <Grid
61
+ columns="hc-pl-2 hc-md-pl-0 hc-grid-flow-col hc-auto-cols-fr"
62
+ gap="hc-gap-0"
63
+ isAnimated={false}
64
+ className={`
65
+ hc-block md:hc-grid hc-py-2 hc-w-full hc-grow hc-leading-tight hc-text-sm md:hc-text-xs lg:hc-text-sm
66
+ ${bodyClassName ?? ""}
67
+ `}
68
+ >
69
+ <Grid.Item className="hc-hidden md:hc-block md:hc-absolute md:hc-left-1.5 hc-top-1.5">
70
+ <span className="hc-sr-only">Expand row</span>
71
+ <Icon
72
+ icon="fluent-emoji-high-contrast:plus"
73
+ size="hc-size-2.5"
74
+ className={`
75
+ hc-opacity-0 hc-text-uiText/60 hc-transition group-hover:hc-opacity-100 group-active:hc-opacity-100
76
+ ${isActive ? "hc-opacity-100 hc-rotate-45" : ""}
77
+ `}
78
+ />
79
+ </Grid.Item>
80
+ <FieldMapper
81
+ item={item}
82
+ fieldsShown={fieldsShown}
83
+ specialFeatures={specialFeatures}
84
+ isFavorite={isFavorite}
85
+ includeFavorite={includeFavorite}
86
+ handleFavouriteClick={handleFavouriteClick}
87
+ />
88
+ {includeFavorite &&
89
+ <Grid.Item
90
+ key={"favorites"}
91
+ className="hc-hidden md:hc-block hc-col-span-1 hc-px-2"
92
+ >
93
+ <Icon
94
+ icon={isFavorite ? "mdi:heart" : "mdi:heart-outline"}
95
+ size="hc-size-3.5"
96
+ iconClasses={isFavorite ? "hc-text-primary" : ""}
97
+ title={!isFavorite ? 'Add job to favorites' : 'Remove job from favorites'}
98
+ className="hc-pr-2 hc-transition-opacity hc-duration-300 hc-cursor-pointer hc-opacity-100"
99
+ onClick={e => {handleFavouriteClick(e, item);}}
100
+ />
101
+ </Grid.Item>
102
+ }
103
+ </Grid>
104
+ {showMap && (
105
+ <div onClick={() => { setMobileTab("mapTab"); handleClick(); }} className="md:hc-hidden hc-w-2/5 sm:hc-w-1/3 hc-p-1.5 hc-my-1 hc-bg-uiAccent/5 hc-border hc-border-uiAccent/10 hc-rounded-sm">
106
+ <img
107
+ src={`https://maps.googleapis.com/maps/api/staticmap?scale=2&center=${item.mapDetails?.latitude},${item.mapDetails?.longitude}&zoom=10&size=240x180&maptype=roadmap&markers=color:0x${mapPinColor}%7Clabel:•%7C${item.mapDetails?.latitude},${item.mapDetails?.longitude}&key=${process.env.GOOGLE_MAPS_API_KEY}`}
108
+ alt={`Map of location for ${item.fields.position}`}
109
+ className="hc-w-full hc-h-full hc-object-cover"
110
+ />
111
+ </div>
112
+ )}
113
+ </button>
114
+ );
115
+ }
116
+ );
117
+
118
+ ListItem.displayName = "ListItem";
119
+
120
+ export default React.memo(ListItem, (prevProps, nextProps) => {
121
+ return (
122
+ prevProps.isActive === nextProps.isActive &&
123
+ prevProps.favorites === nextProps.favorites &&
124
+ prevProps.item.id === nextProps.item.id &&
125
+ prevProps.item.fields.travelTime === nextProps.item.fields.travelTime &&
126
+ prevProps.fieldsShown === nextProps.fieldsShown &&
127
+ prevProps.bodyClassName === nextProps.bodyClassName &&
128
+ prevProps.className === nextProps.className
129
+ );
130
+ });
@@ -1,64 +1,64 @@
1
- import React from 'react';
2
-
3
- const InfoWindowContent = ({
4
- items,
5
- fullAddress,
6
- applyFilters,
7
- mapInfoWindowConfig
8
- }) => {
9
- if (!items || items.length < 0) {
10
- return null;
11
- }
12
-
13
- let mapDetails = items[0].mapDetails;
14
- let entityDisplayName = mapDetails?.entityDisplayName;
15
- let address = mapDetails?.address;
16
-
17
- let displayHeader = entityDisplayName;
18
- let displayAddress = fullAddress;
19
-
20
- if (mapInfoWindowConfig) {
21
- if (mapInfoWindowConfig.entityHeaderField && mapDetails[mapInfoWindowConfig.entityHeaderField]) {
22
- displayHeader = mapDetails[mapInfoWindowConfig.entityHeaderField];
23
- }
24
-
25
- if (mapInfoWindowConfig.showEntityAddressFields) {
26
- const addressFields = mapInfoWindowConfig.showEntityAddressFields
27
- .map(field => address[field])
28
- .filter(Boolean)
29
- .join(', ');
30
- displayAddress = addressFields;
31
- }
32
- } else {
33
- if (!entityDisplayName.includes(address?.street) && !entityDisplayName.includes(address?.zip)) {
34
- displayAddress = fullAddress;
35
- } else {
36
- displayAddress = '';
37
- }
38
- }
39
-
40
- return (
41
- <div className="hc-flex-auto hc-p-2">
42
- <div>
43
- <div>
44
- <h4 className="hc-text-lg hc-font-bold hc-leading-tight hc-mb-3">
45
- {displayHeader}
46
- </h4>
47
- <p>{displayAddress}</p>
48
- <div className="hc-pt-2">
49
- <button
50
- className="hc-cursor-pointer hover:hc-opacity-70 hc-text-primary"
51
- onClick={applyFilters}
52
- >
53
- {items.length > 1
54
- ? `View All ${items.length} jobs at this location`
55
- : `View job at this location`}
56
- </button>
57
- </div>
58
- </div>
59
- </div>
60
- </div>
61
- );
62
- };
63
-
64
- export default InfoWindowContent;
1
+ import React from 'react';
2
+
3
+ const InfoWindowContent = ({
4
+ items,
5
+ fullAddress,
6
+ applyFilters,
7
+ mapInfoWindowConfig
8
+ }) => {
9
+ if (!items || items.length < 0) {
10
+ return null;
11
+ }
12
+
13
+ let mapDetails = items[0].mapDetails;
14
+ let entityDisplayName = mapDetails?.entityDisplayName;
15
+ let address = mapDetails?.address;
16
+
17
+ let displayHeader = entityDisplayName;
18
+ let displayAddress = fullAddress;
19
+
20
+ if (mapInfoWindowConfig) {
21
+ if (mapInfoWindowConfig.entityHeaderField && mapDetails[mapInfoWindowConfig.entityHeaderField]) {
22
+ displayHeader = mapDetails[mapInfoWindowConfig.entityHeaderField];
23
+ }
24
+
25
+ if (mapInfoWindowConfig.showEntityAddressFields) {
26
+ const addressFields = mapInfoWindowConfig.showEntityAddressFields
27
+ .map(field => address[field])
28
+ .filter(Boolean)
29
+ .join(', ');
30
+ displayAddress = addressFields;
31
+ }
32
+ } else {
33
+ if (!entityDisplayName.includes(address?.street) && !entityDisplayName.includes(address?.zip)) {
34
+ displayAddress = fullAddress;
35
+ } else {
36
+ displayAddress = '';
37
+ }
38
+ }
39
+
40
+ return (
41
+ <div className="hc-flex-auto hc-p-2">
42
+ <div>
43
+ <div>
44
+ <h4 className="hc-text-lg hc-font-bold hc-leading-tight hc-mb-3">
45
+ {displayHeader}
46
+ </h4>
47
+ <p>{displayAddress}</p>
48
+ <div className="hc-pt-2">
49
+ <button
50
+ className="hc-cursor-pointer hover:hc-opacity-70 hc-text-primary"
51
+ onClick={applyFilters}
52
+ >
53
+ {items.length > 1
54
+ ? `View All ${items.length} jobs at this location`
55
+ : `View job at this location`}
56
+ </button>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ );
62
+ };
63
+
64
+ export default InfoWindowContent;