import { Text } from '@/aesthetics/Text';
import { font, radius, spacing, useColors } from '@/aesthetics/styles';
import { useStrings } from '@/common/hooks/useStrings';
import { Card } from '@/see-log/aesthetics/Card';
import { RecommendedFoodItems } from '@/see-log/food-recommendation/RecommendedFoodItems';
import type { FoodRecommendation } from '@/types/foodlog';
import { FileText } from 'lucide-react-native';
import { ActivityIndicator, Pressable, StyleSheet, View } from 'react-native';
import { IngredientChip } from './DashboardUI';
type FoodRecoCardProps = {
ingredients: string[];
foods: FoodRecommendation[];
loading: boolean;
hasGenerated: boolean;
canGenerate: boolean;
onGenerate: () => void;
};
export function FoodRecoCard({
ingredients,
foods,
loading,
hasGenerated,
canGenerate,
onGenerate,
}: FoodRecoCardProps) {
const c = useColors();
const strings = useStrings();
if (loading) {
return (
{strings.seeLog.report.generating}
);
}
if (hasGenerated) {
return (
{ingredients.length > 0 && (
{strings.seeLog.report.ingredientsToEat}
{ingredients.map((name, i) => (
))}
)}
{foods.length > 0 && (
{strings.seeLog.report.recipeIdeas}
)}
{canGenerate && (
[
styles.regenerateButton,
{ borderColor: c.border },
pressed && { opacity: 0.6 },
]}
>
{strings.seeLog.report.regenerate}
)}
);
}
return (
{canGenerate ? (
[
styles.generateButton,
{ backgroundColor: c.accent },
pressed && { opacity: 0.8 },
]}
>
{strings.seeLog.report.generate}
) : (
{strings.seeLog.report.logToGenerate}
)}
);
}
const styles = StyleSheet.create({
loadingContainer: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
gap: spacing.md,
paddingVertical: spacing.xl,
},
loadingText: {
fontSize: font.sm,
},
content: {
gap: spacing.xl,
},
section: {
gap: spacing.md,
},
sectionTitle: {
fontSize: font.md,
fontWeight: '600',
},
chipGrid: {
flexDirection: 'row',
flexWrap: 'wrap',
gap: spacing.sm,
},
generateContainer: {
alignItems: 'center',
paddingVertical: spacing.xl,
},
generateButton: {
flexDirection: 'row',
alignItems: 'center',
gap: spacing.sm,
paddingHorizontal: spacing.xl,
paddingVertical: spacing.md,
borderRadius: radius.pill,
},
generateButtonText: {
color: '#fff',
fontSize: font.md,
fontWeight: '600',
},
generateHint: {
fontSize: font.sm,
fontStyle: 'italic',
},
regenerateButton: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
gap: spacing.sm,
paddingVertical: spacing.md,
borderWidth: 1,
borderRadius: radius.md,
},
regenerateButtonText: {
fontSize: font.sm,
fontWeight: '500',
},
});