This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
caelum0x 64fbe9f474 feat: round-3 deep product build-out (69 gaps closed, all 7 products green)
Deep-audit + build-out across all products to fully-usable state; all typecheck clean.

- gitgram-web (99): wire Store feature to real endpoints, close 9 gaps
- gitgram-backend (100): close 8 flow gaps, document infra-provisioning items
- gitgram-mobile (90): fix API base-URL/path mismatch (404s) + copy proximity
  components into components/proximity wired to real screens; 15 gaps, +react-native-svg
- aitm-core (95): wire natural-language CLI flow end-to-end; 11 gaps
- aitm-api (97): fix teams metadata runtime bug; copy a2a-js server/client/grpc
  into src/a2a and wire A2A route; crates.io package search; 8 gaps
- aitm-mcp (100): fix A2A client/server card mismatch; 9 gaps
- aitm-website (95): build missing docs routes; 9 gaps

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 13:54:57 +03:00

129 lines
3.3 KiB
TypeScript

import React, { useState } from 'react';
import {
View,
Text,
StyleSheet,
TextInput,
ScrollView,
TouchableOpacity,
Alert,
} from 'react-native';
import { useLocalSearchParams, useRouter } from 'expo-router';
import { Colors } from '../../../../constants/Colors';
import Header from '../../../../components/navigation/Header';
import { Button } from '../../../../components/ui/Button';
import { adCampaignService } from '../../../../services/adCampaignService';
import { logger } from '../../../../utils/logger';
const PRESET_AMOUNTS = [10, 25, 50, 100, 250];
export default function FundCampaignScreen() {
const router = useRouter();
const { id } = useLocalSearchParams<{ id: string }>();
const [amount, setAmount] = useState('');
const [submitting, setSubmitting] = useState(false);
const parsedAmount = Number(amount);
const isValid = !Number.isNaN(parsedAmount) && parsedAmount > 0;
const handleFund = async () => {
if (!id) return;
if (!isValid) {
Alert.alert('Error', 'Enter a valid funding amount greater than 0');
return;
}
setSubmitting(true);
try {
await adCampaignService.fundCampaign(id, parsedAmount);
Alert.alert('Funded', `Added $${parsedAmount.toFixed(2)} to your campaign budget`, [
{ text: 'OK', onPress: () => router.back() },
]);
} catch (error) {
logger.error('Fund campaign error:', error);
Alert.alert('Error', 'Failed to fund campaign. Please try again.');
} finally {
setSubmitting(false);
}
};
return (
<View style={styles.container}>
<Header title="Add Funds" />
<ScrollView contentContainerStyle={styles.content}>
<Text style={styles.label}>Funding amount (USD)</Text>
<TextInput
style={styles.input}
value={amount}
onChangeText={setAmount}
placeholder="0.00"
placeholderTextColor={Colors.textSecondary}
keyboardType="decimal-pad"
/>
<View style={styles.presets}>
{PRESET_AMOUNTS.map((preset) => (
<TouchableOpacity
key={preset}
style={styles.presetChip}
onPress={() => setAmount(String(preset))}
>
<Text style={styles.presetText}>${preset}</Text>
</TouchableOpacity>
))}
</View>
<Button
title="Add Funds"
onPress={handleFund}
size="lg"
loading={submitting}
disabled={submitting || !isValid}
/>
</ScrollView>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
},
content: {
padding: 16,
gap: 16,
},
label: {
color: Colors.textSecondary,
fontSize: 14,
},
input: {
backgroundColor: Colors.surface,
color: Colors.text,
borderRadius: 8,
borderWidth: 1,
borderColor: Colors.border,
padding: 14,
fontSize: 24,
fontWeight: '600',
},
presets: {
flexDirection: 'row',
flexWrap: 'wrap',
gap: 8,
},
presetChip: {
paddingHorizontal: 16,
paddingVertical: 10,
backgroundColor: Colors.surface,
borderRadius: 20,
borderWidth: 1,
borderColor: Colors.border,
},
presetText: {
color: Colors.text,
fontWeight: '600',
},
});