Code Smells Fix (Majors and Minors)
continuous-integration/drone/push Build is passing Details

pull/20/head
Louison PARANT 1 year ago
parent 3e0e3f6e6a
commit 12e8660fc1

@ -2,7 +2,7 @@ import Ingredient from "../../Models/Ingredient";
export default interface IIngredientService {
getAllIngredient(): Promise<Ingredient[]>;
getIngredientById(id: Number): Promise<Ingredient | null>;
getIngredientByLetter(id: String): Promise<Ingredient[]>;
getfilteredIngredient(prompt: String): Promise<Ingredient[]>;
getIngredientById(id: number): Promise<Ingredient | null>;
getIngredientByLetter(id: string): Promise<Ingredient[]>;
getfilteredIngredient(prompt: string): Promise<Ingredient[]>;
}

@ -17,7 +17,7 @@ export default class IngredientService implements IIngredientService {
}
async getIngredientById(id: Number): Promise<Ingredient | null>{
async getIngredientById(id: number): Promise<Ingredient | null>{
try {
const response = await axios.get(`${this.API_URL}/${id}`);
return response.data as Ingredient;
@ -26,7 +26,7 @@ export default class IngredientService implements IIngredientService {
}
}
async getIngredientByLetter(letter: String): Promise<any>{
async getIngredientByLetter(letter: string): Promise<any>{
try {
const response = await axios.get(`${this.API_URL}/letter/${letter}`);
return response.data as Ingredient[];
@ -35,7 +35,7 @@ export default class IngredientService implements IIngredientService {
}
}
async getfilteredIngredient(prompt: String): Promise<Ingredient[]> {
async getfilteredIngredient(prompt: string): Promise<Ingredient[]> {
try {
const response = await axios.get(`${this.API_URL}/filter/${prompt}`);
return response.data as Ingredient[];

@ -2,5 +2,5 @@ import Recipes from "../../Models/Recipes";
export default interface IRecipesService {
getAllRecipes(): Promise<Recipes[]>;
getRecipeById(id: Number): Promise<Recipes | null>;
getRecipeById(id: number): Promise<Recipes | null>;
}

@ -17,7 +17,7 @@ export default class RecipesService implements IRecipesService {
}
async getRecipeById(id: Number): Promise<Recipes | null>{
async getRecipeById(id: number): Promise<Recipes | null>{
try {
const response = await axios.get(`${this.API_URL}/${id}`);
console.log(response);

@ -1,10 +1,10 @@
import React, { useContext } from 'react';
import {StyleSheet,Pressable, Text, View, Image} from 'react-native';
import {StyleSheet,Pressable, Text, View} from 'react-native';
import Separator from '../components/Separator';
import ColorContext from '../theme/ColorContext';
interface foodElementImageProps {
interface FoodElementTextProps {
title : string
}

@ -1,15 +1,12 @@
import React from 'react';
import {StyleSheet,Pressable, Text, View, Image} from 'react-native';
import Separator from '../components/Separator';
import {StyleSheet,Pressable, Text, View} from 'react-native';
interface foodElementTextProps {
interface FoodElementTextSimpleProps {
title: string
}
export default function FoodElementTextSimple(props: foodElementTextProps) {
export default function FoodElementTextSimple(props: FoodElementTextSimpleProps) {
return (
<Pressable style={styles.button}>
<View style={styles.container}>

@ -1,5 +1,5 @@
import React from 'react';
import {StyleSheet, Text, TextInput, View, Image, FlatList} from 'react-native';
import {StyleSheet, Text, View, Image} from 'react-native';
type TitleProps = {
title: string

@ -1,8 +1,6 @@
import React, { useContext } from 'react';
import {StyleSheet, Text, TextInput, View, Image, FlatList} from 'react-native';
import ValidateButton from './ValidateButton';
import HeaderFlatList from './HeaderFlatList';
import { MultipleSelectList, SelectList } from 'react-native-dropdown-select-list'
import {StyleSheet, Image} from 'react-native';
import {MultipleSelectList} from 'react-native-dropdown-select-list'
import ColorContext from '../theme/ColorContext';
type ListProps = {

@ -1,8 +1,6 @@
import React, { useContext } from 'react';
import {StyleSheet, Text, TextInput, View, Image, FlatList, Pressable} from 'react-native';
import ValidateButton from './ValidateButton';
import HeaderFlatList from './HeaderFlatList';
import { MultipleSelectList, SelectList } from 'react-native-dropdown-select-list'
import {StyleSheet, Image} from 'react-native';
import {MultipleSelectList} from 'react-native-dropdown-select-list'
import ColorContext from '../theme/ColorContext';
type ListProps = {

@ -1,6 +1,5 @@
import {React, useState} from 'react';
import {StyleSheet, Text, TextInput, View, Image, Pressable} from 'react-native';
import ValidateButton from './ValidateButton';
import {StyleSheet, Text, View, Image, Pressable} from 'react-native';
import ListWithoutSelect from './ListWithoutSelect';
type ProfileProps = {

@ -1,18 +1,18 @@
import React from 'react';
import {StyleSheet,Pressable, Text, View, Image, SafeAreaView, ScrollView} from 'react-native';
import {StyleSheet, Pressable, Text, View, Image, ScrollView} from 'react-native';
import brochette from '../assets/images/brochette.png';
import Union_left from '../assets/images/Union_left.png';
import Union_right from '../assets/images/Union_right.png';
import background from '../assets/images/Background.png';
interface recipeElementProps {
interface RecipeElementProps {
number: string
title: string
textList: string[]
description: string
}
export default function RecipeElement(props: recipeElementProps) {
export default function RecipeElement(props: RecipeElementProps) {
return (
<Pressable style={styles.button}>
<View style={styles.view}>

@ -1,17 +1,17 @@
import React from 'react';
import {StyleSheet,Pressable, Text, View, Image} from 'react-native';
import {StyleSheet, Text, View, Image} from 'react-native';
import brochette from '../assets/images/brochette.png';
import background from '../assets/images/Background.png';
interface recipeElementReduceProps {
interface RecipeElementReduceProps {
number : number
title : string
image : string | null
duration : string
}
export default function RecipeElementReduce(props: recipeElementReduceProps) {
export default function RecipeElementReduce(props: RecipeElementReduceProps) {
return (
<View style={styles.button}>
<View style={styles.view}>

@ -1,6 +1,5 @@
import React, { useContext, useState } from 'react';
import { View, Text, TouchableOpacity, Image, Pressable } from 'react-native';
import { GestureResponderEvent, StyleSheet } from 'react-native';
import { View, Text, TouchableOpacity, Image, Pressable, GestureResponderEvent, StyleSheet } from 'react-native';
import { BlurView } from 'expo-blur';
import ThemeContext from '../theme/ThemeContext';
import ColorContext from '../theme/ColorContext';

@ -1,10 +1,9 @@
import React, { useContext } from 'react';
import { Image, Text, StyleSheet } from 'react-native';
import { Image, StyleSheet } from 'react-native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HomePage from '../screens/HomePage';
import Profiles from '../screens/Profiles';
import CreateProfile from '../screens/CreateProfile';
import ModifyProfile from '../screens/ModifyProfile';
import ThemeContext from '../theme/ThemeContext';
import ColorContext from '../theme/ColorContext';

@ -32,7 +32,7 @@ export default function FiltersSelection(props) {
const dieProfiles = [{value: "Porkless"}, {value: "Pescatarian"}]
function isInProfileDiets(element, index, array) {
var retType = true
let retType = true
dieProfiles.forEach(function (diets) {
if(diets.value==element.value){
retType = false

@ -1,7 +1,6 @@
import React, { useEffect, useState, useContext } from 'react';
import { View, StyleSheet, Text, Image, Pressable, ActivityIndicator, FlatList, ScrollView, useWindowDimensions } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import TopBar from '../components/TopBar';
import { Searchbar } from 'react-native-paper';
import FoodElementText from '../components/FoodElementText';
import CustomButton from '../components/CustomButton';

@ -17,12 +17,6 @@ export default function Profiles({navigation, props}) {
const allJackie = [{value: "Tomato"}, {value: "Relic"}]
const dieJackie = [{value: "Porkless"}, {value: "Vegetarian"}]
const allGoro = []
const dieGoro = [{value: "Pescatarian"}]
const allViktor = [{value: "Pasta"}, {value: "Fish"}]
const dieViktor = [{value: "Dairy free"}, {value: "Vegan"}]
const [visible, setVisible] = useState(false);
const [opacity, setOpacity] = useState(1);
const raisePopUp = () => {

@ -3,7 +3,6 @@ import { View, StyleSheet, Text, ScrollView, useWindowDimensions} from 'react-na
import { SafeAreaProvider } from 'react-native-safe-area-context';
import RecipeElementReduce from '../components/RecipeElementReduce';
import AllergiesTab from '../components/ListWithoutSelect';
import RecipesService from '../Services/Recipes/RecipesServices';
import Recipes from '../Models/Recipes';
import { LinearGradient } from 'expo-linear-gradient';

@ -71,7 +71,7 @@ export default function RecipeSuggestion(props) {
}
else{
setMaxCpt(ingredientList.length+ingredientList.length%4)
var cpt=ingredientList.length-(ingredientList.length%4)
let cpt=ingredientList.length-(ingredientList.length%4)
setMinCpt(cpt)
}
}

Loading…
Cancel
Save