import React, { useState } from 'react'; import { View, Text, TouchableOpacity, TextInput, Modal, KeyboardAvoidingView, Platform } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { Plus } from 'lucide-react-native'; import * as Haptics from 'expo-haptics'; interface TopBarProps { mode: 'camera' | 'library'; recipeName: string; onSaveRecipe: (name: string) => void; } export default function TopBar({ mode, recipeName, onSaveRecipe }: TopBarProps) { const insets = useSafeAreaInsets(); const [modalVisible, setModalVisible] = useState(false); const [newRecipeName, setNewRecipeName] = useState(''); const handleSavePress = () => { const name = newRecipeName.trim(); if (!name) return; onSaveRecipe(name); setNewRecipeName(''); setModalVisible(false); Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); }; return ( <> {mode === 'camera' ? 'LIVE' : 'LIBRARY'} {recipeName} setModalVisible(true)} className="flex-row items-center rounded-full border border-zinc-700/80 bg-black/45 px-4 py-2.5" activeOpacity={0.7} > SAVE setModalVisible(false)} > SAVE CURRENT AS RECIPE setModalVisible(false)} className="flex-1 bg-zinc-800 py-3 rounded-lg items-center" > CANCEL SAVE RECIPE ); }