import { View, Text, StyleSheet, FlatList } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { useRouter } from 'expo-router';
import { useFeeds } from '@/hooks/useFeeds';
import { Colors } from '@/lib/colors';
import { FontSize, FontWeight, Radius, Spacing } from '@/lib/theme';
import { AppBar, Card, EmptyState, Loader } from '@/components/ui';
import type { Feed } from '@/types';
export default function InfoListScreen() {
const { data: feeds, isLoading } = useFeeds();
const router = useRouter();
const renderItem = ({ item }: { item: Feed }) => {
const extrait = (item.contenu ?? '').replace(/<[^>]*>/g, '').trim();
return (
router.push(`/(tabs)/info/${item.slug}`)} style={styles.card}>
{item.titre}
{extrait ? (
{extrait}
) : null}
{new Date(item.created_at).toLocaleDateString('fr-FR', {
day: 'numeric',
month: 'long',
year: 'numeric',
})}
);
};
return (
{isLoading ? (
) : (
String(item.id)}
renderItem={renderItem}
contentContainerStyle={styles.listContent}
ListEmptyComponent={
}
/>
)}
);
}
const styles = StyleSheet.create({
container: { flex: 1, backgroundColor: Colors.gray[50] },
listContent: { padding: Spacing.lg, gap: Spacing.md },
card: { padding: Spacing.lg },
cardRow: { flexDirection: 'row', alignItems: 'center', gap: Spacing.md },
cardIcon: {
width: 48,
height: 48,
borderRadius: Radius.sm,
backgroundColor: '#E3E3FD',
justifyContent: 'center',
alignItems: 'center',
},
cardContent: { flex: 1 },
cardTitle: { fontSize: FontSize.body, fontWeight: FontWeight.bold, color: Colors.black, marginBottom: Spacing.xs },
cardExcerpt: { fontSize: FontSize.xs, color: Colors.gray[500], lineHeight: 18 },
cardDate: { fontSize: FontSize.tiny, color: Colors.gray[400], marginTop: Spacing.xs },
});