@@ -25,9 +25,9 @@ import Pastille from "../_utils/components/stateless/pastille";
2525
2626import ClickAwayListener from "@mui/material/ClickAwayListener" ;
2727import Clickable from "../_utils/components/stateless/clickable" ;
28- import { useSelector } from "./store/hooks" ;
28+ import { useDispatch , useSelector } from "./store/hooks" ;
2929import SceneLoader from "@/_3d/scenes/skate_1" ;
30- import { useGetNFTsForDropByAddressQuery } from "./store/services/drop " ;
30+ import { getAssetsOwned } from "./store/actions/app.actions " ;
3131
3232const pastilles = [
3333 {
@@ -48,40 +48,35 @@ const pastilles = [
4848 } ,
4949] ;
5050
51- const Drop : FC = ( ) => {
52- const state = useSelector ( ( state ) => state . appState ) ;
53- const isConnected = state . signedIn ;
54- const nfts = state . walletAssets . nfts ;
51+ const Drop : FC < { dropId : number } > = ( { dropId } ) => {
52+ // store
53+ const dispatch = useDispatch ( ) ;
54+ const { auth , wallet } = useSelector ( ( state ) => state . appState ) ;
5555
56- const [ currentItem , setItem ] = React . useState ( undefined as any ) ;
56+ // fc state
57+ const [ currentItem , setItem ] = React . useState < { collection : string ; id : number ; img : string } > ( ) ;
5758 const [ checked , setChecked ] = React . useState ( false ) ;
59+ const handleChange = ( ) => setChecked ( ! checked ) ;
5860
59- const handleChange = ( ) => {
60- if ( checked === false ) {
61- setChecked ( true ) ;
62- } else {
63- setChecked ( false ) ;
61+ useEffect ( ( ) => {
62+ if ( auth . signedIn ) {
63+ dispatch ( getAssetsOwned ( dropId , auth . address ) ) ;
6464 }
65- } ;
65+ } , [ auth . signedIn ] ) ;
6666
6767 const deckTexture = "/models/skate/textures/sublime-deck.png" ;
6868 const placeholderTexture = "/models/skate/textures/imgForMiddle.png" ;
6969
70- const { data, error, isLoading } = useGetNFTsForDropByAddressQuery ( {
71- dropId : 0 ,
72- address : "0xcadaA91596F3E2aFA69a37F47a5C70a4e3765c00" ,
73- } ) ;
74-
75- console . log ( data ) ;
76-
77- //
7870 return (
7971 < Fade duration = { 1500 } triggerOnce >
8072 < Style . Root >
8173 < Style . Header > </ Style . Header >
82- < Style . Part1 >
83- < SceneLoader deckTexture = { deckTexture } placeholderTexture = { placeholderTexture } _id = { 1 } />
84- { /* <My3DScene /> */ }
74+ < Style . Body >
75+ < SceneLoader
76+ deckTexture = { deckTexture }
77+ placeholderTexture = { currentItem ?. img || placeholderTexture }
78+ _id = { 1 }
79+ />
8580 < Style . LeftSide >
8681 < Style . HeaderLeftSide container spacing = { 0 } alignItems = "center" >
8782 < Grid item xs = { 6 } >
@@ -112,29 +107,29 @@ const Drop: FC = () => {
112107 </ Grid >
113108 </ Style . HeaderLeftSide >
114109 { /* */ }
115- < Style . BodyLeftSide connected = { state . signedIn } >
110+ < Style . BodyLeftSide connected = { auth . signedIn } >
116111 { /* */ }
117112 < Style . InnerLeftSide >
118- { nfts . length ? (
119- nfts . map ( ( list , index1 ) => (
113+ { wallet . nfts . length ? (
114+ wallet . nfts . map ( ( collection , index1 ) => (
120115 < div key = { index1 } >
121- < Style . CollectionName > { list . collection } </ Style . CollectionName >
116+ < Style . CollectionName > { collection . collectionName } </ Style . CollectionName >
122117 < ImageList cols = { 4 } gap = { 4 } style = { { marginBottom : "20px" } } >
123- { list . list . map ( ( item , index ) => (
118+ { collection . assets . map ( ( item , index ) => (
124119 < ImageListItem
125120 key = { index }
126121 style = { {
127122 border :
128123 currentItem &&
129- currentItem . collection === list . collection &&
124+ currentItem . collection === collection . collectionName &&
130125 currentItem . id === item . id
131126 ? "3px solid #2AFE00"
132127 : "3px solid white" ,
133128 cursor : "pointer" ,
134129 } }
135130 onClick = { ( ) => {
136131 setItem ( {
137- collection : list . collection ,
132+ collection : collection . collectionName ,
138133 id : item . id ,
139134 img : item . img ,
140135 } ) ;
@@ -143,15 +138,15 @@ const Drop: FC = () => {
143138 < img
144139 src = { `${ item . img } ?w=248&fit=crop&auto=format` }
145140 srcSet = { `${ item . img } ?w=248&fit=crop&auto=format&dpr=2 2x` }
146- alt = { item . title }
141+ alt = { " item.id" }
147142 loading = "lazy"
148143 />
149144 </ ImageListItem >
150145 ) ) }
151146 </ ImageList >
152147 </ div >
153148 ) )
154- ) : state . signedIn ? (
149+ ) : auth . signedIn ? (
155150 < Style . InnerLeftSideNoNfts > You do not own any NFTs :'(</ Style . InnerLeftSideNoNfts >
156151 ) : (
157152 < Style . InnerLeftSideNoNfts > You are not connected :'(</ Style . InnerLeftSideNoNfts >
@@ -248,14 +243,8 @@ const Drop: FC = () => {
248243 </ Style . InnerContainerInfo >
249244 </ Style . ContainerInfo >
250245 </ ClickAwayListener >
251- </ Style . Part1 >
252- < Style . Overlay >
253- < Style . InnerOverlay container justifyContent = "space-evenly" >
254- < Style . InnerOverlayLeft item > </ Style . InnerOverlayLeft >
255- < Style . InnerOverlayCenter item > </ Style . InnerOverlayCenter >
256- < Style . InnerOverlayRight item > </ Style . InnerOverlayRight >
257- </ Style . InnerOverlay >
258- </ Style . Overlay >
246+ </ Style . Body >
247+ < Style . Footer > </ Style . Footer >
259248 </ Style . Root >
260249 </ Fade >
261250 ) ;
0 commit comments