Browse Source

adding instution field on MatModal and updating icons size

master
analuizaff 3 years ago
parent
commit
596eb043bd
  1. 2
      src/App.js
  2. 4
      src/app/components/AssembleModalObject.js
  3. 25
      src/app/components/MapModal.js
  4. 2
      src/app/hooks/useSocketMarkers.js
  5. 4
      src/app/screens/MapFeedScreen.js

2
src/App.js

@ -33,7 +33,7 @@ export default function App() {
const storageUser = await authStorage.getUser(); const storageUser = await authStorage.getUser();
if (storageUser) setUser(storageUser); if (storageUser) setUser(storageUser);
global.location = { lat: -23.623, long: -46.5637 }; // await getLocation();
global.location = { lat: -9.969802, long: -67.816956 }; // await getLocation();
}; };
if (!isReady && netInfo.isInternetReachable) { if (!isReady && netInfo.isInternetReachable) {

4
src/app/components/AssembleModalObject.js

@ -64,6 +64,7 @@ function verifyMeasureDates(labels, measureDate) {
const AssembleModalObject = (response, name) => { const AssembleModalObject = (response, name) => {
var situation = null; var situation = null;
var user = null; var user = null;
var institution = null;
var address = null; var address = null;
var date = null; var date = null;
var time = null; var time = null;
@ -90,7 +91,7 @@ const AssembleModalObject = (response, name) => {
); );
} }
if (f.fieldname == "siglarede") { if (f.fieldname == "siglarede") {
user = f.fieldsanswersvalue;
institution = f.fieldsanswersvalue;
} }
if (f.fieldname == "nome") { if (f.fieldname == "nome") {
address = f.fieldsanswersvalue; address = f.fieldsanswersvalue;
@ -123,6 +124,7 @@ const AssembleModalObject = (response, name) => {
name: name, name: name,
title: situation, title: situation,
user: user, user: user,
institution: institution,
address: address, address: address,
date: date + " | " + time, date: date + " | " + time,
description: comments, description: comments,

25
src/app/components/MapModal.js

@ -1,6 +1,7 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Text, TouchableOpacity, View, StyleSheet, Image } from "react-native"; import { Text, TouchableOpacity, View, StyleSheet, Image } from "react-native";
import { MaterialCommunityIcons } from "@expo/vector-icons"; import { MaterialCommunityIcons } from "@expo/vector-icons";
import { FontAwesome5 } from '@expo/vector-icons';
import SelfClosingModal from "../components/SelfClosingModal"; import SelfClosingModal from "../components/SelfClosingModal";
import colors from "../config/colors"; import colors from "../config/colors";
import { showMessage } from "react-native-flash-message"; import { showMessage } from "react-native-flash-message";
@ -95,7 +96,7 @@ function iconTextRow(props) {
<View alignSelf="flex-start" marginRight={10}> <View alignSelf="flex-start" marginRight={10}>
<MaterialCommunityIcons <MaterialCommunityIcons
name={props.name} name={props.name}
size={18}
size={25}
color={colors.primary} color={colors.primary}
/> />
</View> </View>
@ -105,6 +106,18 @@ function iconTextRow(props) {
); );
} }
function iconInstitutionTextRow(props) {
return (
<View flexDirection="row" alignSelf="flex-start" marginVertical={3}>
<View alignSelf="flex-start" marginRight={10}>
<FontAwesome5 name={props.name} size={25} color={colors.primary} />
</View>
<Text style={styles.text}>{props.description}</Text>
</View>
);
}
function iconImageRow(props) { function iconImageRow(props) {
return ( return (
<View flexDirection="row" alignSelf="flex-start" marginVertical={3}> <View flexDirection="row" alignSelf="flex-start" marginVertical={3}>
@ -213,17 +226,19 @@ function componentBody(props) {
const date = props.date ? props.date : "implementando..."; const date = props.date ? props.date : "implementando...";
const address = props.address ? props.address : "Erro ao carregar endereço"; const address = props.address ? props.address : "Erro ao carregar endereço";
const user = props.user ? props.user : "Usuário ativo"; const user = props.user ? props.user : "Usuário ativo";
const institution = props.institution ? props.institution : "Erro ao carregar instituição"
return ( return (
<View style={styles.bodyRow}> <View style={styles.bodyRow}>
<Image style={styles.bodyIcon} resizeMode="stretch" source={props.logo} /> <Image style={styles.bodyIcon} resizeMode="stretch" source={props.logo} />
<View style={styles.bodyInfo}> <View style={styles.bodyInfo}>
{!isOfficialPluviometer(props.name) && iconTextRow({ name: "account", description: user })}
{iconInstitutionTextRow({name: "university", description: institution})}
{iconTextRow({ name: "map-marker", description: address })} {iconTextRow({ name: "map-marker", description: address })}
{!isPluviometer(props.name) && {!isPluviometer(props.name) &&
iconTextRow({ name: "calendar", description: date })} iconTextRow({ name: "calendar", description: date })}
{iconTextRow({ name: "account", description: user })}
{props.name != "automaticPluviometer" &&
{!isOfficialPluviometer(props.name) &&
iconImageRow({ name: "camera", pic: pictures })} iconImageRow({ name: "camera", pic: pictures })}
</View> </View>
</View> </View>
@ -249,6 +264,10 @@ function isPluviometer(name) {
return name === "pluviometer" || name === "automaticPluviometer"; return name === "pluviometer" || name === "automaticPluviometer";
} }
function isOfficialPluviometer(name) {
return name === "automaticPluviometer";
}
function MapModal({ showModal, setShowModal, markers }) { function MapModal({ showModal, setShowModal, markers }) {
const [currentMarker, setCurrentMarker] = useState(undefined); const [currentMarker, setCurrentMarker] = useState(undefined);
var timeFilter = null; var timeFilter = null;

2
src/app/hooks/useSocketMarkers.js

@ -5,7 +5,7 @@ import PinTransitavel from "../assets/floodZonesAssets/PinTransitavel";
const custom_assets = { const custom_assets = {
pluviometer: assets.pluviometer, pluviometer: assets.pluviometer,
officialPluviometer: assets.officialPluviometer,
officialPluviometer: assets.pluviometer,
floodZones: assets.floodZones, floodZones: assets.floodZones,
riverLevel: ["low", "normal", "high", "flooding"].map((key) => { riverLevel: ["low", "normal", "high", "flooding"].map((key) => {
return assets.riverLevel[key]; return assets.riverLevel[key];

4
src/app/screens/MapFeedScreen.js

@ -13,13 +13,13 @@ export default function MapFeedScreen(props) {
const [dataOptionsToShow, setDataOptionsToShow] = useState({ const [dataOptionsToShow, setDataOptionsToShow] = useState({
oficial: { oficial: {
automaticPluviometer: false,
automaticPluviometer: true,
susceptibilityAreas: false, susceptibilityAreas: false,
}, },
citzen: { citzen: {
floodRisk: false, floodRisk: false,
pluviometer: false, pluviometer: false,
rain: true,
rain: false,
floodZones: false, floodZones: false,
riverFlood: false, riverFlood: false,
}, },

Loading…
Cancel
Save