fermeture auto

This commit is contained in:
trochas
2025-12-09 15:43:16 +01:00
parent 5550f0b9dd
commit d1cd117013
4 changed files with 53 additions and 45 deletions

View File

@@ -14,14 +14,11 @@ export default function Home() {
return( return(
<ThemedView lvl={3} style={styles.container}> <ThemedView lvl={3} style={styles.container}>
<View style={{width:"100%", position: 'absolute',marginLeft:"50%"}}>
<View style={styles.header}>
<View style={{position: 'absolute'}}>
<SelectChantier></SelectChantier>
</View>
<View style={{position: 'absolute'}}>
<SetStatus></SetStatus> <SetStatus></SetStatus>
</View> </View>
<View style={{width:"100%", position: 'absolute'}}>
<SelectChantier></SelectChantier>
</View> </View>
</ThemedView> </ThemedView>

View File

@@ -68,6 +68,7 @@ export default function SelectChantier() {
<Image source={{ uri:"https://cdn.discordapp.com/attachments/1425108443571945644/1427207643180826757/raw.png?ex=69392bb2&is=6937da32&hm=dcc09e76d3dca89d2418947b46efbd38673b9dc559027724b2e51d493b173bc9&" /*chantier.urlImg*/ }} style={styles.image} /> <Image source={{ uri:"https://cdn.discordapp.com/attachments/1425108443571945644/1427207643180826757/raw.png?ex=69392bb2&is=6937da32&hm=dcc09e76d3dca89d2418947b46efbd38673b9dc559027724b2e51d493b173bc9&" /*chantier.urlImg*/ }} style={styles.image} />
</View> </View>
<View> <View>
<ThemedText>{chantier.chef != null ? "true" : "false"}</ThemedText>
<ThemedText>Adresse: {chantier.adresse}</ThemedText> <ThemedText>Adresse: {chantier.adresse}</ThemedText>
<ThemedText>Chef de chantier: {chantier.chef.last_name}{" "}{chantier.chef.name}</ThemedText> <ThemedText>Chef de chantier: {chantier.chef.last_name}{" "}{chantier.chef.name}</ThemedText>
<ThemedText>État: {chantier.etat}</ThemedText> <ThemedText>État: {chantier.etat}</ThemedText>
@@ -104,7 +105,7 @@ export default function SelectChantier() {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
windowClose: { windowClose: {
//backgroundColor: '#00FFFF', //backgroundColor: '#00FF0040',
//borderRadius:10, //borderRadius:10,
padding: 10, padding: 10,
width: "50%", width: "50%",
@@ -112,7 +113,7 @@ const styles = StyleSheet.create({
overflow: "hidden", overflow: "hidden",
}, },
windowOpean: { windowOpean: {
//backgroundColor: '#00FFFF', //backgroundColor: '#00FF0040',
//borderRadius:10, //borderRadius:10,
width: "100%", width: "100%",
height: screenHeight / 2, height: screenHeight / 2,

View File

@@ -1,6 +1,6 @@
import { useChantier } from '@/app/ContextChantier'; import { useChantier } from '@/app/ContextChantier';
import { useState } from 'react'; import { useState } from 'react';
import { Dimensions, LayoutAnimation, Pressable, StyleSheet, View } from 'react-native'; import { Dimensions, LayoutAnimation, Modal, Pressable, StyleSheet, View } from 'react-native';
import Animated, { LinearTransition } from 'react-native-reanimated'; import Animated, { LinearTransition } from 'react-native-reanimated';
import { ThemedButton } from './themed-button'; import { ThemedButton } from './themed-button';
import { ThemedText } from './themed-text'; import { ThemedText } from './themed-text';
@@ -50,43 +50,53 @@ export default function SetStatus() {
return( return(
<Animated.View <>
layout={LinearTransition.duration(200)} <Modal
style={isOpen ? styles.windowOpean : styles.windowClose}> visible={isOpen}
transparent
<AnimatedThemedView layout={LinearTransition.duration(200)} lvl={2} shadow={true} style={styles.window}> animationType="none"
<ThemedButton style={styles.button} lvl={isOpen ? 1 : 1} onPress={() => onPressOpen()}> onRequestClose={() => setIsOpen(false)}
<ThemedText style={styles.centeredText}>{currentSatus}</ThemedText> >
</ThemedButton> {isOpen && (
{isOpen && <Pressable
<View style={styles.menu}> style={styles.overlay}
<View style={styles.list}> onPress={() => setIsOpen(false)}
/>
{choices.map((str, index) => ( )}
str!==currentSatus && choice(str, index) </Modal>
))} <Animated.View layout={LinearTransition.duration(200)} style={styles.windowBox}>
</View> <AnimatedThemedView layout={LinearTransition.duration(200)} lvl={2} shadow={true} style={styles.window}>
</View> <ThemedButton style={styles.button} lvl={isOpen ? 1 : 1} onPress={() => onPressOpen()}>
} <ThemedText style={styles.centeredText}>{currentSatus}</ThemedText>
</AnimatedThemedView> </ThemedButton>
</Animated.View> {isOpen &&
<View style={styles.menu}>
<View style={styles.list}>
{choices.map((str, index) => (
str!==currentSatus && choice(str, index)
))}
</View>
</View>
}
</AnimatedThemedView>
</Animated.View>
</>
) )
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
overlay: {
windowClose:{ ...StyleSheet.absoluteFillObject,
//backgroundColor: '#00FFFF', zIndex: 1,
//borderRadius:10,
padding: 10,
width:"50%",
//height:60,
overflow: 'hidden',
}, },
windowOpean:{ windowBox:{
width:"50%", //backgroundColor: '#00FFFF40',
width:"30%",
padding: 10, padding: 10,
paddingLeft: 0,
overflow: 'hidden',
}, },
window:{ window:{
borderRadius:15, borderRadius:15,
@@ -106,7 +116,7 @@ const styles = StyleSheet.create({
}, },
satus:{ satus:{
padding:10, padding:10,
flexDirection: 'row', margin:5,
}, },
button:{ button:{
width:'100%', width:'100%',
@@ -117,5 +127,6 @@ const styles = StyleSheet.create({
}, },
centeredText:{ centeredText:{
textAlign: 'center', textAlign: 'center',
fontSize: 13,
} }
}); });

View File

@@ -1,7 +1,6 @@
import { collection, getDocs, getDoc } from "firebase/firestore"; import { collection, getDoc, getDocs, Timestamp } from "firebase/firestore";
import { Chantier, Reservation, Ressources, User } from "../class/class";
import { db } from "../firebase_config"; import { db } from "../firebase_config";
import { Timestamp } from "firebase/firestore";
import { Chantier, User, Ressources, Reservation } from "../class/class";
export async function getUsers(): Promise<User[]> { export async function getUsers(): Promise<User[]> {
try { try {
@@ -38,7 +37,7 @@ export async function getRessources(): Promise<Ressources[]> {
} }
export async function getChantiers(): Promise<Chantier[]> { export async function getChantiers(): Promise<Chantier[]> {
const snap = await getDocs(collection(db, "chantiers")); const snap = await getDocs(collection(db, "chantier"));
const chantiers: Chantier[] = []; const chantiers: Chantier[] = [];
for (const docSnap of snap.docs) { for (const docSnap of snap.docs) {