Skip to content

Commit 3667a5b

Browse files
committed
feat: ahoracrypto widget
1 parent a4528c2 commit 3667a5b

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4+
<script src="https://webwidget.ahoracrypto.com/webwidget.js"></script>
45
<meta charset="utf-8" />
56
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
67
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />

src/components/pnk-widget.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React, { useEffect } from "react";
2+
3+
export default function PNKWidget({ wallet }) {
4+
useEffect(() => {
5+
let widget = window.AhoraCrypto.renderWebwidget({
6+
containerId: 'ahora-widget',
7+
language: 'en',
8+
cryptoCurrency: 'PNK',
9+
fiatCurrency: 'EUR',
10+
borderRadius: 24,
11+
borderWithShadow: true,
12+
theme: 'light',
13+
referral: 'kleros-court-v1',
14+
});
15+
16+
widget.onReady(() => widget.setWalletAddress(wallet));
17+
18+
return () => widget?.destroy?.();
19+
}, [wallet]);
20+
21+
return <div id="ahora-widget" style={{ maxWidth: 416, margin: "0 auto", marginBottom: "28px" }} />;
22+
}

src/containers/tokens.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { useCallback } from "react";
33
import { drizzleReactHooks } from "@drizzle/react-plugin";
44
import BuyPNKCard from "../components/buy-pnk-card";
55
import OTCCard from "../components/otc-card";
6+
import PNKWidget from "../components/pnk-widget";
67
import PNKBalanceCard from "../components/pnk-balance-card";
78
import PNKMainnetExchangesCard from "../components/pnk-exchanges-card";
89
import PNKXdaiExchangesCard from "../components/pnk-xdai-exchanges-card";
@@ -64,6 +65,7 @@ export default function Tokens() {
6465
title="Buy PNK"
6566
/>
6667
<PNKBalanceCard />
68+
<PNKWidget wallet={drizzleState.account} />
6769
<Row gutter={40}>
6870
<Col lg={8} md={12}>
6971
<BuyPNKCard />
@@ -110,6 +112,7 @@ export default function Tokens() {
110112
title="Buy PNK"
111113
/>
112114
<PNKBalanceCard />
115+
<PNKWidget wallet={drizzleState.account} />
113116
<Row gutter={40}>
114117
<Col>
115118
<PNKXdaiExchangesCard />

0 commit comments

Comments
 (0)