Improve delete UX and prepaid credit time display.
Show minutes and local expiry for resource credits; add shared delete hook with row/card loading overlays, detail-page deleting modal, and disabled controls to prevent double-delete. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -801,6 +801,15 @@ export class BillingService {
|
||||
const remainingMs = Math.max(0, new Date(credit.expiresAt).getTime() - now);
|
||||
const remainingDays = Math.floor(remainingMs / 86400000);
|
||||
const remainingHours = Math.floor((remainingMs % 86400000) / 3600000);
|
||||
const remainingMinutes = Math.floor((remainingMs % 3600000) / 60000);
|
||||
const remainingLabel =
|
||||
remainingDays > 0
|
||||
? `${remainingDays}d ${remainingHours}h ${remainingMinutes}m`
|
||||
: remainingHours > 0
|
||||
? `${remainingHours}h ${remainingMinutes}m`
|
||||
: remainingMinutes > 0
|
||||
? `${remainingMinutes}m`
|
||||
: 'less than 1m';
|
||||
return {
|
||||
id: credit.id,
|
||||
sourceAppName: credit.sourceAppName,
|
||||
@@ -818,8 +827,10 @@ export class BillingService {
|
||||
billingCycle: credit.billingCycle,
|
||||
expiresAt: credit.expiresAt,
|
||||
remainingMs,
|
||||
remainingLabel:
|
||||
remainingDays > 0 ? `${remainingDays}d ${remainingHours}h` : `${remainingHours}h`,
|
||||
remainingDays,
|
||||
remainingHours,
|
||||
remainingMinutes,
|
||||
remainingLabel,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user