@bosonprotocol/react-kit 0.30.0-alpha.3 → 0.30.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/modal/components/Commit/OfferVariantView.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/Commit/OfferVariantView.js +3 -0
- package/dist/cjs/components/modal/components/Commit/OfferVariantView.js.map +1 -1
- package/dist/cjs/components/modal/components/common/OfferFullDescription/DigitalProductData.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/common/OfferFullDescription/DigitalProductData.js +33 -12
- package/dist/cjs/components/modal/components/common/OfferFullDescription/DigitalProductData.js.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/PhygitalProduct.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/PhygitalProduct.js +9 -23
- package/dist/cjs/components/modal/components/common/detail/PhygitalProduct.js.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/TokenGatedItem.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/TokenGatedItem.js +28 -16
- package/dist/cjs/components/modal/components/common/detail/TokenGatedItem.js.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.d.ts +3 -1
- package/dist/cjs/components/productCard/ProductCard.d.ts.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.js +14 -2
- package/dist/cjs/components/productCard/ProductCard.js.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.styles.d.ts +1 -0
- package/dist/cjs/components/productCard/ProductCard.styles.d.ts.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.styles.js +43 -3
- package/dist/cjs/components/productCard/ProductCard.styles.js.map +1 -1
- package/dist/cjs/components/ui/IpfsImage.d.ts +3 -0
- package/dist/cjs/components/ui/IpfsImage.d.ts.map +1 -1
- package/dist/cjs/components/ui/IpfsImage.js +12 -2
- package/dist/cjs/components/ui/IpfsImage.js.map +1 -1
- package/dist/cjs/hooks/bundles/useBundleItemsImages.d.ts +10 -0
- package/dist/cjs/hooks/bundles/useBundleItemsImages.d.ts.map +1 -0
- package/dist/cjs/hooks/bundles/useBundleItemsImages.js +56 -0
- package/dist/cjs/hooks/bundles/useBundleItemsImages.js.map +1 -0
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uris.d.ts +11 -0
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uris.d.ts.map +1 -0
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uris.js +37 -0
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uris.js.map +1 -0
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUris.d.ts +11 -0
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUris.d.ts.map +1 -0
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUris.js +37 -0
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUris.js.map +1 -0
- package/dist/cjs/hooks/contracts/useGetTokenUriImages.d.ts +10 -0
- package/dist/cjs/hooks/contracts/useGetTokenUriImages.d.ts.map +1 -0
- package/dist/cjs/hooks/contracts/useGetTokenUriImages.js +103 -0
- package/dist/cjs/hooks/contracts/useGetTokenUriImages.js.map +1 -0
- package/dist/cjs/hooks/index.d.ts +3 -3
- package/dist/cjs/hooks/index.d.ts.map +1 -1
- package/dist/cjs/hooks/index.js +3 -3
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/lib/ipfs/ipfs.d.ts.map +1 -1
- package/dist/cjs/lib/ipfs/ipfs.js +9 -4
- package/dist/cjs/lib/ipfs/ipfs.js.map +1 -1
- package/dist/cjs/lib/offer/getOfferDetails.js.map +1 -1
- package/dist/esm/components/modal/components/Commit/OfferVariantView.d.ts.map +1 -1
- package/dist/esm/components/modal/components/Commit/OfferVariantView.js +3 -0
- package/dist/esm/components/modal/components/Commit/OfferVariantView.js.map +1 -1
- package/dist/esm/components/modal/components/common/OfferFullDescription/DigitalProductData.d.ts.map +1 -1
- package/dist/esm/components/modal/components/common/OfferFullDescription/DigitalProductData.js +34 -8
- package/dist/esm/components/modal/components/common/OfferFullDescription/DigitalProductData.js.map +1 -1
- package/dist/esm/components/modal/components/common/detail/PhygitalProduct.d.ts.map +1 -1
- package/dist/esm/components/modal/components/common/detail/PhygitalProduct.js +9 -24
- package/dist/esm/components/modal/components/common/detail/PhygitalProduct.js.map +1 -1
- package/dist/esm/components/modal/components/common/detail/TokenGatedItem.d.ts.map +1 -1
- package/dist/esm/components/modal/components/common/detail/TokenGatedItem.js +28 -16
- package/dist/esm/components/modal/components/common/detail/TokenGatedItem.js.map +1 -1
- package/dist/esm/components/productCard/ProductCard.d.ts +3 -1
- package/dist/esm/components/productCard/ProductCard.d.ts.map +1 -1
- package/dist/esm/components/productCard/ProductCard.js +3 -3
- package/dist/esm/components/productCard/ProductCard.js.map +1 -1
- package/dist/esm/components/productCard/ProductCard.styles.d.ts +1 -0
- package/dist/esm/components/productCard/ProductCard.styles.d.ts.map +1 -1
- package/dist/esm/components/productCard/ProductCard.styles.js +42 -2
- package/dist/esm/components/productCard/ProductCard.styles.js.map +1 -1
- package/dist/esm/components/ui/IpfsImage.d.ts +3 -0
- package/dist/esm/components/ui/IpfsImage.d.ts.map +1 -1
- package/dist/esm/components/ui/IpfsImage.js +13 -3
- package/dist/esm/components/ui/IpfsImage.js.map +1 -1
- package/dist/esm/hooks/bundles/useBundleItemsImages.d.ts +10 -0
- package/dist/esm/hooks/bundles/useBundleItemsImages.d.ts.map +1 -0
- package/dist/esm/hooks/bundles/useBundleItemsImages.js +48 -0
- package/dist/esm/hooks/bundles/useBundleItemsImages.js.map +1 -0
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uris.d.ts +11 -0
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uris.d.ts.map +1 -0
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uris.js +22 -0
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uris.js.map +1 -0
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUris.d.ts +11 -0
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUris.d.ts.map +1 -0
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUris.js +22 -0
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUris.js.map +1 -0
- package/dist/esm/hooks/contracts/useGetTokenUriImages.d.ts +10 -0
- package/dist/esm/hooks/contracts/useGetTokenUriImages.d.ts.map +1 -0
- package/dist/esm/hooks/contracts/useGetTokenUriImages.js +90 -0
- package/dist/esm/hooks/contracts/useGetTokenUriImages.js.map +1 -0
- package/dist/esm/hooks/index.d.ts +3 -3
- package/dist/esm/hooks/index.d.ts.map +1 -1
- package/dist/esm/hooks/index.js +3 -3
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/lib/ipfs/ipfs.d.ts.map +1 -1
- package/dist/esm/lib/ipfs/ipfs.js +9 -4
- package/dist/esm/lib/ipfs/ipfs.js.map +1 -1
- package/dist/esm/lib/offer/getOfferDetails.js.map +1 -1
- package/package.json +4 -4
- package/src/components/modal/components/Commit/OfferVariantView.tsx +3 -0
- package/src/components/modal/components/common/OfferFullDescription/DigitalProductData.tsx +157 -113
- package/src/components/modal/components/common/detail/PhygitalProduct.tsx +13 -30
- package/src/components/modal/components/common/detail/TokenGatedItem.tsx +27 -15
- package/src/components/productCard/ProductCard.styles.ts +43 -2
- package/src/components/productCard/ProductCard.tsx +3 -2
- package/src/components/ui/IpfsImage.tsx +18 -3
- package/src/components/widgets/commit/CommitWidget.tsx +1 -1
- package/src/hooks/bundles/useBundleItemsImages.ts +71 -0
- package/src/hooks/contracts/erc1155/useErc1155Uris.ts +52 -0
- package/src/hooks/contracts/erc721/useErc721TokenUris.ts +52 -0
- package/src/hooks/contracts/useGetTokenUriImages.ts +126 -0
- package/src/hooks/index.ts +3 -3
- package/src/lib/ipfs/ipfs.ts +15 -5
- package/src/lib/offer/getOfferDetails.ts +4 -4
- package/src/stories/widgets/Commit.stories.tsx +3 -3
- package/dist/cjs/components/nftItem/NftItemIcon.d.ts +0 -8
- package/dist/cjs/components/nftItem/NftItemIcon.d.ts.map +0 -1
- package/dist/cjs/components/nftItem/NftItemIcon.js +0 -14
- package/dist/cjs/components/nftItem/NftItemIcon.js.map +0 -1
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uri.d.ts +0 -9
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uri.d.ts.map +0 -1
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uri.js +0 -29
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uri.js.map +0 -1
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUri.d.ts +0 -9
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUri.d.ts.map +0 -1
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUri.js +0 -29
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUri.js.map +0 -1
- package/dist/cjs/hooks/contracts/useGetTokenUriImage.d.ts +0 -8
- package/dist/cjs/hooks/contracts/useGetTokenUriImage.d.ts.map +0 -1
- package/dist/cjs/hooks/contracts/useGetTokenUriImage.js +0 -93
- package/dist/cjs/hooks/contracts/useGetTokenUriImage.js.map +0 -1
- package/dist/esm/components/nftItem/NftItemIcon.d.ts +0 -8
- package/dist/esm/components/nftItem/NftItemIcon.d.ts.map +0 -1
- package/dist/esm/components/nftItem/NftItemIcon.js +0 -7
- package/dist/esm/components/nftItem/NftItemIcon.js.map +0 -1
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uri.d.ts +0 -9
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uri.d.ts.map +0 -1
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uri.js +0 -16
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uri.js.map +0 -1
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUri.d.ts +0 -9
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUri.d.ts.map +0 -1
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUri.js +0 -16
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUri.js.map +0 -1
- package/dist/esm/hooks/contracts/useGetTokenUriImage.d.ts +0 -8
- package/dist/esm/hooks/contracts/useGetTokenUriImage.d.ts.map +0 -1
- package/dist/esm/hooks/contracts/useGetTokenUriImage.js +0 -80
- package/dist/esm/hooks/contracts/useGetTokenUriImage.js.map +0 -1
- package/src/components/nftItem/NftItemIcon.tsx +0 -16
- package/src/hooks/contracts/erc1155/useErc1155Uri.ts +0 -31
- package/src/hooks/contracts/erc721/useErc721TokenUri.ts +0 -31
- package/src/hooks/contracts/useGetTokenUriImage.ts +0 -102
|
@@ -3,7 +3,6 @@ import React from "react";
|
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import { getOfferDetails } from "../../../../../lib/offer/getOfferDetails";
|
|
5
5
|
import { Offer } from "../../../../../types/offer";
|
|
6
|
-
import { NftItemIcon } from "../../../../nftItem/NftItemIcon";
|
|
7
6
|
import { DetailsSummary } from "../../../../ui/DetailsSummary";
|
|
8
7
|
import { Grid } from "../../../../ui/Grid";
|
|
9
8
|
import { Typography } from "../../../../ui/Typography";
|
|
@@ -15,6 +14,12 @@ import {
|
|
|
15
14
|
digitalTypeMappingDisplay,
|
|
16
15
|
ercTokenMapping
|
|
17
16
|
} from "../../../../../lib/bundle/const";
|
|
17
|
+
import { useBundleItemsImages } from "../../../../../hooks/bundles/useBundleItemsImages";
|
|
18
|
+
import { useCoreSDKWithContext } from "../../../../../hooks/core-sdk/useCoreSdkWithContext";
|
|
19
|
+
import { isNftItem } from "../../../../../lib/bundle/filter";
|
|
20
|
+
import { isTruthy } from "../../../../../types/helpers";
|
|
21
|
+
import Video from "../../../../ui/Video";
|
|
22
|
+
import IpfsImage from "../../../../ui/IpfsImage";
|
|
18
23
|
|
|
19
24
|
const StyledDetailsSummary = styled(DetailsSummary)`
|
|
20
25
|
.icon-wrapper {
|
|
@@ -38,7 +43,12 @@ export const DigitalProductData: React.FC<DigitalProductDataProps> = ({
|
|
|
38
43
|
offer,
|
|
39
44
|
imagesToShow
|
|
40
45
|
}) => {
|
|
41
|
-
const {
|
|
46
|
+
const { bundleItems } = getOfferDetails(offer);
|
|
47
|
+
const { images } = useBundleItemsImages({
|
|
48
|
+
bundleItems,
|
|
49
|
+
coreSDK: useCoreSDKWithContext()
|
|
50
|
+
});
|
|
51
|
+
|
|
42
52
|
return (
|
|
43
53
|
<Grid
|
|
44
54
|
flexDirection="column"
|
|
@@ -47,121 +57,155 @@ export const DigitalProductData: React.FC<DigitalProductDataProps> = ({
|
|
|
47
57
|
justifyContent="space-between"
|
|
48
58
|
>
|
|
49
59
|
<Typography tag="h3">Digital product data</Typography>
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
60
|
+
{bundleItems
|
|
61
|
+
?.map((bundleItem, index) => {
|
|
62
|
+
if (!isNftItem(bundleItem)) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const nftItem = bundleItem;
|
|
66
|
+
const nftMedia = [
|
|
67
|
+
...(nftItem.image
|
|
68
|
+
? [{ url: nftItem.image, type: "image" } as const]
|
|
69
|
+
: []),
|
|
70
|
+
...(nftItem.animationUrl
|
|
71
|
+
? [
|
|
72
|
+
{
|
|
73
|
+
url: nftItem.animationUrl,
|
|
74
|
+
type: "video"
|
|
75
|
+
} as const
|
|
76
|
+
]
|
|
77
|
+
: [])
|
|
78
|
+
];
|
|
79
|
+
const imageSrc = images?.[index];
|
|
80
|
+
const videoSrc = bundleItem.animationUrl;
|
|
81
|
+
const icon = videoSrc ? (
|
|
82
|
+
<MediaWrapper>
|
|
83
|
+
<Video src={videoSrc} />
|
|
84
|
+
</MediaWrapper>
|
|
85
|
+
) : imageSrc ? (
|
|
86
|
+
<MediaWrapper>
|
|
87
|
+
<IpfsImage
|
|
88
|
+
src={imageSrc}
|
|
89
|
+
overrides={{ ipfsGateway: "https://ipfs.io/ipfs" }}
|
|
90
|
+
/>
|
|
91
|
+
</MediaWrapper>
|
|
92
|
+
) : null;
|
|
93
|
+
return (
|
|
94
|
+
<StyledDetailsSummary
|
|
95
|
+
key={nftItem.id}
|
|
96
|
+
icon={icon ? <MediaWrapper>{icon}</MediaWrapper> : null}
|
|
97
|
+
summaryText={nftItem.name || nftItem.contract || ""}
|
|
98
|
+
initiallyOpen={index === 0}
|
|
99
|
+
>
|
|
100
|
+
<DetailTable
|
|
101
|
+
align={false}
|
|
102
|
+
noBorder
|
|
103
|
+
data={[
|
|
104
|
+
...(nftItem.contract
|
|
105
|
+
? [
|
|
106
|
+
{
|
|
107
|
+
name: "Contract address",
|
|
108
|
+
value: (
|
|
109
|
+
<Typography tag="p">{nftItem.contract}</Typography>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
102
112
|
]
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
)
|
|
115
|
-
})),
|
|
116
|
-
...(nftItem.tokenIdRange?.min && nftItem.tokenIdRange.max
|
|
117
|
-
? [
|
|
118
|
-
{
|
|
119
|
-
name: "Token IDs",
|
|
120
|
-
value: (
|
|
121
|
-
<Typography tag="p">
|
|
122
|
-
{nftItem.tokenIdRange?.min}-
|
|
123
|
-
{nftItem.tokenIdRange?.max}
|
|
124
|
-
</Typography>
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
: []),
|
|
129
|
-
...(nftItem.terms || []).map((term) => ({
|
|
130
|
-
name: term.displayKey || term.key,
|
|
131
|
-
value: (
|
|
132
|
-
<Typography tag="p">
|
|
133
|
-
{buyerTransferInfoMapping[
|
|
134
|
-
term.value as keyof typeof buyerTransferInfoMapping
|
|
113
|
+
: []),
|
|
114
|
+
...(nftItem.description
|
|
115
|
+
? [
|
|
116
|
+
{
|
|
117
|
+
name: "Description",
|
|
118
|
+
value: (
|
|
119
|
+
<Typography tag="p">
|
|
120
|
+
{nftItem.description}
|
|
121
|
+
</Typography>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
135
124
|
]
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
125
|
+
: []),
|
|
126
|
+
...(nftItem.attributes || []).map((attribute) => ({
|
|
127
|
+
name: attribute.displayType || attribute.traitType,
|
|
128
|
+
value: (
|
|
129
|
+
<Typography tag="p">
|
|
130
|
+
{digitalTypeMappingDisplay[
|
|
131
|
+
attribute.value as keyof typeof digitalTypeMappingDisplay
|
|
132
|
+
]
|
|
133
|
+
? digitalTypeMappingDisplay[
|
|
134
|
+
attribute.value as keyof typeof digitalTypeMappingDisplay
|
|
141
135
|
]
|
|
142
|
-
|
|
143
|
-
|
|
136
|
+
: digitalNftTypeMapping[
|
|
137
|
+
attribute.value as keyof typeof digitalNftTypeMapping
|
|
138
|
+
]
|
|
139
|
+
? digitalNftTypeMapping[
|
|
140
|
+
attribute.value as keyof typeof digitalNftTypeMapping
|
|
141
|
+
]
|
|
142
|
+
: attribute.value}
|
|
143
|
+
</Typography>
|
|
144
|
+
)
|
|
145
|
+
})),
|
|
146
|
+
...(nftItem.tokenIdRange?.min && nftItem.tokenIdRange.max
|
|
147
|
+
? [
|
|
148
|
+
{
|
|
149
|
+
name:
|
|
150
|
+
nftItem.tokenIdRange?.min ===
|
|
151
|
+
nftItem.tokenIdRange?.max
|
|
152
|
+
? "Token ID"
|
|
153
|
+
: "Token IDs",
|
|
154
|
+
value:
|
|
155
|
+
nftItem.tokenIdRange?.min ===
|
|
156
|
+
nftItem.tokenIdRange?.max ? (
|
|
157
|
+
<Typography tag="p">
|
|
158
|
+
{nftItem.tokenIdRange?.min}
|
|
159
|
+
</Typography>
|
|
160
|
+
) : (
|
|
161
|
+
<Typography tag="p">
|
|
162
|
+
{nftItem.tokenIdRange?.min}-
|
|
163
|
+
{nftItem.tokenIdRange?.max}
|
|
164
|
+
</Typography>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
: []),
|
|
169
|
+
...(nftItem.terms || []).map((term) => ({
|
|
170
|
+
name: term.displayKey || term.key,
|
|
171
|
+
value: (
|
|
172
|
+
<Typography tag="p">
|
|
173
|
+
{buyerTransferInfoMapping[
|
|
174
|
+
term.value as keyof typeof buyerTransferInfoMapping
|
|
175
|
+
]
|
|
176
|
+
? buyerTransferInfoMapping[
|
|
177
|
+
term.value as keyof typeof buyerTransferInfoMapping
|
|
144
178
|
]
|
|
145
|
-
:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
179
|
+
: ercTokenMapping[
|
|
180
|
+
term.value as keyof typeof ercTokenMapping
|
|
181
|
+
]
|
|
182
|
+
? ercTokenMapping[
|
|
183
|
+
term.value as keyof typeof ercTokenMapping
|
|
184
|
+
]
|
|
185
|
+
: term.value}
|
|
186
|
+
</Typography>
|
|
187
|
+
)
|
|
188
|
+
}))
|
|
189
|
+
]}
|
|
190
|
+
inheritColor={false}
|
|
191
|
+
/>
|
|
192
|
+
{!!nftMedia.length && (
|
|
193
|
+
<div style={{ width: "100%", padding: "0 2rem 1.5rem 2rem" }}>
|
|
194
|
+
<SlickSlider
|
|
195
|
+
settings={{
|
|
196
|
+
...initialSettings,
|
|
197
|
+
slidesToShow: imagesToShow
|
|
198
|
+
}}
|
|
199
|
+
mediaFiles={nftMedia}
|
|
200
|
+
alignLeft
|
|
201
|
+
imageOptimizationOpts={{ height: 500 }}
|
|
202
|
+
/>
|
|
203
|
+
</div>
|
|
204
|
+
)}
|
|
205
|
+
</StyledDetailsSummary>
|
|
206
|
+
);
|
|
207
|
+
})
|
|
208
|
+
.filter(isTruthy)}
|
|
165
209
|
</Grid>
|
|
166
210
|
);
|
|
167
211
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { ArrowSquareUpRight } from "phosphor-react";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
3
|
import styled from "styled-components";
|
|
4
|
-
import {
|
|
4
|
+
import { useBundleItemsImages } from "../../../../../hooks/bundles/useBundleItemsImages";
|
|
5
5
|
import { useErc1155Name } from "../../../../../hooks/contracts/erc1155/useErc1155Name";
|
|
6
6
|
import { useErc721Name } from "../../../../../hooks/contracts/erc721/useErc721Name";
|
|
7
7
|
import { useCoreSDKWithContext } from "../../../../../hooks/core-sdk/useCoreSdkWithContext";
|
|
8
|
+
import { formatAddress } from "../../../../../lib/address/address";
|
|
8
9
|
import { isNftItem, isProductV1Item } from "../../../../../lib/bundle/filter";
|
|
9
10
|
import { getOfferDetails } from "../../../../../lib/offer/getOfferDetails";
|
|
11
|
+
import { theme } from "../../../../../theme";
|
|
10
12
|
import { Offer } from "../../../../../types/offer";
|
|
13
|
+
import { Tooltip } from "../../../../tooltip/Tooltip";
|
|
11
14
|
import { Grid } from "../../../../ui/Grid";
|
|
12
15
|
import IpfsImage from "../../../../ui/IpfsImage";
|
|
13
16
|
import ThemedButton from "../../../../ui/ThemedButton";
|
|
14
17
|
import { Typography } from "../../../../ui/Typography";
|
|
15
18
|
import Video from "../../../../ui/Video";
|
|
16
|
-
import { theme } from "../../../../../theme";
|
|
17
|
-
import { Tooltip } from "../../../../tooltip/Tooltip";
|
|
18
|
-
import { formatAddress } from "../../../../../lib/address/address";
|
|
19
19
|
const colors = theme.colors.light;
|
|
20
20
|
const imageSize = "2.5rem";
|
|
21
21
|
|
|
@@ -52,27 +52,7 @@ export const PhygitalProduct: React.FC<PhygitalProductProps> = ({ offer }) => {
|
|
|
52
52
|
},
|
|
53
53
|
{ enabled: !!contracts?.length, coreSDK }
|
|
54
54
|
);
|
|
55
|
-
const {
|
|
56
|
-
{
|
|
57
|
-
tokenIds: bundleItems?.map((bundleItem) => {
|
|
58
|
-
if (isNftItem(bundleItem)) {
|
|
59
|
-
return (
|
|
60
|
-
bundleItem.tokenIdRange?.min ??
|
|
61
|
-
bundleItem.tokenIdRange?.max ??
|
|
62
|
-
bundleItem.tokenId
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
}),
|
|
67
|
-
tokenUris: bundleItems?.map((bundleItem) => {
|
|
68
|
-
if (isNftItem(bundleItem)) {
|
|
69
|
-
return bundleItem.metadataUri;
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
})
|
|
73
|
-
},
|
|
74
|
-
{ enabled: !!bundleItems?.length }
|
|
75
|
-
);
|
|
55
|
+
const { images } = useBundleItemsImages({ bundleItems, coreSDK });
|
|
76
56
|
return (
|
|
77
57
|
<Grid flexDirection="column" alignItems="flex-start" gap="1rem">
|
|
78
58
|
<Typography>
|
|
@@ -118,7 +98,7 @@ export const PhygitalProduct: React.FC<PhygitalProductProps> = ({ offer }) => {
|
|
|
118
98
|
</Tooltip>
|
|
119
99
|
);
|
|
120
100
|
}
|
|
121
|
-
imageSrc =
|
|
101
|
+
imageSrc = images?.[index];
|
|
122
102
|
videoSrc = bundleItem.animationUrl;
|
|
123
103
|
rangeText =
|
|
124
104
|
bundleItem.tokenIdRange?.min ||
|
|
@@ -158,13 +138,16 @@ export const PhygitalProduct: React.FC<PhygitalProductProps> = ({ offer }) => {
|
|
|
158
138
|
color: colors.darkGrey
|
|
159
139
|
}}
|
|
160
140
|
>
|
|
161
|
-
{
|
|
141
|
+
{videoSrc ? (
|
|
162
142
|
<MediaWrapper>
|
|
163
|
-
<
|
|
143
|
+
<Video src={videoSrc} />
|
|
164
144
|
</MediaWrapper>
|
|
165
|
-
) :
|
|
145
|
+
) : imageSrc ? (
|
|
166
146
|
<MediaWrapper>
|
|
167
|
-
<
|
|
147
|
+
<IpfsImage
|
|
148
|
+
src={imageSrc}
|
|
149
|
+
overrides={{ ipfsGateway: "https://ipfs.io/ipfs" }}
|
|
150
|
+
/>
|
|
168
151
|
</MediaWrapper>
|
|
169
152
|
) : null}
|
|
170
153
|
<div>{quantity}x</div>
|
|
@@ -10,12 +10,12 @@ import React, {
|
|
|
10
10
|
useState
|
|
11
11
|
} from "react";
|
|
12
12
|
import styled from "styled-components";
|
|
13
|
-
import {
|
|
13
|
+
import { useErc1155Uris } from "../../../../../hooks/contracts/erc1155/useErc1155Uris";
|
|
14
14
|
import { useErc20ExchangeTokenInfo } from "../../../../../hooks/contracts/erc20/useErc20ExchangeTokenInfo";
|
|
15
|
-
import {
|
|
15
|
+
import { useErc721TokenUris } from "../../../../../hooks/contracts/erc721/useErc721TokenUris";
|
|
16
16
|
import { useCoreSDKWithContext } from "../../../../../hooks/core-sdk/useCoreSdkWithContext";
|
|
17
17
|
import { nativeOnChain } from "../../../../../lib/const/tokens";
|
|
18
|
-
import {
|
|
18
|
+
import { useGetTokenUriImages } from "../../../../../hooks/contracts/useGetTokenUriImages";
|
|
19
19
|
import { theme } from "../../../../../theme";
|
|
20
20
|
import { Offer } from "../../../../../types/offer";
|
|
21
21
|
import { useConfigContext } from "../../../../config/ConfigContext";
|
|
@@ -185,10 +185,15 @@ export const TokenGatedItem = ({
|
|
|
185
185
|
coreSDK
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
|
-
const
|
|
188
|
+
const pairsContractTokens = [
|
|
189
189
|
{
|
|
190
190
|
contractAddress: condition?.tokenAddress,
|
|
191
191
|
tokenIds: [condition?.minTokenId]
|
|
192
|
+
}
|
|
193
|
+
];
|
|
194
|
+
const { data: erc721TokenUri } = useErc721TokenUris(
|
|
195
|
+
{
|
|
196
|
+
pairsContractTokens
|
|
192
197
|
},
|
|
193
198
|
{
|
|
194
199
|
enabled:
|
|
@@ -198,10 +203,9 @@ export const TokenGatedItem = ({
|
|
|
198
203
|
coreSDK
|
|
199
204
|
}
|
|
200
205
|
);
|
|
201
|
-
const { data: erc1155Uri } =
|
|
206
|
+
const { data: erc1155Uri } = useErc1155Uris(
|
|
202
207
|
{
|
|
203
|
-
|
|
204
|
-
tokenIds: [condition?.minTokenId]
|
|
208
|
+
pairsContractTokens
|
|
205
209
|
},
|
|
206
210
|
{
|
|
207
211
|
enabled:
|
|
@@ -230,17 +234,25 @@ export const TokenGatedItem = ({
|
|
|
230
234
|
);
|
|
231
235
|
|
|
232
236
|
const tokenIdForImage = condition?.minTokenId;
|
|
233
|
-
const { data: erc721Image } =
|
|
237
|
+
const { data: erc721Image } = useGetTokenUriImages(
|
|
234
238
|
{
|
|
235
|
-
|
|
236
|
-
|
|
239
|
+
pairsTokenUrisIds: [
|
|
240
|
+
{
|
|
241
|
+
tokenUris: erc721TokenUri?.[0],
|
|
242
|
+
tokenIds: [tokenIdForImage]
|
|
243
|
+
}
|
|
244
|
+
]
|
|
237
245
|
},
|
|
238
246
|
{ enabled: !!(erc721TokenUri && erc721TokenUri[0] && tokenIdForImage) }
|
|
239
247
|
);
|
|
240
|
-
const { data: erc1155Image } =
|
|
248
|
+
const { data: erc1155Image } = useGetTokenUriImages(
|
|
241
249
|
{
|
|
242
|
-
|
|
243
|
-
|
|
250
|
+
pairsTokenUrisIds: [
|
|
251
|
+
{
|
|
252
|
+
tokenUris: erc1155Uri?.[0],
|
|
253
|
+
tokenIds: [tokenIdForImage]
|
|
254
|
+
}
|
|
255
|
+
]
|
|
244
256
|
},
|
|
245
257
|
{ enabled: !!(erc1155Uri && erc1155Uri[0] && tokenIdForImage) }
|
|
246
258
|
);
|
|
@@ -255,9 +267,9 @@ export const TokenGatedItem = ({
|
|
|
255
267
|
currencies={[currency]}
|
|
256
268
|
/>
|
|
257
269
|
) : erc721Image ? (
|
|
258
|
-
<ErcImage src={erc721Image[0]} alt="erc721" />
|
|
270
|
+
<ErcImage src={erc721Image[0][0]} alt="erc721" />
|
|
259
271
|
) : erc1155Image ? (
|
|
260
|
-
<ErcImage src={erc1155Image[0]} alt="erc1155" />
|
|
272
|
+
<ErcImage src={erc1155Image[0][0]} alt="erc1155" />
|
|
261
273
|
) : null}
|
|
262
274
|
</>
|
|
263
275
|
);
|
|
@@ -13,6 +13,45 @@ export const ProductCardLabelWrapper = styled.div`
|
|
|
13
13
|
z-index: 1;
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
|
+
export const TopLeftRibbon = styled.div`
|
|
17
|
+
--d: 6px; /* folded part */
|
|
18
|
+
position: relative;
|
|
19
|
+
z-index: 1;
|
|
20
|
+
&:before {
|
|
21
|
+
content: attr(data-text);
|
|
22
|
+
font-size: var(--f);
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
/* I : position & coloration */
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
transform: translate(0%, 125%) rotate(-45deg);
|
|
29
|
+
transform-origin: bottom left;
|
|
30
|
+
padding: 5px 35px calc(var(--d) + 5px);
|
|
31
|
+
color: ${({ theme }) => theme?.colors?.light.white};
|
|
32
|
+
background: linear-gradient(rgba(0, 0, 0, 0.5) 0 0) bottom/100% var(--d)
|
|
33
|
+
no-repeat ${({ theme }) => theme?.colors?.light.secondary};
|
|
34
|
+
/* II : clipping */
|
|
35
|
+
clip-path: polygon(
|
|
36
|
+
0 0,
|
|
37
|
+
100% 0,
|
|
38
|
+
100% 100%,
|
|
39
|
+
calc(100% - var(--d)) calc(100% - var(--d)),
|
|
40
|
+
var(--d) calc(100% - var(--d)),
|
|
41
|
+
0 100%
|
|
42
|
+
);
|
|
43
|
+
/* III : masking */
|
|
44
|
+
-webkit-mask:
|
|
45
|
+
linear-gradient(135deg, transparent calc(50% - var(--d) * 0.707), #fff 0)
|
|
46
|
+
bottom left,
|
|
47
|
+
linear-gradient(-135deg, transparent calc(50% - var(--d) * 0.707), #fff 0)
|
|
48
|
+
bottom right;
|
|
49
|
+
-webkit-mask-size: 300vmax 300vmax;
|
|
50
|
+
-webkit-mask-composite: destination-in;
|
|
51
|
+
mask-composite: intersect;
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
|
|
16
55
|
export const ProductCardCreator = styled.div`
|
|
17
56
|
display: flex;
|
|
18
57
|
flex-direction: column;
|
|
@@ -130,8 +169,10 @@ export const ProductCardWrapper = styled.div<{ $isHoverDisabled: boolean }>`
|
|
|
130
169
|
? css`
|
|
131
170
|
transition: all 300ms ease-in-out;
|
|
132
171
|
&:hover {
|
|
133
|
-
box-shadow:
|
|
134
|
-
|
|
172
|
+
box-shadow:
|
|
173
|
+
0px 0px 0px rgba(0, 0, 0, 0.05),
|
|
174
|
+
4px 4px 4px rgba(0, 0, 0, 0.05),
|
|
175
|
+
8px 8px 8px rgba(0, 0, 0, 0.05),
|
|
135
176
|
16px 16px 16px rgba(0, 0, 0, 0.05);
|
|
136
177
|
|
|
137
178
|
[data-image-wrapper] {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ProductCardBottomContent,
|
|
12
12
|
ProductCardCreator,
|
|
13
13
|
ProductCardCreatorAvatar,
|
|
14
|
+
TopLeftRibbon,
|
|
14
15
|
ProductCardCreatorName,
|
|
15
16
|
ProductCardData,
|
|
16
17
|
ProductCardImageWrapper,
|
|
@@ -62,8 +63,8 @@ const Wrapper = ({
|
|
|
62
63
|
}
|
|
63
64
|
return <>{children}</>;
|
|
64
65
|
};
|
|
65
|
-
export const PhygitalLabel = () => {
|
|
66
|
-
return <
|
|
66
|
+
export const PhygitalLabel = ({ ...rest }) => {
|
|
67
|
+
return <TopLeftRibbon {...rest} data-text="Phygital" />;
|
|
67
68
|
};
|
|
68
69
|
export const ProductCard = (props: IProductCard) => {
|
|
69
70
|
const {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CameraSlash, Image as ImageIcon } from "phosphor-react";
|
|
2
|
-
import React, { useState } from "react";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
|
|
5
5
|
import { buttonText } from "./styles";
|
|
@@ -82,6 +82,9 @@ interface IImage {
|
|
|
82
82
|
withLoading?: boolean;
|
|
83
83
|
optimizationOpts?: Partial<ImageOptimizationOpts>;
|
|
84
84
|
onSetStatus?: (status: LoadingStatus) => void;
|
|
85
|
+
overrides?: {
|
|
86
|
+
ipfsGateway?: string;
|
|
87
|
+
};
|
|
85
88
|
}
|
|
86
89
|
const IpfsImage: React.FC<IImage & React.HTMLAttributes<HTMLDivElement>> = ({
|
|
87
90
|
src,
|
|
@@ -92,6 +95,7 @@ const IpfsImage: React.FC<IImage & React.HTMLAttributes<HTMLDivElement>> = ({
|
|
|
92
95
|
withLoading = true,
|
|
93
96
|
optimizationOpts,
|
|
94
97
|
onSetStatus,
|
|
98
|
+
overrides,
|
|
95
99
|
...rest
|
|
96
100
|
}) => {
|
|
97
101
|
const { ipfsGateway } = useIpfsContext();
|
|
@@ -103,10 +107,21 @@ const IpfsImage: React.FC<IImage & React.HTMLAttributes<HTMLDivElement>> = ({
|
|
|
103
107
|
onSetStatus?.(innerStatus);
|
|
104
108
|
};
|
|
105
109
|
const [currentSrc, setCurrentSrc] = useState<string>(
|
|
106
|
-
getImageUrl(src, ipfsGateway, optimizationOpts)
|
|
110
|
+
getImageUrl(src, overrides?.ipfsGateway || ipfsGateway, optimizationOpts)
|
|
107
111
|
);
|
|
108
112
|
const [didOriginalSrcFail, setDidOriginalSrcFail] = useState<boolean>(false);
|
|
109
|
-
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (src === currentSrc) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
// reset all if src changes
|
|
118
|
+
setStatus(withLoading ? "loading" : "success");
|
|
119
|
+
setCurrentSrc(
|
|
120
|
+
getImageUrl(src, overrides?.ipfsGateway || ipfsGateway, optimizationOpts)
|
|
121
|
+
);
|
|
122
|
+
setDidOriginalSrcFail(false);
|
|
123
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
124
|
+
}, [src]);
|
|
110
125
|
const isError = status === "error";
|
|
111
126
|
const isLoading = status === "loading";
|
|
112
127
|
const isSuccess = status === "success";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./CommitWidgetProviders";
|
|
9
9
|
import GlobalStyle from "../../styles/GlobalStyle";
|
|
10
10
|
import { CSSProperties } from "styled-components";
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
type CommitProps = {
|
|
13
13
|
buttonProps?: Omit<ButtonProps, "onClick">;
|
|
14
14
|
trigger?: ComponentType<{ onClick: () => unknown }> | undefined;
|