aboutsummaryrefslogtreecommitdiff
path: root/src/webex/pages/popup.tsx
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-09-05 16:23:54 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-09-05 16:23:54 +0200
commit51aa6d81464afe92e60f13281d4fda3bb54c45ba (patch)
treebdd7bd364d7af067976c276c5ee9065dac0133a5 /src/webex/pages/popup.tsx
parent8144b0f5535c3d00c1e508cddce3cd88a153a581 (diff)
downloadwallet-core-51aa6d81464afe92e60f13281d4fda3bb54c45ba.tar.xz
refactor / format
Diffstat (limited to 'src/webex/pages/popup.tsx')
-rw-r--r--src/webex/pages/popup.tsx45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx
index 91ab515e4..205945471 100644
--- a/src/webex/pages/popup.tsx
+++ b/src/webex/pages/popup.tsx
@@ -26,8 +26,6 @@
*/
import * as i18n from "../../i18n";
-import { runOnceWhenReady } from "./common";
-
import { AmountJson } from "../../amounts";
import * as Amounts from "../../amounts";
@@ -37,7 +35,12 @@ import {
WalletBalanceEntry,
} from "../../walletTypes";
-import { abbrev, renderAmount, PageLink } from "../renderHtml";
+import {
+ abbrev,
+ renderAmount,
+ PageLink,
+ registerMountPage,
+} from "../renderHtml";
import * as wxApi from "../wxApi";
import * as React from "react";
@@ -196,8 +199,7 @@ function EmptyBalanceView() {
<div>
<i18n.Translate wrap="p">
You have no balance to show. Need some{" "}
- <PageLink pageName="welcome.html">help</PageLink> getting
- started?
+ <PageLink pageName="welcome.html">help</PageLink> getting started?
</i18n.Translate>
</div>
);
@@ -303,7 +305,8 @@ class WalletBalanceView extends React.Component<any, any> {
<div>
<p>{i18n.str`Error: could not retrieve balance information.`}</p>
<p>
- Click <PageLink pageName="welcome.html">here</PageLink> for help and diagnostics.
+ Click <PageLink pageName="welcome.html">here</PageLink> for help and
+ diagnostics.
</p>
</div>
);
@@ -551,22 +554,22 @@ function openTab(page: string) {
};
}
-const el = (
- <div>
- <WalletNavBar />
- <div style={{ margin: "1em" }}>
- <Router>
- <WalletBalanceView route="/balance" default />
- <WalletHistory route="/history" />
- <WalletDebug route="/debug" />
- </Router>
+function WalletPopup() {
+ return (
+ <div>
+ <WalletNavBar />
+ <div style={{ margin: "1em" }}>
+ <Router>
+ <WalletBalanceView route="/balance" default />
+ <WalletHistory route="/history" />
+ <WalletDebug route="/debug" />
+ </Router>
+ </div>
</div>
- </div>
-);
+ );
+}
-runOnceWhenReady(() => {
- ReactDOM.render(el, document.getElementById("content")!);
- // Will be used by the backend to detect when the popup gets closed,
- // so we can clear notifications
+registerMountPage(() => {
chrome.runtime.connect({ name: "popup" });
+ return <WalletPopup />
});