add anomaly
This commit is contained in:
@@ -4,8 +4,9 @@ import SetStatus from '@/components/setStatus';
|
||||
import { ThemedView, } from '@/components/themed-view';
|
||||
import Constants from 'expo-constants'; //pour connaître la taille de la barre menu de l'OS en haut
|
||||
import React from 'react';
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import { StyleSheet, View,Text } from 'react-native';
|
||||
import { useChantier } from '../ContextChantier';
|
||||
import Anomaly from '@/components/anomaly';
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +26,7 @@ export default function Home() {
|
||||
<SelectChantier></SelectChantier>
|
||||
</View>
|
||||
<ChantierSummary style={styles.summary} data={{chantier}}/>
|
||||
|
||||
<Anomaly style={styles.anomaly} data={{chantier}}/>
|
||||
</View>
|
||||
</ThemedView>
|
||||
)
|
||||
@@ -47,5 +48,8 @@ const styles = StyleSheet.create({
|
||||
summary:{
|
||||
marginTop:60,
|
||||
padding:10,
|
||||
},
|
||||
anomaly:{
|
||||
padding:10,
|
||||
}
|
||||
});
|
||||
@@ -35,7 +35,7 @@ const LoginScreen: React.FC = () => {
|
||||
|
||||
return (
|
||||
<ThemedView lvl={1} style={styles.container}>
|
||||
<ThemedText style={styles.title}>Se connecter / S'incrire</ThemedText>
|
||||
<ThemedText style={styles.title}>Se connecter</ThemedText>
|
||||
<ThemedTextInput
|
||||
lvl = {2}
|
||||
border = {5}
|
||||
@@ -81,4 +81,4 @@ const styles = StyleSheet.create({
|
||||
padding: 10,
|
||||
marginBottom: 10,
|
||||
},
|
||||
});
|
||||
});
|
||||
58
components/anomaly.tsx
Normal file
58
components/anomaly.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Chantier } from '@/class/class';
|
||||
import { ThemedView, } from '@/components/themed-view';
|
||||
import React from 'react';
|
||||
import { Image, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
||||
import { ThemedText } from './themed-text';
|
||||
|
||||
|
||||
type Props = {
|
||||
data: {
|
||||
chantier:Chantier|null;
|
||||
}
|
||||
style?: StyleProp<ViewStyle>;
|
||||
};
|
||||
|
||||
export default function Anomaly({data,style , ...otherProps }: Props) {
|
||||
|
||||
return(
|
||||
<View style={style}>
|
||||
{data.chantier ? (
|
||||
<ThemedView lvl={4} style={styles.anomaliesContainer}>
|
||||
<ThemedText style={styles.anomaliesTitle}>Anomalies</ThemedText>
|
||||
{data.chantier.anomalies.length > 0 ? (
|
||||
data.chantier.anomalies.map((anomaly, index) => (
|
||||
<ThemedView key={index} lvl={2} style={styles.anomalyItem}>
|
||||
<ThemedText>• {anomaly}</ThemedText>
|
||||
</ThemedView>
|
||||
))
|
||||
) : (
|
||||
<ThemedText style={styles.noAnomaly}>Aucune anomalie</ThemedText>
|
||||
) }
|
||||
</ThemedView>
|
||||
): null}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
//Anomalies styles
|
||||
anomaliesContainer: {
|
||||
padding: 5,
|
||||
borderRadius: 10,
|
||||
height: 150,
|
||||
},
|
||||
anomaliesTitle: {
|
||||
fontSize: 16,
|
||||
fontWeight: "bold",
|
||||
marginBottom: 8,
|
||||
},
|
||||
anomalyItem: {
|
||||
padding: 8,
|
||||
marginBottom: 5,
|
||||
borderRadius: 8,
|
||||
},
|
||||
noAnomaly: {
|
||||
fontStyle: "italic",
|
||||
opacity: 0.7,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user