diff --git a/app/css/app.css b/app/css/app.css index 20148ed..f14d9d9 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -72,10 +72,15 @@ h1.title { visibility: hidden; } -.ship:hover button { +.ship:hover button, +.ship:hover .input-group { visibility: visible; } +.ship .input-group { + visibility: hidden; +} + .ship span.price { position: absolute; background: rgb(38, 121, 21); @@ -129,6 +134,13 @@ h1.title { clear: both; } +#enableSales { + float: left; + clear: both; + display: block; + width: 100%; +} + #enableSales span { position: relative; top: -5px; diff --git a/app/js/components/addToken.js b/app/js/components/addToken.js index 5dc68e5..4bffa19 100644 --- a/app/js/components/addToken.js +++ b/app/js/components/addToken.js @@ -68,6 +68,8 @@ class AddToken extends Component { this.props.loadShipsForSale(); // TODO: show success + + return true; }) .catch((err) => { console.error(err); diff --git a/app/js/components/ship.js b/app/js/components/ship.js index 4c140d5..a59d35b 100644 --- a/app/js/components/ship.js +++ b/app/js/components/ship.js @@ -63,7 +63,7 @@ class Ship extends Component { }) .then(receipt => { console.log(receipt); - + this.props.onAction(); // TODO: show success @@ -79,7 +79,7 @@ class Ship extends Component { } render(){ - const { energy, lasers, shield, price, wallet } = this.props; + const { energy, lasers, shield, price, wallet, salesEnabled } = this.props; const { image, isSubmitting, showSellForm } = this.state; const formattedPrice = !wallet ? web3.utils.fromWei(price, "ether") : ''; @@ -95,7 +95,7 @@ class Ship extends Component { { !wallet ? - : (!showSellForm + : (!showSellForm && salesEnabled ? : '') } diff --git a/app/js/components/shipList.js b/app/js/components/shipList.js index 3347276..81dd4da 100644 --- a/app/js/components/shipList.js +++ b/app/js/components/shipList.js @@ -11,7 +11,8 @@ class ShipList extends Component { constructor(props){ super(props); this.state = { - isSubmitting: false + isSubmitting: false, + salesEnabled: false } } @@ -30,7 +31,7 @@ enableMarketplace = () => { const { setApprovalForAll } = SpaceshipToken.methods; this.setState({isSubmitting: true}); - +console.log(SpaceshipMarketplace); const toSend = setApprovalForAll(SpaceshipMarketplace.options.address, !this.state.salesEnabled); toSend.estimateGas() @@ -54,9 +55,12 @@ enableMarketplace = () => { render = () => { const { list, title, id, wallet, onAction } = this.props; + const { salesEnabled } = this.state; + return
-

{title}

{ wallet ? : ''} - { list.map((ship, i) => ) } +

{title}

+ { wallet ? : ''} + { list.map((ship, i) => ) }
; } diff --git a/contracts/SpaceshipMarketplace.sol b/contracts/SpaceshipMarketplace.sol index fcc49b6..b4d6301 100644 --- a/contracts/SpaceshipMarketplace.sol +++ b/contracts/SpaceshipMarketplace.sol @@ -1,10 +1,10 @@ pragma solidity 0.4.24; import "./SpaceshipToken.sol"; -import "zeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol"; +import "zeppelin-solidity/contracts/token/ERC721/ERC721Holder.sol"; -contract SpaceshipMarketplace is ERC721Receiver { +contract SpaceshipMarketplace is ERC721Holder { // Esta estructura guarda informacion sobre las ventas struct Sale { @@ -23,7 +23,7 @@ contract SpaceshipMarketplace is ERC721Receiver { event ShipSold(uint indexed spaceshipId, uint price, address indexed oldOwner, address indexed newOwner); - constructor(SpaceshipToken _token) public{ + constructor(SpaceshipToken _token) public { token = _token; }