redo series page

This commit is contained in:
Rohithk 2023-09-26 23:38:47 +05:30
commit fa62636370
6 changed files with 232 additions and 31 deletions

View file

@ -7,7 +7,7 @@ export default function Layout({ children }) {
<div className='e bg-light-white text-app-dark-blue dark:bg-app-dark-blue dark:text-app-pure-white lg:flex lg:items-center'>
<Navigation />
<ThemeToggler parentComponent={"main"}/>
<main className='mx-0 flex flex-col overflow-visible bg-light-white p-4 py-6 dark:bg-app-dark-blue md:m-6 md:px-0 md:pt-12 lg:ml-[10rem] lg:min-w-[1200px] lg:grow'>
<main className='mx-0 flex flex-col overflow-visible bg-light-white p-4 py-6 dark:bg-app-dark-blue md:m-6 md:px-0 md:pt-12 lg:ml-[10rem] lg:min-w-[800px] lg:grow'>
{children}
<Footer />
</main>

View file

@ -1,7 +1,6 @@
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import AppIcon from './icons/AppIcon'
import AppLogo from './icons/AppIcon'
import IconNavHome from './icons/IconNavHome'
import IconNavMovie from './icons/IconNavMovie'
@ -27,7 +26,7 @@ export default function Navigation() {
}
return (
<nav className=' bg-app-shady-white sticky top-0 z-50 flex items-center justify-between p-5 shadow-md shadow-black dark:bg-app-semi-dark-blue md:mx-6 md:mb-[33px] md:mt-6 md:rounded-[10px] lg:fixed lg:left-0 lg:my-12 lg:mr-0 lg:h-5/6 lg:flex-col lg:py-9'>
<nav className='bg-app-shady-white sticky top-0 z-50 flex items-center justify-between p-5 shadow-md shadow-black dark:bg-app-semi-dark-blue md:mx-6 md:mb-[33px] md:mt-6 md:rounded-[10px] lg:fixed lg:left-0 lg:my-12 lg:mr-0 lg:h-5/6 lg:flex-col lg:py-9'>
<div
onClick={() => setIsOpen(false)}
className={` overlay backdrop ${isOpen ? 'active' : ''}`}></div>
@ -60,7 +59,7 @@ export default function Navigation() {
height='24'
fill='currentColor'
className={
router.pathname == '/latest-top-10'
router.pathname === '/latest-top-10'
? 'active-link'
: 'icon-nav'
}
@ -85,7 +84,7 @@ export default function Navigation() {
height='24'
fill='currentColor'
className={
router.pathname == '/get-posts/[category]'
router.pathname === '/get-posts/[category]'
? 'active-link'
: 'icon-nav'
}
@ -106,7 +105,7 @@ export default function Navigation() {
height='24'
fill='currentColor'
className={
router.pathname == '/search'
router.pathname === '/search'
? 'active-link !text-gray-600'
: 'icon-nav'
}
@ -146,7 +145,7 @@ export default function Navigation() {
height='24'
fill='currentColor'
className={
router.pathname == '/upload' ? 'active-link' : 'icon-nav'
router.pathname === '/upload' ? 'active-link' : 'icon-nav'
}
viewBox='0 0 16 16'>
<path d='M8 2a5.53 5.53 0 0 0-3.594 1.342c-.766.66-1.321 1.52-1.464 2.383C1.266 6.095 0 7.555 0 9.318 0 11.366 1.708 13 3.781 13h8.906C14.502 13 16 11.57 16 9.773c0-1.636-1.242-2.969-2.834-3.194C12.923 3.999 10.69 2 8 2zm2.354 5.146a.5.5 0 0 1-.708.708L8.5 6.707V10.5a.5.5 0 0 1-1 0V6.707L6.354 7.854a.5.5 0 1 1-.708-.708l2-2a.5.5 0 0 1 .708 0l2 2z' />
@ -166,7 +165,7 @@ export default function Navigation() {
height='24'
fill='currentColor'
className={
router.pathname == '/faq' ? 'active-link' : 'icon-nav'
router.pathname === '/faq' ? 'active-link' : 'icon-nav'
}
viewBox='0 0 16 16'>
<path d='M2 5C.892 5 0 5.892 0 7v7c0 1.108.892 2 2 2h9c1.108 0 2-.892 2-2v-3.8L16 7h-3c0-1.108-.892-2-2-2zm4.438 2C7.75 6.926 8.926 7.936 9 9.25c0 1.121-.308 1.544-1.281 2.281a1.68 1.68 0 00-.281.25c-.04.05-.032.033-.032.031.006.423-.39.782-.812.782a.79.79 0 01-.781-.782c0-.401.179-.754.375-1a3.14 3.14 0 01.562-.562 3.85 3.85 0 00.563-.531c.074-.09.097-.24.093-.344v-.031a.785.785 0 00-.843-.75c-.451.025-.813.362-.851.758a.697.697 0 01-.718.648.816.816 0 01-.781-.594 1.725 1.725 0 01.01-.533c.005-.014.006-.03.012-.043.202-1.024 1.09-1.768 2.203-1.83zm.156 6.406a.82.82 0 01.812.813c0 .442-.37.781-.812.781a.768.768 0 01-.781-.781c0-.442.339-.813.78-.813zM2 1C.892 1 0 1.892 0 3v.568A3.918 3.918 0 012 3h9c1.376 0 2.55.763 3.268 1.848L16 3h-3c0-1.108-.892-2-2-2z' />
@ -190,7 +189,7 @@ export default function Navigation() {
height='24'
fill='hsl(223, 23%, 46%)'
className={
router.pathname == '/latest-top-10' ? 'active-link' : 'icon-nav'
router.pathname === '/latest-top-10' ? 'active-link' : 'icon-nav'
}
viewBox='0 0 50 50'>
<path d='M 0 7.5 L 0 12.5 L 50 12.5 L 50 7.5 Z M 0 22.5 L 0 27.5 L 50 27.5 L 50 22.5 Z M 0 37.5 L 0 42.5 L 50 42.5 L 50 37.5 Z'></path>
@ -225,7 +224,7 @@ export default function Navigation() {
height='24'
fill='currentColor'
className={
router.pathname == '/latest-top-10' ? 'active-link' : 'icon-nav'
router.pathname === '/latest-top-10' ? 'active-link' : 'icon-nav'
}
viewBox='0 0 16 16'>
<path d='M8 16c3.314 0 6-2 6-5.5 0-1.5-.5-4-2.5-6 .25 1.5-1.25 2-1.25 2C11 4 9 .5 6 0c.357 2 .5 4-2 6-1.25 1-2 2.729-2 4.5C2 14 4.686 16 8 16Zm0-1c-1.657 0-3-1-3-2.75 0-.75.25-2 1.25-3C6.125 10 7 10.5 7 10.5c-.375-1.25.5-3.25 2-3.5-.179 1-.25 2 1 3 .625.5 1 1.364 1 2.25C11 14 9.657 15 8 15Z' />
@ -243,7 +242,7 @@ export default function Navigation() {
height='24'
fill='currentColor'
className={
router.pathname == '/get-posts/[category]'
router.pathname === '/get-posts/[category]'
? 'active-link'
: 'icon-nav'
}
@ -260,7 +259,7 @@ export default function Navigation() {
height='24'
fill='currentColor'
className={
router.pathname == '/search' ? 'active-link' : 'icon-nav'
router.pathname === '/search' ? 'active-link' : 'icon-nav'
}
viewBox='0 0 16 16'>
<path d='M6.5 13a6.474 6.474 0 0 0 3.845-1.258h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.008 1.008 0 0 0-.115-.1A6.471 6.471 0 0 0 13 6.5 6.502 6.502 0 0 0 6.5 0a6.5 6.5 0 1 0 0 13Zm0-8.518c1.664-1.673 5.825 1.254 0 5.018-5.825-3.764-1.664-6.69 0-5.018Z' />
@ -284,7 +283,7 @@ export default function Navigation() {
height='24'
fill='currentColor'
className={
router.pathname == '/upload' ? 'active-link' : 'icon-nav'
router.pathname === '/upload' ? 'active-link' : 'icon-nav'
}
viewBox='0 0 16 16'>
<path d='M8 2a5.53 5.53 0 0 0-3.594 1.342c-.766.66-1.321 1.52-1.464 2.383C1.266 6.095 0 7.555 0 9.318 0 11.366 1.708 13 3.781 13h8.906C14.502 13 16 11.57 16 9.773c0-1.636-1.242-2.969-2.834-3.194C12.923 3.999 10.69 2 8 2zm2.354 5.146a.5.5 0 0 1-.708.708L8.5 6.707V10.5a.5.5 0 0 1-1 0V6.707L6.354 7.854a.5.5 0 1 1-.708-.708l2-2a.5.5 0 0 1 .708 0l2 2z' />
@ -298,7 +297,7 @@ export default function Navigation() {
width='24'
height='24'
fill='currentColor'
className={router.pathname == '/faq' ? 'active-link' : 'icon-nav'}
className={router.pathname === '/faq' ? 'active-link' : 'icon-nav'}
viewBox='0 0 16 16'>
<path d='M2 5C.892 5 0 5.892 0 7v7c0 1.108.892 2 2 2h9c1.108 0 2-.892 2-2v-3.8L16 7h-3c0-1.108-.892-2-2-2zm4.438 2C7.75 6.926 8.926 7.936 9 9.25c0 1.121-.308 1.544-1.281 2.281a1.68 1.68 0 00-.281.25c-.04.05-.032.033-.032.031.006.423-.39.782-.812.782a.79.79 0 01-.781-.782c0-.401.179-.754.375-1a3.14 3.14 0 01.562-.562 3.85 3.85 0 00.563-.531c.074-.09.097-.24.093-.344v-.031a.785.785 0 00-.843-.75c-.451.025-.813.362-.851.758a.697.697 0 01-.718.648.816.816 0 01-.781-.594 1.725 1.725 0 01.01-.533c.005-.014.006-.03.012-.043.202-1.024 1.09-1.768 2.203-1.83zm.156 6.406a.82.82 0 01.812.813c0 .442-.37.781-.812.781a.768.768 0 01-.781-.781c0-.442.339-.813.78-.813zM2 1C.892 1 0 1.892 0 3v.568A3.918 3.918 0 012 3h9c1.376 0 2.55.763 3.268 1.848L16 3h-3c0-1.108-.892-2-2-2z' />
</svg>
@ -344,7 +343,7 @@ export default function Navigation() {
width='24'
height='24'
fill='currentColor'
className={router.pathname == '/login' ? 'active-link' : 'icon-nav'}
className={router.pathname === '/login' ? 'active-link' : 'icon-nav'}
viewBox='0 0 16 16'>
<path
fillRule='evenodd'

View file

@ -23,8 +23,6 @@ const servers_ = [
},
{
servername: "Blackvid", link: "https://blackvid.space/embed?tmdb="
}, {
servername: "Superembed", link: "https://multiembed.mov/directstream.php?video_id="
}
]
const fetcher = (...args) => fetch(...args).then((res) => res.json())
@ -73,7 +71,7 @@ const Movies = () => {
onClick={() => {
if (server.servername === "Vidsrc.me")
setVideoServer(server.link + me)
else if (server.servername === "Vidsrc.to" || server.servername === "Superembed")
else if (server.servername === "Vidsrc.to" )
setVideoServer(server.link + to)
else
setVideoServer(server.link + data?.imdb.imdb.tmdb_id);

View file

@ -1,18 +1,223 @@
import React from 'react'
import { useRouter } from 'next/router';
import React, {useEffect, useState} from 'react'
import {useRouter} from 'next/router';
import Head from 'next/head'
import {AiOutlineDown, AiOutlineExpand} from "react-icons/ai";
import useSWR from "swr";
const servers_ = [
{
servername: "Vidsrc.me", link: "https://vidsrc.me/embed/tv?",
},
{
servername: "Vidsrc.to", link: "https://vidsrc.to/embed/tv/"
},
{
servername: "Moviesapi.club", link: "https://moviesapi.club/tv/"
},
{
servername: "Blackvid", link: "https://blackvid.space/embed?tmdb="
}
]
const fetcher = (...args) => fetch(...args).then((res) => res.json())
const Tv = () => {
const router = useRouter()
const { id,tmdb} = router.query;
return (
<>
<Head>
<title>Play Tv | Yaps</title>
</Head>
<iframe src={`https://vidsrc.me/embed/tv?${tmdb?(`tmdb=${tmdb}`):(`imdb=${id}`)}&color=5a6990`} frameBorder="0" style={{width: '100%' ,height: '92vh'}} allowfullscreen="allowfullscreen"></iframe>
</>
)
const {id, tmdb} = router.query;
const {data, error} = useSWR(`/api/tv/${id ? id : tmdb}`, fetcher)
const [MovieDetailsHidden, setMovieDetailsHidden] = useState(false)
const [tvDetails, setTvDetails] = useState({
episode: 1, season: 1
})
const [season, SetSeason] = useState([]);
const [episodes, setEpisodes] = useState({})
const [seasonDropDown, setSeasonDropDown] = useState(false)
const [episodeDropDown, setEpisodeDropDown] = useState(false)
const [videoServer, setVideoServer] = useState('')
useEffect(() => {
let temp = []
if (data)
for (let i = 1; i < data.detail.seasons.length; i++) {
temp.push(i);
}
SetSeason(temp)
let episode = [];
let c = 1;
if (data) {
if (data.detail.seasons[0].name.includes("Specials")) {
for (let k = 0; k < temp.length; k++) {
for (let i = 1; i < data.detail.seasons[c].episode_count + 1; i++)
episode.push(i);
episodes[c] = episode
c++;
episode = []
}
} else {
c = 0;
for (let k = 0; k < temp.length; k++) {
for (let i = 1; i < data.detail.seasons[c].episode_count + 1; i++)
episode.push(i);
episodes[c + 1] = episode
c++;
episode = []
}
}
}
}, [seasonDropDown, episodeDropDown]);
useEffect(() => {
if (data !== undefined) {
let inputstrings = `${data?.detail.name}season`
let inputStringe = `${data?.detail.name}episode`
if (localStorage.getItem(inputstrings.replace(/\s+/g, "").toLowerCase())) {
setTvDetails(prev => {
return {
...prev, season: parseInt(localStorage.getItem(inputstrings.replace(/\s+/g, "").toLowerCase())
)
}
})
} else {
localStorage.setItem(inputstrings.replace(/\s+/g, "").toLowerCase(), tvDetails.season)
}
if (localStorage.getItem(inputStringe.replace(/\s+/g, "").toLowerCase())) {
setTvDetails(prev => {
return {
...prev, episode: parseInt(localStorage.getItem(inputStringe.replace(/\s+/g, "").toLowerCase())
)
}
})
} else {
localStorage.setItem(inputStringe.replace(/\s+/g, "").toLowerCase(), tvDetails.episode)
}
}
}, [data]);
useEffect(() => {
if (data !== undefined) {
let inputstrings = `${data?.detail.name}season`
let inputStringe = `${data?.detail.name}episode`
if (localStorage.getItem(inputstrings.replace(/\s+/g, "").toLowerCase())) {
localStorage.setItem(inputstrings.replace(/\s+/g, "").toLowerCase(), tvDetails.season)
}
if (localStorage.getItem(inputStringe.replace(/\s+/g, "").toLowerCase())) {
localStorage.setItem(inputStringe.replace(/\s+/g, "").toLowerCase(), tvDetails.episode)
}
if (videoServer.includes("vidsrc.me")) setVideoServer(`https://vidsrc.me/embed/tv?${tmdb ? `tmdb=${tmdb}` : `imdb=${id}`}&season=${tvDetails.season}&episode=${tvDetails.episode}`)
if (videoServer.includes("vidsrc.to")) setVideoServer(`https://vidsrc.to/embed/tv/${tmdb ? `${tmdb}` : `${id}`}/${tvDetails.season}/${tvDetails.episode}`)
else if (videoServer.includes("moviesapi.club")) setVideoServer(`https://moviesapi.club/tv/${tmdb}-${tvDetails.season}-${tvDetails.episode}`)
else if (videoServer.includes("blackvid.space")) setVideoServer(`https://blackvid.space/embed?tmdb=${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}`);
}
}, [tvDetails]);
return (
<>
<Head>
<title>Play Tv | Yaps</title>
</Head>
<div className={` ${MovieDetailsHidden ? 'w-full' : 'min-w-2/3 '} flex flex-col h-full`}>
<div
className={"w-full h-16 pb-2 text-3xl"}>{data?.detail.name} S{tvDetails.season} E{tvDetails.episode}</div>
<iframe
src={videoServer ? videoServer : `https://vidsrc.me/embed/tv?tmdb=${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}`}
className={"z-50"}
style={{width: '100%', height: '92vh'}}
allowFullScreen="allowfullscreen"></iframe>
<div className={"w-full p-4 pl-0 bg-transparent flex gap-10 flex-row justify-start items-center"}>
<div onClick={() => setMovieDetailsHidden(!MovieDetailsHidden)}
className={"flex flex-row gap-1 items-center hover:text-orange-500 transition duration-300 ease-in-out hover:cursor-pointer"}>
<AiOutlineExpand/>
<span>Expand</span>
</div>
<div className={"relative w-32 "}>
<div className={"flex z-50 justify-center items-center flex-row gap-2"} onClick={() => {
setSeasonDropDown(!seasonDropDown)
setEpisodeDropDown(false)
}}>
Select Season<span className={"pt-1"}><AiOutlineDown/></span>
</div>
<div
className={` flex-col z-40 overflow-y-scroll p-2 h-32 bg-black text-white w-32 absolute justify-center transition duration-300 ease-in-out items-center ${seasonDropDown ? 'translate-y-0 opacity-1' : 'translate-y-[-150%] opacity-0'} `}>
<ul className={""}>
{season.map((season, index) => {
return (
<li key={index} onClick={() => {
setTvDetails({season: season, episode: 1})
setSeasonDropDown(false)
}}
className={`relative hover:bg-amber-700 hover:cursor-pointer pl-2 flex items-center justify-evenly w-full h-5 ${tvDetails.season === season ? 'bg-amber-700' : ''}`}>
Season <span>{season}</span>
</li>
)
})
}
</ul>
</div>
</div>
<div className={"relative w-32 "}>
<div className={"flex z-50 justify-center items-center flex-row gap-2"} onClick={() => {
setEpisodeDropDown(!episodeDropDown)
setSeasonDropDown(false)
}}>
Select Episode<span className={"pt-1"}><AiOutlineDown/></span>
</div>
<div
className={` flex-col z-40 overflow-y-scroll p-2 h-32 bg-black text-white w-32 absolute justify-center transition duration-300 ease-in-out items-center ${episodeDropDown ? 'translate-y-0 opacity-1' : 'translate-y-[-150%] opacity-0'} `}>
<ul className={""}>
{episodes[tvDetails.season] && episodes[tvDetails.season].map((episode, index) => {
return (
<li key={index} onClick={() => {
setTvDetails(prev => {
return {...prev, episode: episode}
})
setEpisodeDropDown(false)
}}
className={`relative hover:bg-amber-700 hover:cursor-pointer pl-2 flex items-center justify-evenly w-full h-5 ${tvDetails.episode === episode ? 'bg-amber-700' : ''}`}>
Episode <span>{episode}</span>
</li>
)
})
}
</ul>
</div>
</div>
</div>
<div className={" w-full flex justify-start items-center h-36"}>
<div className={"rounded w-full h-full flex flex-row "}>
<div
className={"p-2 h-full bg-app-shady-white dark:bg-app-grey dark:text-black text-center w-1/3"}>
{`You are watching `}
<div className={" font-bold"}>{data ? data.detail.name : ""}</div>
<div> If current server doesn't work please try other servers beside.</div>
</div>
<div className={" bg-app-pure-white text-black w-2/3 h-full"}>
<div
className={"w-full flex flex-wrap flex-row gap-7 p-5 justify-start items-center h-10"}>
{servers_.map((server, index) => {
return (
<div
onClick={() => {
if (server.servername === "Vidsrc.me")
setVideoServer(`${server.link}${tmdb ? `tmdb=${tmdb}` : `imdb=${id}`}&season=${tvDetails.season}&episode=${tvDetails.episode}`)
else if (server.servername === "Vidsrc.to")
setVideoServer(`${server.link}${tmdb ? `${tmdb}` : `${id}`}/${tvDetails.season}/${tvDetails.episode}`)
else if (server.servername === "Moviesapi.club")
setVideoServer(`${server.link}${tmdb}-${tvDetails.season}-${tvDetails.episode}`)
else
setVideoServer(`${server.link}${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}`);
}
}
className={"dark:bg-app-semi-dark-blue dark:text-white hover:scale-110 hover:cursor-pointer transition duration-300 ease-in-out bg-app-shady-white rounded p-3 w-max text-center h-8"}
key={index}>
{server.servername}
</div>
)
})}
</div>
</div>
</div>
</div>
</div>
</>
)
}
export default Tv

View file

@ -214,7 +214,7 @@ const Details = () => {
<button
className='my-3 w-full rounded border-primary bg-primary/10 bg-gradient-to-r from-[#420075] via-purple-500 to-[#FF0054] px-[2rem] py-2 text-[15px] text-gray-100 hover:text-app-dark-blue xl:w-[70%]'
onClick={() => {
router.push(`/streaming?id=${data?.imdb}`)
router.push(`/play/${data?.category_str.toLowerCase()}?id=${data?.imdb}`)
}}>
Play Now
</button>

View file

@ -749,7 +749,6 @@ td {
border-right: #5a6a90 solid 1px;
z-index: 89;
}
*/
/* Transparent Backdrop */
.backdrop {