From 6aa9a0658bfc7dc8e79112d5b9236518762013f4 Mon Sep 17 00:00:00 2001 From: CIFO Dev Date: Thu, 4 Dec 2025 17:06:02 +0700 Subject: [PATCH 1/2] fix build --- src/features/payments/components/PaymentSheet.tsx | 1 - src/pages/PaymentStatusPage.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/src/features/payments/components/PaymentSheet.tsx b/src/features/payments/components/PaymentSheet.tsx index c560201..e2b8e35 100644 --- a/src/features/payments/components/PaymentSheet.tsx +++ b/src/features/payments/components/PaymentSheet.tsx @@ -31,7 +31,6 @@ export interface PaymentSheetProps { } export function PaymentSheet({ merchantName = 'Simaya', orderId, amount, expireAt, customerName, children, showStatusCTA = true }: PaymentSheetProps) { - const countdown = useCountdown(expireAt) const [expanded, setExpanded] = React.useState(true) return (
diff --git a/src/pages/PaymentStatusPage.tsx b/src/pages/PaymentStatusPage.tsx index 0aa146b..ab518d0 100644 --- a/src/pages/PaymentStatusPage.tsx +++ b/src/pages/PaymentStatusPage.tsx @@ -21,7 +21,6 @@ export function PaymentStatusPage() { const statusText = data?.status ?? 'pending' const isFinal = ['settlement', 'capture', 'expire', 'cancel', 'deny', 'refund', 'chargeback'].includes(statusText) - const isSuccess = statusText === 'settlement' || statusText === 'capture' function sanitizeUrl(u?: string) { return (u || '').replace(/[`\s]+$/g, '').replace(/^\s+|\s+$/g, '').replace(/`/g, '') } From 29b28a389ee7cb66ee77f35b3d11419437463379 Mon Sep 17 00:00:00 2001 From: CIFO Dev Date: Thu, 4 Dec 2025 17:09:57 +0700 Subject: [PATCH 2/2] Fix UX --- .../payments/components/PaymentSheet.tsx | 17 +---------------- src/pages/CheckoutPage.tsx | 3 +-- src/pages/PayPage.tsx | 2 -- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/features/payments/components/PaymentSheet.tsx b/src/features/payments/components/PaymentSheet.tsx index e2b8e35..43be25f 100644 --- a/src/features/payments/components/PaymentSheet.tsx +++ b/src/features/payments/components/PaymentSheet.tsx @@ -6,31 +6,16 @@ function formatCurrencyIDR(amount: number) { return new Intl.NumberFormat('id-ID', { style: 'currency', currency: 'IDR', maximumFractionDigits: 0 }).format(amount) } -function useCountdown(expireAt: number) { - const [now, setNow] = React.useState(() => Date.now()) - React.useEffect(() => { - const id = setInterval(() => setNow(Date.now()), 1000) - return () => clearInterval(id) - }, []) - const remainMs = Math.max(0, expireAt - now) - const totalSec = Math.floor(remainMs / 1000) - const hh = String(Math.floor(totalSec / 3600)).padStart(2, '0') - const mm = String(Math.floor((totalSec % 3600) / 60)).padStart(2, '0') - const ss = String(totalSec % 60).padStart(2, '0') - return `${hh}:${mm}:${ss}` -} - export interface PaymentSheetProps { merchantName?: string orderId: string amount: number - expireAt: number // epoch ms customerName?: string children?: React.ReactNode showStatusCTA?: boolean } -export function PaymentSheet({ merchantName = 'Simaya', orderId, amount, expireAt, customerName, children, showStatusCTA = true }: PaymentSheetProps) { +export function PaymentSheet({ merchantName = 'Simaya', orderId, amount, customerName, children, showStatusCTA = true }: PaymentSheetProps) { const [expanded, setExpanded] = React.useState(true) return (
diff --git a/src/pages/CheckoutPage.tsx b/src/pages/CheckoutPage.tsx index ae67b46..c3dcd00 100644 --- a/src/pages/CheckoutPage.tsx +++ b/src/pages/CheckoutPage.tsx @@ -215,7 +215,6 @@ export function CheckoutPage() { } const orderId = orderIdRef.current const amount = 3500000 - const expireAt = Date.now() + 59 * 60 * 1000 + 32 * 1000 // 00:59:32 const [selected, setSelected] = React.useState(null) const [currentStep, setCurrentStep] = React.useState<1 | 2>(1) const [isBusy, setIsBusy] = React.useState(false) @@ -259,7 +258,7 @@ export function CheckoutPage() { )} - + {/* Wizard 2 langkah: Step 1 (Form Dummy) → Step 2 (Payment - Snap/Core auto-detect) */} {currentStep === 1 && (
diff --git a/src/pages/PayPage.tsx b/src/pages/PayPage.tsx index ff175a3..d7a601e 100644 --- a/src/pages/PayPage.tsx +++ b/src/pages/PayPage.tsx @@ -241,7 +241,6 @@ export function PayPage() { merchantName={merchantName} orderId={orderId || (token ?? '')} amount={amount} - expireAt={expireAt} showStatusCTA={false} >
@@ -271,7 +270,6 @@ export function PayPage() { merchantName={merchantName} orderId={orderId} amount={amount} - expireAt={expireAt} showStatusCTA={currentStep === 2} >