Skip to content

Commit

Permalink
fix: when you click on phygitals in templates page, it should redirec… (
Browse files Browse the repository at this point in the history
  • Loading branch information
albertfolch-redeemeum authored May 14, 2024
1 parent d57438c commit d7db7fa
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
15 changes: 15 additions & 0 deletions src/components/product/utils/useInitialValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import {
OPTIONS_UNIT,
OPTIONS_WEIGHT,
ProductMetadataAttributeKeys,
ProductTypeTypeValues,
ProductTypeVariantsValues,
SUPPORTED_FILE_FORMATS,
TOKEN_CRITERIA,
Expand All @@ -80,6 +81,12 @@ export function useInitialValues() {
const isTokenGated = searchParams.get(
SellerLandingPageParameters.sltokenGated
);
const productTypeQueryParam = searchParams.get(
SellerLandingPageParameters.slproductType
);
const productType = Object.values(ProductTypeTypeValues).find(
(validProductType) => validProductType === productTypeQueryParam
);
const fromProductUuid = searchParams.get(
SellerHubQueryParameters.fromProductUuid
);
Expand Down Expand Up @@ -208,6 +215,14 @@ export function useInitialValues() {
cloneInitialValues.productType.tokenGatedOffer = "true";
}
}
if (productType) {
if (cloneBaseValues.productType) {
cloneBaseValues.productType.productType = productType;
}
if (cloneInitialValues?.productType) {
cloneInitialValues.productType.productType = productType;
}
}

return {
shouldDisplayModal:
Expand Down
3 changes: 2 additions & 1 deletion src/lib/routing/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export const UrlParameters = {
export const SellerLandingPageParameters = {
slsteps: "slsteps", // slsteps = seller landing steps
sltitle: "sltitle",
sltokenGated: "sltokenGated"
sltokenGated: "sltokenGated",
slproductType: "slproductType"
};

export const configQueryParameters = {
Expand Down
34 changes: 29 additions & 5 deletions src/pages/sell/landing/SellerLandingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ProductTypeTypeValues } from "components/product/utils";
import React from "react";
import styled from "styled-components";

Expand Down Expand Up @@ -197,7 +198,13 @@ export const SellerLandingPage: React.FC = () => {
VariableStep.AddSalesChannels
],
to: {
pathname: SellerCenterRoutes.CreateProduct
pathname: SellerCenterRoutes.CreateProduct,
search: [
[
SellerLandingPageParameters.slproductType,
ProductTypeTypeValues.physical
]
]
},
firstActiveStep: hasSeller ? 1 : 0,
doSetQueryParams: true
Expand All @@ -208,10 +215,27 @@ export const SellerLandingPage: React.FC = () => {
image={<img src={sneakerNftImg} width="128" height="128" />}
title="Create Phygitals"
subtitle="Bundle physical products with a digital twin all in one offer"
as="a"
href="https://form.typeform.com/to/NaiNUsqn"
target="_blank"
rel="noopener noreferrer"
onClick={() => {
showModal("VARIABLE_STEPS_EXPLAINER", {
title: "Create Phygitals",
order: [
VariableStep.CreateYourProfile,
VariableStep.CreateYourProducts,
VariableStep.AddSalesChannels
],
to: {
pathname: SellerCenterRoutes.CreateProduct,
search: [
[
SellerLandingPageParameters.slproductType,
ProductTypeTypeValues.phygital
]
]
},
firstActiveStep: hasSeller ? 1 : 0,
doSetQueryParams: true
});
}}
/>
<CreateTokenGatedOffers
hasSeller={hasSeller}
Expand Down

0 comments on commit d7db7fa

Please sign in to comment.