-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9255f7f
commit 3f7f9b7
Showing
12 changed files
with
136 additions
and
124 deletions.
There are no files selected for viewing
This file contains 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
62 changes: 62 additions & 0 deletions
62
src/components/detail/DetailWidget/BasicCommitDetailWidget.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { ExternalCommitDetailView } from "@bosonprotocol/react-kit"; | ||
import { useConfigContext } from "components/config/ConfigContext"; | ||
import { MODAL_TYPES } from "components/modal/ModalComponents"; | ||
import { useModal } from "components/modal/useModal"; | ||
import { CONFIG } from "lib/config"; | ||
import { BosonRoutes } from "lib/routing/routes"; | ||
import { useKeepQueryParamsNavigate } from "lib/utils/hooks/useKeepQueryParamsNavigate"; | ||
import { VariantV1 } from "pages/products/types"; | ||
import React, { ReactNode } from "react"; | ||
|
||
type BasicCommitDetailWidgetProps = { | ||
selectedVariant: VariantV1; | ||
isPreview: boolean; | ||
children?: ReactNode; | ||
}; | ||
|
||
export const BasicCommitDetailWidget: React.FC< | ||
BasicCommitDetailWidgetProps | ||
> = ({ selectedVariant, isPreview, children }) => { | ||
const { showModal } = useModal(); | ||
const navigate = useKeepQueryParamsNavigate(); | ||
const { config } = useConfigContext(); | ||
return ( | ||
<ExternalCommitDetailView | ||
providerProps={{ | ||
...CONFIG, | ||
envName: config.envName, | ||
configId: config.envConfig.configId, | ||
walletConnectProjectId: CONFIG.walletConnect.projectId, | ||
defaultCurrencySymbol: CONFIG.defaultCurrency.symbol, | ||
defaultCurrencyTicker: CONFIG.defaultCurrency.ticker, | ||
licenseTemplate: CONFIG.rNFTLicenseTemplate, | ||
minimumDisputeResolutionPeriodDays: CONFIG.minimumDisputePeriodInDays, | ||
contactSellerForExchangeUrl: "" | ||
}} | ||
selectedVariant={selectedVariant} | ||
showPriceAsterisk={isPreview} | ||
showBosonLogo={false} | ||
onExchangePolicyClick={({ exchangePolicyCheckResult }) => { | ||
showModal(MODAL_TYPES.EXCHANGE_POLICY_DETAILS, { | ||
title: "Exchange Policy Details", | ||
offerId: selectedVariant.offer.id, | ||
offerData: selectedVariant.offer, | ||
exchangePolicyCheckResult: exchangePolicyCheckResult | ||
}); | ||
}} | ||
onPurchaseOverview={() => { | ||
showModal(MODAL_TYPES.WHAT_IS_REDEEM, { | ||
title: "Commit and Redeem" | ||
}); | ||
}} | ||
onClickBuyOrSwap={({ swapParams }) => { | ||
navigate({ pathname: BosonRoutes.Swap, search: swapParams }); | ||
}} | ||
onAlreadyOwnOfferClick={() => { | ||
navigate({ pathname: BosonRoutes.YourAccount }); | ||
}} | ||
> | ||
<>{children}</> | ||
</ExternalCommitDetailView> | ||
); | ||
}; |
This file contains 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 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 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 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.