diff --git a/expo-boomboomapp/src/components/RegisterStepper/RegisterStepper.tsx b/expo-boomboomapp/src/components/RegisterStepper/RegisterStepper.tsx index de74046..85dbdcf 100644 --- a/expo-boomboomapp/src/components/RegisterStepper/RegisterStepper.tsx +++ b/expo-boomboomapp/src/components/RegisterStepper/RegisterStepper.tsx @@ -48,7 +48,7 @@ export function RegisterStepper({ const I18n = languageService.useTranslation(); const nestedNavigationRef = createNavigationContainerRef(); - const [step, setStep] = useState(1); + const [step, setStep] = useState(0); const [disableSubmit, setDisableSubmit] = useState(true); const stepperLayoutCallback = useRef({ @@ -73,8 +73,8 @@ export function RegisterStepper({ await stepperLayoutCallback.current.value({ navigateOnNextStep }); }; - const isLastStep = step === numberOfStep; - const progress = step / numberOfStep; + const isLastStep = step === numberOfStep - 1; + const progress = step / (numberOfStep - 1); const coreStyles = useCoreStyles(); const styles = useEStyles({ @@ -117,9 +117,11 @@ export function RegisterStepper({ - {I18n.t("common.stepperHeader", { step, numberOfStep })} + {I18n.t("common.stepperHeader", { step: step + 1, numberOfStep })} + + + {I18n.t(`component.RegisterStepper.step.${step}.title`)} - Upload profile picture ); diff --git a/expo-boomboomapp/src/components/RegisterStepper/steps/FavoriteSongs.tsx b/expo-boomboomapp/src/components/RegisterStepper/steps/FavoriteSongs.tsx index b33232c..6f8cc2f 100644 --- a/expo-boomboomapp/src/components/RegisterStepper/steps/FavoriteSongs.tsx +++ b/expo-boomboomapp/src/components/RegisterStepper/steps/FavoriteSongs.tsx @@ -1,8 +1,12 @@ +import { useQuery } from "@tanstack/react-query"; import { useEffect, useState } from "react"; import { Modal, ScrollView, Text, TouchableOpacity, View } from "react-native"; import { ProfileApiServiceI } from "../../../api/ProfileApiService/ProfileApiServiceI"; -import { Track } from "../../../api/SpotifyApiService/SpotifyApiServiceI"; +import { + SpotifyApiServiceI, + Track, +} from "../../../api/SpotifyApiService/SpotifyApiServiceI"; import useEStyles from "../../../hooks/useEStyles"; import { RegisterStackParamsList, @@ -18,9 +22,6 @@ import { SongCard } from "../../SongCard"; import { SongPicker } from "../../SongPicker"; import { StepProps } from "../RegisterStepper"; -// TODO use styles -const CONTENT_PADDING = 20; - export default function FavoriteSongs({ setStepperLayoutCallback, setDisableSubmit, @@ -32,7 +33,20 @@ export default function FavoriteSongs({ const profileApiService = getGlobalInstance( ServiceInterface.ProfileApiServiceI, ); + const spotifyApiService = getGlobalInstance( + ServiceInterface.SpotifyApiServiceI, + ); const [mySongs, setMySongs] = useState([]); + const { data: top5Tracks } = useQuery({ + queryKey: [spotifyApiService.fetchTop5Tracks.name], + queryFn: () => spotifyApiService.fetchTop5Tracks(), + }); + + useEffect(() => { + if (top5Tracks) { + setMySongs(top5Tracks); + } + }, [top5Tracks]); const [pickSongModalVisible, setPickSongModalVisible] = useState(false); @@ -83,7 +97,7 @@ export default function FavoriteSongs({ }, []); useEffect(() => { - if (mySongs.length === 4) { + if (mySongs.length === 5) { setDisableSubmit(false); } }, [mySongs]); @@ -105,8 +119,6 @@ export default function FavoriteSongs({ - + @@ -134,7 +146,7 @@ export default function FavoriteSongs({ icon={() => ( removeSong(song.name)} /> )} diff --git a/expo-boomboomapp/src/components/SongCard.tsx b/expo-boomboomapp/src/components/SongCard.tsx index 3a3e69e..3513a56 100644 --- a/expo-boomboomapp/src/components/SongCard.tsx +++ b/expo-boomboomapp/src/components/SongCard.tsx @@ -31,7 +31,7 @@ export function SongCard({ song, icon }: SongCardProps) { }); return ( - + {song.image && (