"use client"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@hexahost/ui"; import { useQuery } from "@tanstack/react-query"; import { useTranslations } from "next-intl"; import { getWallet } from "@/lib/api/billing"; export function BillingContent() { const t = useTranslations("account.billing"); const { data, isLoading, isError } = useQuery({ queryKey: ["wallet"], queryFn: getWallet, }); if (isLoading) { return
{t("loading")}
; } if (isError || !data) { return{t("loadError")}
; } const transactions = data.transactions ?? []; return ({t("subtitle")}
{data.balance}
{t("creditsLabel")}
{t("transactionsEmpty")}
) : (| {t("columns.date")} | {t("columns.type")} | {t("columns.amount")} | {t("columns.reference")} |
|---|---|---|---|
| {new Date(tx.createdAt).toLocaleString()} | {tx.type} | {tx.amount} | {tx.referenceType ?? "—"} |