Compare commits
7 Commits
effee2c557
...
a06e3fbf11
| Author | SHA1 | Date |
|---|---|---|
|
|
a06e3fbf11 | |
|
|
492631ab7e | |
|
|
0cae14971f | |
|
|
cb7cbb7ac9 | |
|
|
a8c5dc79f0 | |
|
|
a02b738012 | |
|
|
80d73faad4 |
|
|
@ -22,8 +22,6 @@ import { VideoModel } from "@/models/video.model";
|
|||
import { VideosModel } from "@/models/videos.model";
|
||||
import { IVote } from "@/models/vote.model";
|
||||
import routes from "@/routes";
|
||||
import { revalidateTag } from "next/cache";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export class Queries {
|
||||
public static async getNews(
|
||||
|
|
@ -90,7 +88,9 @@ export class Queries {
|
|||
}
|
||||
|
||||
public static async getVideo(id: number): Promise<VideoModel> {
|
||||
return await fetch(`${baseUrl.MATERIALS_SRC}${routes.video(id)}`).then(
|
||||
return await fetch(`${baseUrl.MATERIALS_SRC}${routes.video(id)}`, {
|
||||
cache: "no-store",
|
||||
}).then(
|
||||
(res) => res.json().then((res) => res as VideoModel)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import Hydrate from '@/utils/HydrateClient';
|
|||
import getQueryClient from '@/utils/getQueryClient';
|
||||
import { dehydrate, useQuery } from '@tanstack/react-query';
|
||||
import { data } from 'autoprefixer';
|
||||
import { NextSeo } from 'next-seo';
|
||||
import Head from 'next/head';
|
||||
import Image from 'next/image';
|
||||
import { useContext } from 'react';
|
||||
import { useMediaQuery } from 'usehooks-ts';
|
||||
|
|
@ -36,7 +36,12 @@ const PageItem = ({ params }: IParams) => {
|
|||
return (
|
||||
<div className="container">
|
||||
<div className="flex flex-col gap-8 py-6">
|
||||
{data && <NextSeo title={data.data.title} description={data.data.content} />}
|
||||
{data && (
|
||||
<Head>
|
||||
<title>{data.data.title}</title>
|
||||
<meta name="description" content={data.data.content} />
|
||||
</Head>
|
||||
)}
|
||||
<div className="flex flex-col gap-2">
|
||||
{data?.data.title ? <PageTitle title={data?.data.title} /> : <Loader />}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import { Queries } from '@/api/queries';
|
|||
import Hydrate from '@/utils/HydrateClient';
|
||||
import { dehydrate, useMutation } from '@tanstack/react-query';
|
||||
import SectionTitle from '@/components/SectionTitle';
|
||||
import { Suspense } from 'react';
|
||||
import Loader from '@/components/Loader';
|
||||
|
||||
interface IParams {
|
||||
params: {
|
||||
|
|
@ -18,15 +20,7 @@ interface IParams {
|
|||
|
||||
const VideoItem = async ({ params }: IParams) => {
|
||||
const queryClient = getQueryClient();
|
||||
// queryClient.prefetchQuery({
|
||||
// queryKey: ['video', `video:${params.video_id}`],
|
||||
// queryFn: () => Queries.getVideo(params.video_id),
|
||||
// });
|
||||
|
||||
// queryClient.prefetchQuery({
|
||||
// queryKey: ['video', 'all'],
|
||||
// queryFn: () => Queries.getVideos(''),
|
||||
// });
|
||||
await queryClient.prefetchQuery({
|
||||
queryKey: ['video', `video:${params.video_id}`],
|
||||
queryFn: () => Queries.getVideo(params.video_id),
|
||||
|
|
@ -40,12 +34,12 @@ const VideoItem = async ({ params }: IParams) => {
|
|||
queryFn: ({ pageParam = 1 }) =>
|
||||
Queries.getVideos(
|
||||
'?' +
|
||||
String(
|
||||
new URLSearchParams({
|
||||
page: pageParam,
|
||||
per_page: '8',
|
||||
}),
|
||||
),
|
||||
String(
|
||||
new URLSearchParams({
|
||||
page: pageParam,
|
||||
per_page: '8',
|
||||
}),
|
||||
),
|
||||
),
|
||||
});
|
||||
const dehydratedState = dehydrate(queryClient);
|
||||
|
|
@ -56,7 +50,13 @@ const VideoItem = async ({ params }: IParams) => {
|
|||
<Hydrate state={dehydratedState}>
|
||||
<div className="video-item-inner">
|
||||
<div className="video-item-wrapper flex flex-col gap-10 relative pb-14">
|
||||
<InfoBlock video_id={params.video_id} />
|
||||
<Suspense fallback={
|
||||
<div className="w-full h-[500px] sm:h-[667px] md:h-[600px] lg:h-[700px] flex items-center justify-center">
|
||||
<Loader height={700} />
|
||||
</div>
|
||||
}>
|
||||
<InfoBlock video_id={params.video_id} />
|
||||
</Suspense>
|
||||
|
||||
<div className="video-item-inner w-full flex flex-col gap-4">
|
||||
<SectionTitle title={'Beylekiler'} />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@import "tailwindcss";
|
||||
@config "../tailwind.config.js";
|
||||
|
||||
@layer base {
|
||||
:root {
|
||||
|
|
@ -129,12 +128,16 @@ video {
|
|||
}
|
||||
|
||||
main,
|
||||
nav,
|
||||
footer {
|
||||
z-index: 10;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
nav {
|
||||
z-index: 50;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
transition: all 0.3s ease;
|
||||
opacity: 0.7;
|
||||
|
|
|
|||
|
|
@ -1,39 +1,25 @@
|
|||
"use client";
|
||||
// NextJs components
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
// React query
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { Queries } from "@/api/queries";
|
||||
// Components
|
||||
import Loader from "./Loader";
|
||||
import VideoPlayer from "./VideoPlayer";
|
||||
import SectionTitle from "./SectionTitle";
|
||||
// Images and cions
|
||||
import { SlEye } from "react-icons/sl";
|
||||
import aydym from "@/public/aydym-com.webp";
|
||||
import horjun from "@/public/horjun.png";
|
||||
import belet from "@/public/belet.jpg";
|
||||
|
||||
import ReactionsBlock from "./treasury/ReactionsBlock";
|
||||
import ViewCount from "./view-count";
|
||||
|
||||
interface IProps {
|
||||
video_id: number;
|
||||
}
|
||||
|
||||
const InfoBlock = ({ video_id }: IProps) => {
|
||||
const { data, isFetching, error } = useQuery({
|
||||
queryKey: ["video", video_id],
|
||||
queryFn: () => Queries.getVideo(video_id),
|
||||
});
|
||||
|
||||
if (isFetching)
|
||||
return (
|
||||
<div className="w-full h-[500px] sm:h-[667px] md:h-[600px] l flex items-center justify-center">
|
||||
<Loader height={700} />
|
||||
</div>
|
||||
);
|
||||
if (error) return <h1>{JSON.stringify(error)}</h1>;
|
||||
const InfoBlock = async ({ video_id }: IProps) => {
|
||||
const {data} = await Queries.getVideo(video_id);
|
||||
|
||||
return (
|
||||
<div className="flex gap-6 max-w-[1220px] w-full justify-between h-full">
|
||||
|
|
@ -41,20 +27,8 @@ const InfoBlock = ({ video_id }: IProps) => {
|
|||
<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">
|
||||
<SectionTitle title={data!.data.title} />
|
||||
<div className="flex gap-2 items-center">
|
||||
<SlEye
|
||||
style={{
|
||||
transition: "150ms all cubic-bezier(0.4, 0, 0.2, 1)",
|
||||
}}
|
||||
width={30}
|
||||
height={18}
|
||||
className="w-[30px] h-[18px]"
|
||||
/>
|
||||
<span className="font-roboto text-lg font-normal text-[#494949] transition-all dark:text-white">
|
||||
{data!.data.view}
|
||||
</span>
|
||||
</div>
|
||||
<SectionTitle title={data.title} />
|
||||
<ViewCount video_id={video_id} viewCount={data.view} />
|
||||
</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">
|
||||
|
|
@ -67,25 +41,25 @@ const InfoBlock = ({ video_id }: IProps) => {
|
|||
</div>
|
||||
|
||||
<div className="flex flex-col gap-6">
|
||||
{data?.data.desc ? (
|
||||
{data.desc ? (
|
||||
<p className="font-roboto text-lg w-full text-black">
|
||||
{data!.data.desc}
|
||||
{data.desc}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
<ReactionsBlock video_id={video_id} />
|
||||
|
||||
{data?.data.aydym_com_url ||
|
||||
data?.data.horjun_content_url ||
|
||||
data?.data.belet_url ? (
|
||||
{data.aydym_com_url ||
|
||||
data.horjun_content_url ||
|
||||
data.belet_url ? (
|
||||
<div className="flex flex-col gap-6">
|
||||
<h2 className="text-2xl font-semibold">
|
||||
Beýleki platformalarda seret:
|
||||
</h2>
|
||||
<div className="flex gap-11 items-center">
|
||||
{data?.data.aydym_com_url ? (
|
||||
{data.aydym_com_url ? (
|
||||
<Link
|
||||
href={data?.data.aydym_com_url}
|
||||
href={data.aydym_com_url}
|
||||
target="_blank"
|
||||
className="flex flex-col items-center justify-center gap-2"
|
||||
>
|
||||
|
|
@ -99,9 +73,9 @@ const InfoBlock = ({ video_id }: IProps) => {
|
|||
<h3>Aydym.com</h3>
|
||||
</Link>
|
||||
) : null}
|
||||
{data?.data.horjun_content_url ? (
|
||||
{data.horjun_content_url ? (
|
||||
<Link
|
||||
href={data?.data.horjun_content_url}
|
||||
href={data.horjun_content_url}
|
||||
target="_blank"
|
||||
className="flex flex-col items-center justify-center gap-2"
|
||||
>
|
||||
|
|
@ -115,9 +89,9 @@ const InfoBlock = ({ video_id }: IProps) => {
|
|||
<h3>HorjunTv</h3>
|
||||
</Link>
|
||||
) : null}
|
||||
{data?.data.belet_url ? (
|
||||
{data.belet_url ? (
|
||||
<Link
|
||||
href={data.data.belet_url}
|
||||
href={data.belet_url}
|
||||
target="_blank"
|
||||
className="flex flex-col items-center justify-center gap-2"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -97,10 +97,10 @@ const Nav = () => {
|
|||
</svg>
|
||||
|
||||
<div
|
||||
className={`absolute top-10 left-1/2 -translate-x-1/2 bg-[#353598] flex flex-col gap-4 p-[24px] rounded-[8px] transition-all duration-300 w-[160px] ${
|
||||
className={`absolute top-10 left-1/2 -translate-x-1/2 z-50 bg-[#353598] flex flex-col gap-4 p-[24px] rounded-[8px] transition-all duration-300 w-[160px] ${
|
||||
dropDownOpened
|
||||
? 'opacity-100 translate-y-0 pointer-events-auto'
|
||||
: ' opacity-0 translate-y-2 pointer-events-none'
|
||||
: 'opacity-0 translate-y-2 pointer-events-none'
|
||||
}`}>
|
||||
<Link
|
||||
href={'/quiz/active'}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { Swiper, SwiperSlide } from 'swiper/react';
|
|||
import Loader from './Loader';
|
||||
import MaterialsContext from '@/context/MaterialsContext';
|
||||
import MoreBtn from './MoreBtn';
|
||||
import { Autoplay, Navigation } from 'swiper';
|
||||
import { Autoplay, Navigation } from 'swiper/modules';
|
||||
import { Queries } from '@/api/queries';
|
||||
import VideoItem from './VideoItem';
|
||||
import { useContext } from 'react';
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ const Plan = () => {
|
|||
}
|
||||
};
|
||||
|
||||
console.log(plans)
|
||||
|
||||
if (!plans) return null;
|
||||
if (!plan) return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,19 +30,9 @@ const WindowTwo = () => {
|
|||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'Air ticket flyer',
|
||||
property: 'on_sub',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'Website',
|
||||
property: 'on_web',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'Outdoor LED',
|
||||
property: 'on_outside_monitors',
|
||||
},
|
||||
name: 'SMS hyzmatlary',
|
||||
property: 'on_sms',
|
||||
}
|
||||
];
|
||||
const ctx = useContext(StepsContext);
|
||||
const { stepContext, propertyContext, data } = ctx;
|
||||
|
|
@ -53,8 +43,6 @@ const WindowTwo = () => {
|
|||
Queries.getPlans(propertyContext.property!).then((data) => plans.setPlans(data));
|
||||
}, [propertyContext.property]);
|
||||
|
||||
useEffect(() => {}, []);
|
||||
|
||||
// console.log('Plans', plans);
|
||||
// console.log('Plan', plan);
|
||||
|
||||
|
|
@ -73,7 +61,7 @@ const WindowTwo = () => {
|
|||
<h2 className="font-mw_sans font-bold md:text-[22px] text-lg leading-[24px]">
|
||||
Mahabat görnüşini we bukjasyny saýlaň!
|
||||
</h2>
|
||||
<div className="md:grid md:grid-cols-5 flex flex-col gap-[8px]">
|
||||
<div className="md:grid md:grid-cols-3 flex flex-col gap-[8px]">
|
||||
{planTypes.map((option) => (
|
||||
<Option
|
||||
onClick={(id) => setPlan(id)}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use client';
|
||||
import Image from 'next/image';
|
||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||
import { Autoplay, Navigation, Pagination } from 'swiper';
|
||||
import { Autoplay, Navigation, Pagination } from 'swiper/modules';
|
||||
import { Queries } from '@/api/queries';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import Loader from '../Loader';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use client';
|
||||
import Image from 'next/image';
|
||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||
import { Navigation, Pagination, Scrollbar, A11y, Autoplay } from 'swiper';
|
||||
import { Navigation, Pagination, Scrollbar, A11y, Autoplay } from 'swiper/modules';
|
||||
import { v4 } from 'uuid';
|
||||
import Link from 'next/link';
|
||||
import { Queries } from '@/api/queries';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use client';
|
||||
import Image from 'next/image';
|
||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||
import { Navigation, Pagination, Scrollbar, A11y, Autoplay } from 'swiper';
|
||||
import { Navigation, Pagination, Scrollbar, A11y, Autoplay } from 'swiper/modules';
|
||||
import { v4 } from 'uuid';
|
||||
import Link from 'next/link';
|
||||
import { HomeModel } from '@/models/home.model';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use client';
|
||||
import Image from 'next/image';
|
||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||
import { Navigation, Pagination, Scrollbar, A11y, Autoplay } from 'swiper';
|
||||
import { Navigation, Pagination, Scrollbar, A11y, Autoplay } from 'swiper/modules';
|
||||
import { v4 } from 'uuid';
|
||||
import Link from 'next/link';
|
||||
import { Queries } from '@/api/queries';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { useQuery } from '@tanstack/react-query';
|
|||
import Loader from '../Loader';
|
||||
import Link from 'next/link';
|
||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||
import { Autoplay, Navigation, Pagination } from 'swiper';
|
||||
import { Autoplay, Navigation, Pagination } from 'swiper/modules';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
const Banner = () => {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import Image from 'next/image';
|
|||
import Loader from '../Loader';
|
||||
import baseUrl from '@/baseUrl';
|
||||
import PageTitle from '../PageTitle';
|
||||
import { NextSeo } from 'next-seo';
|
||||
import Head from 'next/head';
|
||||
|
||||
interface IProps {
|
||||
id: string;
|
||||
|
|
@ -54,10 +54,10 @@ const Item = ({ id }: IProps) => {
|
|||
dangerouslySetInnerHTML={{ __html: data!.data.content_html }}></p>
|
||||
</div>
|
||||
</div> */}
|
||||
<NextSeo
|
||||
title={bannerData?.data[0] ? bannerData?.data[0].title : ''}
|
||||
description={data!.data.excerpt}
|
||||
/>
|
||||
<Head>
|
||||
<title>{bannerData?.data[0] ? bannerData?.data[0].title : ''}</title>
|
||||
<meta name="description" content={data!.data.excerpt} />
|
||||
</Head>
|
||||
<div className="flex flex-col gap-2">
|
||||
<PageTitle title={bannerData?.data[0] ? bannerData?.data[0].title : ''} />
|
||||
<p className="text-lg">{data?.data.published_at}</p>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||
import { Navigation, Autoplay } from 'swiper';
|
||||
import { Navigation, Autoplay } from 'swiper/modules';
|
||||
import { InfiniteData } from '@tanstack/react-query';
|
||||
import { NewsModel } from '@/models/news.model';
|
||||
import { v4 } from 'uuid';
|
||||
|
|
|
|||
|
|
@ -81,30 +81,30 @@ const QuizWinnerTable = ({ quizId, questionsData }: IProps) => {
|
|||
<div className="table-desktop hidden sm:flex flex-col bg-fillTableHead rounded-[25px] shadow-quizButton overflow-hidden max-w-[1000px] w-full">
|
||||
{/* Table Head */}
|
||||
<div className="flex border-b border-fillTableStrokeTableHead">
|
||||
{winnersData[0].client_id || quizSearchData?.data ? (
|
||||
{winnersData[0]?.client_id || quizSearchData?.data ? (
|
||||
<div className="text-center flex justify-center items-center text-base text-textBlack leading-[125%] font-semibold max-w-[54px] w-[100%] pl-6 pr-3 py-5">
|
||||
<span>Ýeri</span>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{winnersData[0].phone || quizSearchData?.data ? (
|
||||
{winnersData[0]?.phone || quizSearchData?.data ? (
|
||||
<div className="text-center flex justify-center items-center text-base text-textBlack leading-[125%] font-semibold max-w-[176px] w-[100%] px-3 py-5">
|
||||
<span>Telefon beligisi</span>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{winnersData[0].answers.length || quizSearchData?.data ? (
|
||||
{winnersData[0]?.answers.length || quizSearchData?.data ? (
|
||||
<div className="text-center flex justify-center items-center text-base text-textBlack leading-[125%] font-semibold w-[100%] px-3 py-5">
|
||||
<span>Jogap beriş nobatlary</span>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{winnersData[0].total_score_of_client || quizSearchData?.data ? (
|
||||
{winnersData[0]?.total_score_of_client || quizSearchData?.data ? (
|
||||
<div className="text-center flex justify-center items-center text-base text-textBlack leading-[125%] font-semibold max-w-[180px] w-[100%] px-3 py-5">
|
||||
<span>Nobatlaryň jemi</span>
|
||||
</div>
|
||||
) : null}
|
||||
{winnersData[0].total_score_of_client || quizSearchData?.data ? (
|
||||
{winnersData[0]?.total_score_of_client || quizSearchData?.data ? (
|
||||
<div className="text-center flex justify-center items-center text-base text-textBlack leading-[125%] font-semibold max-w-[180px] w-[100%] px-3 py-5">
|
||||
<span>Utuklaryň jemi</span>
|
||||
</div>
|
||||
|
|
@ -113,7 +113,7 @@ const QuizWinnerTable = ({ quizId, questionsData }: IProps) => {
|
|||
|
||||
{/* Table Body */}
|
||||
<div className="">
|
||||
{winnersData
|
||||
{winnersData.length > 0
|
||||
? winnersData.map((winner, id) => (
|
||||
<div
|
||||
className={`flex border-b border-fillTableStrokeTableRow ${
|
||||
|
|
@ -262,24 +262,24 @@ const QuizWinnerTable = ({ quizId, questionsData }: IProps) => {
|
|||
<div className="sm:hidden flex flex-col bg-fillTableHead rounded-[13px] shadow-quizButton overflow-hidden max-w-[1000px] w-full">
|
||||
{/* Table Head */}
|
||||
<div className="flex border-b border-fillTableStrokeTableHead p-2 gap-[8px]">
|
||||
{winnersData[0].client_id || quizSearchData?.data ? (
|
||||
{winnersData[0]?.client_id || quizSearchData?.data ? (
|
||||
<div className="text-center flex items-center text-xs text-textBlack leading-[125%] font-semibold max-w-[14px] w-[100%]">
|
||||
<span>Ýeri</span>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{winnersData[0].phone || quizSearchData?.data ? (
|
||||
{winnersData[0]?.phone || quizSearchData?.data ? (
|
||||
<div className="text-center flex justify-center items-center text-xs text-textBlack leading-[125%] font-semibold max-w-[107px] w-[100%]">
|
||||
<span>Telefon beligisi</span>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{winnersData[0].total_score_of_client || quizSearchData?.data ? (
|
||||
{winnersData[0]?.total_score_of_client || quizSearchData?.data ? (
|
||||
<div className="text-center flex justify-center items-center text-xs text-textBlack leading-[125%] font-semibold max-w-[75px] w-[100%]">
|
||||
<span>Nobatlaryň jemi </span>
|
||||
</div>
|
||||
) : null}
|
||||
{winnersData[0].total_score_of_client || quizSearchData?.data ? (
|
||||
{winnersData[0]?.total_score_of_client || quizSearchData?.data ? (
|
||||
<div className="text-center flex justify-center items-center text-xs text-textBlack leading-[125%] font-semibold max-w-[99px] w-[100%]">
|
||||
<span>Utuklaryň jemi</span>
|
||||
</div>
|
||||
|
|
@ -453,7 +453,7 @@ const QuizWinnerTable = ({ quizId, questionsData }: IProps) => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{winnersData.length < winnersTotal && (
|
||||
{winnersData.length < winnersTotal && !quizSearchData && (
|
||||
<button
|
||||
onClick={() => getData(true)}
|
||||
className="py-[5px] px-[10px] rounded-md bg-blue-500 text-white border border-blue-500 lg:hover:bg-white lg:hover:text-blue-500 transition-all duration-300"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
'use client';
|
||||
import { Queries } from '@/api/queries';
|
||||
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { data } from 'autoprefixer';
|
||||
import axios from 'axios';
|
||||
import { Loader } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { BiSolidLike, BiLike, BiSolidDislike, BiDislike } from 'react-icons/bi';
|
||||
import { useLocalStorage } from 'usehooks-ts';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
'use client';
|
||||
import axios from 'axios';
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
import { SlEye } from 'react-icons/sl'
|
||||
|
||||
function ViewCount({ video_id, viewCount }: { video_id: number, viewCount: number }) {
|
||||
const [view, setView] = useState(viewCount);
|
||||
|
||||
const addView = useCallback(async () => {
|
||||
const materials = localStorage.getItem('MHB_MATERIALS_ID');
|
||||
if (materials) {
|
||||
const materialsArray = materials.split(',');
|
||||
if (!materialsArray.includes(video_id.toString())) {
|
||||
const res = await axios.post(`https://turkmentv.gov.tm/v2/api/material/${video_id}/views/increment`);
|
||||
if (res.status === 200) {
|
||||
materialsArray.push(video_id.toString());
|
||||
setView(res.data.view);
|
||||
}
|
||||
}
|
||||
localStorage.setItem('MHB_MATERIALS_ID', materialsArray.join(','));
|
||||
} else {
|
||||
const res = await axios.post(`https://turkmentv.gov.tm/v2/api/material/${video_id}/views/increment`);
|
||||
if (res.status === 200) {
|
||||
localStorage.setItem('MHB_MATERIALS_ID', [video_id.toString()].join(','));
|
||||
setView(res.data.view);
|
||||
}
|
||||
}
|
||||
|
||||
}, [video_id])
|
||||
|
||||
useEffect(() => {
|
||||
addView();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="flex gap-2 items-center">
|
||||
<SlEye
|
||||
style={{
|
||||
transition: "150ms all cubic-bezier(0.4, 0, 0.2, 1)",
|
||||
}}
|
||||
width={30}
|
||||
height={18}
|
||||
className="w-[30px] h-[18px]"
|
||||
/>
|
||||
<span className="font-roboto text-lg font-normal text-[#494949] transition-all dark:text-white">
|
||||
{view}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ViewCount
|
||||
92
package.json
92
package.json
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "next-mhb",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 4000",
|
||||
|
|
@ -9,58 +9,58 @@
|
|||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.10.6",
|
||||
"@emotion/styled": "^11.10.6",
|
||||
"@hookform/resolvers": "^3.10.0",
|
||||
"@mui/material": "^5.12.1",
|
||||
"@mui/x-date-pickers": "^6.5.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.2",
|
||||
"@radix-ui/react-dialog": "^1.1.2",
|
||||
"@radix-ui/react-label": "^2.1.2",
|
||||
"@radix-ui/react-popover": "^1.1.1",
|
||||
"@radix-ui/react-slot": "^1.1.2",
|
||||
"@tanstack/react-query": "^4.32.0",
|
||||
"@tanstack/react-query-devtools": "^4.32.0",
|
||||
"@types/node": "18.15.13",
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.1",
|
||||
"@hookform/resolvers": "^5.2.2",
|
||||
"@mui/material": "^7.3.7",
|
||||
"@mui/x-date-pickers": "^8.26.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.15",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
"@radix-ui/react-label": "^2.1.8",
|
||||
"@radix-ui/react-popover": "^1.1.15",
|
||||
"@radix-ui/react-slot": "^1.2.4",
|
||||
"@tanstack/react-query": "^5.90.20",
|
||||
"@tanstack/react-query-devtools": "^5.91.2",
|
||||
"@types/node": "25.0.10",
|
||||
"@types/react": "19.0.8",
|
||||
"@types/react-dom": "19.0.3",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"autoprefixer": "10.4.14",
|
||||
"axios": "^1.5.1",
|
||||
"@types/uuid": "^11.0.0",
|
||||
"autoprefixer": "10.4.23",
|
||||
"axios": "^1.13.2",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"date-fns": "^2.30.0",
|
||||
"dayjs": "^1.11.7",
|
||||
"framer-motion": "^10.12.16",
|
||||
"lucide-react": "^0.408.0",
|
||||
"next": "15.1.6",
|
||||
"next-seo": "^6.0.0",
|
||||
"postcss": "8.4.23",
|
||||
"react": "19.0.0",
|
||||
"react-confetti": "^6.1.0",
|
||||
"react-day-picker": "^8.10.1",
|
||||
"react-dom": "19.0.0",
|
||||
"react-fast-marquee": "^1.3.5",
|
||||
"react-hook-form": "^7.54.2",
|
||||
"react-icons": "^4.8.0",
|
||||
"react-player": "^2.12.0",
|
||||
"react-slot-counter": "^3.0.4",
|
||||
"react-use": "^17.5.1",
|
||||
"sharp": "^0.33.5",
|
||||
"swiper": "^9.2.4",
|
||||
"tailwind-merge": "^2.6.0",
|
||||
"tailwindcss": "3.3.1",
|
||||
"date-fns": "^4.1.0",
|
||||
"dayjs": "^1.11.19",
|
||||
"framer-motion": "^12.29.0",
|
||||
"lucide-react": "^0.563.0",
|
||||
"next": "16.1.4",
|
||||
"next-seo": "^7.0.1",
|
||||
"postcss": "8.5.6",
|
||||
"react": "19.2.3",
|
||||
"react-confetti": "^6.4.0",
|
||||
"react-day-picker": "^9.13.0",
|
||||
"react-dom": "19.2.3",
|
||||
"react-fast-marquee": "^1.6.5",
|
||||
"react-hook-form": "^7.71.1",
|
||||
"react-icons": "^5.5.0",
|
||||
"react-player": "^3.4.0",
|
||||
"react-slot-counter": "^3.3.2",
|
||||
"react-use": "^17.6.0",
|
||||
"sharp": "^0.34.5",
|
||||
"swiper": "^12.0.3",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"tailwindcss": "4.1.18",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"typescript": "^5.2.2",
|
||||
"usehooks-ts": "^2.9.1",
|
||||
"uuid": "^9.0.0",
|
||||
"zod": "^3.24.1",
|
||||
"zustand": "^5.0.1"
|
||||
"typescript": "^5.9.3",
|
||||
"usehooks-ts": "^3.1.1",
|
||||
"uuid": "^13.0.0",
|
||||
"zod": "^4.3.6",
|
||||
"zustand": "^5.0.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/date-fns": "^2.6.0",
|
||||
"eslint": "8.49.0",
|
||||
"eslint-config-next": "15.1.6"
|
||||
"@types/date-fns": "^2.6.3",
|
||||
"eslint": "9.39.2",
|
||||
"eslint-config-next": "16.1.4"
|
||||
},
|
||||
"overrides": {
|
||||
"@types/react": "19.0.8",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
'@tailwindcss/postcss': {},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Some example text
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { fontFamily } from 'tailwindcss/defaultTheme';
|
||||
import defaultTheme from 'tailwindcss/defaultTheme';
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export const content = [
|
||||
'./pages/**/*.{js,ts,jsx,tsx}',
|
||||
|
|
@ -163,11 +163,11 @@ export const theme = {
|
|||
'4xl': ['0 35px 35px rgba(0, 0, 0, 0.25)', '0 45px 65px rgba(0, 0, 0, 0.15)'],
|
||||
},
|
||||
fontFamily: {
|
||||
aeroport: ['var(--font-aeroport)', ...fontFamily.sans],
|
||||
roboto: ['var(--font-roboto)', ...fontFamily.sans],
|
||||
mw: ['var(--font-mw)', ...fontFamily.sans],
|
||||
mw_sans: ['var(--font-mwsans)', ...fontFamily.sans],
|
||||
alexandria: ['var(--font-alexandria)', ...fontFamily.sans],
|
||||
aeroport: ['var(--font-aeroport)', ...defaultTheme.fontFamily.sans],
|
||||
roboto: ['var(--font-roboto)', ...defaultTheme.fontFamily.sans],
|
||||
mw: ['var(--font-mw)', ...defaultTheme.fontFamily.sans],
|
||||
mw_sans: ['var(--font-mwsans)', ...defaultTheme.fontFamily.sans],
|
||||
alexandria: ['var(--font-alexandria)', ...defaultTheme.fontFamily.sans],
|
||||
},
|
||||
gridTemplateRows: {
|
||||
full3: 'repeat(3, 33.333333333333333333333%)',
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
"use client";
|
||||
|
||||
import { Hydrate as RQHydrate, HydrateProps } from "@tanstack/react-query";
|
||||
import { HydrationBoundary, HydrationBoundaryProps } from "@tanstack/react-query";
|
||||
|
||||
function Hydrate(props: HydrateProps) {
|
||||
return <RQHydrate {...props} />;
|
||||
function Hydrate(props: HydrationBoundaryProps) {
|
||||
return <HydrationBoundary {...props} />;
|
||||
}
|
||||
|
||||
export default Hydrate;
|
||||
|
|
|
|||
Loading…
Reference in New Issue