Skip to content

Commit cac09a3

Browse files
committed
ai insights
1 parent 5ce6eca commit cac09a3

1 file changed

Lines changed: 18 additions & 25 deletions

File tree

frontend/app/screens/ai-insights.jsx

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import React, { useState } from 'react';
2-
import { View, Text, TextInput, StyleSheet, ScrollView, TouchableOpacity } from 'react-native';
2+
import {
3+
View,
4+
Text,
5+
TextInput,
6+
StyleSheet,
7+
ScrollView,
8+
TouchableOpacity,
9+
Image,
10+
} from 'react-native';
311
import { LinearGradient } from 'expo-linear-gradient';
412
import { colors } from '../../utils/colors';
513
import { fonts } from '../../utils/fonts';
@@ -23,12 +31,8 @@ export default function AiInsights() {
2331
<View style={styles.section}>
2432
<Text style={styles.sectionTitle}>Water Management</Text>
2533
<View style={styles.insightRow}>
26-
<View style={styles.chartPlaceholder}>
27-
<Text style={styles.chartText}>[Moisture Pie Chart]</Text>
28-
</View>
29-
<View style={styles.chartPlaceholder}>
30-
<Text style={styles.chartText}>[Water Usage Timeline]</Text>
31-
</View>
34+
<Image source={require('../../assets/images/moisture-pie.png')} style={styles.chartImage} />
35+
<Image source={require('../../assets/images/water-timeline.png')} style={styles.chartImage} />
3236
</View>
3337
<Text style={styles.sectionText}>
3438
Based on your farm’s data, we recommend adjusting your watering schedule during early mornings for better absorption and reduced evaporation.
@@ -38,9 +42,7 @@ export default function AiInsights() {
3842
{/* 2. Fertilizer */}
3943
<View style={styles.section}>
4044
<Text style={styles.sectionTitle}>Fertilizer</Text>
41-
<View style={styles.chartPlaceholderFull}>
42-
<Text style={styles.chartText}>[Fertilizer Bar Graph]</Text>
43-
</View>
45+
<Image source={require('../../assets/images/fertilizer-bar.png')} style={styles.chartImageFull} />
4446
<Text style={styles.sectionText}>
4547
The fertilizers used had moderate environmental impact. Consider reducing nitrogen-based fertilizers and increasing compost or organic options for sustainability.
4648
</Text>
@@ -113,8 +115,8 @@ export default function AiInsights() {
113115
}
114116

115117
const landAcres = parseFloat(land);
116-
const yieldEstimate = landAcres * 1000; // in kg
117-
const seedEstimate = landAcres * 25; // units
118+
const yieldEstimate = landAcres * 1000;
119+
const seedEstimate = landAcres * 25;
118120

119121
const result = `Based on your input of ${landAcres} acres for ${crop},\n\nEstimated Yield: ~${yieldEstimate} kg\nRequired Seeds: ~${seedEstimate} units.\n\nEnsure irrigation availability: "${irrigation}" and farming type: "${farmingType}" are optimal for best results.`;
120122

@@ -167,29 +169,20 @@ const styles = StyleSheet.create({
167169
flexDirection: 'row',
168170
justifyContent: 'space-between',
169171
},
170-
chartPlaceholder: {
172+
chartImage: {
171173
width: '48%',
172174
height: 120,
173175
borderRadius: 12,
174-
backgroundColor: '#d7ffd9',
175-
justifyContent: 'center',
176-
alignItems: 'center',
176+
resizeMode: 'cover',
177177
marginBottom: 12,
178178
},
179-
chartPlaceholderFull: {
179+
chartImageFull: {
180180
width: '100%',
181181
height: 140,
182182
borderRadius: 12,
183-
backgroundColor: '#d7ffd9',
184-
justifyContent: 'center',
185-
alignItems: 'center',
183+
resizeMode: 'cover',
186184
marginBottom: 12,
187185
},
188-
chartText: {
189-
fontSize: 14,
190-
fontFamily: fonts.Regular,
191-
color: '#555',
192-
},
193186
sectionText: {
194187
fontSize: 14,
195188
fontFamily: fonts.Regular,

0 commit comments

Comments
 (0)