clean code smells 👮
continuous-integration/drone/push Build is passing Details

Tests
Lucas Delanier 2 years ago
parent 9a577959af
commit eef6737ac9

@ -5,7 +5,6 @@ import useColorScheme from './hooks/useColorScheme'
import Navigation from './navigation'
import store from "./redux/store"
import {Provider} from "react-redux"
import {useState} from "react"
export default function App() {
const isLoadingComplete = useCachedResources()

@ -3,6 +3,7 @@ import {Image, StyleSheet, Text, View} from "react-native";
import {LinearGradient} from "expo-linear-gradient";
import Stars from "./StarsComponent";
import * as React from "react";
import {formatTime} from "../model/formatTime";
type MovieListProps = {
movie: Movie
@ -10,12 +11,6 @@ type MovieListProps = {
}
export function MovieListComponent(props: MovieListProps) {
function formatTime(time: number) {
const hours = Math.floor(time / 60);
const minutes = time % 60;
return `${hours}h ${minutes < 10 ? `0${minutes}` : minutes}m`;
}
const styles = StyleSheet.create({
filmCard: {
width: 70,

@ -1,5 +1,6 @@
export function formatTime(time: number) {
const hours = Math.floor(time / 60);
const minutes = time % 60;
return `${hours}h ${minutes < 10 ? `0${minutes}` : minutes}m`;
const minutesToDisplay = minutes < 10 ? `0${minutes}` : minutes
return `${hours}h ${minutesToDisplay}m`;
}

@ -63,7 +63,7 @@ export const getTrendingID = () => {
const IDPromise = await fetch(config.base_url + "trending/movie/day?api_key=" + config.api_key);
const IDListJson = await IDPromise.json();
// @ts-ignore
const idList: String[] = IDListJson.results.map(elt => elt["id"]);
const idList: string[] = IDListJson.results.map(elt => elt["id"]);
const MovieList: Movie[] = [];
Promise.all(idList.map(async elt => {
try {
@ -75,9 +75,9 @@ export const getTrendingID = () => {
// @ts-ignore
Promise.all(responses.map(result => result.json()))
.then(function (elements) {
elements.map(elt => {
elements.forEach(elt => {
const infoJson = elt;
const genreRow: String[] = [];
const genreRow: string[] = [];
// @ts-ignore
elt["genres"].map(genre => {
genreRow.push(genre.name);

@ -1,6 +1,5 @@
import { configureStore } from '@reduxjs/toolkit'
import appReducer from "./reducers/appReducer";
import { getDefaultMiddleware } from '@reduxjs/toolkit';
const reducer = {
appReducer: appReducer,
}

@ -15,7 +15,7 @@ import {NewCard, SuggestedCard} from "../components/cards";
import {setFavouriteList,setWatchLaterList} from "../storage/storage"
export default function HomeScreen({}: RootStackScreenProps<'Home'>) {
export default function HomeScreen() {
// @ts-ignore
const trendingMovies = useSelector(state => state.appReducer.trendingMovies)
// @ts-ignore

Loading…
Cancel
Save