Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion frontend/src/components/FoodLogForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,28 @@ export const FoodLogForm: React.FC<FoodLogFormProps> = ({ onSubmit, onBack }) =>

{/* Custom food entry */}
{isCustom && (
<View>
<View style={{width: '75%' }}>

<TextInput
style={{ borderWidth: 1, borderColor: '#ccc', borderRadius: 8, padding: 12, marginBottom: 8, backgroundColor: '#fafafa' }}
placeholder="Food name"
value={customName}
onChangeText={setCustomName}
/>
{customIngredients.length === 0 && (
<Text style={{ color: '#aaa', fontSize: 13, marginBottom: 4 }}>
Ingredients
</Text>
)}
<View>
<Chips
items={customIngredients}
itemName="Ingredients"
placeholder="Add Ingredients..."
onAdd={(ing) => setCustomIngredients((prev) => [...prev, ing])}
onRemove={(i) => setCustomIngredients((prev) => prev.filter((_, idx) => idx !== i))}
/>
</View>
<TouchableOpacity onPress={() => { setIsCustom(false); setSearchQuery(""); }}>
<Text className="text-sm font-medium font-ptserif text-[#eea487] mt-2">
Search bank instead
Expand Down
26 changes: 18 additions & 8 deletions frontend/src/components/GenericChipComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import {
interface ChipsProps {
items: string[];
itemName: string;
placeholder?: string;
onAdd: (item: string) => void;
onRemove: (index: number) => void;
}

export const Chips: React.FC<ChipsProps> = ({
items,
itemName,
placeholder,
onAdd,
onRemove,
}) => {
Expand Down Expand Up @@ -43,14 +45,22 @@ export const Chips: React.FC<ChipsProps> = ({
</View>
))}
</View>
<TextInput
className="border border-neutral-300 rounded-lg p-3 text-base bg-neutral-50 mb-2"
placeholder={`Add ${itemName.toLowerCase()}...`}
value={input}
onChangeText={setInput}
onSubmitEditing={handleSubmit}
returnKeyType="done"
/>
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
<TextInput
style={{ flex: 1, borderWidth: 1, borderColor: '#d4d4d4', borderRadius: 8, padding: 10, fontSize: 13, backgroundColor: '#fafafa' }}
placeholder={placeholder ?? `Add ${itemName.toLowerCase()}...`}
value={input}
onChangeText={setInput}
onSubmitEditing={handleSubmit}
returnKeyType="done"
/>
<TouchableOpacity
onPress={handleSubmit}
style={{ backgroundColor: '#eea487', borderRadius: 8, padding: 10 }}
>
<Text style={{ color: 'white', fontWeight: '600', fontSize: 13 }}>Add</Text>
</TouchableOpacity>
</View>
</View>
);
};
Loading