-
Notifications
You must be signed in to change notification settings - Fork 40
feat(VCST-4584): implement select-address-map-modal to product page #2181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
goldenmaya
wants to merge
13
commits into
dev
Choose a base branch
from
feat/VCST-4584-bopis
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+470
−211
Open
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
de47dc5
feat: implement select-address-map-modal to product page
goldenmaya 0bf9c9e
fix: some fixes
goldenmaya d628703
Merge branch 'dev' into feat/VCST-4584-bopis
goldenmaya 2886d2f
fix: issues
goldenmaya 4ff2bcb
refactor: simplify code
goldenmaya a311524
fix: tests
goldenmaya b88e253
fix: implement vc-tooltip in pickup-availability-info
goldenmaya cb0791b
fix: location.id
goldenmaya 38874c9
fix: prevent reactive unwrapping of filter context refs in modal stack
goldenmaya 02cf94b
Merge branch 'dev' into feat/VCST-4584-bopis
goldenmaya 2d87863
Merge branch 'dev' into feat/VCST-4584-bopis
Lenajava1 fe95313
feat: add data-test-ids for shipment options popup components
Lenajava1 2b8fc61
Merge branch 'dev' into feat/VCST-4584-bopis
Lenajava1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 97 additions & 45 deletions
142
client-app/shared/catalog/components/product-pickup-locations.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +1,126 @@ | ||
| <template> | ||
| <VcWidget :title="$t('shared.catalog.shipment_options.title')" class="product-pickup-locations"> | ||
| <VcLoaderOverlay v-if="loading" /> | ||
|
|
||
| <div class="product-pickup-locations__group"> | ||
| <VcImage | ||
| src="in-store-pickup.svg" | ||
| :alt="$t('shared.catalog.shipment_options.in_store')" | ||
| class="product-pickup-locations__img" | ||
| /> | ||
|
|
||
| <div class="product-pickup-locations__content"> | ||
| <div class="product-pickup-locations__header"> | ||
| {{ $t("shared.catalog.shipment_options.in_store") }} | ||
| </div> | ||
| <template #default-container> | ||
| <div class="product-pickup-locations__container"> | ||
| <VcLoaderOverlay v-if="loading || modalOpening" /> | ||
|
|
||
| <div | ||
| v-for="pickupLocation in pickupLocations" | ||
| :key="pickupLocation.id" | ||
| class="product-pickup-locations__option" | ||
| > | ||
| <div class="product-pickup-locations__name"> | ||
| {{ pickupLocation.name }} | ||
| </div> | ||
|
|
||
| <PickupAvailabilityInfo | ||
| :availability-type="pickupLocation.availabilityType" | ||
| :availability-note="pickupLocation.availabilityNote" | ||
| <div class="product-pickup-locations__group"> | ||
| <VcImage | ||
| src="in-store-pickup.svg" | ||
| :alt="$t('shared.catalog.shipment_options.check_pickup_locations')" | ||
| class="product-pickup-locations__img" | ||
| /> | ||
|
|
||
| <button type="button" class="product-pickup-locations__link" @click="openMapModal"> | ||
| <span>{{ $t("shared.catalog.shipment_options.check_pickup_locations") }} </span> | ||
|
|
||
| <VcIcon class="product-pickup-locations__icon" name="arrow-right" color="primary" size="xs" /> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </template> | ||
| </VcWidget> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import type { ProductPickupLocation } from "@/core/api/graphql/types"; | ||
| import PickupAvailabilityInfo from "@/shared/common/components/pickup-availability-info.vue"; | ||
| import { computed, ref } from "vue"; | ||
| import { useModuleSettings } from "@/core/composables/useModuleSettings"; | ||
| import { BOPIS_MAP_API_KEY, MODULE_ID_SHIPPING } from "@/core/constants/modules"; | ||
| import { useProductPickupLocations } from "@/shared/catalog/composables/useProductPickupLocations"; | ||
| import { createProductFilterContext } from "@/shared/checkout/composables/usePickupFilterContext"; | ||
| import { useModal } from "@/shared/modal"; | ||
| import SelectAddressMapModal from "@/shared/checkout/components/select-address-map-modal.vue"; | ||
|
|
||
| interface IProps { | ||
| pickupLocations?: ProductPickupLocation[]; | ||
| loading: boolean; | ||
| productId: string; | ||
| } | ||
|
|
||
| const props = defineProps<IProps>(); | ||
|
|
||
| const MODAL_FETCH_LIMIT = 50; | ||
|
|
||
| const { getSettingValue } = useModuleSettings(MODULE_ID_SHIPPING); | ||
| const apiKey = computed(() => getSettingValue(BOPIS_MAP_API_KEY)); | ||
|
|
||
| const { openModal } = useModal(); | ||
|
|
||
| const { | ||
| pickupLocations: modalPickupLocations, | ||
| fetchPickupLocations: fetchModalPickupLocations, | ||
| pickupLocationsLoading: modalLoading, | ||
| } = useProductPickupLocations(); | ||
|
|
||
| const modalAddresses = computed(() => | ||
| modalPickupLocations.value.map((location) => ({ | ||
| ...location, | ||
| ...location.address, | ||
| description: location.description, | ||
| })), | ||
| ); | ||
vas11yev1work marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| function fetchLocations(keyword?: string) { | ||
| return fetchModalPickupLocations({ | ||
| productId: props.productId, | ||
| first: MODAL_FETCH_LIMIT, | ||
| keyword: keyword || undefined, | ||
| }); | ||
| } | ||
|
|
||
| defineProps<IProps>(); | ||
| const filterContext = createProductFilterContext({ | ||
| onSearch: (keyword: string) => { | ||
| void fetchLocations(keyword); | ||
| }, | ||
| loading: modalLoading, | ||
| }); | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const modalOpening = ref(false); | ||
|
|
||
| async function openMapModal() { | ||
| modalOpening.value = true; | ||
|
|
||
| try { | ||
| await fetchLocations(); | ||
| } finally { | ||
| modalOpening.value = false; | ||
| } | ||
|
|
||
| openModal({ | ||
| component: SelectAddressMapModal, | ||
| props: { | ||
| addresses: modalAddresses, | ||
| apiKey: apiKey.value, | ||
| selectable: false, | ||
| filterContext, | ||
|
|
||
| onFilterChange: () => { | ||
| void fetchLocations(filterContext.filterKeyword.value); | ||
| }, | ||
goldenmaya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }); | ||
| } | ||
| </script> | ||
|
|
||
| <style lang="scss"> | ||
| .product-pickup-locations { | ||
| &__group { | ||
| @apply flex flex-row gap-x-3 items-start border rounded p-3; | ||
| } | ||
|
|
||
| &__content { | ||
| @apply min-w-0; | ||
| &__container { | ||
| @apply relative py-4 px-5; | ||
| } | ||
|
|
||
| &__header { | ||
| @apply font-bold text-lg; | ||
|
|
||
| word-break: break-word; | ||
| &__group { | ||
| @apply flex flex-row gap-x-3 items-center border border-neutral-400 rounded p-2.5 min-h-[74px]; | ||
| } | ||
|
|
||
| &__option { | ||
| @apply my-3; | ||
| &__img { | ||
| @apply size-12 shrink-0 rounded; | ||
| } | ||
|
|
||
| &__name { | ||
| @apply font-bold text-sm; | ||
| &__link { | ||
| @apply inline-flex items-center gap-1 text-sm text-accent cursor-pointer whitespace-nowrap; | ||
|
|
||
| word-break: break-word; | ||
| &:hover { | ||
| @apply text-accent-700; | ||
| } | ||
| } | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GraphQL query missing
regionNamefield for addressesLow Severity
The new
addresssub-selection in the product pickup locations query fetchesregionIdbut notregionName. ThegetAddressNameutility destructuresregionNameto build the display string, so region names will be silently omitted from addresses shown in the product pickup locations modal list.