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(
<ThemedView lvl={3} style={styles.container}>
<View style={styles.header}>
<View style={{position: 'absolute'}}>
<SelectChantier></SelectChantier>
</View>
<View style={{position: 'absolute'}}>
<View style={{width:"100%", position: 'absolute',marginLeft:"50%"}}>
<SetStatus></SetStatus>
</View>
</View>
<View style={{width:"100%", position: 'absolute'}}>
<SelectChantier></SelectChantier>
</View>
</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} />
</View>
<View>
<ThemedText>{chantier.chef != null ? "true" : "false"}</ThemedText>
<ThemedText>Adresse: {chantier.adresse}</ThemedText>
<ThemedText>Chef de chantier: {chantier.chef.last_name}{" "}{chantier.chef.name}</ThemedText>
<ThemedText>État: {chantier.etat}</ThemedText>
@@ -104,7 +105,7 @@ export default function SelectChantier() {
const styles = StyleSheet.create({
windowClose: {
//backgroundColor: '#00FFFF',
//backgroundColor: '#00FF0040',
//borderRadius:10,
padding: 10,
width: "50%",
@@ -112,7 +113,7 @@ const styles = StyleSheet.create({
overflow: "hidden",
},
windowOpean: {
//backgroundColor: '#00FFFF',
//backgroundColor: '#00FF0040',
//borderRadius:10,
width: "100%",
height: screenHeight / 2,

View File

@@ -1,6 +1,6 @@
import { useChantier } from '@/app/ContextChantier';
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 { ThemedButton } from './themed-button';
import { ThemedText } from './themed-text';
@@ -50,43 +50,53 @@ export default function SetStatus() {
return(
<Animated.View
layout={LinearTransition.duration(200)}
style={isOpen ? styles.windowOpean : styles.windowClose}>
<AnimatedThemedView layout={LinearTransition.duration(200)} lvl={2} shadow={true} style={styles.window}>
<ThemedButton style={styles.button} lvl={isOpen ? 1 : 1} onPress={() => onPressOpen()}>
<ThemedText style={styles.centeredText}>{currentSatus}</ThemedText>
</ThemedButton>
{isOpen &&
<View style={styles.menu}>
<View style={styles.list}>
{choices.map((str, index) => (
str!==currentSatus && choice(str, index)
))}
</View>
</View>
}
</AnimatedThemedView>
</Animated.View>
<>
<Modal
visible={isOpen}
transparent
animationType="none"
onRequestClose={() => setIsOpen(false)}
>
{isOpen && (
<Pressable
style={styles.overlay}
onPress={() => setIsOpen(false)}
/>
)}
</Modal>
<Animated.View layout={LinearTransition.duration(200)} style={styles.windowBox}>
<AnimatedThemedView layout={LinearTransition.duration(200)} lvl={2} shadow={true} style={styles.window}>
<ThemedButton style={styles.button} lvl={isOpen ? 1 : 1} onPress={() => onPressOpen()}>
<ThemedText style={styles.centeredText}>{currentSatus}</ThemedText>
</ThemedButton>
{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({
windowClose:{
//backgroundColor: '#00FFFF',
//borderRadius:10,
padding: 10,
width:"50%",
//height:60,
overflow: 'hidden',
overlay: {
...StyleSheet.absoluteFillObject,
zIndex: 1,
},
windowOpean:{
width:"50%",
windowBox:{
//backgroundColor: '#00FFFF40',
width:"30%",
padding: 10,
paddingLeft: 0,
overflow: 'hidden',
},
window:{
borderRadius:15,
@@ -106,7 +116,7 @@ const styles = StyleSheet.create({
},
satus:{
padding:10,
flexDirection: 'row',
margin:5,
},
button:{
width:'100%',
@@ -117,5 +127,6 @@ const styles = StyleSheet.create({
},
centeredText:{
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 { Timestamp } from "firebase/firestore";
import { Chantier, User, Ressources, Reservation } from "../class/class";
export async function getUsers(): Promise<User[]> {
try {
@@ -38,7 +37,7 @@ export async function getRessources(): Promise<Ressources[]> {
}
export async function getChantiers(): Promise<Chantier[]> {
const snap = await getDocs(collection(db, "chantiers"));
const snap = await getDocs(collection(db, "chantier"));
const chantiers: Chantier[] = [];
for (const docSnap of snap.docs) {