From 1ae9c9f2448a1301b0cb5f84c9c980b2d614f57d Mon Sep 17 00:00:00 2001 From: Grzegorz Kapkowski Date: Sun, 8 Jul 2018 14:56:04 +0200 Subject: [PATCH 1/3] Initial CryptoGoods integration --- public/index.html | 1 + src/Share.js | 24 ++++++++++++++++++++++++ src/ShowPage.js | 22 ++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/public/index.html b/public/index.html index b58ac6f..dff4a63 100644 --- a/public/index.html +++ b/public/index.html @@ -24,6 +24,7 @@ + diff --git a/src/Share.js b/src/Share.js index fb6c506..1373e8f 100644 --- a/src/Share.js +++ b/src/Share.js @@ -1,3 +1,4 @@ +/*global CryptoGoods:true*/ import React, { Component } from 'react'; import styled from 'styled-components'; @@ -77,6 +78,7 @@ class Share extends Component { this.share('tweet', e)}>Tweet it this.share('image', e)}>Get an image + this.share('cryptogoods', e)}>Buy at cryptogoods.co )} @@ -111,6 +113,28 @@ class Share extends Component { '_blank', ); break; + case 'cryptogoods': + CryptoGoods.open({ + // [required] : The token to display (must be owned by calling user) + token_id: '127', + // [optional] : Add this line while testing. Delete this line for production. + test: true, + // [optional] : The product to display initially + product: 'mug', + // [optional] : Used to avoid collisions between token IDs between different contracts + contract_name: 'CryptoKitties', + // [optional] : Used to avoid collisions between token IDs between different contracts + contract_address: '0x06012c8cf97BEaD5deAe237070F9587f8E7A266d', + // [optional] : For tracking purchases to your website (format: http[s]://example.com) + referrer: "https://cryptopurr.co", + // [optional] : A CSS branding color for matching your websites branding within the cart + brand_color: "#85D40C", + // [optional] : Payload containing additional data + payload: { + image_url: ipfsUrl, + } + }); + break; default: newWindow = window.open(ipfsUrl, '_blank'); } diff --git a/src/ShowPage.js b/src/ShowPage.js index 35e6494..4770d27 100644 --- a/src/ShowPage.js +++ b/src/ShowPage.js @@ -1,3 +1,4 @@ +/*global CryptoGoods:true*/ import React, { Component } from 'react'; import styled from 'styled-components'; import { pageView } from './Analytics'; @@ -278,6 +279,27 @@ export class SocialBadges extends React.Component { } /> + + { + console.log(id); + CryptoGoods.open({ + // [required] : The token to display (must be owned by calling user) + token_id: id, + // [optional] : Add this line while testing. Delete this line for production. + test: true, + // [optional] : The product to display initially + product: 'mug', + // [optional] : Used to avoid collisions between token IDs between different contracts + contract_name: 'CryptoKitties', + // [optional] : Used to avoid collisions between token IDs between different contracts + contract_address: '0x06012c8cf97BEaD5deAe237070F9587f8E7A266d', + // [optional] : For tracking purchases to your website (format: http[s]://example.com) + referrer: "https://cryptopurr.co", + // [optional] : A CSS branding color for matching your websites branding within the cart + brand_color: "#85D40C", + }); + }} children={} /> + {this.state.editing && ( Date: Sun, 8 Jul 2018 15:01:57 +0200 Subject: [PATCH 2/3] Clean up --- src/ShowPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ShowPage.js b/src/ShowPage.js index 4770d27..bf28572 100644 --- a/src/ShowPage.js +++ b/src/ShowPage.js @@ -281,7 +281,6 @@ export class SocialBadges extends React.Component { { - console.log(id); CryptoGoods.open({ // [required] : The token to display (must be owned by calling user) token_id: id, From 507f56c5d55058c1dccf9a64d1e3af37ba406e33 Mon Sep 17 00:00:00 2001 From: Grzegorz Kapkowski Date: Sun, 8 Jul 2018 15:17:46 +0200 Subject: [PATCH 3/3] Github icon doesn't match here, neither does external link but it's better --- src/ShowPage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ShowPage.js b/src/ShowPage.js index bf28572..e1a029d 100644 --- a/src/ShowPage.js +++ b/src/ShowPage.js @@ -12,7 +12,7 @@ import { ActiveEntityName } from './Entity'; import Modal from './Modal'; -import { FacebookIcon, GithubIcon, TwitterIcon, InstagramIcon, socialColors } from './Icons'; +import { FacebookIcon, GithubIcon, TwitterIcon, InstagramIcon, ExternalLink, socialColors } from './Icons'; import { ConnectedLabelForm, ReplyForm, CommentForm, ConnectedWriteToForm, ConnectedCommentForm } from './CommentForm'; import { EntityIcon } from './entityApi'; import Link from './Link'; @@ -280,7 +280,7 @@ export class SocialBadges extends React.Component { - { + { CryptoGoods.open({ // [required] : The token to display (must be owned by calling user) token_id: id, @@ -297,7 +297,7 @@ export class SocialBadges extends React.Component { // [optional] : A CSS branding color for matching your websites branding within the cart brand_color: "#85D40C", }); - }} children={} /> + }} children={} /> {this.state.editing && (