mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-07 18:56:29 +00:00
feat: add disabled prop to DevicesToPay component and update button state management ✨
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m36s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m36s
This commit is contained in:
@ -62,6 +62,7 @@ export default async function PaymentPage({
|
|||||||
className="pb-4 gap-4 flex sm:flex-row flex-col items-start justify-start"
|
className="pb-4 gap-4 flex sm:flex-row flex-col items-start justify-start"
|
||||||
>
|
>
|
||||||
<DevicesToPay
|
<DevicesToPay
|
||||||
|
disabled={payment.paid || payment.is_expired}
|
||||||
user={userProfile || undefined}
|
user={userProfile || undefined}
|
||||||
payment={payment || undefined}
|
payment={payment || undefined}
|
||||||
/>
|
/>
|
||||||
|
@ -30,7 +30,8 @@ const initialState: VerifyDevicePaymentState = {
|
|||||||
export default function DevicesToPay({
|
export default function DevicesToPay({
|
||||||
payment,
|
payment,
|
||||||
user,
|
user,
|
||||||
}: { payment?: Payment; user?: User }) {
|
disabled
|
||||||
|
}: { payment?: Payment; user?: User, disabled?: boolean }) {
|
||||||
const [state, formAction, isPending] = useActionState(verifyDevicePayment, initialState);
|
const [state, formAction, isPending] = useActionState(verifyDevicePayment, initialState);
|
||||||
|
|
||||||
// Handle toast notifications based on state changes
|
// Handle toast notifications based on state changes
|
||||||
@ -118,7 +119,7 @@ export default function DevicesToPay({
|
|||||||
<input type="hidden" name="paymentId" value={payment?.id ?? ""} />
|
<input type="hidden" name="paymentId" value={payment?.id ?? ""} />
|
||||||
<input type="hidden" name="method" value="TRANSFER" />
|
<input type="hidden" name="method" value="TRANSFER" />
|
||||||
<Button
|
<Button
|
||||||
disabled={isPending}
|
disabled={isPending || disabled}
|
||||||
type="submit"
|
type="submit"
|
||||||
size={"lg"}
|
size={"lg"}
|
||||||
className="mb-4"
|
className="mb-4"
|
||||||
|
Reference in New Issue
Block a user