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

164 lines
4.8 KiB
TypeScript

import React, { useState, useEffect } from 'react';
import {
View,
Text,
StyleSheet,
FlatList,
TouchableOpacity,
ActivityIndicator,
} from 'react-native';
import { useLocalSearchParams, useRouter } from 'expo-router';
import { Colors } from '../../../constants/Colors';
import { githubService } from '../../../services/githubService';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { logger } from '../../../utils/logger';
export default function FilesScreen() {
const router = useRouter();
const { id, fullName, path } = useLocalSearchParams<{ id: string; fullName: string; path?: string }>();
const [contents, setContents] = useState<any[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
if (fullName) {
loadContents();
}
}, [fullName, path]);
const loadContents = async () => {
try {
setLoading(true);
const [owner, repo] = fullName!.split('/');
const data = await githubService.getRepositoryContent(owner, repo, path || '');
// Sort: folders first, then files
const sortedData = Array.isArray(data) ? data.sort((a: any, b: any) => {
if (a.type === b.type) {
return a.name.localeCompare(b.name);
}
return a.type === 'dir' ? -1 : 1;
}) : [];
setContents(sortedData);
} catch (error) {
logger.error('Error loading contents:', error);
} finally {
setLoading(false);
}
};
const handleItemPress = (item: any) => {
if (item.type === 'dir') {
router.push({
pathname: '/project/[id]/files',
params: { id, fullName, path: item.path }
});
} else {
router.push({
pathname: '/project/[id]/blob',
params: { id, fullName, path: item.path, url: item.url }
});
}
};
const renderItem = ({ item }: { item: any }) => (
<TouchableOpacity style={styles.item} onPress={() => handleItemPress(item)}>
<Icon
name={item.type === 'dir' ? 'folder' : 'insert-drive-file'}
size={24}
color={item.type === 'dir' ? Colors.info : Colors.textSecondary}
/>
<Text style={styles.itemName}>{item.name}</Text>
<Icon name="chevron-right" size={20} color={Colors.textSecondary} />
</TouchableOpacity>
);
return (
<View style={styles.container}>
<View style={styles.header}>
<TouchableOpacity style={styles.backButton} onPress={() => router.back()}>
<Icon name="arrow-back" size={24} color={Colors.text} />
</TouchableOpacity>
<Text style={styles.headerTitle} numberOfLines={1}>
{path || fullName}
</Text>
</View>
{loading ? (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color={Colors.primary} />
</View>
) : (
<FlatList
data={contents}
renderItem={renderItem}
keyExtractor={(item) => item.sha}
contentContainerStyle={styles.listContent}
ListEmptyComponent={
<View style={styles.emptyContainer}>
<Text style={styles.emptyText}>No files found</Text>
</View>
}
/>
)}
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
},
header: {
flexDirection: 'row',
alignItems: 'center',
padding: 16,
paddingTop: 60,
paddingBottom: 12,
backgroundColor: Colors.secondary,
borderBottomWidth: 1,
borderBottomColor: Colors.border,
gap: 12,
},
backButton: {
padding: 4,
},
headerTitle: {
fontSize: 16,
fontWeight: '600',
color: Colors.text,
flex: 1,
},
loadingContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
listContent: {
paddingBottom: 20,
},
item: {
flexDirection: 'row',
alignItems: 'center',
padding: 16,
borderBottomWidth: 1,
borderBottomColor: Colors.border,
backgroundColor: Colors.background,
gap: 12,
},
itemName: {
flex: 1,
fontSize: 16,
color: Colors.text,
},
emptyContainer: {
padding: 32,
alignItems: 'center',
},
emptyText: {
color: Colors.textSecondary,
fontSize: 16,
},
});