fix: render dynamic scannable QR Code image from payload fallback
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 41s
Details
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 41s
Details
This commit is contained in:
parent
fb9c2c79a3
commit
11a0c20aa2
|
|
@ -220,10 +220,20 @@ export default function CourseUnlockModal({ course, onClose, onSuccess, token }:
|
|||
) : (
|
||||
<>
|
||||
<div className="bg-white p-3 rounded-xl inline-block shadow-xl border border-zinc-200">
|
||||
{paymentData.pixData?.encodedImage ? (
|
||||
<img src={`data:image/jpeg;base64,${paymentData.pixData.encodedImage}`} alt="QR Code PIX" className="w-36 h-36" />
|
||||
{paymentData.pixData?.encodedImage && paymentData.pixData.encodedImage.length > 20 ? (
|
||||
<img
|
||||
src={paymentData.pixData.encodedImage.startsWith('data:') ? paymentData.pixData.encodedImage : `data:image/png;base64,${paymentData.pixData.encodedImage}`}
|
||||
alt="QR Code PIX"
|
||||
className="w-40 h-40 object-contain mx-auto"
|
||||
/>
|
||||
) : paymentData.pixData?.payload ? (
|
||||
<img
|
||||
src={`https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${encodeURIComponent(paymentData.pixData.payload)}`}
|
||||
alt="QR Code PIX"
|
||||
className="w-40 h-40 object-contain mx-auto"
|
||||
/>
|
||||
) : (
|
||||
<div className="w-36 h-36 bg-zinc-100 flex items-center justify-center">Sem Imagem</div>
|
||||
<div className="w-40 h-40 bg-zinc-100 flex items-center justify-center text-zinc-500 text-xs font-bold rounded-lg">Gerando QR Code...</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
|
|
|
|||
Loading…
Reference in New Issue