turkmen-tv-front/components/InfoBlock.tsx

122 lines
4.8 KiB
TypeScript
Raw Normal View History

2024-08-19 12:44:56 +00:00
// NextJs components
import Image from "next/image";
import Link from "next/link";
2024-08-19 12:44:56 +00:00
// React query
import { Queries } from "@/api/queries";
2024-08-19 12:44:56 +00:00
// Components
import VideoPlayer from "./VideoPlayer";
import SectionTitle from "./SectionTitle";
2024-08-19 12:44:56 +00:00
// Images and cions
import aydym from "@/public/aydym-com.webp";
import horjun from "@/public/horjun.png";
import belet from "@/public/belet.jpg";
2024-09-12 10:50:33 +00:00
import ReactionsBlock from "./treasury/ReactionsBlock";
2025-06-23 09:15:10 +00:00
import ViewCount from "./view-count";
2024-08-19 12:44:56 +00:00
interface IProps {
video_id: number;
}
2025-06-23 09:15:10 +00:00
const InfoBlock = async ({ video_id }: IProps) => {
const {data} = await Queries.getVideo(video_id);
2024-08-19 12:44:56 +00:00
return (
<div className="flex gap-6 max-w-[1220px] w-full justify-between h-full">
<div className="flex flex-col gap-6 w-full h-full">
<div className="flex justify-between gap-[32px] w-full h-full">
<div className="w-full flex flex-col gap-6 h-full">
<div className=" flex flex-col gap-2">
2025-06-23 09:15:10 +00:00
<SectionTitle title={data.title} />
<ViewCount video_id={video_id} viewCount={data.view} />
2024-08-19 12:44:56 +00:00
</div>
<div className="flex flex-col gap-[40px] h-full w-full">
<div className="flex gap-[40px] md:flex-row flex-col h-full w-full">
<div>
<VideoPlayer
video_id={video_id}
maxHeight="700px"
maxWidth="100%"
/>
2024-08-19 12:44:56 +00:00
</div>
<div className="flex flex-col gap-6">
2025-06-23 09:15:10 +00:00
{data.desc ? (
<p className="font-roboto text-lg w-full text-black">
2025-06-23 09:15:10 +00:00
{data.desc}
</p>
2024-08-19 12:44:56 +00:00
) : null}
2024-09-12 10:50:33 +00:00
<ReactionsBlock video_id={video_id} />
2025-06-23 09:15:10 +00:00
{data.aydym_com_url ||
data.horjun_content_url ||
data.belet_url ? (
2024-08-19 12:44:56 +00:00
<div className="flex flex-col gap-6">
<h2 className="text-2xl font-semibold">
Beýleki platformalarda seret:
</h2>
2024-08-19 12:44:56 +00:00
<div className="flex gap-11 items-center">
2025-06-23 09:15:10 +00:00
{data.aydym_com_url ? (
2024-08-19 12:44:56 +00:00
<Link
2025-06-23 09:15:10 +00:00
href={data.aydym_com_url}
2024-08-19 12:44:56 +00:00
target="_blank"
className="flex flex-col items-center justify-center gap-2"
>
2024-08-19 12:44:56 +00:00
<div className="relative h-16 w-16 flex items-center justify-center overflow-hidden border-[#00AEFF] border-[1.5px] p-2 rounded-full">
<Image
src={aydym}
alt="Aydym.com"
className="rounded-full"
/>
2024-08-19 12:44:56 +00:00
</div>
<h3>Aydym.com</h3>
</Link>
) : null}
2025-06-23 09:15:10 +00:00
{data.horjun_content_url ? (
2024-08-19 12:44:56 +00:00
<Link
2025-06-23 09:15:10 +00:00
href={data.horjun_content_url}
2024-08-19 12:44:56 +00:00
target="_blank"
className="flex flex-col items-center justify-center gap-2"
>
2024-08-19 12:44:56 +00:00
<div className="relative h-16 w-16 flex items-center justify-center overflow-hidden border-[#00AEFF] border-[1.5px] p-2 rounded-full">
<Image
src={horjun}
alt="HorjunTv"
className="rounded-full"
/>
2024-08-19 12:44:56 +00:00
</div>
<h3>HorjunTv</h3>
</Link>
) : null}
2025-06-23 09:15:10 +00:00
{data.belet_url ? (
2024-08-19 12:44:56 +00:00
<Link
2025-06-23 09:15:10 +00:00
href={data.belet_url}
2024-08-19 12:44:56 +00:00
target="_blank"
className="flex flex-col items-center justify-center gap-2"
>
2024-08-19 12:44:56 +00:00
<div className="relative h-16 w-16 flex items-center justify-center overflow-hidden border-[#00AEFF] border-[1.5px] p-2 rounded-full">
<Image
src={belet}
alt="BeletTv"
className="rounded-full"
/>
2024-08-19 12:44:56 +00:00
</div>
<h3>BeletFilm</h3>
</Link>
) : null}
</div>
</div>
) : null}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
};
export default InfoBlock;