From f4f6a5a8f5f3ab3446f45dcc7f5cfaf572b64ec9 Mon Sep 17 00:00:00 2001 From: GabrielTrettel Date: Wed, 8 Sep 2021 15:44:24 -0300 Subject: [PATCH] initial implementation of account screen --- src/app/screens/AccountScreen.js | 139 +++++++++++++++++++++++-------- 1 file changed, 102 insertions(+), 37 deletions(-) diff --git a/src/app/screens/AccountScreen.js b/src/app/screens/AccountScreen.js index 694c6d2..d98b64e 100644 --- a/src/app/screens/AccountScreen.js +++ b/src/app/screens/AccountScreen.js @@ -1,61 +1,122 @@ import React, { useContext } from "react"; -import { Text, Button, Image, View } from "react-native"; +import { Text, Button, Image, View, StyleSheet } from "react-native"; import Screen from "../components/Screen"; -import InDevelopment from "../components/InDevelopment"; import { AuthContext } from "../auth/context"; import authStorage from "../auth/storage"; import { TouchableOpacity } from "react-native-gesture-handler"; import assets from "../config/assets"; +import { MaterialCommunityIcons } from "@expo/vector-icons"; import { scaleDimsFromWidth, dimensions } from "../config/dimensions"; import colors from "../config/colors"; - - function handleLogOut(setUser) { - - setUser(null); authStorage.removeToken(); } -function AccountScreen(props) { - const { user, setUser } = useContext(AuthContext); +function UserHeader({ name, fone }) { + return ( + + + + {name} + {fone} + + + ); +} - const dims = scaleDimsFromWidth(93, 106, 35); +function ProfileItensList({ icon, title, onPress }) { + return ( + + + + + + {title} + + + + ); +} + +function AccountScreen(props) { + const { user, setUser } = useContext(AuthContext); + const profileItems = [ + { + icon: "account", + title: "Editar Perfil", + onPress: () => { + console.log("1"); + }, + }, + { + icon: "lock", + title: "Alterar senha", + onPress: () => { + console.log("2"); + }, + }, + { + icon: "account", + title: "Cadastrar pluviômetro", + onPress: () => { + console.log("3"); + }, + }, + { + icon: "account", + title: "ATIVAR INSTITUIÇÃO", + onPress: () => { + console.log("4"); + }, + }, + { + icon: "information-outline", + title: "SOBRE O PROJETO", + onPress: () => { + console.log("5"); + }, + }, + { + icon: "logout", + title: "sair", + onPress: () => { + handleLogOut(setUser); + }, + }, + { + icon: "trash-can", + title: "Desativar conta", + onPress: () => { + console.log("7"); + }, + }, + ]; + console.log("a"); return ( - {user.name} - {user.email} + - {/* props.navigation.navigate("PluviometerRegister")}> - - - - - Cadastrar Pluviômetro - - - - */} + + {profileItems.map(({ icon, title, onPress }) => ( + + ))} +