@abcagency/hc-ui-components 1.3.29 → 1.3.31
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 +8 -3
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/modules/filter/item.js +1 -1
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/list/field-mapper.js +2 -2
- package/dist/components/modules/list/field-mapper.js.map +1 -1
- package/dist/components/modules/list/header-item.js +2 -1
- package/dist/components/modules/list/header-item.js.map +1 -1
- package/dist/components/modules/list/header.js +5 -1
- package/dist/components/modules/list/header.js.map +1 -1
- package/dist/components/modules/list/item-list.js +46 -19
- package/dist/components/modules/list/item-list.js.map +1 -1
- package/dist/components/modules/list/list-item/list-item.js +4 -4
- package/dist/components/modules/list/list-item/list-item.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js +1 -2
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/contexts/mapListContext.js +2 -2
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/components/modules/list/header.d.ts +2 -1
- package/dist/types/contexts/mapListContext.d.ts +1 -0
- package/dist/types/util/urlFilterUtil.d.ts +1 -1
- package/dist/util/urlFilterUtil.js +2 -3
- package/dist/util/urlFilterUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/components/HireControlMap.js +4 -1
- package/src/components/modules/filter/item.js +1 -1
- package/src/components/modules/list/field-mapper.js +4 -3
- package/src/components/modules/list/header-item.js +92 -91
- package/src/components/modules/list/header.js +51 -49
- package/src/components/modules/list/item-list.tsx +93 -59
- package/src/components/modules/list/list-item/list-item.js +130 -130
- package/src/contexts/mapListContext.tsx +4 -2
- package/src/util/urlFilterUtil.js +85 -86
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { twMerge } from 'tailwind-merge';
|
|
3
|
-
|
|
4
|
-
import Grid from '~/components/modules/grid';
|
|
5
|
-
import HeaderItem from '~/components/modules/list/header-item';
|
|
6
|
-
|
|
7
|
-
const ListHeader = ({
|
|
8
|
-
className,
|
|
9
|
-
fieldsShown,
|
|
10
|
-
fieldNames,
|
|
11
|
-
fieldIsSortable = true,
|
|
12
|
-
setSortSetting,
|
|
13
|
-
sortSetting,
|
|
14
|
-
includeFavorite = false
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
import Grid from '~/components/modules/grid';
|
|
5
|
+
import HeaderItem from '~/components/modules/list/header-item';
|
|
6
|
+
|
|
7
|
+
const ListHeader = ({
|
|
8
|
+
className,
|
|
9
|
+
fieldsShown,
|
|
10
|
+
fieldNames,
|
|
11
|
+
fieldIsSortable = true,
|
|
12
|
+
setSortSetting,
|
|
13
|
+
sortSetting,
|
|
14
|
+
includeFavorite = false,
|
|
15
|
+
scrollbarWidth
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<Grid
|
|
19
|
+
columns="hc-grid-flow-col hc-auto-cols-fr"
|
|
20
|
+
gap="hc-gap-0"
|
|
21
|
+
isAnimated={false}
|
|
22
|
+
style={{ paddingRight: `${scrollbarWidth && scrollbarWidth > 0 ? scrollbarWidth + 6 : 1 }px` }}
|
|
23
|
+
className={twMerge`
|
|
24
|
+
hc-hidden md:hc-grid hc-bg-uiAccent/10 hc-border-b hc-border-uiAccent/10 hc-sticky hc-top-0 hc-z-10
|
|
25
|
+
${className ?? ""}
|
|
26
|
+
`}
|
|
27
|
+
>
|
|
28
|
+
{fieldsShown.map(field => (
|
|
29
|
+
<HeaderItem
|
|
30
|
+
key={field}
|
|
31
|
+
isSortable={fieldIsSortable}
|
|
32
|
+
sortSetting={sortSetting}
|
|
33
|
+
field={field}
|
|
34
|
+
setSortSetting={setSortSetting}
|
|
35
|
+
>
|
|
36
|
+
{fieldNames[field]}
|
|
37
|
+
</HeaderItem>
|
|
38
|
+
))}
|
|
39
|
+
{ includeFavorite == true &&
|
|
40
|
+
<HeaderItem key={"favorite"}
|
|
41
|
+
isSortable={false}
|
|
42
|
+
field={"favorite"}
|
|
43
|
+
>
|
|
44
|
+
Favorite
|
|
45
|
+
</HeaderItem>
|
|
46
|
+
}
|
|
47
|
+
</Grid>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default ListHeader;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { RefObject, ReactNode } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState, RefObject, ReactNode } from 'react';
|
|
2
2
|
import Header from '~/components/modules/list/header';
|
|
3
3
|
import Sort from '~/components/modules/filter/sort';
|
|
4
4
|
import Loading from "~/util/loading";
|
|
@@ -22,63 +22,97 @@ interface ItemsListProps {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const ItemsList: React.FC<ItemsListProps> = ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}) =>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
+
console.log('Scrollbar width:', newScrollbarWidth);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
checkScrollbar();
|
|
52
|
+
|
|
53
|
+
const resizeObserver = new ResizeObserver(() => checkScrollbar());
|
|
54
|
+
const mutationObserver = new MutationObserver(() => checkScrollbar());
|
|
55
|
+
|
|
56
|
+
if (scrollContainerRef.current) {
|
|
57
|
+
resizeObserver.observe(scrollContainerRef.current);
|
|
58
|
+
mutationObserver.observe(scrollContainerRef.current, { childList: true, subtree: true, attributes: true });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return () => {
|
|
62
|
+
if (scrollContainerRef.current) {
|
|
63
|
+
resizeObserver.unobserve(scrollContainerRef.current);
|
|
64
|
+
mutationObserver.disconnect();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}, [scrollContainerRef]);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div className="hc-relative hc-bg-white md:hc-px-4 hc-flex hc-flex-col">
|
|
71
|
+
<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">
|
|
72
|
+
<h2 className="hc-text-gray-500 hc-font-semibold hc-text-xs md:hc-text-sm">
|
|
73
|
+
{loading && <span>Loading...</span>}
|
|
74
|
+
{!loading && <span>{filteredListings.length} results</span>}
|
|
75
|
+
</h2>
|
|
76
|
+
<div className="hc-block md:hc-hidden">
|
|
77
|
+
<Sort
|
|
78
|
+
className={''}
|
|
79
|
+
fields={fieldsShown}
|
|
80
|
+
setSortSetting={setSortSetting}
|
|
81
|
+
fieldNames={fieldNames}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
<div>
|
|
86
|
+
<Header
|
|
87
|
+
className={''}
|
|
88
|
+
setSortSetting={setSortSetting}
|
|
89
|
+
sortSetting={sortSetting}
|
|
90
|
+
fieldsShown={fieldsShown}
|
|
91
|
+
fieldNames={fieldNames}
|
|
92
|
+
includeFavorite={includeFavorite}
|
|
93
|
+
scrollbarWidth={scrollbarWidth}
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
<div
|
|
97
|
+
ref={scrollContainerRef}
|
|
98
|
+
className={`
|
|
99
|
+
hc-flex-grow hc-overflow-y-auto
|
|
100
|
+
${showMap ? "md:hc-max-h-45vh hc-max-h-[100vh]" : "md:hc-max-h-95vh hc-max-h-[95vh]"}
|
|
101
|
+
`}
|
|
102
|
+
>
|
|
103
|
+
{loading ? (
|
|
104
|
+
<div className="hc-flex hc-justify-center hc-items-center hc-pt-20">
|
|
105
|
+
<Loading />
|
|
106
|
+
</div>
|
|
107
|
+
) : (
|
|
108
|
+
children
|
|
109
|
+
)}
|
|
110
|
+
<div ref={loader} style={{ height: "100px", textAlign: "center" }}>
|
|
111
|
+
{filteredListings.length >= itemLimit && <Loading />}
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
83
117
|
|
|
84
118
|
export default ItemsList;
|
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
import React, { forwardRef
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{...props}
|
|
59
|
-
>
|
|
60
|
-
<Grid
|
|
61
|
-
columns="hc-grid-flow-col hc-auto-cols-fr"
|
|
62
|
-
gap="hc-gap-
|
|
63
|
-
isAnimated={false}
|
|
64
|
-
className={`
|
|
65
|
-
hc-block md:hc-grid hc-
|
|
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"
|
|
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¢er=${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-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¢er=${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
|
+
});
|
|
@@ -76,6 +76,7 @@ interface MapListProviderProps {
|
|
|
76
76
|
trackEvent: (event: string) => void;
|
|
77
77
|
listings?: Listing[];
|
|
78
78
|
setFiltersUrl?:boolean;
|
|
79
|
+
handleUrlUpdate: (searchParams: string) => void;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
@@ -88,7 +89,8 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
88
89
|
linkFormat,
|
|
89
90
|
trackEvent,
|
|
90
91
|
listings = [],
|
|
91
|
-
setFiltersUrl
|
|
92
|
+
setFiltersUrl,
|
|
93
|
+
handleUrlUpdate,
|
|
92
94
|
}) => {
|
|
93
95
|
const firstLoadFilters = () =>{
|
|
94
96
|
let urlFilters = filtersFromURL(window.location)?.filters;
|
|
@@ -228,7 +230,7 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
228
230
|
}
|
|
229
231
|
if(setFiltersUrl === true)
|
|
230
232
|
{
|
|
231
|
-
updateURLWithFilters(tempSelectedFilters, window.location, tempQuery);
|
|
233
|
+
updateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);
|
|
232
234
|
}
|
|
233
235
|
tempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');
|
|
234
236
|
setMapItems(mapItems);
|