diff --git a/src/app/invoice/[id]/page.tsx b/src/app/invoice/[id]/page.tsx index 58cf28e..e85917c 100644 --- a/src/app/invoice/[id]/page.tsx +++ b/src/app/invoice/[id]/page.tsx @@ -65,7 +65,29 @@ export default function InvoiceDetailPage({ params }: Props) { const [showDuplicateModal, setShowDuplicateModal] = useState(false); const [paymentError, setPaymentError] = useState(null); const [paymentMethod, setPaymentMethod] = useState<"freighter" | "walletconnect">("freighter"); - const [payerNonce, setPayerNonce] = useState(null); + const [amountLocked, setAmountLocked] = useState(false); + const prevPayAmountRef = useRef(""); + const [cooldownExpiresAt, setCooldownExpiresAt] = useState(null); + const [activeDetailsTab, setActiveDetailsTab] = useState<"audit" | "history" | "notes">("audit"); + + const prevStatusRef = useRef(null); + const timelineRef = useRef(null); + const [exportingTimeline, setExportingTimeline] = useState(false); + + useEffect(() => { + setNotifySubscribed(isSubscribedToInvoice(id)); + }, [id]); + + const handleNotifyMe = async () => { + const permission = await requestNotificationPermission(); + if (permission !== "granted") { + setNotifyDenied(true); + return; + } + subscribeToInvoice(id); + setNotifySubscribed(true); + setNotifyDenied(false); + }; const load = async () => { const inv = await splitClient.getInvoice(id); @@ -581,50 +603,36 @@ export default function InvoiceDetailPage({ params }: Props) { /> )} - {/* Token & Contract Info */} + {/* Tabbed detail section: Audit Log / History / Notes */}
-

Details

-
-
- Invoice ID - #{id} -
-
- Token - - {truncateAddress(invoice.token, 8)} - -
-
- Deadline - - {invoice.deadline > 0 - ? new Date(invoice.deadline * 1000).toLocaleString() - : "No deadline"} - -
-
- Total Amount - {formatAmount(total)} USDC -
-
- Funded - {formatAmount(invoice.funded)} USDC -
-
- Status - - {invoice.status} - -
- {payerNonce !== null && ( -
- Your Nonce - {payerNonce.toString()} -
- )} +
+ {(["audit", "history", "notes"] as const).map((tab) => { + const labels: Record = { audit: "Audit Log", history: "History", notes: "Notes" }; + return ( + + ); + })}
+ {activeDetailsTab === "audit" && } + {activeDetailsTab === "history" && } + {activeDetailsTab === "notes" && publicKey && ( + + )}
+ {showCancelModal && (