Skip to content

Commit

Permalink
fix: fixed url in watch page
Browse files Browse the repository at this point in the history
  • Loading branch information
SujanButang committed Nov 19, 2024
1 parent be31ece commit 036ae42
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/app/anime/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import Container from "@/components/container";
import AnimeCard from "@/components/anime-card";
import { IAnimeDetails } from "@/types/anime-details";

import Button from "@/components/common/custom-button";
import { CirclePlay } from "lucide-react";

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { api } from "@/lib/api";

Expand Down Expand Up @@ -53,7 +50,7 @@ const Page = async ({ params }: { params: { slug: string } }) => {
className="shrink-0"
/>
<div className="flex flex-col md:gap-5 gap-2 pb-16">
<h1 className="md:text-5xl text-2xl md:font-black font-extrabold z-[100]">
<h1 className="md:text-5xl text-2xl md:font-black font-extrabold z-[9]">
{anime.anime.info.name}
</h1>

Expand Down
2 changes: 2 additions & 0 deletions src/app/anime/watch/video-player-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { useGetEpisodeServers } from "@/query/get-episode-servers";
const VideoPlayerSection = () => {
const { selectedEpisode, anime } = useAnimeStore();

console.log("selected", selectedEpisode);

const { data: serversData } = useGetEpisodeServers(selectedEpisode);

const { data: episodeData, isLoading } = useGetEpisodeData(
Expand Down
9 changes: 7 additions & 2 deletions src/components/episode-playlist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ type Props = {
const EpisodePlaylist = ({ animeId, title }: Props) => {
const searchParams = useSearchParams();

const episodeId = searchParams.get("epi");
const episodeId = searchParams.get("episode");

const isLatestEpisode = searchParams.get("type");

const { setSelectedEpisode } = useAnimeStore();
Expand All @@ -26,7 +27,11 @@ const EpisodePlaylist = ({ animeId, title }: Props) => {
const episodeRefs = useRef<(HTMLDivElement | null)[]>([]);

useEffect(() => {
if (!episodeId && !!episodes && !!episodes.episodes.length) {
if (
(!episodeId || !episodeId.includes("ep")) &&
!!episodes &&
!!episodes.episodes.length
) {
if (!!isLatestEpisode) {
setSelectedEpisode(
episodes.episodes[episodes.episodes.length - 1].episodeId as string,
Expand Down

0 comments on commit 036ae42

Please sign in to comment.