mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-25 21:08:00 +00:00
fix: payment proof lifecycle, repeating toast, and escrow migrations
- Replace IPFS/Pinata upload with Supabase Storage for payment proofs - Add 1-day auto-expiry for proof images (retained if disputed) - Fix repeating "payment deadline expired" toast (fire once, clear interval) - Fix cancel_reason → cancellation_reason column reference - Add payment proof lifecycle migration (proof_expires_at, cleanup functions) - Add atomic escrow migration (accept_p2p_offer, complete/cancel trade) - Add cleanup-proofs edge function for daily expired proof deletion
This commit is contained in:
@@ -199,14 +199,17 @@ export default function P2PTrade() {
|
||||
|
||||
const deadline = new Date(trade.payment_deadline).getTime();
|
||||
|
||||
let expired = false;
|
||||
|
||||
const updateTimer = () => {
|
||||
const now = Date.now();
|
||||
const remaining = Math.max(0, Math.floor((deadline - now) / 1000));
|
||||
setTimeRemaining(remaining);
|
||||
|
||||
if (remaining === 0 && trade.status === 'pending') {
|
||||
// Auto-cancel logic could go here
|
||||
if (remaining === 0 && !expired) {
|
||||
expired = true;
|
||||
toast.warning(t('p2pTrade.paymentDeadlineExpired'));
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -714,8 +717,8 @@ export default function P2PTrade() {
|
||||
<CardContent className="py-6 text-center">
|
||||
<XCircle className="w-16 h-16 text-gray-500 mx-auto mb-4" />
|
||||
<h3 className="text-xl font-semibold text-gray-400 mb-2">{t('p2pTrade.tradeCancelled')}</h3>
|
||||
{trade.cancel_reason && (
|
||||
<p className="text-gray-500">{t('p2pTrade.cancelReason', { reason: trade.cancel_reason })}</p>
|
||||
{trade.cancellation_reason && (
|
||||
<p className="text-gray-500">{t('p2pTrade.cancelReason', { reason: trade.cancellation_reason })}</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user