@abcagency/hc-ui-components 1.3.13 → 1.3.15
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.map +1 -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.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.map +1 -1
- package/dist/components/modules/filter/item.js +6 -1
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/location.js +5 -3
- 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.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.map +1 -1
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- 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 +11 -10
- 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.map +1 -1
- package/dist/components/modules/maps/map-list.js.map +1 -1
- 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/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 +54 -37
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/hooks/useList.js +3 -15
- 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 +7 -7
- 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 +124 -124
- package/src/components/modules/accordions/MapAccordionItem.js +72 -72
- package/src/components/modules/accordions/default.js +171 -171
- package/src/components/modules/accordions/filterItem.js +3 -1
- package/src/components/modules/accordions/filters.js +1 -1
- package/src/components/modules/buttons/button-group-apply.js +116 -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 +149 -149
- package/src/components/modules/filter/item.js +5 -0
- package/src/components/modules/filter/location.js +5 -3
- package/src/components/modules/filter/points-of-interest.js +44 -44
- package/src/components/modules/filter/radio-item.js +53 -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 +95 -95
- package/src/components/modules/maps/info-window-card.js +17 -17
- package/src/components/modules/maps/info-window-content.js +74 -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 +7 -7
- 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 +133 -133
- package/src/components/modules/maps/map-list.js +74 -74
- package/src/components/modules/maps/map-marker.js +86 -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/placeTypes.js +8 -8
- package/src/contexts/mapContext.js +0 -14
- package/src/contexts/mapListContext.js +26 -8
- package/src/contexts/placesContext.js +102 -102
- package/src/hooks/useList.js +4 -16
- 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 +9 -4
- 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/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,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 { getStorageItem } from '~/util/localStorageUtil';
|
|
10
|
-
|
|
11
|
-
const FilterCommute = ({ className }) => {
|
|
12
|
-
const {
|
|
13
|
-
ready,
|
|
14
|
-
suggestions: { status, data },
|
|
15
|
-
setValue,
|
|
16
|
-
clearSuggestions
|
|
17
|
-
} = usePlacesAutocomplete();
|
|
18
|
-
|
|
19
|
-
const [selected, setSelected] = useState(getStorageItem('selectedCommute', ''));
|
|
20
|
-
const inputRef = useRef(null);
|
|
21
|
-
const { setCommuteLocation, commuteLocation } = useMapList();
|
|
22
|
-
const [isCurrentLocation, setIsCurrentLocation] = useState(getStorageItem('isCurrentLocation', false));
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (commuteLocation !== null && commuteLocation != '') return;
|
|
26
|
-
setIsCurrentLocation(false);
|
|
27
|
-
localStorage.removeItem('isCurrentLocation');
|
|
28
|
-
localStorage.removeItem('selectedCommute');
|
|
29
|
-
setSelected("");
|
|
30
|
-
}, [commuteLocation]);
|
|
31
|
-
|
|
32
|
-
const handleSelect = async (val, isCurrLocation = false) => {
|
|
33
|
-
setValue(val, false);
|
|
34
|
-
setSelected(val);
|
|
35
|
-
localStorage.setItem('selectedCommute', val);
|
|
36
|
-
clearSuggestions();
|
|
37
|
-
if (isCurrLocation) return;
|
|
38
|
-
try {
|
|
39
|
-
const results = await getGeocode({ address: val });
|
|
40
|
-
const { lat, lng } = await getLatLng(results[0]);
|
|
41
|
-
setCommuteLocation({ lat, lng });
|
|
42
|
-
} catch (error) {
|
|
43
|
-
// no-op
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const fetchLocation = () => {
|
|
48
|
-
if (!navigator.geolocation) {
|
|
49
|
-
console.error("Geolocation is not supported by this browser.");
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
navigator.geolocation.getCurrentPosition(
|
|
53
|
-
position => {
|
|
54
|
-
setCommuteLocation({
|
|
55
|
-
lat: position.coords.latitude,
|
|
56
|
-
lng: position.coords.longitude
|
|
57
|
-
});
|
|
58
|
-
handleSelect("Current Location");
|
|
59
|
-
},
|
|
60
|
-
error => {
|
|
61
|
-
console.error("Error fetching location", error);
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div className={`relative ${className ?? ""}`}>
|
|
68
|
-
<label
|
|
69
|
-
htmlFor="commute"
|
|
70
|
-
className="hc-flex hc-items-center hc-gap-2 hc-mb-2 hc-text-xs hc-uppercase hc-font-bold hc-text-uiText"
|
|
71
|
-
>
|
|
72
|
-
<Icon
|
|
73
|
-
icon="ri:pin-distance-fill"
|
|
74
|
-
size="hc-size-5"
|
|
75
|
-
className="hc-text-uiAccent/30"
|
|
76
|
-
/>
|
|
77
|
-
<span>
|
|
78
|
-
<span className="md:hc-hidden lg:hc-inline">Calculate your</span> commute
|
|
79
|
-
</span>
|
|
80
|
-
</label>
|
|
81
|
-
|
|
82
|
-
<Combobox value={selected} onChange={handleSelect}>
|
|
83
|
-
<div className="hc-relative hc-mt-1">
|
|
84
|
-
<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">
|
|
85
|
-
<Combobox.Input
|
|
86
|
-
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"
|
|
87
|
-
onChange={e => {
|
|
88
|
-
setValue(e.target.value);
|
|
89
|
-
setSelected(e.target.value);
|
|
90
|
-
}}
|
|
91
|
-
value={selected}
|
|
92
|
-
disabled={!ready}
|
|
93
|
-
placeholder="Starting point"
|
|
94
|
-
ref={inputRef}
|
|
95
|
-
/>
|
|
96
|
-
<Button.Btn
|
|
97
|
-
variant="icon"
|
|
98
|
-
size="sqsm"
|
|
99
|
-
onClick={() => {
|
|
100
|
-
setIsCurrentLocation(!isCurrentLocation);
|
|
101
|
-
localStorage.setItem('isCurrentLocation', !isCurrentLocation);
|
|
102
|
-
if (isCurrentLocation || commuteLocation) {
|
|
103
|
-
setCommuteLocation("");
|
|
104
|
-
setSelected("");
|
|
105
|
-
} else if (!commuteLocation) { fetchLocation(); }
|
|
106
|
-
}}
|
|
107
|
-
|
|
108
|
-
className=""
|
|
109
|
-
>
|
|
110
|
-
<span className="hc-sr-only">Use your location</span>
|
|
111
|
-
{commuteLocation ? <Icon icon="mdi:times"></Icon> : <Button.Icon className={isCurrentLocation ? 'hc-text-blue-500' : 'hc-text-current'} icon="mdi:hc-my-location" />}
|
|
112
|
-
</Button.Btn>
|
|
113
|
-
</div>
|
|
114
|
-
<Transition
|
|
115
|
-
as={Fragment}
|
|
116
|
-
leave="hc-transition hc-ease-in hc-duration-100"
|
|
117
|
-
leaveFrom="hc-opacity-100"
|
|
118
|
-
leaveTo="hc-opacity-0"
|
|
119
|
-
afterLeave={clearSuggestions}
|
|
120
|
-
>
|
|
121
|
-
<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">
|
|
122
|
-
{status === "OK" &&
|
|
123
|
-
data.map(data => (
|
|
124
|
-
<Combobox.Option
|
|
125
|
-
key={data.place_id}
|
|
126
|
-
value={data.description}
|
|
127
|
-
className={({ active }) =>
|
|
128
|
-
`hc-relative hc-cursor-default hc-select-none hc-px-4 hc-py-2 ${active ? "hc-bg-primary hc-text-white" : "hc-text-uiText"
|
|
129
|
-
}`
|
|
130
|
-
}
|
|
131
|
-
>
|
|
132
|
-
{({ selected }) => (
|
|
133
|
-
<span
|
|
134
|
-
className={`hc-block hc-truncate ${selected ? "hc-font-bold" : "hc-font-medium"}`}
|
|
135
|
-
>
|
|
136
|
-
{data.description}
|
|
137
|
-
</span>
|
|
138
|
-
)}
|
|
139
|
-
</Combobox.Option>
|
|
140
|
-
))}
|
|
141
|
-
</Combobox.Options>
|
|
142
|
-
</Transition>
|
|
143
|
-
</div>
|
|
144
|
-
</Combobox>
|
|
145
|
-
</div>
|
|
146
|
-
);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export default FilterCommute;
|
|
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 { getStorageItem } from '~/util/localStorageUtil';
|
|
10
|
+
|
|
11
|
+
const FilterCommute = ({ className }) => {
|
|
12
|
+
const {
|
|
13
|
+
ready,
|
|
14
|
+
suggestions: { status, data },
|
|
15
|
+
setValue,
|
|
16
|
+
clearSuggestions
|
|
17
|
+
} = usePlacesAutocomplete();
|
|
18
|
+
|
|
19
|
+
const [selected, setSelected] = useState(getStorageItem('selectedCommute', ''));
|
|
20
|
+
const inputRef = useRef(null);
|
|
21
|
+
const { setCommuteLocation, commuteLocation } = useMapList();
|
|
22
|
+
const [isCurrentLocation, setIsCurrentLocation] = useState(getStorageItem('isCurrentLocation', false));
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (commuteLocation !== null && commuteLocation != '') return;
|
|
26
|
+
setIsCurrentLocation(false);
|
|
27
|
+
localStorage.removeItem('isCurrentLocation');
|
|
28
|
+
localStorage.removeItem('selectedCommute');
|
|
29
|
+
setSelected("");
|
|
30
|
+
}, [commuteLocation]);
|
|
31
|
+
|
|
32
|
+
const handleSelect = async (val, isCurrLocation = false) => {
|
|
33
|
+
setValue(val, false);
|
|
34
|
+
setSelected(val);
|
|
35
|
+
localStorage.setItem('selectedCommute', val);
|
|
36
|
+
clearSuggestions();
|
|
37
|
+
if (isCurrLocation) return;
|
|
38
|
+
try {
|
|
39
|
+
const results = await getGeocode({ address: val });
|
|
40
|
+
const { lat, lng } = await getLatLng(results[0]);
|
|
41
|
+
setCommuteLocation({ lat, lng });
|
|
42
|
+
} catch (error) {
|
|
43
|
+
// no-op
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const fetchLocation = () => {
|
|
48
|
+
if (!navigator.geolocation) {
|
|
49
|
+
console.error("Geolocation is not supported by this browser.");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
navigator.geolocation.getCurrentPosition(
|
|
53
|
+
position => {
|
|
54
|
+
setCommuteLocation({
|
|
55
|
+
lat: position.coords.latitude,
|
|
56
|
+
lng: position.coords.longitude
|
|
57
|
+
});
|
|
58
|
+
handleSelect("Current Location");
|
|
59
|
+
},
|
|
60
|
+
error => {
|
|
61
|
+
console.error("Error fetching location", error);
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div className={`relative ${className ?? ""}`}>
|
|
68
|
+
<label
|
|
69
|
+
htmlFor="commute"
|
|
70
|
+
className="hc-flex hc-items-center hc-gap-2 hc-mb-2 hc-text-xs hc-uppercase hc-font-bold hc-text-uiText"
|
|
71
|
+
>
|
|
72
|
+
<Icon
|
|
73
|
+
icon="ri:pin-distance-fill"
|
|
74
|
+
size="hc-size-5"
|
|
75
|
+
className="hc-text-uiAccent/30"
|
|
76
|
+
/>
|
|
77
|
+
<span>
|
|
78
|
+
<span className="md:hc-hidden lg:hc-inline">Calculate your</span> commute
|
|
79
|
+
</span>
|
|
80
|
+
</label>
|
|
81
|
+
|
|
82
|
+
<Combobox value={selected} onChange={handleSelect}>
|
|
83
|
+
<div className="hc-relative hc-mt-1">
|
|
84
|
+
<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">
|
|
85
|
+
<Combobox.Input
|
|
86
|
+
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"
|
|
87
|
+
onChange={e => {
|
|
88
|
+
setValue(e.target.value);
|
|
89
|
+
setSelected(e.target.value);
|
|
90
|
+
}}
|
|
91
|
+
value={selected}
|
|
92
|
+
disabled={!ready}
|
|
93
|
+
placeholder="Starting point"
|
|
94
|
+
ref={inputRef}
|
|
95
|
+
/>
|
|
96
|
+
<Button.Btn
|
|
97
|
+
variant="icon"
|
|
98
|
+
size="sqsm"
|
|
99
|
+
onClick={() => {
|
|
100
|
+
setIsCurrentLocation(!isCurrentLocation);
|
|
101
|
+
localStorage.setItem('isCurrentLocation', !isCurrentLocation);
|
|
102
|
+
if (isCurrentLocation || commuteLocation) {
|
|
103
|
+
setCommuteLocation("");
|
|
104
|
+
setSelected("");
|
|
105
|
+
} else if (!commuteLocation) { fetchLocation(); }
|
|
106
|
+
}}
|
|
107
|
+
|
|
108
|
+
className=""
|
|
109
|
+
>
|
|
110
|
+
<span className="hc-sr-only">Use your location</span>
|
|
111
|
+
{commuteLocation ? <Icon icon="mdi:times"></Icon> : <Button.Icon className={isCurrentLocation ? 'hc-text-blue-500' : 'hc-text-current'} icon="mdi:hc-my-location" />}
|
|
112
|
+
</Button.Btn>
|
|
113
|
+
</div>
|
|
114
|
+
<Transition
|
|
115
|
+
as={Fragment}
|
|
116
|
+
leave="hc-transition hc-ease-in hc-duration-100"
|
|
117
|
+
leaveFrom="hc-opacity-100"
|
|
118
|
+
leaveTo="hc-opacity-0"
|
|
119
|
+
afterLeave={clearSuggestions}
|
|
120
|
+
>
|
|
121
|
+
<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">
|
|
122
|
+
{status === "OK" &&
|
|
123
|
+
data.map(data => (
|
|
124
|
+
<Combobox.Option
|
|
125
|
+
key={data.place_id}
|
|
126
|
+
value={data.description}
|
|
127
|
+
className={({ active }) =>
|
|
128
|
+
`hc-relative hc-cursor-default hc-select-none hc-px-4 hc-py-2 ${active ? "hc-bg-primary hc-text-white" : "hc-text-uiText"
|
|
129
|
+
}`
|
|
130
|
+
}
|
|
131
|
+
>
|
|
132
|
+
{({ selected }) => (
|
|
133
|
+
<span
|
|
134
|
+
className={`hc-block hc-truncate ${selected ? "hc-font-bold" : "hc-font-medium"}`}
|
|
135
|
+
>
|
|
136
|
+
{data.description}
|
|
137
|
+
</span>
|
|
138
|
+
)}
|
|
139
|
+
</Combobox.Option>
|
|
140
|
+
))}
|
|
141
|
+
</Combobox.Options>
|
|
142
|
+
</Transition>
|
|
143
|
+
</div>
|
|
144
|
+
</Combobox>
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export default FilterCommute;
|
|
@@ -16,6 +16,11 @@ const FilterItem = ({
|
|
|
16
16
|
var isActive =
|
|
17
17
|
selectedFilters != undefined && !!selectedFilters[field]?.[itemKey];
|
|
18
18
|
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if(!selectedFilters)
|
|
21
|
+
return;
|
|
22
|
+
setActiveItem(!!selectedFilters[field]?.[itemKey]);
|
|
23
|
+
},[selectedFilters, field, itemKey]);
|
|
19
24
|
const changeHandler = () => {
|
|
20
25
|
setSelectedFilters(prevFilters => {
|
|
21
26
|
const updatedFilters = { ...prevFilters };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
import Accordion from '~/components/modules/accordions/default';
|
|
4
4
|
import FilterCommute from '~/components/modules/filter/commute';
|
|
@@ -30,12 +30,14 @@ const FilterLocation = ({
|
|
|
30
30
|
// return updatedFilters;
|
|
31
31
|
// });
|
|
32
32
|
// };
|
|
33
|
-
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
console.log(selectedFilters);
|
|
35
|
+
},[selectedFilters]);
|
|
34
36
|
var locations = filterOptions?.locations;
|
|
35
37
|
var pointsOfInterest = filterOptions?.pointsOfInterest;
|
|
36
38
|
return (
|
|
37
39
|
<FilterCard className={className ?? ""}>
|
|
38
|
-
<FilterCard.Title icon="fluent:
|
|
40
|
+
<FilterCard.Title icon="fluent:location-16-filled">
|
|
39
41
|
<span>
|
|
40
42
|
<span className="hc-hidden lg:hc-inline">Job</span> location
|
|
41
43
|
</span>
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import Accordion from '~/components/modules/accordions/default';
|
|
4
|
-
import RadioItem from '~/components/modules/filter/radio-item';
|
|
5
|
-
|
|
6
|
-
const FilterPointsOfInterest = ({
|
|
7
|
-
title = "Points of interest",
|
|
8
|
-
pointsOfInterest,
|
|
9
|
-
setDefaultValue,
|
|
10
|
-
className,
|
|
11
|
-
defaultValue
|
|
12
|
-
}) => {
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
className={`
|
|
16
|
-
hc-relative
|
|
17
|
-
${className ?? ""}
|
|
18
|
-
`}
|
|
19
|
-
>
|
|
20
|
-
<Accordion defaultValue={defaultValue} className="hc-space-y-4">
|
|
21
|
-
<Accordion.Item id="points-of-interest">
|
|
22
|
-
<Accordion.Trigger.HasHeader
|
|
23
|
-
onClick={() => setDefaultValue("points-of-interest")}
|
|
24
|
-
className="hc-stretched-link hc-text-left"
|
|
25
|
-
iconClassName="hc-order-last"
|
|
26
|
-
headerClassName="hc-relative hc-py-2 hc-rounded hc-border hc-border-uiAccent/20 hc-bg-white hc-text-sm hc-transition data-[state=open]:hc-border-b-transparent data-[state=open]:hc-rounded-b-none"
|
|
27
|
-
>
|
|
28
|
-
{title}
|
|
29
|
-
</Accordion.Trigger.HasHeader>
|
|
30
|
-
<Accordion.Content bodyClassName="hc-px-2 hc-py-1 hc-bg-white hc-rounded-b hc-border hc-border-uiAccent/20 hc-border-t-0 hc-max-h-[20vh] md:hc-max-h-[25vh] ohc-verflow-auto">
|
|
31
|
-
{pointsOfInterest.items.map((item, index) => {
|
|
32
|
-
return <RadioItem
|
|
33
|
-
key={item.key + index}
|
|
34
|
-
item={item}
|
|
35
|
-
field={item.id} />;
|
|
36
|
-
})}
|
|
37
|
-
</Accordion.Content>
|
|
38
|
-
</Accordion.Item>
|
|
39
|
-
</Accordion>
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default FilterPointsOfInterest;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Accordion from '~/components/modules/accordions/default';
|
|
4
|
+
import RadioItem from '~/components/modules/filter/radio-item';
|
|
5
|
+
|
|
6
|
+
const FilterPointsOfInterest = ({
|
|
7
|
+
title = "Points of interest",
|
|
8
|
+
pointsOfInterest,
|
|
9
|
+
setDefaultValue,
|
|
10
|
+
className,
|
|
11
|
+
defaultValue
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
className={`
|
|
16
|
+
hc-relative
|
|
17
|
+
${className ?? ""}
|
|
18
|
+
`}
|
|
19
|
+
>
|
|
20
|
+
<Accordion defaultValue={defaultValue} className="hc-space-y-4">
|
|
21
|
+
<Accordion.Item id="points-of-interest">
|
|
22
|
+
<Accordion.Trigger.HasHeader
|
|
23
|
+
onClick={() => setDefaultValue("points-of-interest")}
|
|
24
|
+
className="hc-stretched-link hc-text-left"
|
|
25
|
+
iconClassName="hc-order-last"
|
|
26
|
+
headerClassName="hc-relative hc-py-2 hc-rounded hc-border hc-border-uiAccent/20 hc-bg-white hc-text-sm hc-transition data-[state=open]:hc-border-b-transparent data-[state=open]:hc-rounded-b-none"
|
|
27
|
+
>
|
|
28
|
+
{title}
|
|
29
|
+
</Accordion.Trigger.HasHeader>
|
|
30
|
+
<Accordion.Content bodyClassName="hc-px-2 hc-py-1 hc-bg-white hc-rounded-b hc-border hc-border-uiAccent/20 hc-border-t-0 hc-max-h-[20vh] md:hc-max-h-[25vh] ohc-verflow-auto">
|
|
31
|
+
{pointsOfInterest.items.map((item, index) => {
|
|
32
|
+
return <RadioItem
|
|
33
|
+
key={item.key + index}
|
|
34
|
+
item={item}
|
|
35
|
+
field={item.id} />;
|
|
36
|
+
})}
|
|
37
|
+
</Accordion.Content>
|
|
38
|
+
</Accordion.Item>
|
|
39
|
+
</Accordion>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default FilterPointsOfInterest;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import Icon from '~/components/modules/icon';
|
|
4
|
-
|
|
5
|
-
import { useMap } from "~/contexts/mapContext";
|
|
6
|
-
|
|
7
|
-
const RadioItem = ({
|
|
8
|
-
className,
|
|
9
|
-
item,
|
|
10
|
-
field,
|
|
11
|
-
...rest
|
|
12
|
-
}) => {
|
|
13
|
-
const { selectedPlaces, setSelectedPlaces } = useMap();
|
|
14
|
-
const chosenPlace = item.key.toLowerCase();
|
|
15
|
-
let isActive = selectedPlaces.includes(chosenPlace);
|
|
16
|
-
|
|
17
|
-
const changeHandler = () => {
|
|
18
|
-
setSelectedPlaces([isActive ? '' : chosenPlace]);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<label key={item.key}
|
|
23
|
-
className={`
|
|
24
|
-
hc-flex hc-items-start hc-gap-2 hc-px-2 hc-py-1.5 hc-rounded-sm hc-text-sm hc-cursor-pointer hc-transition hover:hc-bg-uiAccent/5
|
|
25
|
-
${item.count === 0 ? 'hc-text-uiDisabled hc-cursor-not-allowed' : 'hover:hc-bg-uiAccent/5'}
|
|
26
|
-
${className ?? ""}
|
|
27
|
-
`}
|
|
28
|
-
{...rest}
|
|
29
|
-
>
|
|
30
|
-
<input
|
|
31
|
-
key={item.key}
|
|
32
|
-
id={item.Key}
|
|
33
|
-
name={field}
|
|
34
|
-
value={item.key}
|
|
35
|
-
type={"radio"}
|
|
36
|
-
className={`hc-size-4 hc-mt-px hc-text-primary hc-border-uiAccent/30 hc-transition-colors hc-rounded-full`}
|
|
37
|
-
checked={isActive}
|
|
38
|
-
onClick={() => {
|
|
39
|
-
changeHandler();
|
|
40
|
-
}}
|
|
41
|
-
onChange={() => { }}
|
|
42
|
-
/>
|
|
43
|
-
<span className="hc-font-medium">{item.key}</span>
|
|
44
|
-
{isActive &&
|
|
45
|
-
<div className="hc-w-full hc-unselect-div">
|
|
46
|
-
<Icon className="hc-float-right" icon="mdi:times"></Icon>
|
|
47
|
-
</div>
|
|
48
|
-
}
|
|
49
|
-
</label>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export default RadioItem;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Icon from '~/components/modules/icon';
|
|
4
|
+
|
|
5
|
+
import { useMap } from "~/contexts/mapContext";
|
|
6
|
+
|
|
7
|
+
const RadioItem = ({
|
|
8
|
+
className,
|
|
9
|
+
item,
|
|
10
|
+
field,
|
|
11
|
+
...rest
|
|
12
|
+
}) => {
|
|
13
|
+
const { selectedPlaces, setSelectedPlaces } = useMap();
|
|
14
|
+
const chosenPlace = item.key.toLowerCase();
|
|
15
|
+
let isActive = selectedPlaces.includes(chosenPlace);
|
|
16
|
+
|
|
17
|
+
const changeHandler = () => {
|
|
18
|
+
setSelectedPlaces([isActive ? '' : chosenPlace]);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<label key={item.key}
|
|
23
|
+
className={`
|
|
24
|
+
hc-flex hc-items-start hc-gap-2 hc-px-2 hc-py-1.5 hc-rounded-sm hc-text-sm hc-cursor-pointer hc-transition hover:hc-bg-uiAccent/5
|
|
25
|
+
${item.count === 0 ? 'hc-text-uiDisabled hc-cursor-not-allowed' : 'hover:hc-bg-uiAccent/5'}
|
|
26
|
+
${className ?? ""}
|
|
27
|
+
`}
|
|
28
|
+
{...rest}
|
|
29
|
+
>
|
|
30
|
+
<input
|
|
31
|
+
key={item.key}
|
|
32
|
+
id={item.Key}
|
|
33
|
+
name={field}
|
|
34
|
+
value={item.key}
|
|
35
|
+
type={"radio"}
|
|
36
|
+
className={`hc-size-4 hc-mt-px hc-text-primary hc-border-uiAccent/30 hc-transition-colors hc-rounded-full`}
|
|
37
|
+
checked={isActive}
|
|
38
|
+
onClick={() => {
|
|
39
|
+
changeHandler();
|
|
40
|
+
}}
|
|
41
|
+
onChange={() => { }}
|
|
42
|
+
/>
|
|
43
|
+
<span className="hc-font-medium">{item.key}</span>
|
|
44
|
+
{isActive &&
|
|
45
|
+
<div className="hc-w-full hc-unselect-div">
|
|
46
|
+
<Icon className="hc-float-right" icon="mdi:times"></Icon>
|
|
47
|
+
</div>
|
|
48
|
+
}
|
|
49
|
+
</label>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default RadioItem;
|