diff --git a/src/app/api/create_invoice/route.ts b/src/app/api/create_invoice/route.ts index 14cd9e9..2d567cf 100644 --- a/src/app/api/create_invoice/route.ts +++ b/src/app/api/create_invoice/route.ts @@ -74,4 +74,5 @@ async function* check_payment(invoice: Invoice) { } yield `data: ${JSON.stringify({ status: "settled" })}\n\n`; + return; } diff --git a/src/app/goal/[eventId]/page.tsx b/src/app/goal/[eventId]/page.tsx index 6abae8f..5a77f16 100644 --- a/src/app/goal/[eventId]/page.tsx +++ b/src/app/goal/[eventId]/page.tsx @@ -90,7 +90,11 @@ export default async function GoalPage({ params }: PageProps) {
diff --git a/src/app/profile/[npub]/page.tsx b/src/app/profile/[npub]/page.tsx index 298bbe6..420ed95 100644 --- a/src/app/profile/[npub]/page.tsx +++ b/src/app/profile/[npub]/page.tsx @@ -10,7 +10,7 @@ interface PageProps { params: { npub: string }; } -export default async function GoalPage({ params }: PageProps) { +export default async function ProfilePage({ params }: PageProps) { const profile = await getUser(params.npub); const banner = profile.getBanner(); @@ -51,7 +51,14 @@ export default async function GoalPage({ params }: PageProps) { - + diff --git a/src/app/profile/[npub]/widget/page.tsx b/src/app/profile/[npub]/widget/page.tsx index 43d0a78..50ab585 100644 --- a/src/app/profile/[npub]/widget/page.tsx +++ b/src/app/profile/[npub]/widget/page.tsx @@ -1,7 +1,6 @@ -import { TTSWidget } from "@/components/Widget"; - import "./widget.css"; -import { RemoveLogo } from "@/components/utils/RemoveLogo"; + +import { TTSWidget } from "@/components/Widget"; interface PageProps { params: { npub: string }; @@ -10,7 +9,6 @@ interface PageProps { export default function widgetPage({ params }: PageProps) { return ( <> - ); diff --git a/src/components/Form.tsx b/src/components/Form.tsx index cbefa84..36dd08d 100644 --- a/src/components/Form.tsx +++ b/src/components/Form.tsx @@ -4,8 +4,6 @@ import { ChangeEvent, FormEvent, useRef, useState } from "react"; import Image from "next/image"; import QRCode from "qrcode"; -import { Settings } from "@/lib/config"; - import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; @@ -31,11 +29,19 @@ interface FormData { interface FormProps { npub: string; - config: Settings; + options: { + MODELS: string[]; + MAX_TEXT_LENGTH: number; + MIN_SATOSHI_QNT: number; + }; eventId?: string; } -export default function Form({ npub, config, eventId = undefined }: FormProps) { +export default function Form({ + npub, + options, + eventId = undefined, +}: FormProps) { const [qrCode, setQRCode] = useState(""); const [paymentStatus, setPaymentStatus] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false); @@ -98,7 +104,8 @@ export default function Form({ npub, config, eventId = undefined }: FormProps) { const reader = response.body!.getReader(); const decoder = new TextDecoder(); - while (true) { + let loop = true; + while (loop) { const { value, done } = await reader.read(); if (done) break; @@ -120,6 +127,8 @@ export default function Form({ npub, config, eventId = undefined }: FormProps) { // @ts-expect-error await window.webln.sendPayment(parsedData.invoice.pr); setPaymentStatus(true); + loop = false; + break; } catch (error) { console.error(error); setQRCode(await QRCode.toDataURL(parsedData.invoice.pr)); @@ -129,6 +138,7 @@ export default function Form({ npub, config, eventId = undefined }: FormProps) { if (parsedData.status === "settled") { setPaymentStatus(true); + loop = false; break; } } @@ -207,7 +217,11 @@ export default function Form({ npub, config, eventId = undefined }: FormProps) { Pagamento bem-sucedido! -

Obrigado por ajudar na nossa meta!.

+ {eventId ? ( +

Obrigado por ajudar na nossa meta!.

+ ) : ( +

Obrigado por usar o LiveSatoshi.

+ )}
- {config.MODELS?.length > 0 && ( + {options.MODELS.length > 0 && ( <>