diff --git a/packages/react-kit/src/components/modal/components/Commit/ContractualAgreementView/ContractualAgreementView.tsx b/packages/react-kit/src/components/modal/components/Commit/ContractualAgreementView/ContractualAgreementView.tsx index a16437ac2..c8ccba22d 100644 --- a/packages/react-kit/src/components/modal/components/Commit/ContractualAgreementView/ContractualAgreementView.tsx +++ b/packages/react-kit/src/components/modal/components/Commit/ContractualAgreementView/ContractualAgreementView.tsx @@ -23,7 +23,7 @@ export function ContractualAgreementView({ showBosonLogoInHeader }: Props) { const offerId = offer?.id; - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/Commit/LicenseAgreementView/LicenseAgreementView.tsx b/packages/react-kit/src/components/modal/components/Commit/LicenseAgreementView/LicenseAgreementView.tsx index 3c700158b..ff2a7ee98 100644 --- a/packages/react-kit/src/components/modal/components/Commit/LicenseAgreementView/LicenseAgreementView.tsx +++ b/packages/react-kit/src/components/modal/components/Commit/LicenseAgreementView/LicenseAgreementView.tsx @@ -1,14 +1,9 @@ import React, { useEffect } from "react"; -import { Grid } from "../../../../ui/Grid"; -import { Typography } from "../../../../ui/Typography"; import { Exchange } from "../../../../../types/exchange"; import License from "../../../../license/License"; import { useNonModalContext } from "../../../nonModal/NonModal"; import { getCssVar } from "../../../../../theme"; -import { - defaultThemedBosonLogoProps, - ThemedBosonLogo -} from "../../common/ThemedBosonLogo"; +import { HeaderView } from "../../../nonModal/headers/HeaderView"; interface Props { onBackClick: () => void; @@ -21,27 +16,16 @@ export function LicenseAgreementView({ offer, showBosonLogoInHeader }: Props) { - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { onArrowLeftClick: onBackClick, headerComponent: ( - - License Agreement - {showBosonLogoInHeader && ( - - )} - + ), contentStyle: { background: getCssVar("--background-accent-color") diff --git a/packages/react-kit/src/components/modal/components/Commit/OfferFullDescriptionView/OfferFullDescriptionView.tsx b/packages/react-kit/src/components/modal/components/Commit/OfferFullDescriptionView/OfferFullDescriptionView.tsx index 5ebd7716a..ffaaedf8b 100644 --- a/packages/react-kit/src/components/modal/components/Commit/OfferFullDescriptionView/OfferFullDescriptionView.tsx +++ b/packages/react-kit/src/components/modal/components/Commit/OfferFullDescriptionView/OfferFullDescriptionView.tsx @@ -4,11 +4,11 @@ import { Offer } from "../../../../../types/offer"; import { useNonModalContext } from "../../../nonModal/NonModal"; import { OfferFullDescription } from "../../common/OfferFullDescription/OfferFullDescription"; import { Grid } from "../../../../ui/Grid"; -import { ArrowLeft } from "phosphor-react"; import { Typography } from "../../../../ui/Typography"; import { OnClickBuyOrSwapHandler } from "../../common/detail/types"; import { UseGetOfferDetailDataProps } from "../../common/detail/useGetOfferDetailData"; import { ThemedBosonLogo } from "../../common/ThemedBosonLogo"; +import { HeaderView } from "../../../nonModal/headers/HeaderView"; type Props = OnClickBuyOrSwapHandler & { onBackClick: () => void; @@ -23,20 +23,16 @@ export function OfferFullDescriptionView({ onClickBuyOrSwap, showBosonLogoInHeader }: Props) { - const dispatch = useNonModalContext(); + const { dispatch, showConnectButton } = useNonModalContext(); useEffect(() => { dispatch({ payload: { onArrowLeftClick: onBackClick, headerComponent: ( - - {offer.metadata?.name || ""} - {showBosonLogoInHeader && } - + ), contentStyle: { background: getCssVar("--background-accent-color"), @@ -44,7 +40,13 @@ export function OfferFullDescriptionView({ } } }); - }, [dispatch, offer.metadata?.name, onBackClick, showBosonLogoInHeader]); + }, [ + dispatch, + offer.metadata?.name, + onBackClick, + showBosonLogoInHeader, + showConnectButton + ]); return ( { dispatch({ payload: { onArrowLeftClick: onBackClick, headerComponent: ( - - - {offerName} - - {showBosonLogoInHeader && } - + <> + {offer?.metadata?.name || ""} + + {showBosonLogoInHeader && } + + ), contentStyle: { background: getCssVar("--background-accent-color") } } }); - }, [dispatch, offerName, onBackClick, showBosonLogoInHeader]); + }, [ + dispatch, + offer?.metadata?.name, + offerName, + onBackClick, + showBosonLogoInHeader, + showConnectButton + ]); return ( <> {offer ? ( diff --git a/packages/react-kit/src/components/modal/components/Commit/OfferVariantView.tsx b/packages/react-kit/src/components/modal/components/Commit/OfferVariantView.tsx index f38148a6a..c90c1b984 100644 --- a/packages/react-kit/src/components/modal/components/Commit/OfferVariantView.tsx +++ b/packages/react-kit/src/components/modal/components/Commit/OfferVariantView.tsx @@ -28,7 +28,7 @@ import { PhygitalLabel } from "../../../productCard/ProductCard"; import { useIsPhygital } from "../../../../hooks/offer/useIsPhygital"; import { getCssVar } from "../../../../theme"; import { InnerCommitDetailViewProps } from "./DetailView/InnerCommitDetailView"; -import { ThemedBosonLogo } from "../common/ThemedBosonLogo"; +import { HeaderView } from "../../nonModal/headers/HeaderView"; const ImageWrapper = styled.div` container-type: inline-size; @@ -111,22 +111,28 @@ export function OfferVariantView({ ); }, [offerImg, images]); - const dispatch = useNonModalContext(); + const { dispatch, showConnectButton } = useNonModalContext(); useEffect(() => { dispatch({ payload: { onArrowLeftClick: null, headerComponent: ( - - {showBosonLogoInHeader && } - + ), contentStyle: { background: getCssVar("--background-accent-color") } } }); - }, [dispatch, showBosonLogoInHeader]); + }, [ + dispatch, + offer.metadata?.name, + showBosonLogoInHeader, + showConnectButton + ]); const hasVariations = !!selectedVariant.variations?.length; const innerOnGetProviderProps = useCallback( (providerProps: DetailContextProps) => { @@ -215,9 +221,6 @@ export function OfferVariantView({ justifyContent="flex-start" alignItems="flex-start" > - - {offer.metadata?.name || ""} - {hasVariations && ( { dispatch({ diff --git a/packages/react-kit/src/components/modal/components/Redeem/ContractualAgreementView/ContractualAgreementView.tsx b/packages/react-kit/src/components/modal/components/Redeem/ContractualAgreementView/ContractualAgreementView.tsx index 5c9bb2fe9..bf9cfad54 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/ContractualAgreementView/ContractualAgreementView.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/ContractualAgreementView/ContractualAgreementView.tsx @@ -20,7 +20,7 @@ export function ContractualAgreementView({ }: Props) { const offer = exchange?.offer; const offerId = offer?.id; - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/ExchangeFullDescriptionView/ExchangeFullDescriptionView.tsx b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/ExchangeFullDescriptionView/ExchangeFullDescriptionView.tsx index b650fd2b6..02f179efb 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/ExchangeFullDescriptionView/ExchangeFullDescriptionView.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/ExchangeFullDescriptionView/ExchangeFullDescriptionView.tsx @@ -25,7 +25,7 @@ export function ExchangeFullDescriptionView({ onClickBuyOrSwap, showBosonLogoInFooter }: Props) { - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/ExchangeView.tsx b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/ExchangeView.tsx index a4018fa8f..67eb7902a 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/ExchangeView.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/ExchangeView.tsx @@ -122,7 +122,7 @@ export function ExchangeView({ ); }, [offerImg, images]); - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/RedeemSuccess.tsx b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/RedeemSuccess.tsx index 70a2d1632..32233b193 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/RedeemSuccess.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/RedeemSuccess.tsx @@ -57,7 +57,7 @@ export function RedeemSuccess({ const offer = exchange?.offer; const offerDetails = offer ? getOfferDetails(offer) : undefined; - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/cancellation/CancellationView.tsx b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/cancellation/CancellationView.tsx index e8b6853b1..0fbb654a4 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/cancellation/CancellationView.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/cancellation/CancellationView.tsx @@ -26,7 +26,7 @@ export const CancellationView: React.FC = ({ showBosonLogoInFooter }) => { const { address } = useAccount(); - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); const { widgetAction } = useRedemptionWidgetContext(); const isCancelModeOnly = widgetAction === RedemptionWidgetAction.CANCEL_FORM; useEffect(() => { diff --git a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/expireVoucher/ExpireVoucherView.tsx b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/expireVoucher/ExpireVoucherView.tsx index 142fade65..8443bf850 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/expireVoucher/ExpireVoucherView.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/ExchangeView/expireVoucher/ExpireVoucherView.tsx @@ -20,7 +20,7 @@ export const ExpireVoucherView: React.FC = ({ onSuccess, showBosonLogoInFooter }) => { - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/Redeem/LicenseAgreementView/LicenseAgreementView.tsx b/packages/react-kit/src/components/modal/components/Redeem/LicenseAgreementView/LicenseAgreementView.tsx index 5b532f31b..7b32ecd9e 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/LicenseAgreementView/LicenseAgreementView.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/LicenseAgreementView/LicenseAgreementView.tsx @@ -18,7 +18,7 @@ export function LicenseAgreementView({ offer, showBosonLogoInFooter }: Props) { - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/Redeem/MyItems/MyItems.tsx b/packages/react-kit/src/components/modal/components/Redeem/MyItems/MyItems.tsx index c5c3ff615..5cafdb721 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/MyItems/MyItems.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/MyItems/MyItems.tsx @@ -42,7 +42,7 @@ export function MyItems({ wallet: address }); const buyerId = buyers?.[0]?.id; - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/Redeem/OfferPolicyView/RedeemOfferPolicyView.tsx b/packages/react-kit/src/components/modal/components/Redeem/OfferPolicyView/RedeemOfferPolicyView.tsx index b5f39a84c..23e17fd0c 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/OfferPolicyView/RedeemOfferPolicyView.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/OfferPolicyView/RedeemOfferPolicyView.tsx @@ -26,7 +26,7 @@ export function RedeemOfferPolicyView({ showBosonLogoInFooter }: Props) { const offerName = offer?.metadata?.name || ""; - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/Redeem/RedeemForm/RedeemFormView.tsx b/packages/react-kit/src/components/modal/components/Redeem/RedeemForm/RedeemFormView.tsx index 377b97c64..8dd94baab 100644 --- a/packages/react-kit/src/components/modal/components/Redeem/RedeemForm/RedeemFormView.tsx +++ b/packages/react-kit/src/components/modal/components/Redeem/RedeemForm/RedeemFormView.tsx @@ -25,7 +25,7 @@ export default function RedeemFormView({ showBosonLogoInFooter }: Props) { const { address } = useAccount(); - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/components/common/StepsOverview/StepsOverview.tsx b/packages/react-kit/src/components/modal/components/common/StepsOverview/StepsOverview.tsx index 3ebe34cef..6328b5b09 100644 --- a/packages/react-kit/src/components/modal/components/common/StepsOverview/StepsOverview.tsx +++ b/packages/react-kit/src/components/modal/components/common/StepsOverview/StepsOverview.tsx @@ -50,7 +50,7 @@ export default function StepsOverview({ onNextClick, showBosonLogoInFooter }: Props) { - const dispatch = useNonModalContext(); + const { dispatch } = useNonModalContext(); useEffect(() => { dispatch({ payload: { diff --git a/packages/react-kit/src/components/modal/nonModal/NonModal.tsx b/packages/react-kit/src/components/modal/nonModal/NonModal.tsx index ad9237e7f..630c674c7 100644 --- a/packages/react-kit/src/components/modal/nonModal/NonModal.tsx +++ b/packages/react-kit/src/components/modal/nonModal/NonModal.tsx @@ -170,9 +170,9 @@ const reducer = (state: State, action: Action): State => { }; }; -const NonModalContext = createContext | undefined>( - undefined -); +const NonModalContext = createContext< + { dispatch: React.Dispatch; showConnectButton: boolean } | undefined +>(undefined); export const useNonModalContext = () => { const context = useContext(NonModalContext); if (!context) { @@ -256,27 +256,27 @@ export default function NonModal({ }, [lookAndFeel]); return ( - -
+ + +
- - - {children} - - - {FooterComponent ? ( - {FooterComponent} - ) : ( -
- )} - + {children} + {FooterComponent ? ( + {FooterComponent} + ) : ( +
+ )} + + ); } diff --git a/packages/react-kit/src/components/modal/nonModal/headers/HeaderView.tsx b/packages/react-kit/src/components/modal/nonModal/headers/HeaderView.tsx new file mode 100644 index 000000000..bed2fb9dd --- /dev/null +++ b/packages/react-kit/src/components/modal/nonModal/headers/HeaderView.tsx @@ -0,0 +1,29 @@ +import React from "react"; +import { Typography } from "../../../ui/Typography"; +import { useNonModalContext } from "../NonModal"; +import { Grid } from "../../../ui/Grid"; +import { ThemedBosonLogo } from "../../components/common/ThemedBosonLogo"; + +export type HeaderViewProps = { + text: string | undefined; + showBosonLogoInHeader: boolean; +}; +export const HeaderView = ({ + showBosonLogoInHeader, + text +}: HeaderViewProps) => { + const { showConnectButton } = useNonModalContext(); + + return ( + <> + {text} + + {showBosonLogoInHeader && } + + + ); +}; diff --git a/packages/react-kit/src/components/widgets/redemption/RedemptionWidgetProviders.tsx b/packages/react-kit/src/components/widgets/redemption/RedemptionWidgetProviders.tsx index 6a370837a..e673ad9f1 100644 --- a/packages/react-kit/src/components/widgets/redemption/RedemptionWidgetProviders.tsx +++ b/packages/react-kit/src/components/widgets/redemption/RedemptionWidgetProviders.tsx @@ -27,6 +27,7 @@ import { import { BosonProvider, BosonProviderProps } from "../../boson/BosonProvider"; import { Web3Provider, Web3ProviderProps } from "../../wallet2/web3Provider"; import { BlockNumberProvider } from "../../../hooks/contracts/useBlockNumber"; +import { RobloxProvider } from "../../../hooks/roblox/context/RobloxProvider"; export type RedemptionWidgetProvidersProps = IpfsProviderProps & Omit & @@ -58,29 +59,31 @@ export const RedemptionWidgetProviders: React.FC {...props} infuraKey={infuraKey} > - - - - - - - - - - - {children} - - - - - - - - - + + + + + + + + + + + + {children} + + + + + + + + + +