managarten/apps-archived/maerchenzauber/apps/mobile/components/molecules/GlobalInsufficientCreditsHandler.tsx
Till-JS 61d181fbc2 chore: archive inactive projects to apps-archived/
Move inactive projects out of active workspace:
- bauntown (community website)
- maerchenzauber (AI story generation)
- memoro (voice memo app)
- news (news aggregation)
- nutriphi (nutrition tracking)
- reader (reading app)
- uload (URL shortener)
- wisekeep (AI wisdom extraction)

Update CLAUDE.md documentation:
- Add presi to active projects
- Document archived projects section
- Update workspace configuration

Archived apps can be re-activated by moving back to apps/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 07:03:59 +01:00

33 lines
1.2 KiB
TypeScript

import React from 'react';
import { useInsufficientCreditsInterceptor } from '../../src/hooks/useInsufficientCreditsInterceptor';
import { useInsufficientCreditsStore } from '../../src/stores/insufficientCreditsStore';
import InsufficientCreditsModal from './InsufficientCreditsModal';
/**
* Global handler for insufficient credits errors.
* This component should be mounted at the root level of the app.
* It intercepts 402 errors and displays the insufficient credits modal.
*/
export default function GlobalInsufficientCreditsHandler() {
// Set up the global fetch interceptor
useInsufficientCreditsInterceptor();
// Get modal state from the store
const { isModalVisible, requiredCredits, availableCredits, operation, closeModal } =
useInsufficientCreditsStore();
return (
<InsufficientCreditsModal
visible={isModalVisible}
requiredCredits={requiredCredits || 0}
availableCredits={availableCredits || 0}
operationType={operation === 'story_creation' ? 'story' : 'character'}
onClose={closeModal}
onGetCredits={() => {
// TODO: Navigate to credits purchase page
console.log('Navigate to credits purchase page');
closeModal();
}}
/>
);
}