diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-04-06 21:05:51 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-04-06 21:05:51 +0530 |
commit | 07f25566ca51b7faf6462a57d15f4ebbfc733ab0 (patch) | |
tree | 04e03d831adae4c00ac6a6a19706de4ed6ad7dd3 /src/webex/pages | |
parent | 13bccc7bd982da58738dfd63a2493e476d596161 (diff) | |
download | wallet-core-07f25566ca51b7faf6462a57d15f4ebbfc733ab0.tar.xz |
start spring cleaning, use rollup instead of both webpack and rollup
Diffstat (limited to 'src/webex/pages')
29 files changed, 33 insertions, 738 deletions
diff --git a/src/webex/pages/add-auditor.html b/src/webex/pages/add-auditor.html deleted file mode 100644 index 7f30b5fb6..000000000 --- a/src/webex/pages/add-auditor.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - - <title>Taler Wallet: Add Auditor</title> - - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - - <link rel="icon" href="/img/icon.png" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/add-auditor-bundle.js"></script> - - <style> - .tree-item { - margin: 2em; - border-radius: 5px; - border: 1px solid gray; - padding: 1em; - } - .button-linky { - background: none; - color: black; - text-decoration: underline; - border: none; - } - </style> - </head> - - <body> - <div id="container"></div> - </body> -</html> diff --git a/src/webex/pages/add-auditor.tsx b/src/webex/pages/add-auditor.tsx index 5840f4d63..dbe84cde4 100644 --- a/src/webex/pages/add-auditor.tsx +++ b/src/webex/pages/add-auditor.tsx @@ -23,7 +23,6 @@ import { CurrencyRecord } from "../../types/dbTypes"; import { getCurrencies, updateCurrency } from "../wxApi"; import React, { useState } from "react"; -import { registerMountPage } from "../renderHtml"; interface ConfirmAuditorProps { url: string; @@ -114,7 +113,7 @@ function ConfirmAuditor(props: ConfirmAuditorProps) { ); } -registerMountPage(() => { +export function makeAddAuditorPage() { const walletPageUrl = new URL(document.location.href); const url = walletPageUrl.searchParams.get("url"); if (!url) { @@ -135,4 +134,4 @@ registerMountPage(() => { const expirationStamp = Number.parseInt(auditorStampStr); const args = { url, currency, auditorPub, expirationStamp }; return <ConfirmAuditor {...args} />; -}); +} diff --git a/src/webex/pages/auditors.html b/src/webex/pages/auditors.html deleted file mode 100644 index 7c207f750..000000000 --- a/src/webex/pages/auditors.html +++ /dev/null @@ -1,36 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Auditors</title> - - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - - <link rel="icon" href="/img/icon.png" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/auditors-bundle.js"></script> - - <style> - body { - font-size: 100%; - } - .tree-item { - margin: 2em; - border-radius: 5px; - border: 1px solid gray; - padding: 1em; - } - .button-linky { - background: none; - color: black; - text-decoration: underline; - border: none; - } - </style> - </head> - - <body> - <div id="container"></div> - </body> -</html> diff --git a/src/webex/pages/auditors.tsx b/src/webex/pages/auditors.tsx index e2bb29af1..e933aeace 100644 --- a/src/webex/pages/auditors.tsx +++ b/src/webex/pages/auditors.tsx @@ -151,8 +151,6 @@ class CurrencyList extends React.Component<{}, CurrencyListState> { } } -function main() { - ReactDOM.render(<CurrencyList />, document.getElementById("container")!); +function makeAuditorsPage() { + return <CurrencyList />; } - -document.addEventListener("DOMContentLoaded", main); diff --git a/src/webex/pages/benchmark.html b/src/webex/pages/benchmark.html deleted file mode 100644 index d4216ecad..000000000 --- a/src/webex/pages/benchmark.html +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Benchmarks</title> - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - <link rel="icon" href="/img/icon.png" /> - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/benchmark-bundle.js"></script> - </head> - <body> - <section id="main"> - <h1>Benchmarks</h1> - <div id="container"></div> - </section> - </body> -</html> diff --git a/src/webex/pages/benchmark.tsx b/src/webex/pages/benchmark.tsx index 7de546bb0..1efe7898d 100644 --- a/src/webex/pages/benchmark.tsx +++ b/src/webex/pages/benchmark.tsx @@ -27,8 +27,6 @@ import { BenchmarkResult } from "../../types/walletTypes"; import * as wxApi from "../wxApi"; import * as React from "react"; -import * as ReactDOM from "react-dom"; -import { registerMountPage } from "../renderHtml"; interface BenchmarkRunnerState { repetitions: number; @@ -101,6 +99,6 @@ class BenchmarkRunner extends React.Component<any, BenchmarkRunnerState> { } } -registerMountPage(() => { +export function makeBenchmarkPage() { return <BenchmarkRunner />; -}); +} diff --git a/src/webex/pages/pay.html b/src/webex/pages/pay.html deleted file mode 100644 index 6afc95615..000000000 --- a/src/webex/pages/pay.html +++ /dev/null @@ -1,76 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Confirm Contract</title> - - <link rel="stylesheet" type="text/css" href="../style/pure.css" /> - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - - <link rel="icon" href="/img/icon.png" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/pay-bundle.js"></script> - - <style> - button.accept { - background-color: #5757d2; - border: 1px solid black; - border-radius: 5px; - margin: 1em 0; - padding: 0.5em; - font-weight: bold; - color: white; - } - button.linky { - background: none !important; - border: none; - padding: 0 !important; - - font-family: arial, sans-serif; - color: #069; - text-decoration: underline; - cursor: pointer; - } - - input.url { - width: 25em; - } - - button.accept:disabled { - background-color: #dedbe8; - border: 1px solid white; - border-radius: 5px; - margin: 1em 0; - padding: 0.5em; - font-weight: bold; - color: #2c2c2c; - } - - .errorbox { - border: 1px solid; - display: inline-block; - margin: 1em; - padding: 1em; - font-weight: bold; - background: #ff8a8a; - } - - .okaybox { - border: 1px solid; - display: inline-block; - margin: 1em; - padding: 1em; - font-weight: bold; - background: #00fa9a; - } - </style> - </head> - - <body> - <section id="main"> - <h1>GNU Taler Wallet</h1> - <article id="container" class="fade"></article> - </section> - </body> -</html> diff --git a/src/webex/pages/pay.tsx b/src/webex/pages/pay.tsx index 714e3b0a3..09aa595c3 100644 --- a/src/webex/pages/pay.tsx +++ b/src/webex/pages/pay.tsx @@ -26,7 +26,7 @@ import * as i18n from "../i18n"; import { PreparePayResult } from "../../types/walletTypes"; -import { renderAmount, ProgressButton, registerMountPage } from "../renderHtml"; +import { renderAmount, ProgressButton } from "../renderHtml"; import * as wxApi from "../wxApi"; import React, { useState, useEffect } from "react"; @@ -178,11 +178,11 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) { ); } -registerMountPage(() => { +export function makePayPage() { const url = new URL(document.location.href); const talerPayUri = url.searchParams.get("talerPayUri"); if (!talerPayUri) { throw Error("invalid parameter"); } return <TalerPayDialog talerPayUri={talerPayUri} />; -}); +}
\ No newline at end of file diff --git a/src/webex/pages/payback.html b/src/webex/pages/payback.html deleted file mode 100644 index 706949544..000000000 --- a/src/webex/pages/payback.html +++ /dev/null @@ -1,36 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Payback</title> - - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - - <link rel="icon" href="/img/icon.png" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/payback-bundle.js"></script> - - <style> - body { - font-size: 100%; - } - .tree-item { - margin: 2em; - border-radius: 5px; - border: 1px solid gray; - padding: 1em; - } - .button-linky { - background: none; - color: black; - text-decoration: underline; - border: none; - } - </style> - </head> - - <body> - <div id="container"></div> - </body> -</html> diff --git a/src/webex/pages/payback.tsx b/src/webex/pages/payback.tsx index 96d43ff49..9c53aac91 100644 --- a/src/webex/pages/payback.tsx +++ b/src/webex/pages/payback.tsx @@ -23,13 +23,8 @@ /** * Imports. */ -import { ReserveRecord } from "../../types/dbTypes"; -import { renderAmount, registerMountPage } from "../renderHtml"; import * as React from "react"; -import { useState } from "react"; -function Payback() { +export function makePaybackPage() { return <div>not implemented</div>; } - -registerMountPage(() => <Payback />); diff --git a/src/webex/pages/popup.css b/src/webex/pages/popup.css deleted file mode 100644 index cca002399..000000000 --- a/src/webex/pages/popup.css +++ /dev/null @@ -1,185 +0,0 @@ -/** - * @author Gabor X. Toth - * @author Marcello Stanisci - * @author Florian Dold - */ - -body { - min-height: 20em; - width: 30em; - margin: 0; - padding: 0; - max-height: 800px; - overflow: hidden; - background-color: #f8faf7; - font-family: Arial, Helvetica, sans-serif; -} - -.nav { - background-color: #033; - padding: 0.5em 0; -} - -.nav a { - color: #f8faf7; - padding: 0.7em 1.4em; - text-decoration: none; -} - -.nav a.active { - background-color: #f8faf7; - color: #000; - font-weight: bold; -} - -.container { - overflow-y: scroll; - max-height: 400px; -} - -.abbrev { - text-decoration-style: dotted; -} - -#content { - padding: 1em; -} - -#wallet-table .amount { - text-align: right; -} - -.hidden { - display: none; -} - -#transactions-table th, -#transactions-table td { - padding: 0.2em 0.5em; -} - -#reserve-create table { - width: 100%; -} - -#reserve-create table td.label { - width: 5em; -} - -#reserve-create table .input input[type="text"] { - width: 100%; -} - -.historyItem { - min-width: 380px; - display: flex; - flex-direction: row; - border-bottom: 1px solid #d9dbd8; - padding: 0.5em; - align-items: center; -} - -.historyItem .amount { - font-size: 110%; - font-weight: bold; - text-align: right; -} - -.historyDate, -.historyTitle, -.historyText, -.historySmall { - margin: 0.3em; -} - -.historyDate { - font-size: 90%; - color: slategray; - text-align: right; -} - -.historyLeft { - display: flex; - flex-direction: column; - text-align: right; -} - -.historyContent { - flex: 1; -} - -.historyTitle { - font-weight: 400; -} - -.historyText { - font-size: 90%; -} - -.historySmall { - font-size: 70%; - text-transform: uppercase; -} - -.historyAmount { - flex-grow: 1; -} - -.historyAmount .primary { - font-size: 100%; -} - -.historyAmount .secondary { - font-size: 80%; -} - -.historyAmount .positive { - color: #088; -} - -.historyAmount .positive:before { - content: "+"; -} - -.historyAmount .negative { - color: #800; -} - -.historyAmount .negative:before { - color: #800; - content: "-"; -} -.icon { - margin: 0 10px; - text-align: center; - width: 35px; - font-size: 20px; - border-radius: 50%; - background: #ccc; - color: #fff; - padding-top: 4px; - height: 30px; -} - -.option { - text-transform: uppercase; - text-align: right; - padding: 0.4em; - font-size: 0.9em; -} - -input[type="checkbox"], -input[type="radio"] { - vertical-align: middle; - position: relative; - bottom: 1px; -} - -input[type="radio"] { - bottom: 2px; -} - -.balance { - text-align: center; - padding-top: 2em; -} diff --git a/src/webex/pages/popup.html b/src/webex/pages/popup.html deleted file mode 100644 index 030641d60..000000000 --- a/src/webex/pages/popup.html +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - <link rel="stylesheet" type="text/css" href="popup.css" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/popup-bundle.js"></script> - </head> - - <body> - <div id="container" style="margin: 0; padding: 0;"></div> - </body> -</html> diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx index 17880db58..f4a2bf568 100644 --- a/src/webex/pages/popup.tsx +++ b/src/webex/pages/popup.tsx @@ -35,7 +35,6 @@ import { abbrev, renderAmount, PageLink, - registerMountPage, } from "../renderHtml"; import * as wxApi from "../wxApi"; @@ -807,7 +806,7 @@ function WalletPopup() { ); } -registerMountPage(() => { +export function createPopup() { chrome.runtime.connect({ name: "popup" }); return <WalletPopup />; -}); +}
\ No newline at end of file diff --git a/src/webex/pages/redirect.html b/src/webex/pages/redirect.html deleted file mode 100644 index 67fddb527..000000000 --- a/src/webex/pages/redirect.html +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - - <script src="/src/webex/pages/redirect.js"></script> - </head> - - <body> - Redirecting to extension page ... - </body> -</html> diff --git a/src/webex/pages/redirect.js b/src/webex/pages/redirect.js deleted file mode 100644 index 547b225bd..000000000 --- a/src/webex/pages/redirect.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This is the entry point for redirects, and should be the only - * web-accessible resource declared in the manifest. This prevents - * malicious websites from embedding wallet pages in them. - * - * We still need this redirect page since a webRequest can only directly - * redirect to pages inside the extension that are a web-accessible resource. - */ - -const myUrl = new URL(window.location.href); -const redirectUrl = myUrl.searchParams.get("url"); -if (!redirectUrl) { - console.error("missing redirect URL"); -} else { - window.location.replace(redirectUrl); -} diff --git a/src/webex/pages/refund.html b/src/webex/pages/refund.html deleted file mode 100644 index c671bb193..000000000 --- a/src/webex/pages/refund.html +++ /dev/null @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Refund Status</title> - - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - - <link rel="icon" href="/img/icon.png" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/refund-bundle.js"></script> - </head> - - <body> - <section id="main"> - <h1>GNU Taler Wallet</h1> - <article id="container" class="fade"></article> - </section> - </body> -</html> diff --git a/src/webex/pages/refund.tsx b/src/webex/pages/refund.tsx index 389d5e569..8263ceace 100644 --- a/src/webex/pages/refund.tsx +++ b/src/webex/pages/refund.tsx @@ -73,7 +73,7 @@ function RefundStatusView(props: { talerRefundUri: string }) { ); } -async function main() { +export function createRefundPage() { const url = new URL(document.location.href); const container = document.getElementById("container"); @@ -88,10 +88,5 @@ async function main() { return; } - ReactDOM.render( - <RefundStatusView talerRefundUri={talerRefundUri} />, - container, - ); + return <RefundStatusView talerRefundUri={talerRefundUri} />; } - -document.addEventListener("DOMContentLoaded", () => main()); diff --git a/src/webex/pages/reset-required.html b/src/webex/pages/reset-required.html deleted file mode 100644 index 124d5f46f..000000000 --- a/src/webex/pages/reset-required.html +++ /dev/null @@ -1,27 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Select Taler Provider</title> - - <link rel="icon" href="/img/icon.png" /> - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - <link rel="stylesheet" type="text/css" href="../style/pure.css" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/reset-required-bundle.js"></script> - - <style> - body { - font-size: 100%; - overflow-y: scroll; - } - </style> - </head> - - <body> - <section id="main"> - <div id="container"></div> - </section> - </body> -</html> diff --git a/src/webex/pages/reset-required.tsx b/src/webex/pages/reset-required.tsx index 81f21f459..e58243b34 100644 --- a/src/webex/pages/reset-required.tsx +++ b/src/webex/pages/reset-required.tsx @@ -21,7 +21,6 @@ */ import * as React from "react"; -import * as ReactDOM from "react-dom"; import * as wxApi from "../wxApi"; @@ -89,6 +88,6 @@ class ResetNotification extends React.Component<any, State> { } } -document.addEventListener("DOMContentLoaded", () => { - ReactDOM.render(<ResetNotification />, document.getElementById("container")!); -}); +export function createResetRequiredPage() { + return <ResetNotification />; +} diff --git a/src/webex/pages/return-coins.html b/src/webex/pages/return-coins.html deleted file mode 100644 index 54106f3e6..000000000 --- a/src/webex/pages/return-coins.html +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Return Coins to Bank Account</title> - - <link rel="stylesheet" type="text/css" href="../style/pure.css" /> - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - - <link rel="icon" href="/img/icon.png" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/return-coins-bundle.js"></script> - </head> - - <body> - <div id="container"></div> - </body> -</html> diff --git a/src/webex/pages/return-coins.tsx b/src/webex/pages/return-coins.tsx index 3786697c6..06a3ba169 100644 --- a/src/webex/pages/return-coins.tsx +++ b/src/webex/pages/return-coins.tsx @@ -310,8 +310,6 @@ class ReturnCoins extends React.Component<{}, ReturnCoinsState> { } } -function main() { - ReactDOM.render(<ReturnCoins />, document.getElementById("container")!); +export function createReturnCoinsPage() { + return <ReturnCoins />; } - -document.addEventListener("DOMContentLoaded", main); diff --git a/src/webex/pages/show-db.html b/src/webex/pages/show-db.html deleted file mode 100644 index ae77e3fb0..000000000 --- a/src/webex/pages/show-db.html +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Reserve Created</title> - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - <link rel="icon" href="/img/icon.png" /> - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/show-db-bundle.js"></script> - </head> - <body> - <h1>DB Dump</h1> - <input type="file" id="fileInput" style="display: none;" /> - <button id="import">Import Dump</button> - <button id="download">Download Dump</button> - <pre id="dump"></pre> - </body> -</html> diff --git a/src/webex/pages/show-db.ts b/src/webex/pages/show-db.ts deleted file mode 100644 index 16ea80d2d..000000000 --- a/src/webex/pages/show-db.ts +++ /dev/null @@ -1,103 +0,0 @@ -/* - This file is part of TALER - (C) 2015 GNUnet e.V. - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - -/** - * Wallet database dump for debugging. - * - * @author Florian Dold - */ - -function replacer( - match: string, - pIndent: string, - pKey: string, - pVal: string, - pEnd: string, -) { - const key = "<span class=json-key>"; - const val = "<span class=json-value>"; - const str = "<span class=json-string>"; - let r = pIndent || ""; - if (pKey) { - r = r + key + '"' + pKey.replace(/[": ]/g, "") + '":</span> '; - } - if (pVal) { - r = r + (pVal[0] === '"' ? str : val) + pVal + "</span>"; - } - return r + (pEnd || ""); -} - -function prettyPrint(obj: any) { - const jsonLine = /^( *)("[\w]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/gm; - return JSON.stringify(obj, null as any, 3) - .replace(/&/g, "&") - .replace(/\\"/g, """) - .replace(/</g, "<") - .replace(/>/g, ">") - .replace(jsonLine, replacer); -} - -document.addEventListener("DOMContentLoaded", () => { - chrome.runtime.sendMessage({ type: "dump-db" }, (resp) => { - const el = document.getElementById("dump"); - if (!el) { - throw Error(); - } - el.innerHTML = prettyPrint(resp); - - document.getElementById("download")!.addEventListener("click", (evt) => { - console.log("creating download"); - const element = document.createElement("a"); - element.setAttribute( - "href", - "data:text/plain;charset=utf-8," + - encodeURIComponent(JSON.stringify(resp)), - ); - element.setAttribute("download", "wallet-dump.txt"); - element.style.display = "none"; - document.body.appendChild(element); - element.click(); - }); - }); - - const fileInput = document.getElementById("fileInput")! as HTMLInputElement; - fileInput.onchange = (evt) => { - if (!fileInput.files || fileInput.files.length !== 1) { - alert("please select exactly one file to import"); - return; - } - const file = fileInput.files[0]; - const fr = new FileReader(); - fr.onload = (e: any) => { - console.log("got file"); - const dump = JSON.parse(e.target.result); - console.log("parsed contents", dump); - chrome.runtime.sendMessage( - { type: "import-db", detail: { dump } }, - (resp) => { - alert("loaded"); - }, - ); - }; - console.log("reading file", file); - fr.readAsText(file); - }; - - document.getElementById("import")!.addEventListener("click", (evt) => { - fileInput.click(); - evt.preventDefault(); - }); -}); diff --git a/src/webex/pages/tip.html b/src/webex/pages/tip.html deleted file mode 100644 index 0625640ed..000000000 --- a/src/webex/pages/tip.html +++ /dev/null @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Received Tip</title> - - <link rel="icon" href="/img/icon.png" /> - <link rel="stylesheet" type="text/css" href="../style/pure.css" /> - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/tip-bundle.js"></script> - </head> - - <body> - <section id="main"> - <h1>GNU Taler Wallet</h1> - <div id="container"></div> - </section> - </body> -</html> diff --git a/src/webex/pages/tip.tsx b/src/webex/pages/tip.tsx index 35e033c0d..10e12d590 100644 --- a/src/webex/pages/tip.tsx +++ b/src/webex/pages/tip.tsx @@ -100,26 +100,12 @@ function TipDisplay(props: { talerTipUri: string }) { ); } -async function main() { - try { +export function createTipPage() { const url = new URL(document.location.href); const talerTipUri = url.searchParams.get("talerTipUri"); if (typeof talerTipUri !== "string") { throw Error("talerTipUri must be a string"); } - ReactDOM.render( - <TipDisplay talerTipUri={talerTipUri} />, - document.getElementById("container")!, - ); - } catch (e) { - // TODO: provide more context information, maybe factor it out into a - // TODO:generic error reporting function or component. - document.body.innerText = i18n.str`Fatal error: "${e.message}".`; - console.error(`got error "${e.message}"`, e); - } + return <TipDisplay talerTipUri={talerTipUri} />; } - -document.addEventListener("DOMContentLoaded", () => { - main(); -}); diff --git a/src/webex/pages/welcome.html b/src/webex/pages/welcome.html deleted file mode 100644 index 8f17891e2..000000000 --- a/src/webex/pages/welcome.html +++ /dev/null @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Withdraw</title> - - <link rel="icon" href="/img/icon.png" /> - <link rel="stylesheet" type="text/css" href="../style/pure.css" /> - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/welcome-bundle.js"></script> - </head> - - <body> - <section id="main"> - <h1>GNU Taler Wallet Installed!</h1> - <div id="container">Loading...</div> - </section> - </body> -</html> diff --git a/src/webex/pages/welcome.tsx b/src/webex/pages/welcome.tsx index 83f4f01d5..8510ad383 100644 --- a/src/webex/pages/welcome.tsx +++ b/src/webex/pages/welcome.tsx @@ -22,7 +22,7 @@ import React, { useState, useEffect } from "react"; import { getDiagnostics } from "../wxApi"; -import { registerMountPage, PageLink } from "../renderHtml"; +import { PageLink } from "../renderHtml"; import { WalletDiagnostics } from "../../types/walletTypes"; function Diagnostics() { @@ -110,4 +110,6 @@ function Welcome() { ); } -registerMountPage(() => <Welcome />); +export function createWelcomePage() { + return <Welcome />; +}
\ No newline at end of file diff --git a/src/webex/pages/withdraw.html b/src/webex/pages/withdraw.html deleted file mode 100644 index 861b219f5..000000000 --- a/src/webex/pages/withdraw.html +++ /dev/null @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8" /> - <title>Taler Wallet: Withdraw</title> - - <link rel="icon" href="/img/icon.png" /> - <link rel="stylesheet" type="text/css" href="../style/pure.css" /> - <link rel="stylesheet" type="text/css" href="../style/wallet.css" /> - - <script src="/dist/page-common-bundle.js"></script> - <script src="/dist/withdraw-bundle.js"></script> - </head> - - <body> - <section id="main"> - <h1>GNU Taler Wallet</h1> - <div class="fade" id="exchange-selection"></div> - </section> - </body> -</html> diff --git a/src/webex/pages/withdraw.tsx b/src/webex/pages/withdraw.tsx index 7a2665314..e071dc8ba 100644 --- a/src/webex/pages/withdraw.tsx +++ b/src/webex/pages/withdraw.tsx @@ -217,6 +217,11 @@ async function main() { } } -document.addEventListener("DOMContentLoaded", () => { - main(); -}); +export function createWithdrawPage() { + const url = new URL(document.location.href); + const talerWithdrawUri = url.searchParams.get("talerWithdrawUri"); + if (!talerWithdrawUri) { + throw Error("withdraw URI required"); + } + return <NewExchangeSelection talerWithdrawUri={talerWithdrawUri} />; +}
\ No newline at end of file |