Bug Fix (Separator ProfileElement)

pull/16/head^2
Louison PARANT 1 year ago
parent 11b08ff43a
commit 1e71f981f6

@ -9,11 +9,11 @@ import FiltersSelection from './screens/FiltersSelection';
export default function App(props) { export default function App(props) {
return( return(
<HomePage/> //<HomePage/>
//<ModifyProfile/> //<ModifyProfile/>
//<Profiles/> //<Profiles/>
//<RecipeSuggestion/> //<RecipeSuggestion/>
//<CreateProfile/> //<CreateProfile/>
//<FiltersSelection/> <FiltersSelection/>
); );
} }

@ -10,6 +10,7 @@ type Profile = {
export default function ProfileElement(props : Profile) { export default function ProfileElement(props : Profile) {
const [waiting, setWaiting] = useState("none") const [waiting, setWaiting] = useState("none")
const [separator, setSeparator] = useState("none")
const changeStatus = () => { const changeStatus = () => {
if (props.disableSelection){ if (props.disableSelection){
setWaiting("none") setWaiting("none")
@ -20,7 +21,13 @@ export default function ProfileElement(props : Profile) {
else{ else{
setWaiting("flex") setWaiting("flex")
} }
console.log(waiting, props.name) if (props.isActive == "flex" && waiting == "none"){
setSeparator("flex")
}
else{
setSeparator("none")
}
console.log(waiting, separator, props.name)
}; };
return ( return (
<Pressable onPress={changeStatus} style={styles.button}> <Pressable onPress={changeStatus} style={styles.button}>
@ -33,7 +40,7 @@ export default function ProfileElement(props : Profile) {
<View style={[styles.active, {display: props.isActive}]}> <View style={[styles.active, {display: props.isActive}]}>
<Text style={styles.textActive}>Activated</Text> <Text style={styles.textActive}>Activated</Text>
</View> </View>
<View style={{flex: 0.3, display: waiting}}/> <View style={{flex: 0.3, display: separator}}/>
<View style={[styles.waiting, {display: waiting}]}> <View style={[styles.waiting, {display: waiting}]}>
<Text style={styles.textWaiting}>Waiting...</Text> <Text style={styles.textWaiting}>Waiting...</Text>
</View> </View>

@ -21,6 +21,7 @@ export default function ValidateButton(props: ValidateButtonProps) {
borderColor: props.colour, borderColor: props.colour,
backgroundColor: props.backColour, backgroundColor: props.backColour,
alignItems: 'center', alignItems: 'center',
justifyContent: "center",
flexDirection: "row", flexDirection: "row",
padding: 5, padding: 5,
paddingRight: 10,}}> paddingRight: 10,}}>

@ -87,7 +87,7 @@ export default function HomePage(props) {
<View style={{marginTop: 10}}/> <View style={{marginTop: 10}}/>
<View style={styles.ingredientSelection}> <View style={styles.ingredientSelection}>
<Text style={{fontSize: 15, color: "#3F3C42"}}>Selected Ingredient</Text> <Text style={{fontSize: 15, color: "#3F3C42"}}>Selected Ingredient</Text>
<View style={{flexDirection: "row", padding: 10}}> <View style={{flexDirection: "row", padding: 10, justifyContent: "center", alignItems: "center"}}>
<Pressable onPress={decreaseCounter}> <Pressable onPress={decreaseCounter}>
<Image source={bracketLeft} style={{ width: 40, height: 40 }} /> <Image source={bracketLeft} style={{ width: 40, height: 40 }} />
</Pressable> </Pressable>
@ -97,9 +97,9 @@ export default function HomePage(props) {
</Pressable> </Pressable>
</View> </View>
</View> </View>
<View style={{marginTop: 20}}/> <View style={{marginTop: 15}}/>
<ValidateButton title="Change Selected Ingredients" image="cook.png" colour="#59BDCD" backColour="#E3DEC9"/> <ValidateButton title="Change Selected Ingredients" image="cook.png" colour="#59BDCD" backColour="#E3DEC9"/>
<View style={{marginTop: 5}}/> <View style={{marginTop: 10}}/>
<ValidateButton title="Search Recipes" image="search.png" colour="#59BDCD" backColour="#E3DEC9"/> <ValidateButton title="Search Recipes" image="search.png" colour="#59BDCD" backColour="#E3DEC9"/>
</View> </View>
</LinearGradient> </LinearGradient>
@ -145,18 +145,17 @@ const styles = StyleSheet.create({
}, },
nbSelected: { nbSelected: {
fontSize: 11, fontSize: 11,
//flex: 0.2,
color: "#3F3C42", color: "#3F3C42",
textAlign: "right", textAlign: "right",
}, },
profilesSelection: { profilesSelection: {
//maxWidth: 370,
flexDirection: 'column', flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: 20, borderRadius: 20,
backgroundColor: '#F2F0E4', backgroundColor: '#F2F0E4',
paddingTop: 5,
marginHorizontal: 10, marginHorizontal: 10,
}, },
welcome: { welcome: {

@ -14,7 +14,7 @@ export default function ModifyProfile(props) {
<TopBar title="Modify Profile" isVisible="true"/> <TopBar title="Modify Profile" isVisible="true"/>
<View style={styles.container}> <View style={styles.container}>
<LinearGradient colors={['#2680AA', '#59BDCD']} style={styles.linearGradient}> <LinearGradient colors={['#2680AA', '#59BDCD']} style={styles.linearGradient}>
<View style={{marginTop: 10}}/> <View style={{marginTop: 20}}/>
<ProfileModification name="Johnny Silverhand" avatar="plus_small.png" diets={die} allergies={all}></ProfileModification> <ProfileModification name="Johnny Silverhand" avatar="plus_small.png" diets={die} allergies={all}></ProfileModification>
<View style={{marginTop: 10}}/> <View style={{marginTop: 10}}/>
<ValidateButton title="Update Profile" image="update.png" colour="#ACA279" backColour="#F2F0E4"></ValidateButton> <ValidateButton title="Update Profile" image="update.png" colour="#ACA279" backColour="#F2F0E4"></ValidateButton>

Loading…
Cancel
Save