clean
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ChevronLeft, ChevronRight } from "lucide-react";
|
||||
import { formatDate, formatCurrency } from "@/lib/utils";
|
||||
import { formatDate } from "@/lib/utils";
|
||||
import { LibreChatTransaction, LibreChatUser } from "@/lib/types";
|
||||
|
||||
// Interface étendue pour les transactions avec description optionnelle
|
||||
@@ -53,29 +53,24 @@ export function TransactionsTable() {
|
||||
return user?.name || user?.email || `Utilisateur ${userId.slice(-8)}`;
|
||||
};
|
||||
|
||||
// Fonction pour formater le montant en euros
|
||||
const formatAmount = (rawAmount: number): string => {
|
||||
// Convertir les tokens en euros (exemple: 1000 tokens = 1 euro)
|
||||
const euros = rawAmount / 1000;
|
||||
return formatCurrency(euros);
|
||||
};
|
||||
|
||||
// Fonction pour obtenir la description
|
||||
const getDescription = (transaction: LibreChatTransaction): string => {
|
||||
const transactionWithDesc = transaction as TransactionWithDescription;
|
||||
|
||||
if (transactionWithDesc.description &&
|
||||
typeof transactionWithDesc.description === 'string' &&
|
||||
transactionWithDesc.description !== "undefined") {
|
||||
|
||||
if (
|
||||
transactionWithDesc.description &&
|
||||
typeof transactionWithDesc.description === "string" &&
|
||||
transactionWithDesc.description !== "undefined"
|
||||
) {
|
||||
return transactionWithDesc.description;
|
||||
}
|
||||
|
||||
|
||||
// Générer une description basée sur le type et le montant
|
||||
const amount = Math.abs(Number(transaction.rawAmount) || 0);
|
||||
if (amount > 0) {
|
||||
return `Consommation de ${amount.toLocaleString()} tokens`;
|
||||
}
|
||||
|
||||
|
||||
return "Transaction sans description";
|
||||
};
|
||||
|
||||
@@ -111,7 +106,6 @@ export function TransactionsTable() {
|
||||
<TableHead>ID</TableHead>
|
||||
<TableHead>Utilisateur</TableHead>
|
||||
<TableHead>Type</TableHead>
|
||||
<TableHead>Montant</TableHead>
|
||||
<TableHead>Tokens</TableHead>
|
||||
<TableHead>Description</TableHead>
|
||||
<TableHead>Date</TableHead>
|
||||
@@ -151,11 +145,6 @@ export function TransactionsTable() {
|
||||
{isCredit ? "Crédit" : "Débit"}
|
||||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<span className="font-semibold">
|
||||
{formatAmount(transaction.rawAmount)}
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{tokenAmount > 0 && (
|
||||
<Badge variant="outline" className="text-xs">
|
||||
|
||||
Reference in New Issue
Block a user