add anomaly
This commit is contained in:
@@ -4,8 +4,9 @@ import SetStatus from '@/components/setStatus';
|
|||||||
import { ThemedView, } from '@/components/themed-view';
|
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 Constants from 'expo-constants'; //pour connaître la taille de la barre menu de l'OS en haut
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View,Text } from 'react-native';
|
||||||
import { useChantier } from '../ContextChantier';
|
import { useChantier } from '../ContextChantier';
|
||||||
|
import Anomaly from '@/components/anomaly';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ export default function Home() {
|
|||||||
<SelectChantier></SelectChantier>
|
<SelectChantier></SelectChantier>
|
||||||
</View>
|
</View>
|
||||||
<ChantierSummary style={styles.summary} data={{chantier}}/>
|
<ChantierSummary style={styles.summary} data={{chantier}}/>
|
||||||
|
<Anomaly style={styles.anomaly} data={{chantier}}/>
|
||||||
</View>
|
</View>
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
)
|
)
|
||||||
@@ -47,5 +48,8 @@ const styles = StyleSheet.create({
|
|||||||
summary:{
|
summary:{
|
||||||
marginTop:60,
|
marginTop:60,
|
||||||
padding:10,
|
padding:10,
|
||||||
|
},
|
||||||
|
anomaly:{
|
||||||
|
padding:10,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -35,7 +35,7 @@ const LoginScreen: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemedView lvl={1} style={styles.container}>
|
<ThemedView lvl={1} style={styles.container}>
|
||||||
<ThemedText style={styles.title}>Se connecter / S'incrire</ThemedText>
|
<ThemedText style={styles.title}>Se connecter</ThemedText>
|
||||||
<ThemedTextInput
|
<ThemedTextInput
|
||||||
lvl = {2}
|
lvl = {2}
|
||||||
border = {5}
|
border = {5}
|
||||||
|
|||||||
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