diff --git a/components/Receiver.tsx b/components/Receiver.tsx new file mode 100644 index 0000000..feb26c5 --- /dev/null +++ b/components/Receiver.tsx @@ -0,0 +1,29 @@ +import React from "react"; +import { View } from "react-native"; +import { Text } from "~/components/ui/text"; + +interface ReceiverProps { + originalText: string; + invoice?: string; +} + +export function Receiver({ originalText, invoice }: ReceiverProps) { + const shouldShowReceiver = + originalText !== invoice && + originalText.toLowerCase().replace("lightning:", "").includes("@"); + + if (!shouldShowReceiver) { + return null; + } + + return ( + + + To + + + {originalText.toLowerCase().replace("lightning:", "")} + + + ); +} \ No newline at end of file diff --git a/pages/send/ConfirmPayment.tsx b/pages/send/ConfirmPayment.tsx index 098730a..7e4642d 100644 --- a/pages/send/ConfirmPayment.tsx +++ b/pages/send/ConfirmPayment.tsx @@ -5,6 +5,7 @@ import React from "react"; import { View } from "react-native"; import { ZapIcon } from "~/components/Icons"; import Loading from "~/components/Loading"; +import { Receiver } from "~/components/Receiver"; import Screen from "~/components/Screen"; import { Button } from "~/components/ui/button"; import { Text } from "~/components/ui/text"; @@ -94,23 +95,7 @@ export function ConfirmPayment() { ) )} - { - /* only show "To" for lightning addresses */ originalText !== - invoice && - originalText - .toLowerCase() - .replace("lightning:", "") - .includes("@") && ( - - - To - - - {originalText.toLowerCase().replace("lightning:", "")} - - - ) - } +