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>
216 lines
5.3 KiB
TypeScript
216 lines
5.3 KiB
TypeScript
import React, { useState, useEffect } from 'react';
|
|
import {
|
|
View,
|
|
Text,
|
|
StyleSheet,
|
|
FlatList,
|
|
TextInput,
|
|
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 { userService } from '../../services/userService';
|
|
import { logger } from '../../utils/logger';
|
|
import VerificationBadge from '../../components/Verification/VerificationBadge';
|
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
|
|
export default function SearchUsersScreen() {
|
|
const router = useRouter();
|
|
const [searchQuery, setSearchQuery] = useState('');
|
|
const [users, setUsers] = useState<any[]>([]);
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
useEffect(() => {
|
|
if (searchQuery.trim()) {
|
|
const timeoutId = setTimeout(() => {
|
|
handleSearch();
|
|
}, 500);
|
|
return () => clearTimeout(timeoutId);
|
|
} else {
|
|
setUsers([]);
|
|
}
|
|
}, [searchQuery]);
|
|
|
|
const handleSearch = async () => {
|
|
if (!searchQuery.trim()) return;
|
|
|
|
setLoading(true);
|
|
try {
|
|
const response = await userService.searchUsers(searchQuery);
|
|
setUsers(response.users || []);
|
|
} catch (error) {
|
|
logger.error('Search users error:', error);
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
};
|
|
|
|
const renderUser = ({ item }: { item: any }) => (
|
|
<TouchableOpacity
|
|
style={styles.userItem}
|
|
onPress={() => router.push(`/profile/${item.id}`)}
|
|
>
|
|
{item.avatar ? (
|
|
<Image source={{ uri: item.avatar }} style={styles.avatar} />
|
|
) : (
|
|
<View style={styles.avatarPlaceholder}>
|
|
<Text style={styles.avatarText}>
|
|
{item.username[0].toUpperCase()}
|
|
</Text>
|
|
</View>
|
|
)}
|
|
<View style={styles.userInfo}>
|
|
<View style={styles.usernameRow}>
|
|
<Text style={styles.username}>@{item.username}</Text>
|
|
<VerificationBadge
|
|
isVerified={item.isVerified}
|
|
isGoldenVerified={item.isGoldenVerified}
|
|
/>
|
|
</View>
|
|
{item.bio && (
|
|
<Text style={styles.bio} numberOfLines={1}>
|
|
{item.bio}
|
|
</Text>
|
|
)}
|
|
{item.followersCount !== undefined && (
|
|
<Text style={styles.stats}>
|
|
{item.followersCount} followers
|
|
</Text>
|
|
)}
|
|
</View>
|
|
</TouchableOpacity>
|
|
);
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<Header title="Search Users" />
|
|
<View style={styles.searchContainer}>
|
|
<Icon name="search" size={20} color={Colors.textSecondary} style={styles.searchIcon} />
|
|
<TextInput
|
|
style={styles.searchInput}
|
|
placeholder="Search users..."
|
|
placeholderTextColor={Colors.textSecondary}
|
|
value={searchQuery}
|
|
onChangeText={setSearchQuery}
|
|
autoFocus
|
|
/>
|
|
{searchQuery.length > 0 && (
|
|
<TouchableOpacity
|
|
style={styles.clearButton}
|
|
onPress={() => setSearchQuery('')}
|
|
>
|
|
<Icon name="close" size={20} color={Colors.textSecondary} />
|
|
</TouchableOpacity>
|
|
)}
|
|
</View>
|
|
|
|
{loading ? (
|
|
<LoadingSpinner />
|
|
) : users.length > 0 ? (
|
|
<FlatList
|
|
data={users}
|
|
renderItem={renderUser}
|
|
keyExtractor={(item) => item.id}
|
|
contentContainerStyle={styles.listContent}
|
|
/>
|
|
) : searchQuery ? (
|
|
<EmptyState
|
|
title="No users found"
|
|
message="Try searching with different keywords"
|
|
icon="🔍"
|
|
/>
|
|
) : (
|
|
<EmptyState
|
|
title="Search Users"
|
|
message="Enter a username to search"
|
|
icon="👥"
|
|
/>
|
|
)}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: Colors.background,
|
|
},
|
|
searchContainer: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
padding: 16,
|
|
borderBottomWidth: 1,
|
|
borderBottomColor: Colors.border,
|
|
gap: 12,
|
|
},
|
|
searchIcon: {
|
|
marginLeft: 4,
|
|
},
|
|
searchInput: {
|
|
flex: 1,
|
|
backgroundColor: Colors.surface,
|
|
borderRadius: 8,
|
|
padding: 12,
|
|
color: Colors.text,
|
|
fontSize: 16,
|
|
},
|
|
clearButton: {
|
|
padding: 4,
|
|
},
|
|
listContent: {
|
|
padding: 16,
|
|
},
|
|
userItem: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
padding: 16,
|
|
borderBottomWidth: 1,
|
|
borderBottomColor: Colors.border,
|
|
gap: 12,
|
|
},
|
|
avatar: {
|
|
width: 50,
|
|
height: 50,
|
|
borderRadius: 25,
|
|
},
|
|
avatarPlaceholder: {
|
|
width: 50,
|
|
height: 50,
|
|
borderRadius: 25,
|
|
backgroundColor: Colors.accent,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
},
|
|
avatarText: {
|
|
color: Colors.text,
|
|
fontSize: 20,
|
|
fontWeight: 'bold',
|
|
},
|
|
userInfo: {
|
|
flex: 1,
|
|
},
|
|
usernameRow: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
marginBottom: 4,
|
|
},
|
|
username: {
|
|
fontSize: 16,
|
|
fontWeight: '600',
|
|
color: Colors.text,
|
|
},
|
|
bio: {
|
|
fontSize: 14,
|
|
color: Colors.textSecondary,
|
|
marginBottom: 4,
|
|
},
|
|
stats: {
|
|
fontSize: 12,
|
|
color: Colors.textSecondary,
|
|
},
|
|
});
|