-
Notifications
You must be signed in to change notification settings - Fork 0
Develop #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Develop #11
Conversation
…nt in body of request to rafiki pos service sync amount and receiverWalletAddress to be the values set by the merchant
feat(kaios-pos): add qr code reading + add payment to rafiki as test
App UI updates
render() { | ||
return this.state.hasError ? ( | ||
<div className="p-6 text-center"> | ||
<h2 className="text-xl font-semibold">Something went wrong</h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both these two lines have hardcoded text? Not localized?
))} | ||
{!items.length && ( | ||
<div className="px-3 py-6 text-center text-white-60"> | ||
No transactions for this date. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
)} | ||
{items.length > 0 && ( | ||
<div className="rounded-4xl bg-green-500 mt-6 px-6 py-6 text-center text-white"> | ||
<span data-l10n-id="email-report">Email report</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
const inputRef = useRef<HTMLSelectElement>(null); | ||
|
||
const availableLanguages = [ | ||
{ code: "en-US", label: "English" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this labels should be translated :) ro-RO would be Romanian
in English language :)
} | ||
}, []); | ||
|
||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we somehow not duplicate this code? Because I see that this one is quite duplicated
<section className="space-y-2"> | ||
<Header /> | ||
<div className={`flex flex-col p-4 mt-4 ${0 === focused ? "active-item-bg" : ""}`}> | ||
<span className="">Payment pointer</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translation - Payment pointer
ref={inputRef} | ||
tabIndex={focused === 0 ? 0 : -1} | ||
className="px-2 py-2 flex webkit-fill text-2xl font-semibold border-none rounded-lg " | ||
placeholder="e.g., $example.com/alice" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translation - placeholder value
{error && <p className="mt-2 text-sm text-red-500">{error}</p>} | ||
</div> | ||
<div className="flex flex-col p-4 mt-4 bg-field "> | ||
<span className="">Currency</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
setError(""); | ||
}} | ||
> | ||
Delete payment pointer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
ref={inputRef} | ||
className="mt-2 w-full rounded-xl bg-white/10 px-4 py-3 outline-none focus:ring-2 focus:ring-emerald-400 placeholder-white/40" | ||
className="mt-2 border-none py-3 outline-none " | ||
placeholder="e.g., $example.com/alice" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate placeholder value
try { | ||
const parsed = JSON.parse(rawData); | ||
if (!parsed || typeof parsed !== "object") { | ||
throw new Error("QR payload must be an object"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate error
}; | ||
|
||
if (typeof paymentPointer !== "string" || paymentPointer.trim() === "") { | ||
throw new Error("paymentPointer missing in QR code"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate error
throw new Error("paymentPointer missing in QR code"); | ||
} | ||
if (typeof signSec !== "string" || signSec.trim() === "") { | ||
throw new Error("signSec missing in QR code"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate error
console.log("[SetupByQR] stored QR settings"); | ||
} catch (err) { | ||
const message = | ||
err instanceof Error ? err.message : "Invalid QR configuration payload"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate error
const videoEl = videoRef.current; | ||
|
||
if (!videoEl) { | ||
setError("Video element not available."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
const canvas = document.createElement("canvas"); | ||
const context = canvas.getContext("2d"); | ||
if (!context) { | ||
setError("Unable to access canvas context."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
setError( | ||
parseError instanceof Error | ||
? parseError.message | ||
: "Unable to process QR", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
|
||
const handleError = (err: unknown) => { | ||
const message = | ||
err instanceof Error ? err.message : "Unable to access camera."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
}, | ||
); | ||
} else { | ||
handleError(new Error("Camera API is not available on this device.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
style={{ minWidth: 0 }} | ||
> | ||
<header className="text-xl font-semibold" data-l10n-id="setup-qr-title"> | ||
Setup by QR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
{decodedValue ? ( | ||
<div> | ||
<div className="font-semibold" data-l10n-id="setup-qr-result-label"> | ||
QR Data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
</div> | ||
) : ( | ||
<div className="text-gray-600" data-l10n-id="setup-qr-instructions"> | ||
{isScanning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
className="text-sm text-gray-600" | ||
data-l10n-id="setup-qr-no-result" | ||
> | ||
No QR code detected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
<div className="text-center"> | ||
<div className="text-4xl font-extrabold tracking-tight"> | ||
<div className="mt-12 pt-8 pb-8"> | ||
<img src="/assets/icons/logo.png" alt="Interledger POS" className="mx-auto" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate alt text
src/pages/WaitCard.tsx
Outdated
<p className="mt-2 text-white/70"> | ||
Waiting for an NFC card… keep it in the field until confirmed. | ||
</p> | ||
<Header title="Waiting for Card" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
src/pages/WaitCard.tsx
Outdated
</p> | ||
)} | ||
|
||
<span data-l10n-id={`statuses-${transactionStatus}-key-message`} className="mt-4 mb-2 px-4 text-xl text-center">Hold card near the reader</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate
* feat: pin page, pin component and state logic * feat: extract a TransactionStatus component
…n status options, and also integrates the pin component (#14)
No description provided.