feat: improve alerts screen ui
This commit is contained in:
@@ -1,15 +1,67 @@
|
|||||||
import { View, Text } from "react-native";
|
import { ScrollView, Text } from "react-native";
|
||||||
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
|
|
||||||
|
import { COLORS } from "../constants/colors";
|
||||||
|
|
||||||
|
import SectionTitle from "../components/SectionTitle";
|
||||||
|
import AlertItem from "@/components/Alertltem";
|
||||||
|
|
||||||
export default function AlertsScreen() {
|
export default function AlertsScreen() {
|
||||||
return (
|
return (
|
||||||
<View
|
<SafeAreaView
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: "center",
|
backgroundColor: COLORS.background,
|
||||||
alignItems: "center",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text>Alertas</Text>
|
<ScrollView
|
||||||
</View>
|
showsVerticalScrollIndicator={false}
|
||||||
|
contentContainerStyle={{
|
||||||
|
padding: 20,
|
||||||
|
paddingBottom: 120,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SectionTitle title="Alertas" />
|
||||||
|
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
color: "#6B7280",
|
||||||
|
fontSize: 14,
|
||||||
|
marginBottom: 24,
|
||||||
|
marginLeft: 12,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Estado actual de recolección
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<AlertItem
|
||||||
|
title="Ruta iniciada"
|
||||||
|
description="El vehículo de recolección ha comenzado la ruta matutina en tu distrito."
|
||||||
|
time="Justo ahora"
|
||||||
|
type="started"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<AlertItem
|
||||||
|
title="Camión cerca"
|
||||||
|
description="El camión está a 2 cuadras. Asegúrate de sacar tus contenedores."
|
||||||
|
time="Hace 15m"
|
||||||
|
type="near"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<AlertItem
|
||||||
|
title="Retraso detectado"
|
||||||
|
description="Congestión de tráfico en la zona principal puede causar retraso."
|
||||||
|
time="Hace 1h"
|
||||||
|
type="danger"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<AlertItem
|
||||||
|
title="Ruta completada"
|
||||||
|
description="¡Buen trabajo! Tu vecindario logró desviar residuos reciclables."
|
||||||
|
time="Ayer"
|
||||||
|
type="completed"
|
||||||
|
/>
|
||||||
|
</ScrollView>
|
||||||
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,56 @@
|
|||||||
import { View, Text } from "react-native";
|
import { ScrollView, View, Text } from "react-native";
|
||||||
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
|
|
||||||
|
import { COLORS } from "../constants/colors";
|
||||||
|
|
||||||
|
import SectionTitle from "../components/SectionTitle";
|
||||||
|
import EtaCard from "../components/EtaCard";
|
||||||
|
import QuickAction from "../components/QuickAction";
|
||||||
|
|
||||||
export default function HomeScreen() {
|
export default function HomeScreen() {
|
||||||
return (
|
return (
|
||||||
<View
|
<SafeAreaView
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: "center",
|
backgroundColor: COLORS.background,
|
||||||
alignItems: "center",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text>Inicio</Text>
|
<ScrollView
|
||||||
</View>
|
showsVerticalScrollIndicator={false}
|
||||||
|
contentContainerStyle={{
|
||||||
|
padding: 20,
|
||||||
|
paddingBottom: 120,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SectionTitle title="EcoRuta" />
|
||||||
|
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
color: "#6B7280",
|
||||||
|
fontSize: 14,
|
||||||
|
marginBottom: 20,
|
||||||
|
marginLeft: 12,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Monitoreo inteligente de recolección
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<EtaCard />
|
||||||
|
|
||||||
|
<SectionTitle title="Acciones rápidas" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: "row",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
marginTop: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<QuickAction title="Alertas" icon="notifications-outline" />
|
||||||
|
|
||||||
|
<QuickAction title="Reportar" icon="warning-outline" />
|
||||||
|
</View>
|
||||||
|
</ScrollView>
|
||||||
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,59 +1,183 @@
|
|||||||
import { View, Text, StyleSheet } from 'react-native';
|
import {
|
||||||
import { Colors, Spacing } from '../constants/theme';
|
View,
|
||||||
|
Text,
|
||||||
|
StyleSheet,
|
||||||
|
} from "react-native";
|
||||||
|
|
||||||
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
|
|
||||||
|
import { Colors, Spacing } from "../constants/theme";
|
||||||
|
|
||||||
type AlertItemProps = {
|
type AlertItemProps = {
|
||||||
message: string;
|
title: string;
|
||||||
type?: 'success' | 'warning' | 'danger';
|
description: string;
|
||||||
|
time: string;
|
||||||
|
type?: "started" | "near" | "danger" | "completed";
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function AlertItem({
|
export default function AlertItem({
|
||||||
message,
|
title,
|
||||||
type = 'success',
|
description,
|
||||||
|
time,
|
||||||
|
type = "started",
|
||||||
}: AlertItemProps) {
|
}: AlertItemProps) {
|
||||||
|
|
||||||
const theme = Colors.light;
|
const theme = Colors.light;
|
||||||
|
|
||||||
const getColor = () => {
|
const getColor = () => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'success':
|
case "started":
|
||||||
return '#22C55E';
|
return "#B8C4BE";
|
||||||
case 'warning':
|
|
||||||
return '#FACC15';
|
case "near":
|
||||||
case 'danger':
|
return "#22C55E";
|
||||||
return '#EF4444';
|
|
||||||
default:
|
case "danger":
|
||||||
return theme.textSecondary;
|
return "#EF4444";
|
||||||
}
|
|
||||||
};
|
case "completed":
|
||||||
|
return "#B8C4BE";
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "#9CA3AF";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getIcon = () => {
|
||||||
|
switch (type) {
|
||||||
|
case "started":
|
||||||
|
return "navigate";
|
||||||
|
|
||||||
|
case "near":
|
||||||
|
return "time-outline";
|
||||||
|
|
||||||
|
case "danger":
|
||||||
|
return "warning-outline";
|
||||||
|
|
||||||
|
case "completed":
|
||||||
|
return "checkmark-done";
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "notifications";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View
|
||||||
<View style={[styles.bar, { backgroundColor: getColor() }]} />
|
style={[
|
||||||
<Text style={[styles.text, { color: theme.text }]}>
|
styles.container,
|
||||||
{message}
|
{
|
||||||
</Text>
|
backgroundColor: "#FFFFFF",
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
styles.iconContainer,
|
||||||
|
{
|
||||||
|
backgroundColor: `${getColor()}20`,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Ionicons
|
||||||
|
name={getIcon()}
|
||||||
|
size={22}
|
||||||
|
color={getColor()}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.content}>
|
||||||
|
<View style={styles.header}>
|
||||||
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.title,
|
||||||
|
{
|
||||||
|
color: theme.text,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{title}
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.time}>
|
||||||
|
{time}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.description,
|
||||||
|
{
|
||||||
|
color: theme.textSecondary,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{description}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flexDirection: 'row',
|
flexDirection: "row",
|
||||||
padding: Spacing.three,
|
|
||||||
marginHorizontal: Spacing.three,
|
padding: 18,
|
||||||
marginVertical: Spacing.one,
|
|
||||||
borderRadius: 12,
|
marginBottom: 16,
|
||||||
backgroundColor: '#F0F0F3',
|
|
||||||
alignItems: 'center',
|
borderRadius: 22,
|
||||||
|
|
||||||
|
alignItems: "flex-start",
|
||||||
|
|
||||||
|
shadowColor: "#000",
|
||||||
|
|
||||||
|
shadowOffset: {
|
||||||
|
width: 0,
|
||||||
|
height: 6,
|
||||||
|
},
|
||||||
|
|
||||||
|
shadowOpacity: 0.05,
|
||||||
|
|
||||||
|
shadowRadius: 10,
|
||||||
|
|
||||||
|
elevation: 4,
|
||||||
},
|
},
|
||||||
bar: {
|
|
||||||
width: 6,
|
iconContainer: {
|
||||||
height: '100%',
|
width: 42,
|
||||||
borderRadius: 4,
|
height: 42,
|
||||||
marginRight: Spacing.two,
|
|
||||||
|
borderRadius: 21,
|
||||||
|
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
|
||||||
|
marginRight: 14,
|
||||||
},
|
},
|
||||||
text: {
|
|
||||||
fontSize: 14,
|
content: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
header: {
|
||||||
|
flexDirection: "row",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
marginBottom: 6,
|
||||||
|
},
|
||||||
|
|
||||||
|
title: {
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: "700",
|
||||||
|
},
|
||||||
|
|
||||||
|
time: {
|
||||||
|
fontSize: 12,
|
||||||
|
color: "#9CA3AF",
|
||||||
|
},
|
||||||
|
|
||||||
|
description: {
|
||||||
|
fontSize: 14,
|
||||||
|
lineHeight: 20,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
@@ -3,13 +3,15 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from "react-native";
|
||||||
|
|
||||||
import { Colors, Spacing } from '../constants/theme';
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
|
|
||||||
|
import { Colors, Spacing } from "../constants/theme";
|
||||||
|
|
||||||
type QuickActionProps = {
|
type QuickActionProps = {
|
||||||
title: string;
|
title: string;
|
||||||
icon: string;
|
icon: any;
|
||||||
onPress?: () => void;
|
onPress?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -18,7 +20,6 @@ export default function QuickAction({
|
|||||||
icon,
|
icon,
|
||||||
onPress,
|
onPress,
|
||||||
}: QuickActionProps) {
|
}: QuickActionProps) {
|
||||||
|
|
||||||
const theme = Colors.light;
|
const theme = Colors.light;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -32,9 +33,11 @@ export default function QuickAction({
|
|||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
>
|
>
|
||||||
<View style={styles.iconContainer}>
|
<View style={styles.iconContainer}>
|
||||||
<Text style={styles.icon}>
|
<Ionicons
|
||||||
{icon}
|
name={icon}
|
||||||
</Text>
|
size={30}
|
||||||
|
color="#0E8A61"
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Text
|
<Text
|
||||||
@@ -53,24 +56,24 @@ export default function QuickAction({
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
width: 100,
|
width: 150,
|
||||||
padding: Spacing.three,
|
|
||||||
borderRadius: 16,
|
paddingVertical: 20,
|
||||||
alignItems: 'center',
|
paddingHorizontal: 12,
|
||||||
justifyContent: 'center',
|
|
||||||
|
borderRadius: 18,
|
||||||
|
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
},
|
},
|
||||||
|
|
||||||
iconContainer: {
|
iconContainer: {
|
||||||
marginBottom: Spacing.two,
|
marginBottom: Spacing.two,
|
||||||
},
|
},
|
||||||
|
|
||||||
icon: {
|
|
||||||
fontSize: 28,
|
|
||||||
},
|
|
||||||
|
|
||||||
title: {
|
title: {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: '600',
|
fontWeight: "600",
|
||||||
textAlign: 'center',
|
textAlign: "center",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user