diff --git a/app/ui/ViewLocationCard.tsx b/app/ui/ViewLocationCard.tsx index f51be74..5d7c8ef 100644 --- a/app/ui/ViewLocationCard.tsx +++ b/app/ui/ViewLocationCard.tsx @@ -11,6 +11,7 @@ import { EncodePayment, PaymentParams } from "hub-3a-payment-encoder"; import Link from "next/link"; import { DocumentIcon } from "@heroicons/react/24/outline"; import { uploadUtilBillsProofOfPayment } from "../lib/actions/locationActions"; +import QRCode from "react-qr-code"; export interface ViewLocationCardProps { location: BillingLocation; @@ -146,22 +147,26 @@ export const ViewLocationCard:FC = ({location, userSettin : null } { - userSettings?.enableRevolutPayment && tenantPaymentMethod === "revolut" ? - <> -

{t("payment-info-header")}

- -

- - {t("revolut-link-text")} - -

- + userSettings?.enableRevolutPayment && tenantPaymentMethod === "revolut" ? (() => { + const revolutPaymentUrl = `https://revolut.me/${userSettings.ownerRevolutProfileName?.replace('@', '')}?amount=${(monthlyExpense / 100).toFixed(2)}¤cy=${userSettings.currency}}`; + return ( + <> +

{t("payment-info-header")}

+
+ +
+

+ + {t("revolut-link-text")} + +

+ + ); + })() : null }
diff --git a/package-lock.json b/package-lock.json index 8562202..87993f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-infinite-scroll-component": "^6.1.0", + "react-qr-code": "^2.0.18", "react-toastify": "^10.0.6", "tailwindcss": "^3.4.0", "typescript": "5.2.2", @@ -7025,6 +7026,11 @@ "node": ">=6" } }, + "node_modules/qr.js": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/qr.js/-/qr.js-0.0.0.tgz", + "integrity": "sha512-c4iYnWb+k2E+vYpRimHqSu575b1/wKl4XFeJGpFmrJQz5I88v9aY2czh7s0w36srfCM1sXgC/xpoJz5dJfq+OQ==" + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -7083,6 +7089,18 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "node_modules/react-qr-code": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/react-qr-code/-/react-qr-code-2.0.18.tgz", + "integrity": "sha512-v1Jqz7urLMhkO6jkgJuBYhnqvXagzceg3qJUWayuCK/c6LTIonpWbwxR1f1APGd4xrW/QcQEovNrAojbUz65Tg==", + "dependencies": { + "prop-types": "^15.8.1", + "qr.js": "0.0.0" + }, + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-toastify": { "version": "10.0.6", "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-10.0.6.tgz", diff --git a/package.json b/package.json index e5d84ae..dc45df6 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-infinite-scroll-component": "^6.1.0", + "react-qr-code": "^2.0.18", "react-toastify": "^10.0.6", "tailwindcss": "^3.4.0", "typescript": "5.2.2",