Files
igny8/frontend/dist/assets/js/Credits-DFf6S4rj.js
IGNY8 VPS (Salman) 3c100be1cf more
2025-11-13 14:12:36 +00:00

2 lines
2.7 KiB
JavaScript

import{r,j as e}from"./chunk-UIGDSWPH-BhuNDbxn.js";import{u as m,a as o,P as l}from"./main-af3pcbZa.js";import{C as s}from"./Card-CAsJMMfR.js";function y(){const d=m(),[t,c]=r.useState(null),[n,i]=r.useState(!0);r.useEffect(()=>{x()},[]);const x=async()=>{try{i(!0);const a=await o();c(a)}catch(a){d.error(`Failed to load credit balance: ${a.message}`)}finally{i(!1)}};return n?e.jsxs("div",{className:"p-6",children:[e.jsx(l,{title:"Credits"}),e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-gray-500",children:"Loading..."})})]}):e.jsxs("div",{className:"p-6",children:[e.jsx(l,{title:"Credits"}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Credit Balance"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Manage your AI credits and usage"})]}),t&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[e.jsxs(s,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx("h3",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Current Balance"})}),e.jsx("div",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:t.credits.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-2",children:"Available credits"})]}),e.jsxs(s,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx("h3",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Monthly Allocation"})}),e.jsx("div",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:t.plan_credits_per_month.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-2",children:"Credits per month"})]}),e.jsxs(s,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx("h3",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Used This Month"})}),e.jsx("div",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:t.credits_used_this_month.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-2",children:"Credits consumed"})]}),e.jsxs(s,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx("h3",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Remaining"})}),e.jsx("div",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:t.credits_remaining.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-2",children:"Credits remaining"})]})]})]})}export{y as default};