diff --git a/src/ai/text/components/consume-credit-card.tsx b/src/ai/text/components/consume-credit-card.tsx
deleted file mode 100644
index ea4f828..0000000
--- a/src/ai/text/components/consume-credit-card.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-'use client';
-
-import { CreditsBalanceButton } from '@/components/layout/credits-balance-button';
-import { Button } from '@/components/ui/button';
-import { useConsumeCredits, useCreditBalance } from '@/hooks/use-credits';
-import { CoinsIcon } from 'lucide-react';
-import { useState } from 'react';
-import { toast } from 'sonner';
-
-const CONSUME_CREDITS = 50;
-
-export function ConsumeCreditCard() {
- const { data: balance = 0, isLoading: isLoadingBalance } = useCreditBalance();
- const consumeCreditsMutation = useConsumeCredits();
- const [loading, setLoading] = useState(false);
-
- const hasEnoughCredits = (amount: number) => balance >= amount;
-
- const handleConsume = async () => {
- if (!hasEnoughCredits(CONSUME_CREDITS)) {
- toast.error('Insufficient credits, please buy more credits.');
- return;
- }
- setLoading(true);
- try {
- await consumeCreditsMutation.mutateAsync({
- amount: CONSUME_CREDITS,
- description: `AI Text Credit Consumption (${CONSUME_CREDITS} credits)`,
- });
- toast.success(`${CONSUME_CREDITS} credits have been consumed.`);
- } catch (error) {
- toast.error('Failed to consume credits, please try again later.');
- } finally {
- setLoading(false);
- }
- };
-
- return (
-
-
-
-
-
-
- );
-}
diff --git a/src/ai/text/components/index.ts b/src/ai/text/components/index.ts
index d0cea3d..de8876e 100644
--- a/src/ai/text/components/index.ts
+++ b/src/ai/text/components/index.ts
@@ -1,5 +1,4 @@
export { AnalysisResults } from './analysis-results';
-export { ConsumeCreditCard } from './consume-credit-card';
export { LoadingStates } from './loading-states';
export { UrlInputForm } from './url-input-form';
export { WebContentAnalyzer } from './web-content-analyzer';
diff --git a/src/app/[locale]/(marketing)/(pages)/test/page.tsx b/src/app/[locale]/(marketing)/(pages)/test/page.tsx
index 8d5a2a6..a5bc1d4 100644
--- a/src/app/[locale]/(marketing)/(pages)/test/page.tsx
+++ b/src/app/[locale]/(marketing)/(pages)/test/page.tsx
@@ -1,12 +1,12 @@
import Container from '@/components/layout/container';
-import { CreditsTest } from '@/components/test/credits-test';
+import { ConsumeCreditsCard } from '@/components/test/credits-test';
export default async function TestPage() {
return (
{/* credits test */}
-
+
);
diff --git a/src/components/test/credits-test.tsx b/src/components/test/credits-test.tsx
index f3bf510..129588f 100644
--- a/src/components/test/credits-test.tsx
+++ b/src/components/test/credits-test.tsx
@@ -6,19 +6,27 @@ import { CoinsIcon } from 'lucide-react';
import { useState } from 'react';
import { toast } from 'sonner';
-export function CreditsTest() {
- const { data: balance = 0, isLoading } = useCreditBalance();
+const CONSUME_CREDITS = 10;
+
+export function ConsumeCreditsCard() {
+ const { data: balance = 0, isLoading: isLoadingBalance } = useCreditBalance();
const consumeCreditsMutation = useConsumeCredits();
const [loading, setLoading] = useState(false);
+ const hasEnoughCredits = (amount: number) => balance >= amount;
+
const handleConsume = async () => {
+ if (!hasEnoughCredits(CONSUME_CREDITS)) {
+ toast.error('Insufficient credits, please buy more credits.');
+ return;
+ }
setLoading(true);
try {
await consumeCreditsMutation.mutateAsync({
- amount: 10,
- description: 'Test credit consumption',
+ amount: CONSUME_CREDITS,
+ description: `Test credit consumption (${CONSUME_CREDITS} credits)`,
});
- toast.success('10 credits consumed successfully!');
+ toast.success(`${CONSUME_CREDITS} credits consumed successfully!`);
} catch (error) {
toast.error('Failed to consume credits');
} finally {
@@ -39,11 +47,13 @@ export function CreditsTest() {