Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
189 lines
4.7 KiB
TypeScript
189 lines
4.7 KiB
TypeScript
import React, { useState } from 'react';
|
|
import {
|
|
View,
|
|
Text,
|
|
StyleSheet,
|
|
TextInput,
|
|
FlatList,
|
|
TouchableOpacity,
|
|
} from 'react-native';
|
|
import { useRouter } from 'expo-router';
|
|
import { Colors } from '../../constants/Colors';
|
|
import Header from '../../components/navigation/Header';
|
|
import LoadingSpinner from '../../components/common/LoadingSpinner';
|
|
import EmptyState from '../../components/common/EmptyState';
|
|
import { Image } from 'expo-image';
|
|
import { storeService } from '../../services/storeService';
|
|
import { logger } from '../../utils/logger';
|
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
|
|
export default function StoreSearchScreen() {
|
|
const router = useRouter();
|
|
const [searchQuery, setSearchQuery] = useState('');
|
|
const [items, setItems] = useState<any[]>([]);
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
const handleSearch = async () => {
|
|
if (!searchQuery.trim()) {
|
|
setItems([]);
|
|
return;
|
|
}
|
|
|
|
setLoading(true);
|
|
try {
|
|
const response = await storeService.getItems(undefined, 1, 20, searchQuery);
|
|
setItems(response.items || []);
|
|
} catch (error) {
|
|
logger.error('Search store items error:', error);
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
};
|
|
|
|
const renderItem = ({ item }: { item: any }) => (
|
|
<TouchableOpacity
|
|
style={styles.itemCard}
|
|
onPress={() => router.push(`/store/item/${item.id}`)}
|
|
>
|
|
{item.images && item.images.length > 0 && (
|
|
<Image source={{ uri: item.images[0] }} style={styles.itemImage} />
|
|
)}
|
|
<View style={styles.itemInfo}>
|
|
<Text style={styles.itemTitle}>{item.title}</Text>
|
|
<Text style={styles.itemDescription} numberOfLines={2}>
|
|
{item.description}
|
|
</Text>
|
|
<View style={styles.itemFooter}>
|
|
<Text style={styles.itemPrice}>${item.price}</Text>
|
|
<View style={styles.itemStats}>
|
|
<Icon name="star" size={16} color={Colors.accent} />
|
|
<Text style={styles.itemRating}>{item.rating || '0.0'}</Text>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</TouchableOpacity>
|
|
);
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<Header title="Search Store" />
|
|
<View style={styles.searchContainer}>
|
|
<TextInput
|
|
style={styles.searchInput}
|
|
placeholder="Search for projects, code, templates..."
|
|
placeholderTextColor={Colors.textSecondary}
|
|
value={searchQuery}
|
|
onChangeText={setSearchQuery}
|
|
onSubmitEditing={handleSearch}
|
|
returnKeyType="search"
|
|
/>
|
|
<TouchableOpacity style={styles.searchButton} onPress={handleSearch}>
|
|
<Icon name="search" size={24} color={Colors.text} />
|
|
</TouchableOpacity>
|
|
</View>
|
|
|
|
{loading ? (
|
|
<LoadingSpinner />
|
|
) : items.length > 0 ? (
|
|
<FlatList
|
|
data={items}
|
|
renderItem={renderItem}
|
|
keyExtractor={(item) => item.id}
|
|
contentContainerStyle={styles.listContent}
|
|
/>
|
|
) : searchQuery ? (
|
|
<EmptyState
|
|
title="No results found"
|
|
message="Try searching with different keywords"
|
|
icon="🔍"
|
|
/>
|
|
) : (
|
|
<EmptyState
|
|
title="Search Store"
|
|
message="Enter keywords to search for items"
|
|
icon="🔍"
|
|
/>
|
|
)}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: Colors.background,
|
|
},
|
|
searchContainer: {
|
|
flexDirection: 'row',
|
|
padding: 16,
|
|
gap: 12,
|
|
borderBottomWidth: 1,
|
|
borderBottomColor: Colors.border,
|
|
},
|
|
searchInput: {
|
|
flex: 1,
|
|
backgroundColor: Colors.surface,
|
|
borderRadius: 8,
|
|
padding: 12,
|
|
color: Colors.text,
|
|
fontSize: 16,
|
|
borderWidth: 1,
|
|
borderColor: Colors.border,
|
|
},
|
|
searchButton: {
|
|
padding: 12,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
},
|
|
listContent: {
|
|
padding: 16,
|
|
},
|
|
itemCard: {
|
|
flexDirection: 'row',
|
|
backgroundColor: Colors.surface,
|
|
borderRadius: 12,
|
|
padding: 12,
|
|
marginBottom: 12,
|
|
gap: 12,
|
|
},
|
|
itemImage: {
|
|
width: 80,
|
|
height: 80,
|
|
borderRadius: 8,
|
|
},
|
|
itemInfo: {
|
|
flex: 1,
|
|
},
|
|
itemTitle: {
|
|
fontSize: 16,
|
|
fontWeight: '600',
|
|
color: Colors.text,
|
|
marginBottom: 4,
|
|
},
|
|
itemDescription: {
|
|
fontSize: 14,
|
|
color: Colors.textSecondary,
|
|
marginBottom: 8,
|
|
},
|
|
itemFooter: {
|
|
flexDirection: 'row',
|
|
justifyContent: 'space-between',
|
|
alignItems: 'center',
|
|
},
|
|
itemPrice: {
|
|
fontSize: 18,
|
|
fontWeight: 'bold',
|
|
color: Colors.accent,
|
|
},
|
|
itemStats: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
gap: 4,
|
|
},
|
|
itemRating: {
|
|
fontSize: 14,
|
|
color: Colors.text,
|
|
},
|
|
});
|
|
|