import React from 'react'; import { View, Text, Pressable } from 'react-native'; import { router } from 'expo-router'; import { ActionMenu } from '~/components/ActionMenu'; import { MinimalAudioPlayer } from '~/components/MinimalAudioPlayer'; import { Text as TextType } from '~/types/database'; import { useTheme } from '~/hooks/useTheme'; interface TextListItemProps { item: TextType; onShare: (text: TextType) => void; onDelete: (textId: string, title: string) => void; formatDate: (dateString: string) => string; getAudioDuration: (item: TextType) => string | null; } export const TextListItem: React.FC = ({ item, onShare, onDelete, formatDate, getAudioDuration, }) => { const { colors } = useTheme(); const handleMenuSelect = (index: number) => { switch (index) { case 0: // Öffnen router.push(`/text/${item.id}`); break; case 1: // Teilen onShare(item); break; case 2: // Tags bearbeiten router.push(`/text/${item.id}`); break; case 3: // Löschen onDelete(item.id, item.title); break; } }; return ( router.push(`/text/${item.id}`)} className={`mb-3 rounded-lg border ${colors.border} ${colors.surface} p-4 shadow-sm`} > {/* Header with title and date/duration */} {item.title} {formatDate(item.updated_at)} {getAudioDuration(item) && ( <> {getAudioDuration(item)} )} {/* Content preview */} {item.content} {/* Footer with tags and audio player */} {item.data.tags?.map((tag, index) => ( {tag} ))} ); };