mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
Remove log in condition in CreditsDialog
This commit is contained in:
2 files changed
+2
-30
No files matched your search
@@ -80,20 +80,7 @@ describe('CreditsDialog', () => {
|
||||
expect(screen.getByText('$100')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows login requirement when user is not logged in', () => {
|
||||
render(
|
||||
<TestApp>
|
||||
<CreditsDialog
|
||||
open={true}
|
||||
onOpenChange={() => {}}
|
||||
providerId="test-provider"
|
||||
connection={mockConnection}
|
||||
/>
|
||||
</TestApp>
|
||||
);
|
||||
|
||||
expect(screen.getByText('Please log in to purchase credits')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('calls onDialogStateChange callback when dialog state changes', () => {
|
||||
const mockCallback = vi.fn();
|
||||
|
||||
@@ -200,7 +200,7 @@ export function CreditsDialog({ open, onOpenChange, providerId, connection }: Cr
|
||||
const data = await ai.get('/credits/payments?limit=50') as PaymentsResponse;
|
||||
return data.data;
|
||||
},
|
||||
enabled: open && !!user,
|
||||
enabled: open,
|
||||
retry: false,
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
@@ -316,15 +316,6 @@ export function CreditsDialog({ open, onOpenChange, providerId, connection }: Cr
|
||||
});
|
||||
|
||||
const handleAddCredits = () => {
|
||||
if (!user) {
|
||||
toast({
|
||||
title: 'Authentication required',
|
||||
description: 'Please log in to purchase credits.',
|
||||
variant: 'destructive',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (amount <= 0) {
|
||||
toast({
|
||||
title: 'Invalid amount',
|
||||
@@ -498,7 +489,7 @@ export function CreditsDialog({ open, onOpenChange, providerId, connection }: Cr
|
||||
|
||||
<Button
|
||||
onClick={handleAddCredits}
|
||||
disabled={!user || amount <= 0 || addCreditsMutation.isPending}
|
||||
disabled={amount <= 0 || addCreditsMutation.isPending}
|
||||
className="w-full h-12 text-base font-medium"
|
||||
size="lg"
|
||||
>
|
||||
@@ -506,12 +497,6 @@ export function CreditsDialog({ open, onOpenChange, providerId, connection }: Cr
|
||||
{paymentMethod === 'stripe' ? 'Pay with Card' : 'Generate Invoice'}
|
||||
{amount > 0 && ` - ${formatCurrency(amount)}`}
|
||||
</Button>
|
||||
|
||||
{!user && (
|
||||
<p className="text-sm text-muted-foreground text-center px-4">
|
||||
Please log in to purchase credits
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex-shrink-0 px-1 -mx-1 py-4">
|
||||
|
||||
Reference in new issue
Block a user