From dae973b3fca4c143c99ae2643936f0ce8726b665 Mon Sep 17 00:00:00 2001 From: trochas Date: Thu, 11 Dec 2025 13:02:45 +0100 Subject: [PATCH] test --- components/selectChantier.tsx | 31 +++++++++++++++++++++++++++---- components/setStatus.tsx | 21 ++++++++++----------- components/themed-button.tsx | 4 +++- components/themed-view.tsx | 4 +++- 4 files changed, 43 insertions(+), 17 deletions(-) diff --git a/components/selectChantier.tsx b/components/selectChantier.tsx index b60385c..085f593 100644 --- a/components/selectChantier.tsx +++ b/components/selectChantier.tsx @@ -5,7 +5,6 @@ import { useEffect, useState } from "react"; import { Dimensions, Image, - LayoutAnimation, Pressable, ScrollView, StyleSheet, @@ -42,9 +41,16 @@ export default function SelectChantier() { const AnimatedThemedTextInput = Animated.createAnimatedComponent(ThemedTextInput); - function onPressOpen(): void { - LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); + async function onPressOpen(){ setIsOpen(!isOpen); + if(!isOpen){ + const updatedChantiers = await getChantiers(); + setChantiers(updatedChantiers) + } + } + + function onPressAddChantier(){ + } useEffect(() => { @@ -90,15 +96,28 @@ export default function SelectChantier() { {isOpen && ( + + + onPressAddChantier()}> + + + + + + {chantiers.map((chantier, index) => + <> renderChantier(chantier, index) + renderChantier(chantier, index) + renderChantier(chantier, index) + renderChantier(chantier, index) + )} - + )} @@ -197,4 +216,8 @@ const styles = StyleSheet.create({ buttonText: { textAlign: "center", }, + buttonAdd:{ + borderRadius: 10, + marginBottom: 10, + } }); diff --git a/components/setStatus.tsx b/components/setStatus.tsx index 0f5019c..c34a624 100644 --- a/components/setStatus.tsx +++ b/components/setStatus.tsx @@ -1,5 +1,5 @@ import { useChantier } from '@/app/ContextChantier'; -import { changeChantierStatus, getChantiers } from "@/services/ressourcesService"; +import { changeChantierStatus } from "@/services/ressourcesService"; import { useState } from 'react'; import { Dimensions, LayoutAnimation, Modal, Pressable, StyleSheet, View } from 'react-native'; import Animated, { LinearTransition } from 'react-native-reanimated'; @@ -31,17 +31,16 @@ export default function SetStatus() { async function onConfirm(): Promise { if(chantier == null) return; - setOpenConfirmation(false); + setCurrentStatus(tempStatus); setIsOpen(false); await changeChantierStatus(chantier.id,tempStatus) //Il faut changer le UX setChantier({...chantier,etat: tempStatus}) - //Il faut charger la bdd - //const updatedChantiers = await getChantiers(); - //const updatedChantier = updatedChantiers.find(c=> c.id=== chantier.id); - //if (updatedChantier) setChantier(updatedChantier); + setOpenConfirmation(false); + + } function onCancel(): void { @@ -70,14 +69,14 @@ export default function SetStatus() { return( - + Changer l'était du chantier en {tempStatus} ? - + onConfirm()}> Confirmer - + onCancel()}> Annuler @@ -177,7 +176,7 @@ const styles = StyleSheet.create({ width:"100%", height:"100%", }, - OverlayView:{ + overlayView:{ borderRadius: 20, padding: 20, alignItems: "center", @@ -185,7 +184,7 @@ const styles = StyleSheet.create({ //backgroundColor:'#ff0000', }, buttonValid:{ - borderWidth: 2, + //borderWidth: 2, width:'100%', margin: 0, borderRadius: 15, diff --git a/components/themed-button.tsx b/components/themed-button.tsx index f26eace..49f9e28 100644 --- a/components/themed-button.tsx +++ b/components/themed-button.tsx @@ -15,6 +15,7 @@ export type ThemedPressableProps = PressableProps & { export function ThemedButton({ style, lightColor, darkColor,lvl=1,border=-1,opacity="FF",shadow=false, ...otherProps }: ThemedPressableProps) { var lvlStr:string = "background"; var borderColor =""; + var borderWidth = 0; if(lvl>=0 && lvl<6){ lvlStr+=lvl; } @@ -28,6 +29,7 @@ export function ThemedButton({ style, lightColor, darkColor,lvl=1,border=-1,opac if(border>=0 && border<6){ borderStr="background"+border; borderColor = useThemeColor({ light: lightColor, dark: darkColor },borderStr as 'background0'|'background1'|'background2'|'background3'|'background4'|'background5'); + borderWidth = 2; } else{ borderColor = backgroundColor @@ -44,5 +46,5 @@ export function ThemedButton({ style, lightColor, darkColor,lvl=1,border=-1,opac shadowRadius: 6, } - return [{ backgroundColor, borderColor }, shadow && shadowStyle, typeof style === 'function' ? style(state) : style,]} {...otherProps}/>; + return [{ backgroundColor, borderColor, borderWidth }, shadow && shadowStyle, typeof style === 'function' ? style(state) : style,]} {...otherProps}/>; } diff --git a/components/themed-view.tsx b/components/themed-view.tsx index 8f3225f..77a0426 100644 --- a/components/themed-view.tsx +++ b/components/themed-view.tsx @@ -16,6 +16,7 @@ export type ThemedViewProps = ViewProps & { export function ThemedView({ style, lightColor, darkColor,lvl=1,border=-1,opacity="FF",shadow=false, ...otherProps }: ThemedViewProps) { var lvlStr:string = "background"; var borderColor =""; + var borderWidth =0; if(lvl>=0 && lvl<6){ lvlStr+=lvl; } @@ -29,6 +30,7 @@ export function ThemedView({ style, lightColor, darkColor,lvl=1,border=-1,opacit if(border>=0 && border<6){ borderStr="background"+border; borderColor = useThemeColor({ light: lightColor, dark: darkColor },borderStr as 'background0'|'background1'|'background2'|'background3'|'background4'|'background5'); + borderWidth = 2; } else{ borderColor = backgroundColor @@ -45,5 +47,5 @@ export function ThemedView({ style, lightColor, darkColor,lvl=1,border=-1,opacit shadowRadius: 6, } - return ; + return ; }