Skip to content

Commit

Permalink
fix: temporarly add any type
Browse files Browse the repository at this point in the history
  • Loading branch information
AlkenD committed Jul 7, 2024
1 parent 7833cca commit fc7f599
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
30 changes: 15 additions & 15 deletions src/lib/components/MainSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import IconButton from "./IconButton";
const MainSlider = ({ data = [] }: any) => {
const [images, setImages] = useState<any>({});

Check failure on line 11 in src/lib/components/MainSlider.tsx

View workflow job for this annotation

GitHub Actions / publish-tauri (macos-latest, --target aarch64-apple-darwin)

'setImages' is declared but its value is never read.

Check failure on line 11 in src/lib/components/MainSlider.tsx

View workflow job for this annotation

GitHub Actions / publish-tauri (macos-latest, --target x86_64-apple-darwin)

'setImages' is declared but its value is never read.

Check failure on line 11 in src/lib/components/MainSlider.tsx

View workflow job for this annotation

GitHub Actions / publish-tauri (ubuntu-22.04)

'setImages' is declared but its value is never read.

Check failure on line 11 in src/lib/components/MainSlider.tsx

View workflow job for this annotation

GitHub Actions / publish-tauri (windows-latest)

'setImages' is declared but its value is never read.
useEffect(() => {
const fetchImages = async () => {
const imagePromises = data.map(async (item: any) => {
const response = await fetch(
`https://api.themoviedb.org/3/movie/${item.id}/images?api_key=${process.env.NEXT_PUBLIC_TMDB_API_KEY}`
);
const json = await response.json();
return { id: item.id, filePath: json.logos[0]?.file_path || "" };
});
const imageResults = await Promise.all(imagePromises);
const imagesMap = imageResults.reduce((acc, img) => {
acc[img.id] = img.filePath;
return acc;
}, {});
setImages(imagesMap);
};
// const fetchImages = async () => {
// const imagePromises = data.map(async (item: any) => {
// const response = await fetch(
// `https://api.themoviedb.org/3/movie/${item.id}/images?api_key=${process.env.NEXT_PUBLIC_TMDB_API_KEY}`
// );
// const json = await response.json();
// return { id: item.id, filePath: json.logos[0]?.file_path || "" };
// });
// const imageResults = await Promise.all(imagePromises);
// const imagesMap = imageResults.reduce((acc, img) => {
// acc[img.id] = img.filePath;
// return acc;
// }, {});
// setImages(imagesMap);
// };
}, []);
return (
<div className="w-full aspect-video lg:aspect-[21/9] max-w-full">
Expand Down
16 changes: 8 additions & 8 deletions src/lib/pages/TvInfoPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import { AnimatePresence, motion } from "framer-motion";
import generateRandomString from "../utils/uidGenerator";

const TvInfoPage = () => {
const tv = useLoaderData();
const tv: any = useLoaderData();
const [selectedSeason, setSelectedSeason] = useState(0);
const [seasonDetails, setSeasonDetails] = useState({});
const [seasonDetails, setSeasonDetails] = useState<any>({});
const [loadingSeasons, setLoadingSeasons] = useState(false);
const lastCalledSeason = useRef(null);

const getSeason = (seasons, seasonNumber) => {
return seasons.find((season) => season.season_number === seasonNumber);
const getSeason = (seasons: any, seasonNumber: any) => {
return seasons.find((season: any) => season.season_number === seasonNumber);
};

const getSeasonDetails = async (season) => {
const getSeasonDetails = async (season: any) => {
if (lastCalledSeason.current === season) return;
lastCalledSeason.current = season;
setLoadingSeasons(true);
Expand All @@ -45,7 +45,7 @@ const TvInfoPage = () => {
}
};

const handleSelectSeason = (seasonNumber) => {
const handleSelectSeason = (seasonNumber: any) => {
if (selectedSeason !== seasonNumber) {
setSelectedSeason(seasonNumber);
}
Expand Down Expand Up @@ -118,7 +118,7 @@ const TvInfoPage = () => {
</tr>
</thead>
<tbody className="max-h-[400px] h-fit overflow-scroll divide-y divide-zinc-700/20">
{tv.seasons.map((season) => (
{tv.seasons.map((season: any) => (
<tr
className="hover:bg-zinc-300/20 cursor-pointer transition-colors"
key={season.season_number}
Expand Down Expand Up @@ -185,7 +185,7 @@ const TvInfoPage = () => {
className="grid grid-cols-3 xl:grid-cols-4 gap-5"
>
{seasonDetails.episodes &&
seasonDetails.episodes.map((episode, index) => (
seasonDetails.episodes.map((episode: any, index: number) => (
<motion.div
key={generateRandomString()}
className="space-y-2 hover:scale-105 transition-transform"
Expand Down

0 comments on commit fc7f599

Please sign in to comment.