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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ Desarrollar un sistema web/móvil para planificar campañas, registrar labores e
- Dashboard
## 5. Fuera de alcance
- Sensores IoT
- Barreras físicas
- Facturación fiscal
- GPS en tiempo real
- IA para autorizar reservas o calcular precios
- IA para prescribir dosis o tratamientos (RN-10)
## 6. Stack objetivo del semestre
- Backend: Java 21 + Spring Boot
- Base de datos: PostgreSQL + Flyway
Expand Down
176 changes: 175 additions & 1 deletion agrocontrol-mobile/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion agrocontrol-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
"dependencies": {
"expo": "~58.0.19",
"expo-status-bar": "~58.0.4",
"lucide-react-native": "^1.65.0",
"react": "19.3.0",
"react-native": "0.88.0",
"react-native-safe-area-context": "~5.10.1"
"react-native-safe-area-context": "~5.10.1",
"react-native-svg": "15.16.0"
},
"devDependencies": {
"@types/react": "~19.3.0",
Expand Down
16 changes: 12 additions & 4 deletions agrocontrol-mobile/src/components/CampanaProgreso.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Calendar } from "lucide-react-native";
import { StyleSheet, Text, View } from "react-native";
import type { Campana, Cultivo } from "../models/agro";
import { calcularAvance, formatearFecha } from "../logic/siembra";
import { ETAPA_ICONO } from "../theme/estados";
import { PALETTE } from "../theme/palette";
import { BarraProgreso } from "./BarraProgreso";

Expand All @@ -12,11 +14,15 @@ type Props = {
// Qué se sembró, en qué etapa va y cuándo se cosecha.
export function CampanaProgreso({ campana, cultivo }: Props) {
const a = calcularAvance(campana, cultivo);
const IconoEtapa = ETAPA_ICONO[a.etapa.nombre];

if (campana.estado === "PLANIFICADA") {
return (
<View style={[styles.caja, styles.cajaPlan]}>
<Text style={styles.cultivo}>📅 {cultivo.nombre}</Text>
<View style={styles.titulo}>
<Calendar size={16} color={PALETTE.disponible} />
<Text style={styles.cultivo}>{cultivo.nombre}</Text>
</View>
<Text style={styles.detalle}>Siembra programada para el {formatearFecha(a.fechaSiembra)}</Text>
</View>
);
Expand All @@ -25,9 +31,10 @@ export function CampanaProgreso({ campana, cultivo }: Props) {
return (
<View style={styles.caja}>
<View style={styles.cabecera}>
<Text style={styles.cultivo}>
{a.etapa.icono} {cultivo.nombre}
</Text>
<View style={styles.titulo}>
<IconoEtapa size={16} color={PALETTE.sembrada} />
<Text style={styles.cultivo}>{cultivo.nombre}</Text>
</View>
<Text style={styles.etapa}>{a.etapa.nombre}</Text>
</View>
<BarraProgreso avance={a.avance} color={PALETTE.sembrada} />
Expand All @@ -48,6 +55,7 @@ const styles = StyleSheet.create({
caja: { backgroundColor: PALETTE.sembradaSuave, borderRadius: 10, padding: 10, gap: 6, marginTop: 6 },
cajaPlan: { backgroundColor: PALETTE.disponibleSuave },
cabecera: { flexDirection: "row", justifyContent: "space-between", alignItems: "center" },
titulo: { flexDirection: "row", alignItems: "center", gap: 6 },
cultivo: { fontSize: 15, fontWeight: "700", color: PALETTE.texto },
etapa: { fontSize: 13, fontWeight: "600", color: PALETTE.sembrada },
detalle: { fontSize: 13, color: PALETTE.textoSuave },
Expand Down
29 changes: 29 additions & 0 deletions agrocontrol-mobile/src/components/EstadoChip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { StyleSheet, Text, View } from "react-native";
import type { EstadoParcela } from "../models/agro";
import { ESTADO_VISUAL } from "../theme/estados";

type Props = {
estado: EstadoParcela;
};

export function EstadoChip({ estado }: Props) {
const { texto, icono: Icono, color, fondo } = ESTADO_VISUAL[estado];
return (
<View style={[styles.chip, { backgroundColor: fondo }]}>
<Icono size={14} color={color} />
<Text style={[styles.texto, { color }]}>{texto}</Text>
</View>
);
}

const styles = StyleSheet.create({
chip: {
flexDirection: "row",
alignItems: "center",
gap: 4,
paddingHorizontal: 8,
paddingVertical: 3,
borderRadius: 6,
},
texto: { fontSize: 12, fontWeight: "700" },
});
13 changes: 2 additions & 11 deletions agrocontrol-mobile/src/components/ParcelaCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Campana, Cultivo, Parcela } from "../models/agro";
import { PALETTE } from "../theme/palette";
import { ESTADO_VISUAL } from "../theme/estados";
import { CampanaProgreso } from "./CampanaProgreso";
import { EstadoChip } from "./EstadoChip";

type Props = {
parcela: Parcela;
Expand All @@ -19,9 +20,7 @@ export function ParcelaCard({ parcela, nombrePredio, campana, cultivo }: Props)
<Text style={styles.codigo}>
{parcela.codigo} <Text style={styles.id}>#{parcela.id}</Text>
</Text>
<Text style={[styles.chip, { color: visual.color, backgroundColor: visual.fondo }]}>
{visual.icono} {visual.texto}
</Text>
<EstadoChip estado={parcela.estado} />
</View>
<Text style={styles.detalle}>
{parcela.areaHa} ha · Predio: <Text style={styles.predio}>{nombrePredio}</Text>
Expand All @@ -44,14 +43,6 @@ const styles = StyleSheet.create({
cabecera: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", gap: 8 },
codigo: { fontSize: 16, fontWeight: "700", color: PALETTE.texto },
id: { fontSize: 13, fontWeight: "400", color: PALETTE.textoSuave },
chip: {
fontSize: 12,
fontWeight: "700",
paddingHorizontal: 8,
paddingVertical: 3,
borderRadius: 6,
overflow: "hidden",
},
detalle: { fontSize: 14, color: PALETTE.textoSuave },
predio: { color: PALETTE.acento, fontWeight: "600" },
});
Loading
Loading