This commit is contained in:
2026-05-22 22:57:05 +03:00
parent 61c50eecc1
commit aa25c6dec5
7 changed files with 82 additions and 31 deletions

View File

@@ -2,21 +2,26 @@ import { useState } from 'react'
import { WalletHeader } from '@widgets/wallet-header'
import { Footer } from '@widgets/footer'
import { useOrders } from '@features/payment'
import type { OrderWithPayment, OrderStatus } from '@features/payment'
import type { OrderWithPayment, OrderStatus, PaymentStatus } from '@features/payment'
import styles from './TransactionsPage.module.css'
const ORDER_STATUS_LABELS: Record<OrderStatus, string> = {
pending: 'Ожидание',
completed: 'Выполнена',
cancelled: 'Отменена',
failed: 'Ошибка',
rejected: 'Отклонён',
completed: 'Выполнен',
cancelled: 'Отменён',
error: 'Ошибка',
}
const PAYMENT_STATUS_LABELS: Record<OrderStatus, string> = {
const PAYMENT_STATUS_LABELS: Record<PaymentStatus, string> = {
pending: 'Ожидание',
completed: 'Оплачен',
cancelled: 'Отменён',
failed: 'Ошибка',
money_accepted: 'Деньги получены',
web3_processing: 'Обработка в сети',
web3_hash_error: 'Ошибка хэша',
web3_balance_problem: 'Проблема с балансом',
receipt_error: 'Ошибка чека',
completed: 'Завершён',
usdt_delivered: 'USDT отправлен',
}
function formatDate(iso: string) {
@@ -36,9 +41,9 @@ function truncateHash(hash: string) {
return `${hash.slice(0, 8)}${hash.slice(-6)}`
}
function StatusBadge({ status, labels }: { status: OrderStatus; labels: Record<OrderStatus, string> }) {
function StatusBadge({ status, labels }: { status: string; labels: Record<string, string> }) {
return (
<span className={`${styles.statusBadge} ${styles[`status_${status}`]}`}>
<span className={`${styles.statusBadge} ${styles[`status_${status}`] ?? ''}`}>
{labels[status] ?? status}
</span>
)