{
let optionName = option.name;
let clonedSelectedOptionMap = new Map(selectedOptionMap);
- let values = option.values.map((value) => {
- clonedSelectedOptionMap.set(optionName, value.value);
- let variant = nodes?.find((variant) => {
- return variant.selectedOptions.every((opt) => {
- return opt.value === clonedSelectedOptionMap.get(opt.name);
+ let values = option.values
+ .map((value) => {
+ clonedSelectedOptionMap.set(optionName, value.value);
+ let variant = nodes?.find((variant) => {
+ return variant.selectedOptions.every((opt) => {
+ return opt.value === clonedSelectedOptionMap.get(opt.name);
+ });
});
- });
- if (hideUnavailableOptions && !variant) {
- return null
- }
- return {
- ...value,
- isAvailable: variant ? variant.availableForSale : false,
- image: variant?.image,
- };
- }).filter(Boolean);
+ if (hideUnavailableOptions && !variant) {
+ return null;
+ }
+ return {
+ ...value,
+ isAvailable: variant ? variant.availableForSale : false,
+ image: variant?.image,
+ };
+ })
+ .filter(Boolean);
let handleSelectOptionValue = (value: string) =>
handleSelectOption(optionName, value);
let config = swatch.configs.find((config) => {
@@ -105,10 +107,7 @@ export function ProductVariants(props: ProductVariantsProps) {
return (
/dev/null 2>&1 && git config core.hooksPath .git-hooks || true",
"dev": "shopify hydrogen dev --worker --codegen --port 3456",
"build": "shopify hydrogen build",
"preview": "npm run build && shopify hydrogen preview --worker",
@@ -32,6 +33,7 @@
"graphql": "16.8.1",
"graphql-tag": "2.12.6",
"isbot": "3.7.0",
+ "keen-slider": "^6.8.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-intersection-observer": "9.5.2",
diff --git a/sync-project.md b/sync-project.md
index 0166c09..52d1a87 100644
--- a/sync-project.md
+++ b/sync-project.md
@@ -7,17 +7,18 @@ Here is the manual way to do it with rsync:
1. Clone the original pilot project into a directory called `pilot`:
- ```bash
- git clone git@github.com:Weaverse/pilot.git
- ```
+ ```bash
+ git clone git@github.com:Weaverse/pilot.git
+ ```
+
2. Put your own pilot project into a same level directory.
3. Run the following command to sync your project with the original pilot project, Keep in mind to
replace `your-pilot-project` with the name of your own pilot project.
- ```bash
- rsync -arv --exclude=node_modules --exclude=.git --exclude=.cache --exclude=.turbo --exclude=dist --exclude=.env ./pilot/ ./your-pilot-project
- ```
+ ```bash
+ rsync -arv --exclude=node_modules --exclude=.git --exclude=.cache --exclude=.turbo --exclude=dist --exclude=.env ./pilot/ ./your-pilot-project
+ ```
4. Commit and push your changes to your own pilot project.
5. It is recommended to run the sync command every time you want to update your project with the latest changes from the