From 062fb4674c6a9829101e29f518e7b9915a389230 Mon Sep 17 00:00:00 2001 From: BorysLevytskyi Date: Fri, 19 Feb 2021 18:24:07 +0200 Subject: [PATCH] Add BTC donation --- src/index.css | 2 ++ src/shell/components/DonateResultView.css | 3 ++ src/shell/components/DonateResultView.tsx | 36 +++++++++++++++++++++++ src/shell/module.tsx | 3 +- 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/shell/components/DonateResultView.css create mode 100644 src/shell/components/DonateResultView.tsx diff --git a/src/index.css b/src/index.css index 0334265..198e747 100644 --- a/src/index.css +++ b/src/index.css @@ -18,6 +18,8 @@ code { font-size: 1.2em; font-weight: bold; } .mono { font-family: monospace; font-size: 1.3em } .expressionInput { width: 500px; padding: 3px; border: none; outline: none; } +.hidden { display: none;} + .result { margin: 10px 10px 30px; } .result .input { margin-bottom: 10px; } .result .content { padding-left: 10px} diff --git a/src/shell/components/DonateResultView.css b/src/shell/components/DonateResultView.css new file mode 100644 index 0000000..bb1ed39 --- /dev/null +++ b/src/shell/components/DonateResultView.css @@ -0,0 +1,3 @@ +.donate-result-view .copy-button { cursor: pointer; padding: 5px} +.donate-result-view .copy-button svg { margin-right: 5px;} +.donate-result-view .qrcode-container { background: white; display: inline-block; padding: 10px} \ No newline at end of file diff --git a/src/shell/components/DonateResultView.tsx b/src/shell/components/DonateResultView.tsx new file mode 100644 index 0000000..7543b78 --- /dev/null +++ b/src/shell/components/DonateResultView.tsx @@ -0,0 +1,36 @@ +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import React, { useState} from 'react'; +import { faClipboard} from "@fortawesome/free-solid-svg-icons"; +import "./DonateResultView.css"; +import { sendAnalyticsEvent } from '../analytics'; + +function DonateResultView() { + + const copyCss = navigator.clipboard != null ? "" : "hidden"; + const [state, setState] = useState('default'); + const copiedCss = state == "copied" ? "" : "hidden"; + + const addr = "1HR3PCeBsv5BFijqqfCh4AY9UturmjfmQA"; + + return
+

Thank you for your interest in donation. At this point BitwiseCmd can only accept Bitcoin donations.

+

+ BTC Address: {addr} copied +

+

+ + + + +

+
+ + function copy() { + navigator.clipboard.writeText(addr); + setState('copied'); + setTimeout(() => setState('default'), 3000); + sendAnalyticsEvent({eventCategory: "BtcAddressCopyButton", eventAction: "Clicked"}) + } +} + +export default DonateResultView; \ No newline at end of file diff --git a/src/shell/module.tsx b/src/shell/module.tsx index e6df92a..d062947 100644 --- a/src/shell/module.tsx +++ b/src/shell/module.tsx @@ -4,6 +4,7 @@ import { sendAnalyticsEvent } from './analytics'; import AppState from './AppState'; import { CmdShell, CommandInput } from './cmd'; import AboutResultView from './components/AboutResultView'; +import DonateResultView from './components/DonateResultView'; import ErrorResultView from './components/ErrorResultView'; import HelpResultView from './components/HelpResultView'; import TextResultView from './components/TextResultView'; @@ -40,7 +41,7 @@ const shellModule = { sendAnalyticsEvent({eventCategory: "DonationButton", eventAction: "ClickedAgain"}) } - appState.addCommandResult(c.input, ); + appState.addCommandResult(c.input, ); }); cmd.command("track", (c:CommandInput) => {