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

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

@ -5,8 +5,6 @@ import axios from 'axios';
export default class IngredientService implements IIngredientService {
private readonly API_URL = "http://leftovers.alwaysdata.net/ingredients";
constructor() {}
async getAllIngredient(): Promise<Ingredient[]> {
try {
const response = await axios.get(this.API_URL);

@ -5,8 +5,6 @@ import Recipes from "../../Models/Recipes";
export default class RecipesService implements IRecipesService {
private readonly API_URL = "http://leftovers.alwaysdata.net/recipes";
constructor() {}
async getAllRecipes(): Promise<Recipes[]> {
try {
const response = await axios.get(this.API_URL);

@ -13,7 +13,7 @@ const componentWidth = 280;
export default function FoodElementText(props : any) {
const {colors, toggleColors } = useContext(ColorContext)
const {colors} = useContext(ColorContext)
const styles = StyleSheet.create({
button: {

@ -9,8 +9,8 @@ type ListProps = {
}
export default function ListSelect(props: ListProps) {
const [selected, setSelected] = React.useState([]);
const { colors, toggleColors } = useContext(ColorContext);
const [selected, setSelected] = React.useState(["None"]);
const {colors} = useContext(ColorContext);
const styles = StyleSheet.create({
titleBar: {

@ -9,8 +9,7 @@ type ListProps = {
}
export default function ListWithoutSelect(props: ListProps) {
const [selected, setSelected] = React.useState([]);
const { colors, toggleColors } = useContext(ColorContext);
const { colors } = useContext(ColorContext);
const styles = StyleSheet.create({
titleBar: {

@ -14,8 +14,8 @@ type ProfileProps = {
}
export default function ProfileDetails(props) {
const { colors, toggleColors } = useContext(ColorContext)
const navigation = useNavigation()
const { colors } = useContext(ColorContext)
//const navigation = useNavigation()
const [display, setDisplay] = useState("none")
const changeListVisibility = () => {
if (display == "none"){

@ -10,7 +10,7 @@ type Profile = {
}
export default function ProfileElement(props : Profile) {
const { colors, toggleColors } = useContext(ColorContext)
const { colors } = useContext(ColorContext)
const [waiting, setWaiting] = useState("none")
const [separator, setSeparator] = useState("none")

@ -15,7 +15,7 @@ type ProfileProps = {
export default function ProfileModification(props: ProfileProps) {
const [name, onChangeName] = useState(props.name);
const { colors, toggleColors } = useContext(ColorContext);
const { colors } = useContext(ColorContext);
let imageSource
if (props.avatar == "plus.png"){

@ -19,7 +19,7 @@ type Profile = {
}
export default function ProfileSelection(props: ProfileSelectionProps) {
const { colors, toggleColors } = useContext(ColorContext);
const { colors } = useContext(ColorContext);
const [cpt, setCpt] = useState(0);
const decreaseCounter = () => {

@ -3,7 +3,7 @@ import {StyleSheet, View} from 'react-native';
import ColorContext from '../theme/ColorContext';
export default function Separator (){
const {colors, toggleColors } = useContext(ColorContext)
const {colors } = useContext(ColorContext)
const styles = StyleSheet.create({
separator: {

@ -9,7 +9,7 @@ import ThemeContext from '../theme/ThemeContext';
const CookingStack = createNativeStackNavigator()
export default function CookingStackScreen() {
const {theme, toggleTheme} = useContext(ThemeContext);
const {theme} = useContext(ThemeContext);
return (
<CookingStack.Navigator>

@ -22,8 +22,7 @@ function AppIcon() {
}
export default function HomeStackScreen() {
const {theme, toggleTheme} = useContext(ThemeContext)
const {colors, toggleColors} = useContext(ColorContext)
const {colors} = useContext(ColorContext)
return (
<HomeStack.Navigator>

@ -15,7 +15,7 @@ import AddIcon from '../assets/images/plus.png'
const ProfilesStack = createNativeStackNavigator()
export default function ProfilesStackScreen({ navigation }) {
const {theme, toggleTheme} = useContext(ThemeContext);
const {theme} = useContext(ThemeContext);
const styles = StyleSheet.create({
headerBarContainer: {

@ -4,7 +4,7 @@ import { Text, StyleSheet } from 'react-native';
import ColorContext from '../theme/ColorContext';
export function HeaderTitle(props) {
const {colors, toggleColors} = useContext(ColorContext)
const {colors} = useContext(ColorContext)
const styles = StyleSheet.create({
headerTitle: {

@ -8,7 +8,7 @@ import ValidateButton from '../components/ValidateButton';
import ColorContext from '../theme/ColorContext';
export default function CreateProfile(props) {
const { colors, toggleColors } = useContext(ColorContext)
const { colors } = useContext(ColorContext)
const all = []
const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}]

@ -11,7 +11,7 @@ import ProfileSelection from '../components/ProfileSelection';
import ColorContext from '../theme/ColorContext';
export default function FiltersSelection(props) {
const {colors, toggleColors} = useContext(ColorContext);
const {colors} = useContext(ColorContext);
const profiles = [
{name: "Johnny Silverhand", avatar: "plus_small.png", isActive: "flex"},
{name: "Panam Palmer", avatar: "plus_small.png", isActive: "none"},

@ -13,7 +13,7 @@ import bracketRight from '../assets/images/angle_bracket_right.png';
export default function HomePage({ navigation, props }) {
const {colors, toggleColors} = useContext(ColorContext);
const {colors} = useContext(ColorContext);
const profiles = [
{name: "Johnny Silverhand", avatar: "plus_small.png", isActive: "flex"},

@ -15,11 +15,11 @@ import ColorContext from '../theme/ColorContext';
export default function IngredientSelection(props) {
const alphabetArray: Array<string> = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState();
const [error, setError] = useState("");
const [response, setResponse] = useState<Ingredient[] | undefined>(undefined);
const [selectedIngredients, setSelectedIngredients] = useState([]);
const ingredientService = new IngredientService();
const {colors, toggleColors} = useContext(ColorContext);
const {colors} = useContext(ColorContext);
const [searchQuery, setSearchQuery] = useState('');

@ -9,7 +9,7 @@ import ValidateButton from '../components/ValidateButton';
import ColorContext from '../theme/ColorContext'
export default function ModifyProfile(props) {
const {colors, toggleColors} = useContext(ColorContext);
const {colors} = useContext(ColorContext);
const all = [{value: "Mussels"}, {value: "Skimmed Milk"}, {value: "Nuts"}]
const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}]
return (

@ -9,7 +9,7 @@ import ProfileDelete from '../components/ProfileDelete';
import ColorContext from '../theme/ColorContext';
export default function Profiles({navigation, props}) {
const { colors, toggleColors } = useContext(ColorContext)
const { colors } = useContext(ColorContext)
const allJohnny = [{value: "Coconut"}, {value: "Skimmed Milk"}, {value: "Nuts"}]
const dieJohnny = [{value: "Gluten free"}, {value: "Porkless"}, {value: "Pescatarian"}]

@ -11,7 +11,7 @@ import ColorContext from '../theme/ColorContext';
export default function RecipeDetails(props) {
const {colors, toggleColors} = useContext(ColorContext);
const {colors} = useContext(ColorContext);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState();

@ -7,14 +7,9 @@ import TopBar from '../components/TopBar';
import RecipeElement from '../components/RecipeElement';
import SelectedIngredient from '../components/SelectedIngredient';
import FoodElementTextSimple from '../components/FoodElementTextSimple';
import FoodElementText from '../components/FoodElementText';
import CustomButton from '../components/CustomButton';
import DietsTab from '../components/ListSelect';
import ColorContext from '../theme/ColorContext';
import brochette from '../assets/images/brochette.png';
import ParameterTopBar from '../components/ParameterTopBar';
import ListSelect from '../components/ListSelect';
import ListWithoutSelect from '../components/ListWithoutSelect';
import ValidateButton from '../components/ValidateButton';
import bracketLeft from '../assets/images/angle_bracket_left.png';
@ -24,7 +19,7 @@ import minus from '../assets/images/minus.png';
export default function RecipeSuggestion(props) {
const {colors, toggleColors} = useContext(ColorContext)
const {colors} = useContext(ColorContext)
const [visible, setVisible] = React.useState(false);
const [visibleFilters, setVisibleFilters] = React.useState(false);
const [visibleIngredients, setVisibleIngredients] = React.useState(true);

Loading…
Cancel
Save