Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial CryptoGoods integration #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<link href="https://fonts.googleapis.com/css?family=Rubik:400,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.1/css/bulma.min.css">
<script src="https://cdn.cryptogoods.co/cryptogoods-v0.11.min.js" type="text/javascript"></script>
</head>

<body>
Expand Down
24 changes: 24 additions & 0 deletions src/Share.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*global CryptoGoods:true*/
import React, { Component } from 'react';
import styled from 'styled-components';

Expand Down Expand Up @@ -77,6 +78,7 @@ class Share extends Component {
<React.Fragment>
<ShareItem onClick={(e) => this.share('tweet', e)}>Tweet it</ShareItem>
<ShareItem onClick={(e) => this.share('image', e)}>Get an image</ShareItem>
<ShareItem onClick={(e) => this.share('cryptogoods', e)}>Buy at cryptogoods.co</ShareItem>
</React.Fragment>
)}
</SharePopup>
Expand Down Expand Up @@ -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');
}
Expand Down
23 changes: 22 additions & 1 deletion src/ShowPage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*global CryptoGoods:true*/
import React, { Component } from 'react';
import styled from 'styled-components';
import { pageView } from './Analytics';
Expand All @@ -11,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';
Expand Down Expand Up @@ -278,6 +279,26 @@ export class SocialBadges extends React.Component {
<Badge activeColor={socialColors.github} href={normalizeHref(github)} children={<GithubIcon />} />
<EditButton labelType="github" />
</SocialBadge>
<SocialBadge>
<Badge activeColor={socialColors.cryptogoods} onClick={() => {
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={<ExternalLink />} />
</SocialBadge>
{this.state.editing && (
<LabelModal onClose={this.editLabel(undefined)}>
<ConnectedLabelForm
Expand Down