import { Image, Pressable, Switch, Text, View } from "react-native"; import { Ionicons } from "@expo/vector-icons"; import * as Haptics from "expo-haptics"; export interface MenuItemData { id: string; name: string; description: string | null; price: number; is_active: boolean; image_url?: string | null; } interface MenuItemCardProps { item: MenuItemData; onPress: () => void; onToggleActive: (active: boolean) => void; } export function MenuItemCard({ item, onPress, onToggleActive }: MenuItemCardProps) { const isAvailable = item.is_active; return ( { Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(() => {}); onPress(); }} style={({ pressed }) => ({ backgroundColor: isAvailable ? "#FFFFFF" : "#F5F5F4", borderRadius: 16, padding: 12, marginBottom: 10, borderWidth: 1, borderColor: isAvailable ? "#E7E5E4" : "#D6D3D1", opacity: pressed ? 0.88 : 1, shadowColor: "#000", shadowOffset: { width: 0, height: 1 }, shadowOpacity: isAvailable ? 0.03 : 0, shadowRadius: 4, elevation: isAvailable ? 1 : 0, })} > {/* Item Image Thumbnail if available */} {item.image_url ? ( ) : null} {/* Item Info */} {item.name} {!isAvailable ? ( Tükendi (86) ) : null} {item.description ? ( {item.description} ) : null} {/* Price */} {item.price} ₺ {/* Action Column: Stock Switch & Details Chevron */} {isAvailable ? "Aktif" : "Kapalı"} { Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium).catch(() => {}); onToggleActive(val); }} trackColor={{ false: "#D6D3D1", true: "#059669" }} thumbColor="#FFFFFF" style={{ transform: [{ scaleX: 0.8 }, { scaleY: 0.8 }] }} /> Düzenle ); }