@abcagency/hc-ui-components 1.3.14 → 1.3.16
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/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/apis/hcApi.js +1 -1
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/clientToken.js.map +1 -1
- package/dist/components/HireControlMap.js +15 -5
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js +11 -1
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/accordions/default.js.map +1 -1
- package/dist/components/modules/accordions/filterItem.js +2 -1
- package/dist/components/modules/accordions/filterItem.js.map +1 -1
- package/dist/components/modules/accordions/filters.js +0 -3
- package/dist/components/modules/accordions/filters.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js +36 -15
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/components/modules/buttons/commute-pill.js.map +1 -1
- package/dist/components/modules/buttons/default.js.map +1 -1
- package/dist/components/modules/buttons/items-pill.js.map +1 -1
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
- package/dist/components/modules/buttons/show-all-button.js.map +1 -1
- package/dist/components/modules/cards/default.js.map +1 -1
- package/dist/components/modules/cards/filter.js.map +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
- package/dist/components/modules/filter/commute.js +22 -6
- package/dist/components/modules/filter/commute.js.map +1 -1
- package/dist/components/modules/filter/index.js +7 -0
- package/dist/components/modules/filter/index.js.map +1 -1
- package/dist/components/modules/filter/item.js +16 -1
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/location.js +1 -1
- package/dist/components/modules/filter/location.js.map +1 -1
- package/dist/components/modules/filter/points-of-interest.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js +7 -0
- package/dist/components/modules/filter/radio-item.js.map +1 -1
- package/dist/components/modules/filter/search.js.map +1 -1
- package/dist/components/modules/filter/sort.js.map +1 -1
- package/dist/components/modules/grid.js.map +1 -1
- package/dist/components/modules/icon.js.map +1 -1
- package/dist/components/modules/jobListing/listing-details.js +6 -0
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js +20 -0
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/components/modules/maps/list/field-mapper.js.map +1 -1
- package/dist/components/modules/maps/list/header-item.js.map +1 -1
- package/dist/components/modules/maps/list/header.js.map +1 -1
- package/dist/components/modules/maps/list/index.js +21 -12
- package/dist/components/modules/maps/list/index.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/index.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +1 -1
- package/dist/components/modules/maps/list/list-item/index.js +12 -2
- package/dist/components/modules/maps/list/list-item/index.js.map +1 -1
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/components/modules/maps/map-marker.js +10 -0
- package/dist/components/modules/maps/map-marker.js.map +1 -1
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/components/modules/maps/place-marker.js.map +1 -1
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/constants/eventTypes.js +16 -0
- package/dist/constants/eventTypes.js.map +1 -0
- package/dist/constants/placeTypes.js.map +1 -1
- package/dist/contexts/mapContext.js +9 -27
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +57 -38
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/contexts/trackEventContext.js +20 -0
- package/dist/contexts/trackEventContext.js.map +1 -0
- package/dist/hooks/useList.js +1 -13
- package/dist/hooks/useList.js.map +1 -1
- package/dist/services/apis/hcApi.js +1 -1
- package/dist/services/apis/hcApi.js.map +1 -1
- package/dist/services/clientToken.js.map +1 -1
- package/dist/services/configService.js.map +1 -1
- package/dist/services/googlePlacesNearbyService.js.map +1 -1
- package/dist/services/listingAggregatorService.js +43 -16
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js.map +1 -1
- package/dist/services/recruiterService.js.map +1 -1
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/loading.js.map +1 -1
- package/dist/util/localStorageUtil.js.map +1 -1
- package/dist/util/mapIconUtil.js.map +1 -1
- package/dist/util/mapUtil.js.map +1 -1
- package/dist/util/sortUtil.js.map +1 -1
- package/dist/util/stringUtils.js.map +1 -1
- package/jsconfig.json +7 -7
- package/package.json +60 -60
- package/postcss.config.js +13 -13
- package/preset.default.js +15 -15
- package/rollup.config.mjs +88 -87
- package/src/apis/hcApi.js +93 -93
- package/src/clientToken.js +9 -9
- package/src/components/HireControlMap.js +129 -124
- package/src/components/modules/accordions/MapAccordionItem.js +74 -72
- package/src/components/modules/accordions/default.js +171 -171
- package/src/components/modules/accordions/filterItem.js +55 -53
- package/src/components/modules/accordions/filters.js +47 -47
- package/src/components/modules/buttons/button-group-apply.js +123 -116
- package/src/components/modules/buttons/commute-pill.js +22 -22
- package/src/components/modules/buttons/default.js +194 -194
- package/src/components/modules/buttons/items-pill.js +35 -35
- package/src/components/modules/buttons/pill-wrapper.js +27 -27
- package/src/components/modules/buttons/show-all-button.js +20 -20
- package/src/components/modules/cards/default.js +167 -167
- package/src/components/modules/cards/filter.js +56 -56
- package/src/components/modules/dialogs/apply-dialog.js +48 -48
- package/src/components/modules/filter/commute.js +154 -149
- package/src/components/modules/filter/index.js +89 -87
- package/src/components/modules/filter/item.js +87 -76
- package/src/components/modules/filter/location.js +71 -71
- package/src/components/modules/filter/points-of-interest.js +44 -44
- package/src/components/modules/filter/radio-item.js +57 -53
- package/src/components/modules/filter/search.js +92 -92
- package/src/components/modules/filter/sort.js +83 -83
- package/src/components/modules/grid.js +54 -54
- package/src/components/modules/icon.js +33 -33
- package/src/components/modules/jobListing/listing-details.js +99 -95
- package/src/components/modules/maps/info-window-card.js +17 -17
- package/src/components/modules/maps/info-window-content.js +81 -74
- package/src/components/modules/maps/list/field-mapper.js +112 -112
- package/src/components/modules/maps/list/header-item.js +91 -91
- package/src/components/modules/maps/list/header.js +47 -47
- package/src/components/modules/maps/list/index.js +112 -107
- package/src/components/modules/maps/list/item-expand-card/index.js +22 -22
- package/src/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +50 -50
- package/src/components/modules/maps/list/item-expand-card/recruiter-details.js +68 -68
- package/src/components/modules/maps/list/item-expand-card/recruiter-headshot.js +22 -22
- package/src/components/modules/maps/list/list-item/index.js +135 -133
- package/src/components/modules/maps/map-list.js +74 -74
- package/src/components/modules/maps/map-marker.js +88 -86
- package/src/components/modules/maps/map.js +230 -230
- package/src/components/modules/maps/place-marker.js +41 -41
- package/src/components/modules/maps/tabs.js +81 -81
- package/src/constants/eventTypes.js +13 -0
- package/src/constants/placeTypes.js +8 -8
- package/src/contexts/mapContext.js +101 -115
- package/src/contexts/mapListContext.js +242 -222
- package/src/contexts/placesContext.js +102 -102
- package/src/contexts/trackEventContext.js +14 -0
- package/src/hooks/useList.js +89 -100
- package/src/index.js +3 -3
- package/src/services/configService.js +16 -16
- package/src/services/googlePlacesNearbyService.js +33 -33
- package/src/services/listingAggregatorService.js +50 -45
- package/src/services/listingEntityService.js +15 -15
- package/src/services/listingService.js +26 -26
- package/src/services/recruiterService.js +17 -17
- package/src/styles/index.css +23 -23
- package/src/util/arrayUtil.js +3 -3
- package/src/util/fieldMapper.js +22 -22
- package/src/util/filterUtil.js +195 -195
- package/src/util/loading.js +17 -17
- package/src/util/localStorageUtil.js +26 -26
- package/src/util/mapIconUtil.js +180 -180
- package/src/util/mapUtil.js +91 -91
- package/src/util/sortUtil.js +32 -32
- package/src/util/stringUtils.js +6 -6
- package/src/util/urlFilterUtil.js +90 -90
- package/tailwind.config.js +126 -126
- package/.editorconfig +0 -12
- package/.eslintrc +0 -105
- package/.prettierignore +0 -3
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import * as Dialog from '@radix-ui/react-dialog';
|
|
3
|
-
|
|
4
|
-
import Button from '~/components/modules/buttons/default';
|
|
5
|
-
import Icon from '~/components/modules/icon';
|
|
6
|
-
|
|
7
|
-
const ApplyDialog = ({ children, applyUrl, internalApplyLink, companyName }) => (
|
|
8
|
-
|
|
9
|
-
<Dialog.Root >
|
|
10
|
-
<Dialog.Trigger asChild>
|
|
11
|
-
{children}
|
|
12
|
-
</Dialog.Trigger>
|
|
13
|
-
<Dialog.Portal>
|
|
14
|
-
<Dialog.Overlay className="hc-bg-black/50 hc-fixed hc-inset-0 hc-animate-overlayShow" />
|
|
15
|
-
<Dialog.Content className="hc-fit-content hc-animate-contentShow hc-fixed hc-inset-0 hc-m-auto hc-max-h-[85vh] hc-w-[90vw] hc-max-w-[450px] hc-rounded-[6px] hc-bg-white hc-p-[25px] hc-shadow-lg focus:hc-outline-none hc-flex hc-flex-col hc-items-center hc-text-center">
|
|
16
|
-
<Dialog.Title className="hc-text-[17px] hc-font-medium hc-w-full">
|
|
17
|
-
Career Opportunities
|
|
18
|
-
</Dialog.Title>
|
|
19
|
-
<Dialog.Description className="hc-mt-4 hc-mb-5 hc-text-[15px] hc-leading-normal hc-w-full">
|
|
20
|
-
Are you currently a {companyName} employee?
|
|
21
|
-
</Dialog.Description>
|
|
22
|
-
<div className="hc-flex hc-justify-center hc-space-x-4 hc-w-full">
|
|
23
|
-
<Dialog.Close asChild>
|
|
24
|
-
<Button.Anchor variant="outline" href={internalApplyLink}>
|
|
25
|
-
Yes
|
|
26
|
-
</Button.Anchor>
|
|
27
|
-
</Dialog.Close>
|
|
28
|
-
<Dialog.Close asChild>
|
|
29
|
-
<Button.Anchor variant="primary" href={applyUrl}>
|
|
30
|
-
No
|
|
31
|
-
</Button.Anchor>
|
|
32
|
-
</Dialog.Close>
|
|
33
|
-
</div>
|
|
34
|
-
<Dialog.Close asChild>
|
|
35
|
-
<Button.Anchor className="hc-absolute hc-top-[10px] hc-right-[10px] hc-inline-flex hc-h-[25px] hc-w-[25px] hc-items-center hc-justify-center hc-rounded-full focus:hc-outline-none"
|
|
36
|
-
variant="ghost" aria-label="Close">
|
|
37
|
-
<Icon
|
|
38
|
-
icon="mdi:times"
|
|
39
|
-
className="hc-cursor-pointer hc-text-black hover:hc-text-gray-500 hover:hc-opacity-75"
|
|
40
|
-
/>
|
|
41
|
-
</Button.Anchor>
|
|
42
|
-
</Dialog.Close>
|
|
43
|
-
</Dialog.Content>
|
|
44
|
-
</Dialog.Portal>
|
|
45
|
-
</Dialog.Root>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
export default ApplyDialog;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Dialog from '@radix-ui/react-dialog';
|
|
3
|
+
|
|
4
|
+
import Button from '~/components/modules/buttons/default';
|
|
5
|
+
import Icon from '~/components/modules/icon';
|
|
6
|
+
|
|
7
|
+
const ApplyDialog = ({ children, applyUrl, internalApplyLink, companyName }) => (
|
|
8
|
+
|
|
9
|
+
<Dialog.Root >
|
|
10
|
+
<Dialog.Trigger asChild>
|
|
11
|
+
{children}
|
|
12
|
+
</Dialog.Trigger>
|
|
13
|
+
<Dialog.Portal>
|
|
14
|
+
<Dialog.Overlay className="hc-bg-black/50 hc-fixed hc-inset-0 hc-animate-overlayShow" />
|
|
15
|
+
<Dialog.Content className="hc-fit-content hc-animate-contentShow hc-fixed hc-inset-0 hc-m-auto hc-max-h-[85vh] hc-w-[90vw] hc-max-w-[450px] hc-rounded-[6px] hc-bg-white hc-p-[25px] hc-shadow-lg focus:hc-outline-none hc-flex hc-flex-col hc-items-center hc-text-center">
|
|
16
|
+
<Dialog.Title className="hc-text-[17px] hc-font-medium hc-w-full">
|
|
17
|
+
Career Opportunities
|
|
18
|
+
</Dialog.Title>
|
|
19
|
+
<Dialog.Description className="hc-mt-4 hc-mb-5 hc-text-[15px] hc-leading-normal hc-w-full">
|
|
20
|
+
Are you currently a {companyName} employee?
|
|
21
|
+
</Dialog.Description>
|
|
22
|
+
<div className="hc-flex hc-justify-center hc-space-x-4 hc-w-full">
|
|
23
|
+
<Dialog.Close asChild>
|
|
24
|
+
<Button.Anchor variant="outline" href={internalApplyLink}>
|
|
25
|
+
Yes
|
|
26
|
+
</Button.Anchor>
|
|
27
|
+
</Dialog.Close>
|
|
28
|
+
<Dialog.Close asChild>
|
|
29
|
+
<Button.Anchor variant="primary" href={applyUrl}>
|
|
30
|
+
No
|
|
31
|
+
</Button.Anchor>
|
|
32
|
+
</Dialog.Close>
|
|
33
|
+
</div>
|
|
34
|
+
<Dialog.Close asChild>
|
|
35
|
+
<Button.Anchor className="hc-absolute hc-top-[10px] hc-right-[10px] hc-inline-flex hc-h-[25px] hc-w-[25px] hc-items-center hc-justify-center hc-rounded-full focus:hc-outline-none"
|
|
36
|
+
variant="ghost" aria-label="Close">
|
|
37
|
+
<Icon
|
|
38
|
+
icon="mdi:times"
|
|
39
|
+
className="hc-cursor-pointer hc-text-black hover:hc-text-gray-500 hover:hc-opacity-75"
|
|
40
|
+
/>
|
|
41
|
+
</Button.Anchor>
|
|
42
|
+
</Dialog.Close>
|
|
43
|
+
</Dialog.Content>
|
|
44
|
+
</Dialog.Portal>
|
|
45
|
+
</Dialog.Root>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export default ApplyDialog;
|
|
@@ -1,149 +1,154 @@
|
|
|
1
|
-
import React, { Fragment, useRef, useState, useEffect } from 'react';
|
|
2
|
-
import { Combobox, Transition } from '@headlessui/react';
|
|
3
|
-
import usePlacesAutocomplete, { getGeocode, getLatLng } from 'use-places-autocomplete';
|
|
4
|
-
|
|
5
|
-
import Button from '~/components/modules/buttons/default';
|
|
6
|
-
import Icon from "~/components/modules/icon";
|
|
7
|
-
|
|
8
|
-
import { useMapList } from '~/contexts/mapListContext';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
{({
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
1
|
+
import React, { Fragment, useRef, useState, useEffect } from 'react';
|
|
2
|
+
import { Combobox, Transition } from '@headlessui/react';
|
|
3
|
+
import usePlacesAutocomplete, { getGeocode, getLatLng } from 'use-places-autocomplete';
|
|
4
|
+
|
|
5
|
+
import Button from '~/components/modules/buttons/default';
|
|
6
|
+
import Icon from "~/components/modules/icon";
|
|
7
|
+
|
|
8
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
9
|
+
import { useTrackEvent } from '~/contexts/trackEventContext';
|
|
10
|
+
import { getStorageItem } from '~/util/localStorageUtil';
|
|
11
|
+
|
|
12
|
+
const FilterCommute = ({ className }) => {
|
|
13
|
+
const {
|
|
14
|
+
ready,
|
|
15
|
+
suggestions: { status, data },
|
|
16
|
+
setValue,
|
|
17
|
+
clearSuggestions
|
|
18
|
+
} = usePlacesAutocomplete();
|
|
19
|
+
|
|
20
|
+
const [selected, setSelected] = useState(getStorageItem('selectedCommute', ''));
|
|
21
|
+
const inputRef = useRef(null);
|
|
22
|
+
const { setCommuteLocation, commuteLocation } = useMapList();
|
|
23
|
+
const [isCurrentLocation, setIsCurrentLocation] = useState(getStorageItem('isCurrentLocation', false));
|
|
24
|
+
const { trackEvent, eventTypes } = useTrackEvent();
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (commuteLocation !== null && commuteLocation != '') return;
|
|
28
|
+
setIsCurrentLocation(false);
|
|
29
|
+
localStorage.removeItem('isCurrentLocation');
|
|
30
|
+
localStorage.removeItem('selectedCommute');
|
|
31
|
+
setSelected("");
|
|
32
|
+
}, [commuteLocation]);
|
|
33
|
+
|
|
34
|
+
const handleSelect = async (val, isCurrLocation = false) => {
|
|
35
|
+
setValue(val, false);
|
|
36
|
+
setSelected(val);
|
|
37
|
+
localStorage.setItem('selectedCommute', val);
|
|
38
|
+
clearSuggestions();
|
|
39
|
+
if (isCurrLocation) return;
|
|
40
|
+
try {
|
|
41
|
+
const results = await getGeocode({ address: val });
|
|
42
|
+
const { lat, lng } = await getLatLng(results[0]);
|
|
43
|
+
trackEvent(eventTypes.COMMUTE_ORIGIN_ADDED, { commuteLocation: { lat, lng }, isCurrentLocation: false });
|
|
44
|
+
setCommuteLocation({ lat, lng });
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// no-op
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const fetchLocation = () => {
|
|
51
|
+
if (!navigator.geolocation) {
|
|
52
|
+
console.error("Geolocation is not supported by this browser.");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
navigator.geolocation.getCurrentPosition(
|
|
56
|
+
position => {
|
|
57
|
+
const location = {
|
|
58
|
+
lat: position.coords.latitude,
|
|
59
|
+
lng: position.coords.longitude
|
|
60
|
+
};
|
|
61
|
+
setCommuteLocation(location);
|
|
62
|
+
trackEvent(eventTypes.COMMUTE_ORIGIN_ADDED, { commuteLocation: location, isCurrentLocation: true });
|
|
63
|
+
handleSelect("Current Location");
|
|
64
|
+
},
|
|
65
|
+
error => {
|
|
66
|
+
console.error("Error fetching location", error);
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div className={`relative ${className ?? ""}`}>
|
|
73
|
+
<label
|
|
74
|
+
htmlFor="commute"
|
|
75
|
+
className="hc-flex hc-items-center hc-gap-2 hc-mb-2 hc-text-xs hc-uppercase hc-font-bold hc-text-uiText"
|
|
76
|
+
>
|
|
77
|
+
<Icon
|
|
78
|
+
icon="ri:pin-distance-fill"
|
|
79
|
+
size="hc-size-5"
|
|
80
|
+
className="hc-text-uiAccent/30"
|
|
81
|
+
/>
|
|
82
|
+
<span>
|
|
83
|
+
<span className="md:hc-hidden lg:hc-inline">Calculate your</span> commute
|
|
84
|
+
</span>
|
|
85
|
+
</label>
|
|
86
|
+
|
|
87
|
+
<Combobox value={selected} onChange={handleSelect}>
|
|
88
|
+
<div className="hc-relative hc-mt-1">
|
|
89
|
+
<div className="hc-relative hc-flex hc-items-center hc-w-full hc-pr-2 hc-cursor-default hc-overflow-hidden hc-rounded hc-bg-white hc-text-left hc-border hc-border-uiAccent/20 focus-within:hc-ring-1 focus-within:hc-ring-uiAccent focus:hc-outline-none">
|
|
90
|
+
<Combobox.Input
|
|
91
|
+
className="hc-w-full hc-border-none hc-py-2 hc-pl-4 hc-pr-1 hc-text-sm hc-leading-5 hc-text-gray-900 focus:hc-ring-0 placeholder:hc-text-gray-400"
|
|
92
|
+
onChange={e => {
|
|
93
|
+
setValue(e.target.value);
|
|
94
|
+
setSelected(e.target.value);
|
|
95
|
+
}}
|
|
96
|
+
value={selected}
|
|
97
|
+
disabled={!ready}
|
|
98
|
+
placeholder="Starting point"
|
|
99
|
+
ref={inputRef}
|
|
100
|
+
/>
|
|
101
|
+
<Button.Btn
|
|
102
|
+
variant="icon"
|
|
103
|
+
size="sqsm"
|
|
104
|
+
onClick={() => {
|
|
105
|
+
setIsCurrentLocation(!isCurrentLocation);
|
|
106
|
+
localStorage.setItem('isCurrentLocation', !isCurrentLocation);
|
|
107
|
+
if (isCurrentLocation || commuteLocation) {
|
|
108
|
+
setCommuteLocation("");
|
|
109
|
+
setSelected("");
|
|
110
|
+
} else if (!commuteLocation) { fetchLocation(); }
|
|
111
|
+
}}
|
|
112
|
+
|
|
113
|
+
className=""
|
|
114
|
+
>
|
|
115
|
+
<span className="hc-sr-only">Use your location</span>
|
|
116
|
+
{commuteLocation ? <Icon icon="mdi:times"></Icon> : <Button.Icon className={isCurrentLocation ? 'hc-text-blue-500' : 'hc-text-current'} icon="mdi:hc-my-location" />}
|
|
117
|
+
</Button.Btn>
|
|
118
|
+
</div>
|
|
119
|
+
<Transition
|
|
120
|
+
as={Fragment}
|
|
121
|
+
leave="hc-transition hc-ease-in hc-duration-100"
|
|
122
|
+
leaveFrom="hc-opacity-100"
|
|
123
|
+
leaveTo="hc-opacity-0"
|
|
124
|
+
afterLeave={clearSuggestions}
|
|
125
|
+
>
|
|
126
|
+
<Combobox.Options className="hc-absolute hc-z-20 hc-mt-1 hc-max-h-60 hc-w-full hc-overflow-auto hc-rounded hc-bg-white hc-py-1 hc-text-base hc-shadow hc-ring-1 hc-ring-uiAccent/10 focus:hc-outline-none sm:hc-text-sm">
|
|
127
|
+
{status === "OK" &&
|
|
128
|
+
data.map(data => (
|
|
129
|
+
<Combobox.Option
|
|
130
|
+
key={data.place_id}
|
|
131
|
+
value={data.description}
|
|
132
|
+
className={({ active }) =>
|
|
133
|
+
`hc-relative hc-cursor-default hc-select-none hc-px-4 hc-py-2 ${active ? "hc-bg-primary hc-text-white" : "hc-text-uiText"
|
|
134
|
+
}`
|
|
135
|
+
}
|
|
136
|
+
>
|
|
137
|
+
{({ selected }) => (
|
|
138
|
+
<span
|
|
139
|
+
className={`hc-block hc-truncate ${selected ? "hc-font-bold" : "hc-font-medium"}`}
|
|
140
|
+
>
|
|
141
|
+
{data.description}
|
|
142
|
+
</span>
|
|
143
|
+
)}
|
|
144
|
+
</Combobox.Option>
|
|
145
|
+
))}
|
|
146
|
+
</Combobox.Options>
|
|
147
|
+
</Transition>
|
|
148
|
+
</div>
|
|
149
|
+
</Combobox>
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export default FilterCommute;
|
|
@@ -1,87 +1,89 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import FilterSearch from '~/components/modules/filter/search';
|
|
4
|
-
import FiltersAccordion from '~/components/modules/accordions/filters';
|
|
5
|
-
import FilterLocations from '~/components/modules/filter/location';
|
|
6
|
-
import Button from '~/components/modules/buttons/default';
|
|
7
|
-
|
|
8
|
-
import { useMap } from '~/contexts/mapContext';
|
|
9
|
-
import { useMapList } from '~/contexts/mapListContext';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import FilterSearch from '~/components/modules/filter/search';
|
|
4
|
+
import FiltersAccordion from '~/components/modules/accordions/filters';
|
|
5
|
+
import FilterLocations from '~/components/modules/filter/location';
|
|
6
|
+
import Button from '~/components/modules/buttons/default';
|
|
7
|
+
|
|
8
|
+
import { useMap } from '~/contexts/mapContext';
|
|
9
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
10
|
+
import { useTrackEvent } from '~/contexts/trackEventContext';
|
|
11
|
+
|
|
12
|
+
const Filter = ({
|
|
13
|
+
className,
|
|
14
|
+
showMap
|
|
15
|
+
}) => {
|
|
16
|
+
const { trackEvent, eventTypes } = useTrackEvent();
|
|
17
|
+
const [hasActiveFilters, setHasActiveFilters] = useState(false);
|
|
18
|
+
const [defaultValue, setDefaultValue] = useState(null);
|
|
19
|
+
const { setSelectedListItem, setLocation, filterReset } = useMap();
|
|
20
|
+
const {
|
|
21
|
+
filteredListings,
|
|
22
|
+
selectedFilters,
|
|
23
|
+
setSelectedFilters,
|
|
24
|
+
setMobileTab,
|
|
25
|
+
handleSettingFavorites,
|
|
26
|
+
setQuery,
|
|
27
|
+
siteConfig
|
|
28
|
+
} = useMapList();
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
className={`
|
|
33
|
+
hc-relative hc-max-h-[95vh] md:hc-max-h-screen hc-overflow-y-auto hc-overflow-x-auto
|
|
34
|
+
${className ?? ""}
|
|
35
|
+
`}
|
|
36
|
+
>
|
|
37
|
+
<div className="hc-px-4 md:hc-pt-4 hc-space-y-4">
|
|
38
|
+
<FiltersAccordion
|
|
39
|
+
setHasActiveFilters={setHasActiveFilters}
|
|
40
|
+
defaultValue={defaultValue}
|
|
41
|
+
setDefaultValue={value => { setDefaultValue(value == defaultValue ? "" : value); }}
|
|
42
|
+
setLocation={setLocation}
|
|
43
|
+
setSelectedListItem={setSelectedListItem}
|
|
44
|
+
/>
|
|
45
|
+
<FilterSearch />
|
|
46
|
+
{siteConfig.hideLocations !== true &&
|
|
47
|
+
<FilterLocations
|
|
48
|
+
setHasActiveFilters={setHasActiveFilters}
|
|
49
|
+
defaultValue={defaultValue}
|
|
50
|
+
showMap={showMap}
|
|
51
|
+
setDefaultValue={value => { setDefaultValue(value == defaultValue ? "" : value); }}
|
|
52
|
+
setLocation={setLocation}
|
|
53
|
+
setSelectedListItem={setSelectedListItem}
|
|
54
|
+
/>
|
|
55
|
+
}
|
|
56
|
+
</div>
|
|
57
|
+
<div className="hc-sticky hc-bottom-0 hc-inset-x-0 hc-flex hc-items-center hc-justify-between hc-gap-2 hc-py-2 hc-px-4 hc-mt-2 hc-bg-white md:hc-bg-gray-100">
|
|
58
|
+
<Button.Btn
|
|
59
|
+
onClick={() => {trackEvent(eventTypes.FILTERS_RESET, { filtersRemoved: selectedFilters }); filterReset(); setSelectedFilters({}); setQuery(null); handleSettingFavorites(null); }}
|
|
60
|
+
variant="outline"
|
|
61
|
+
size="sm"
|
|
62
|
+
>
|
|
63
|
+
Reset
|
|
64
|
+
</Button.Btn>
|
|
65
|
+
{selectedFilters && Object.keys(selectedFilters).length > 0 &&
|
|
66
|
+
<Button.Btn
|
|
67
|
+
onClick={() => setMobileTab("listTab")}
|
|
68
|
+
variant="primary"
|
|
69
|
+
size="sm"
|
|
70
|
+
className={`
|
|
71
|
+
md:hc-hidden
|
|
72
|
+
${hasActiveFilters ? "hc-opacity-0 hc-pointer-events-none" : "hc-opacity-100"}
|
|
73
|
+
`}
|
|
74
|
+
>
|
|
75
|
+
<Button.Body>
|
|
76
|
+
<Button.Icon
|
|
77
|
+
icon="fluent:search-12-filled"
|
|
78
|
+
size="hc-size-3.5"
|
|
79
|
+
/>
|
|
80
|
+
Show {filteredListings.length} Jobs
|
|
81
|
+
</Button.Body>
|
|
82
|
+
</Button.Btn>
|
|
83
|
+
}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default Filter;
|