Skip to content
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

@W-17443086 Allow store to be selected by Shopper #2187

Merged
merged 20 commits into from
Jan 22, 2025

Conversation

hajinsuha1
Copy link
Collaborator

@hajinsuha1 hajinsuha1 commented Jan 7, 2025

Description

Allows users to select a store in StoreLocator. Once a store is selected, the store id, name, and inventoryId are saved in local storage under the key store_${siteId}.

Before:
Screenshot 2025-01-16 at 10 18 16 AM

After:
Screenshot 2025-01-16 at 10 19 05 AM

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • add radio buttons for each store in StoreLocator
  • save the store id, name, and inventoryId of the selected store in local storage

How to Test-Drive This PR

  • Navigate to https://cloud-jinsu-env3.mobify-storefront-staging.com/global/en-GB/
  • Open the developer console (F12) and navigate to the Network tab
  • Open the store locator by clicking the Store icon on the top right.
  • Set location to Country: United States, Postal Code: 94086, and press "Find" to see list of stores
  • Click on a radio button for a store
  • navigate to Application. Under Storage, click Local Storage and click the name of the site.
  • Verify there is a key store_RefArchGlobal with a JSON value that contains the store id, store name, and store inventoryId of the selected store
    • You can cross check the store id and inventoryId using the response of the /store-search API
  • Verify the selected store persists when closing and opening the store locator
  • Verify the store locator selection works in https://cloud-jinsu-env3.mobify-storefront-staging.com/store-locator

A11Y

  • Verify store info is read when a store is selected

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@hajinsuha1 hajinsuha1 changed the base branch from develop to feature-bopis January 10, 2025 16:36
@hajinsuha1 hajinsuha1 requested a review from bendvc January 10, 2025 18:17
@hajinsuha1 hajinsuha1 marked this pull request as ready for review January 10, 2025 18:17
@hajinsuha1 hajinsuha1 requested a review from a team as a code owner January 10, 2025 18:17
{store.city}, {store.stateCode ? store.stateCode : ''}{' '}
{store.postalCode}
</Box>
{store.distance !== undefined ? (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Could these conditionals be simplified

store.distance !== undefined && ( ... )

@hajinsuha1 hajinsuha1 requested review from bfeister and removed request for bendvc January 14, 2025 19:03
Copy link
Collaborator

@bfeister bfeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hajinsuha1 I have a strong preference that we include a screenshot of "before" and "after" a given change for those changes that modify UI. It's a good "audit trail" to be able to look at a PR (when I look at git history) and see what the intent was behind a given change... do you mind adding screenshots of "before" and "after"?

@@ -5,7 +5,7 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import React from 'react'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing a CHANGELOG.md update associated with this PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added! @bfeister question on the release process. Currently I have the base branch set to a feature branch feature-bopis. Does this make sense or should I just merge the change into develop?

This change does works on it's own, although it doesn't really do anything other than save the store info in local storage

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to merge into develop since it works on it's own. It'll help to avoid a "big bang" merge and make that diff smaller

@jeremy-jung1
Copy link
Collaborator

jeremy-jung1 commented Jan 15, 2025

FYI: While making the CI pass, you may also find that some tests unrelated to your changes fail the pipeline. Some fixes were pushed recently to develop that fixes it, so if you see that just merge develop into your branches

@hajinsuha1 hajinsuha1 requested a review from bfeister January 16, 2025 16:13
<AccordionPanel mb={6} mt={4}>
<div
dangerouslySetInnerHTML={{
__html: store?.storeHours
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why dangerouslySetInnerHTML here? Can't we just interpolate the value in the place where we declare vars via useState and similar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /store-search API actually returns the store hours as html
Screenshot 2025-01-17 at 2 15 51 PM

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, SUPER weird, but ok 🚢

@hajinsuha1 hajinsuha1 changed the base branch from feature-bopis to develop January 16, 2025 18:29
@hajinsuha1 hajinsuha1 requested a review from bfeister January 17, 2025 19:26
<HStack align="flex-start" mt="16px" mb="16px">
<Radio
value={store.id}
mt="1.5px"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking) weird to have 1.5px which seems like not a valid value. Reminds me of when Retina displays first came out and there were weird hacks like ~10 years ago. But if it's correct, then fine

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh good callout! So dug into this a bit, seems like all modern browsers support this while older browsers may round to the nearest whole number.

I also don't see anywhere else in PWA Kit that uses this so just for consistency i'll change it to 1px. UI wise this puts the radio button bottom-aligned with the store name rather than centered which isn't a big deal

bfeister
bfeister previously approved these changes Jan 21, 2025
jeremy-jung1
jeremy-jung1 previously approved these changes Jan 21, 2025
@hajinsuha1 hajinsuha1 dismissed stale reviews from jeremy-jung1 and bfeister via 33a631f January 21, 2025 18:46
@hajinsuha1 hajinsuha1 merged commit 3adb5ca into develop Jan 22, 2025
29 checks passed
@hajinsuha1 hajinsuha1 deleted the W-17443086-select-store-from-store-locator-ui branch January 22, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants