diff options
author | Sebastian <sebasjm@gmail.com> | 2022-05-03 00:16:03 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-05-03 00:16:03 -0300 |
commit | dc842eab6b7a3b2e891ee89a325ec73e04d3be95 (patch) | |
tree | 5df20315b9f50c88598fe4084d739b8610f46bac /packages/taler-wallet-webextension/src/components | |
parent | 939729004a8f5fecde19e679a0672843c496662f (diff) | |
download | wallet-core-dc842eab6b7a3b2e891ee89a325ec73e04d3be95.tar.xz |
deposit from payto
Diffstat (limited to 'packages/taler-wallet-webextension/src/components')
-rw-r--r-- | packages/taler-wallet-webextension/src/components/Part.tsx | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/packages/taler-wallet-webextension/src/components/Part.tsx b/packages/taler-wallet-webextension/src/components/Part.tsx index d1683b20b..21c0f65dc 100644 --- a/packages/taler-wallet-webextension/src/components/Part.tsx +++ b/packages/taler-wallet-webextension/src/components/Part.tsx @@ -13,7 +13,8 @@ You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { h, VNode } from "preact"; +import { PaytoUri, stringifyPaytoUri } from "@gnu-taler/taler-util"; +import { Fragment, h, VNode } from "preact"; import { ExtraLargeText, LargeText, SmallLightText } from "./styled/index.js"; export type Kind = "positive" | "negative" | "neutral"; @@ -39,3 +40,43 @@ export function Part({ text, title, kind, big }: Props): VNode { </div> ); } + +interface PropsPayto { + payto: PaytoUri; + kind: Kind; + big?: boolean; +} +export function PartPayto({ payto, kind, big }: PropsPayto): VNode { + const Text = big ? ExtraLargeText : LargeText; + let text: string | undefined = undefined; + let title = ""; + if (payto.isKnown) { + if (payto.targetType === "x-taler-bank") { + text = payto.account; + title = "Bank account"; + } else if (payto.targetType === "bitcoin") { + text = payto.targetPath; + title = "Bitcoin addr"; + } else if (payto.targetType === "iban") { + text = payto.targetPath; + title = "IBAN"; + } + } + if (!text) { + text = stringifyPaytoUri(payto); + title = "Payto URI"; + } + return ( + <div style={{ margin: "1em" }}> + <SmallLightText style={{ margin: ".5em" }}>{title}</SmallLightText> + <Text + style={{ + color: + kind == "positive" ? "green" : kind == "negative" ? "red" : "black", + }} + > + {text} + </Text> + </div> + ); +} |