diff --git a/front/components/Hoverable.ts b/front/components/Hoverable.ts index 75ce45f..3353ce5 100644 --- a/front/components/Hoverable.ts +++ b/front/components/Hoverable.ts @@ -125,7 +125,7 @@ export default function Hoverable({ }; } - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any return React.cloneElement(React.Children.only(children) as any, { ...webProps, // if child is Touchable diff --git a/front/components/Metronome.tsx b/front/components/Metronome.tsx index 8135c3d..6d7ff33 100644 --- a/front/components/Metronome.tsx +++ b/front/components/Metronome.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from 'react'; -import { Slider, Text, View, IconButton, Icon } from 'native-base'; +import { Slider, View, IconButton, Icon } from 'native-base'; import { MaterialCommunityIcons } from '@expo/vector-icons'; import { Audio } from 'expo-av'; import { VolumeHigh, VolumeSlash } from 'iconsax-react-native'; diff --git a/front/components/ProgressBar.tsx b/front/components/ProgressBar.tsx index 7b52c73..325567c 100644 --- a/front/components/ProgressBar.tsx +++ b/front/components/ProgressBar.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { Translate, translate } from '../i18n/i18n'; -import { Box, Text, VStack, Progress, Stack } from 'native-base'; +import { Translate } from '../i18n/i18n'; +import { Box, VStack, Progress, Stack } from 'native-base'; import { useNavigation } from '../Navigation'; import Card from '../components/Card'; import UserAvatar from './UserAvatar'; diff --git a/front/components/V2/SongCardInfo.tsx b/front/components/V2/SongCardInfo.tsx index bcf7488..0d07d63 100644 --- a/front/components/V2/SongCardInfo.tsx +++ b/front/components/V2/SongCardInfo.tsx @@ -1,19 +1,11 @@ import Song from '../../models/Song'; import React from 'react'; import { Image, Platform, View } from 'react-native'; -import { - Pressable, - Text, - IconButton, - PresenceTransition, - Icon, - useBreakpointValue, -} from 'native-base'; +import { Pressable, Text, PresenceTransition, Icon, useBreakpointValue } from 'native-base'; import { LikeButton } from './SongCardInfoLikeBtn'; import { Ionicons } from '@expo/vector-icons'; import { useQuery } from '../../Queries'; import API from '../../API'; -import { MaterialIcons } from '@expo/vector-icons'; import { useLikeSongMutation } from '../../utils/likeSongMutation'; import Hoverable from '../Hoverable'; diff --git a/front/models/Song.ts b/front/models/Song.ts index bf39b97..c696686 100644 --- a/front/models/Song.ts +++ b/front/models/Song.ts @@ -30,7 +30,11 @@ export const SongValidator = yup artist: yup.lazy(() => ArtistValidator.default(undefined)).optional(), album: yup.lazy(() => AlbumValidator.default(undefined)).optional(), genre: yup.lazy(() => GenreValidator.default(undefined)).optional(), - likedByUsers: yup.lazy(() => yup.array(yup.object({ userId: yup.number().required() })).default(undefined)).optional(), + likedByUsers: yup + .lazy(() => + yup.array(yup.object({ userId: yup.number().required() })).default(undefined) + ) + .optional(), }) .concat(ModelValidator) .transform((song: Song) => ({ diff --git a/front/package.json b/front/package.json index c821fb2..ab42657 100644 --- a/front/package.json +++ b/front/package.json @@ -66,6 +66,7 @@ "devDependencies": { "@babel/core": "^7.20.0", "@babel/plugin-transform-export-namespace-from": "^7.22.11", + "@types/fbjs": "^3.0.10", "@types/lodash": "^4.14.199", "@types/react": "~18.2.14", "@typescript-eslint/eslint-plugin": "^6.7.3", diff --git a/front/utils/likeSongMutation.ts b/front/utils/likeSongMutation.ts index 0dae056..176a91f 100644 --- a/front/utils/likeSongMutation.ts +++ b/front/utils/likeSongMutation.ts @@ -1,5 +1,5 @@ -import { useMutation, useQueryClient } from "react-query" -import API from "../API"; +import { useMutation, useQueryClient } from 'react-query'; +import API from '../API'; /** * Mutation to like/unlike a song @@ -7,13 +7,13 @@ import API from "../API"; export const useLikeSongMutation = () => { const queryClient = useQueryClient(); - return useMutation(({ songId, like }: {songId: number, like: boolean}) => { - const apiCall = like ? API.addLikedSong : API.removeLikedSong - + return useMutation(({ songId, like }: { songId: number; like: boolean }) => { + const apiCall = like ? API.addLikedSong : API.removeLikedSong; + return apiCall(songId).then(() => { - queryClient.invalidateQueries({ queryKey: ['liked songs'] }) - queryClient.invalidateQueries({ queryKey: ['songs'] }) - queryClient.invalidateQueries({ queryKey: [songId] }) + queryClient.invalidateQueries({ queryKey: ['liked songs'] }); + queryClient.invalidateQueries({ queryKey: ['songs'] }); + queryClient.invalidateQueries({ queryKey: [songId] }); }); }); -} \ No newline at end of file +}; diff --git a/front/views/V2/DiscoveryView.tsx b/front/views/V2/DiscoveryView.tsx index 7408a1d..d8d07a9 100644 --- a/front/views/V2/DiscoveryView.tsx +++ b/front/views/V2/DiscoveryView.tsx @@ -10,7 +10,9 @@ import GoldenRatio from '../../components/V2/GoldenRatio'; // eslint-disable-next-line @typescript-eslint/ban-types const HomeView = (props: RouteProps<{}>) => { - const suggestionsQuery = useQuery(API.getSongSuggestions(['artist', 'SongHistory', 'likedByUsers'])); + const suggestionsQuery = useQuery( + API.getSongSuggestions(['artist', 'likedByUsers', 'SongHistory']) + ); const navigation = useNavigation(); const screenSize = useBreakpointValue({ base: 'small', md: 'big' }); const isPhone = screenSize === 'small'; diff --git a/front/views/settings/SettingsView.tsx b/front/views/settings/SettingsView.tsx index 17c3f78..b15c09d 100644 --- a/front/views/settings/SettingsView.tsx +++ b/front/views/settings/SettingsView.tsx @@ -12,7 +12,7 @@ import { Route, SceneRendererProps, } from 'react-native-tab-view'; -import { HeartEdit, UserEdit, Notification, SecurityUser, FolderCross } from 'iconsax-react-native'; +import { HeartEdit, UserEdit, SecurityUser, FolderCross } from 'iconsax-react-native'; import { Scene } from 'react-native-tab-view/lib/typescript/src/types'; import { RouteProps } from '../../Navigation'; import ScaffoldCC from '../../components/UI/ScaffoldCC'; diff --git a/front/yarn.lock b/front/yarn.lock index 6ce02fc..3b90603 100644 --- a/front/yarn.lock +++ b/front/yarn.lock @@ -3169,6 +3169,13 @@ "@types/qs" "*" "@types/serve-static" "*" +"@types/fbjs@^3.0.10": + version "3.0.10" + resolved "https://registry.yarnpkg.com/@types/fbjs/-/fbjs-3.0.10.tgz#e837db996533e28e862d8fd09b3e1c44d7f0e252" + integrity sha512-becmqsrRvB0qwgEYy96i9cN48w8YwOeaMhpyT/sbkSuWX27LDXPESBrgSFKkgcIdk39jqcPlLdLljT2y2OcyTg== + dependencies: + "@types/jsdom" "*" + "@types/glob@^7.1.1": version "7.2.0" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" @@ -3228,6 +3235,15 @@ dependencies: "@types/istanbul-lib-report" "*" +"@types/jsdom@*": + version "21.1.6" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-21.1.6.tgz#bcbc7b245787ea863f3da1ef19aa1dcfb9271a1b" + integrity sha512-/7kkMsC+/kMs7gAYmmBR9P0vGTnOoLhQhyhQJSlXGI5bzTHp6xdo0TtKWQAsz6pmSAeVqKSbqeyP6hytqr9FDw== + dependencies: + "@types/node" "*" + "@types/tough-cookie" "*" + parse5 "^7.0.0" + "@types/json-schema@*", "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" @@ -3342,6 +3358,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== +"@types/tough-cookie@*": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" + integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== + "@types/use-sync-external-store@^0.0.3": version "0.0.3" resolved "https://registry.yarnpkg.com/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz#b6725d5f4af24ace33b36fafd295136e75509f43" @@ -5365,7 +5386,7 @@ entities@^2.0.0: resolved "https://registry.yarnpkg.com/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55" integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A== -entities@^4.2.0: +entities@^4.2.0, entities@^4.4.0: version "4.5.0" resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== @@ -9198,6 +9219,13 @@ parse-png@^2.1.0: dependencies: pngjs "^3.3.0" +parse5@^7.0.0: + version "7.1.2" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.1.2.tgz#0736bebbfd77793823240a23b7fc5e010b7f8e32" + integrity sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw== + dependencies: + entities "^4.4.0" + parseurl@~1.3.2, parseurl@~1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"