aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
blob: 9008e9751819a2b0952815c7e9fe106795d78339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { h, Fragment, VNode } from "preact";
import { useState } from "preact/hooks";
import { QR } from "../components/QR";
import { ButtonBox, FontIcon, WalletBox } from "../components/styled";
export interface Props {
  reservePub: string;
  paytos: string[];
  onBack: () => void;
}

export function ReserveCreated({ reservePub, paytos, onBack }: Props): VNode {
  const [opened, setOpened] = useState(-1);
  return (
    <WalletBox>
      <section>
        <h2>Reserve created!</h2>
        <p>
          Now you need to send money to the exchange to one of the following
          accounts
        </p>
        <p>
          To complete the setup of the reserve, you must now initiate a wire
          transfer using the given wire transfer subject and crediting the
          specified amount to the indicated account of the exchange.
        </p>
      </section>
      <section>
        <ul>
          {paytos.map((href, idx) => {
            const url = new URL(href);
            return (
              <li key={idx}>
                <p>
                  <a
                    href=""
                    onClick={(e) => {
                      setOpened((o) => (o === idx ? -1 : idx));
                      e.preventDefault();
                    }}
                  >
                    {url.pathname}
                  </a>
                  {opened === idx && (
                    <Fragment>
                      <p>
                        If your system supports RFC 8905, you can do this by
                        opening <a href={href}>this URI</a> or scan the QR with
                        your wallet
                      </p>
                      <QR text={href} />
                    </Fragment>
                  )}
                </p>
              </li>
            );
          })}
        </ul>
      </section>
      <footer>
        <ButtonBox onClick={onBack}>
          <FontIcon>&#x2190;</FontIcon>
        </ButtonBox>
        <div />
      </footer>
    </WalletBox>
  );
}