fix: update dependencies API compatibility for build success
- Update revalidateTag to accept required profile parameter (Next.js 16) - Change ReactPlayer url prop to src (react-player v3) - Add initialPageParam to prefetchInfiniteQuery and useInfiniteQuery calls (TanStack Query v5) - Update useMutation to object syntax with mutationFn (TanStack Query v5) - Change isLoading to isPending for mutations (TanStack Query v5) - Fix useOnClickOutside ref type casting (usehooks-ts) - Update AnimationControls to LegacyAnimationControls (framer-motion v12) - Change IconLeft/IconRight to Chevron component (react-day-picker v9) - Update darkMode config format (Tailwind CSS v4) - Update tsconfig moduleResolution to bundler and target to ES2017
This commit is contained in:
parent
a06e3fbf11
commit
687f5aab4e
|
|
@ -35,6 +35,6 @@ export async function authenticateLottery(phone: string, code: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const revalidateTagName = async (tag: string) => {
|
export const revalidateTagName = async (tag: string, profile: string = "default") => {
|
||||||
revalidateTag(tag);
|
revalidateTag(tag, profile);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ const page = () => {
|
||||||
height={'100%'}
|
height={'100%'}
|
||||||
width={'100%'}
|
width={'100%'}
|
||||||
controls
|
controls
|
||||||
url={channel.source}
|
src={channel.source}
|
||||||
playing={true}
|
playing={true}
|
||||||
key={v4()}
|
key={v4()}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ const VideoItem = async ({ params }: IParams) => {
|
||||||
await queryClient.prefetchInfiniteQuery({
|
await queryClient.prefetchInfiniteQuery({
|
||||||
queryKey: ['video', 'all'],
|
queryKey: ['video', 'all'],
|
||||||
queryFn: () => Queries.getVideos(''),
|
queryFn: () => Queries.getVideos(''),
|
||||||
|
initialPageParam: 1,
|
||||||
});
|
});
|
||||||
await queryClient.prefetchInfiniteQuery({
|
await queryClient.prefetchInfiniteQuery({
|
||||||
queryKey: ['videos', 'infinite', ''],
|
queryKey: ['videos', 'infinite', ''],
|
||||||
|
|
@ -36,11 +37,12 @@ const VideoItem = async ({ params }: IParams) => {
|
||||||
'?' +
|
'?' +
|
||||||
String(
|
String(
|
||||||
new URLSearchParams({
|
new URLSearchParams({
|
||||||
page: pageParam,
|
page: String(pageParam),
|
||||||
per_page: '8',
|
per_page: '8',
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
initialPageParam: 1,
|
||||||
});
|
});
|
||||||
const dehydratedState = dehydrate(queryClient);
|
const dehydratedState = dehydrate(queryClient);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,12 @@ const Treasury = async () => {
|
||||||
'?' +
|
'?' +
|
||||||
String(
|
String(
|
||||||
new URLSearchParams({
|
new URLSearchParams({
|
||||||
page: pageParam,
|
page: String(pageParam),
|
||||||
per_page: '8',
|
per_page: '8',
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
initialPageParam: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
const dehydratedState = dehydrate(queryClient);
|
const dehydratedState = dehydrate(queryClient);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
import PrizeCard from '@/components/prizes/PrizeCard';
|
import PrizeCard from '@/components/prizes/PrizeCard';
|
||||||
import { useState } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||||
import { GiftsType } from '@/typings/gifts/gifts.type';
|
import { GiftsType } from '@/typings/gifts/gifts.type';
|
||||||
|
|
@ -22,19 +22,20 @@ const PrizesPage = ({ params }: { params: { user_id: string } }) => {
|
||||||
const mobile = useMediaQuery('(max-width: 768px)');
|
const mobile = useMediaQuery('(max-width: 768px)');
|
||||||
|
|
||||||
// Fetching data using TanStack Query
|
// Fetching data using TanStack Query
|
||||||
const { data, isLoading, error } = useQuery<GiftsType, Error>(
|
const { data, isLoading, error } = useQuery<GiftsType, Error>({
|
||||||
[`gifts-${params.user_id}`, params.user_id], // Query key using user_id
|
queryKey: [`gifts-${params.user_id}`, params.user_id],
|
||||||
() =>
|
queryFn: () =>
|
||||||
axios
|
axios
|
||||||
.get(`https://sms.turkmentv.gov.tm/api/gifts/${params.user_id}`)
|
.get(`https://sms.turkmentv.gov.tm/api/gifts/${params.user_id}`)
|
||||||
.then((response) => response.data),
|
.then((response) => response.data),
|
||||||
{
|
});
|
||||||
// Handle error with onError callback to trigger the redirect
|
|
||||||
onError: () => {
|
// Handle error with redirect
|
||||||
router.push('/prizes/auth');
|
useEffect(() => {
|
||||||
},
|
if (error) {
|
||||||
},
|
router.push('/prizes/auth');
|
||||||
);
|
}
|
||||||
|
}, [error, router]);
|
||||||
|
|
||||||
if (isLoading)
|
if (isLoading)
|
||||||
return (
|
return (
|
||||||
|
|
@ -49,6 +50,10 @@ const PrizesPage = ({ params }: { params: { user_id: string } }) => {
|
||||||
return null; // Return null since the redirect will occur
|
return null; // Return null since the redirect will occur
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-[32px] md:gap-[64px] items-center w-full overflow-x-hidden">
|
<div className="flex flex-col gap-[32px] md:gap-[64px] items-center w-full overflow-x-hidden">
|
||||||
<header className="flex flex-col items-center gap-[24px] w-full">
|
<header className="flex flex-col items-center gap-[24px] w-full">
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
'use client';
|
'use client';
|
||||||
import { useRef, useState } from 'react';
|
import React, { useRef, useState } from 'react';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
import { BiSolidDownArrow } from 'react-icons/bi';
|
import { BiSolidDownArrow } from 'react-icons/bi';
|
||||||
|
|
@ -28,7 +28,7 @@ const CustomSelect = ({
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
const [input, setInput] = useState<string>();
|
const [input, setInput] = useState<string>();
|
||||||
|
|
||||||
useOnClickOutside(ref, () => setOpen(false));
|
useOnClickOutside(ref as React.RefObject<HTMLElement>, () => setOpen(false));
|
||||||
return (
|
return (
|
||||||
<div ref={ref} className="custom-input relative cursor-pointer" onClick={() => setOpen(!open)}>
|
<div ref={ref} className="custom-input relative cursor-pointer" onClick={() => setOpen(!open)}>
|
||||||
{label ? (
|
{label ? (
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,15 @@ const VideoList = ({ isSlides }: IProps) => {
|
||||||
queryKey: ['videos', 'infinite', params ? params : ''],
|
queryKey: ['videos', 'infinite', params ? params : ''],
|
||||||
queryFn: ({ pageParam = 1 }) =>
|
queryFn: ({ pageParam = 1 }) =>
|
||||||
params.search !== ''
|
params.search !== ''
|
||||||
? Queries.getVideos('?' + String(new URLSearchParams({ ...params, page: pageParam })))
|
? Queries.getVideos('?' + String(new URLSearchParams({ ...params, page: String(pageParam) })))
|
||||||
: Queries.getVideos(
|
: Queries.getVideos(
|
||||||
'?' + String(new URLSearchParams({ ...noSearchParams, page: pageParam })),
|
'?' + String(new URLSearchParams({ ...noSearchParams, page: String(pageParam) })),
|
||||||
),
|
),
|
||||||
getNextPageParam: (prevData) =>
|
getNextPageParam: (prevData) =>
|
||||||
prevData.meta.last_page > prevData.meta.current_page
|
prevData.meta.last_page > prevData.meta.current_page
|
||||||
? prevData.meta.current_page + 1
|
? prevData.meta.current_page + 1
|
||||||
: null,
|
: null,
|
||||||
keepPreviousData: true,
|
initialPageParam: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLoading) return <Loader height={250} />;
|
if (isLoading) return <Loader height={250} />;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ const VideoPlayer = ({ maxHeight, maxWidth, video_id }: IProps) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutation = useMutation(() => addViews());
|
const mutation = useMutation({ mutationFn: () => addViews() });
|
||||||
|
|
||||||
const onPlayHandler = () => {
|
const onPlayHandler = () => {
|
||||||
if (!hasStartedPlaying) {
|
if (!hasStartedPlaying) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
import { MouseEvent, useContext, useEffect, useRef, useState } from 'react';
|
import React, { MouseEvent, useContext, useEffect, useRef, useState } from 'react';
|
||||||
import { Calendar } from '../ui/calendar';
|
import { Calendar } from '../ui/calendar';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import { SmsContext } from '@/context/SmsContext';
|
import { SmsContext } from '@/context/SmsContext';
|
||||||
|
|
@ -51,7 +51,7 @@ const FilterTable = () => {
|
||||||
setCalendar(false);
|
setCalendar(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
useOnClickOutside(calendarRef, handleClickOutside);
|
useOnClickOutside(calendarRef as React.RefObject<HTMLElement>, handleClickOutside);
|
||||||
|
|
||||||
const checkSortActive = () => {
|
const checkSortActive = () => {
|
||||||
if (activeSort === 'asc' || datee || searchFecth) {
|
if (activeSort === 'asc' || datee || searchFecth) {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ const SmallSwiperNews = () => {
|
||||||
if (isFetching) return <Loader height={'100%'} />;
|
if (isFetching) return <Loader height={'100%'} />;
|
||||||
if (error) return <h1>{JSON.stringify(error)}</h1>;
|
if (error) return <h1>{JSON.stringify(error)}</h1>;
|
||||||
|
|
||||||
console.log(!!null);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="small-swiper flex-1">
|
<div className="small-swiper flex-1">
|
||||||
<Swiper
|
<Swiper
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ import { PropsWithChildren } from "react";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import {
|
import {
|
||||||
VariantLabels,
|
VariantLabels,
|
||||||
AnimationControls,
|
|
||||||
TargetAndTransition,
|
TargetAndTransition,
|
||||||
} from "framer-motion";
|
} from "framer-motion";
|
||||||
|
import type { LegacyAnimationControls } from "motion-dom";
|
||||||
|
|
||||||
interface IProps extends PropsWithChildren {
|
interface IProps extends PropsWithChildren {
|
||||||
initial?: any;
|
initial?: any;
|
||||||
animate?: VariantLabels | AnimationControls | TargetAndTransition | undefined;
|
animate?: VariantLabels | LegacyAnimationControls | TargetAndTransition | undefined;
|
||||||
exit?: VariantLabels | TargetAndTransition | undefined;
|
exit?: VariantLabels | TargetAndTransition | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ const MainNews = () => {
|
||||||
prevData.meta.last_page > prevData.meta.current_page
|
prevData.meta.last_page > prevData.meta.current_page
|
||||||
? prevData.meta.current_page + 1
|
? prevData.meta.current_page + 1
|
||||||
: null,
|
: null,
|
||||||
|
initialPageParam: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
const news = data!.pages.flatMap((data) => data.data)[0];
|
const news = data!.pages.flatMap((data) => data.data)[0];
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ const NewsGrid = ({ title, isExtendable, isSlides, perPage = 8 }: IProps) => {
|
||||||
prevData.meta.last_page > prevData.meta.current_page
|
prevData.meta.last_page > prevData.meta.current_page
|
||||||
? prevData.meta.current_page + 1
|
? prevData.meta.current_page + 1
|
||||||
: null,
|
: null,
|
||||||
keepPreviousData: true,
|
initialPageParam: 1,
|
||||||
});
|
});
|
||||||
// const { data, isLoading, isFetchingNextPage, error, hasNextPage, fetchNextPage } =
|
// const { data, isLoading, isFetchingNextPage, error, hasNextPage, fetchNextPage } =
|
||||||
// useInfiniteQuery({
|
// useInfiniteQuery({
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,8 @@ const PrizeCard = ({
|
||||||
<button
|
<button
|
||||||
className="px-[24px] py-[10px] w-full md:w-fit text-textSmall leading-textSmall -tracking-[-1%] font-medium bg-lightPrimary text-lightOnPrimary rounded-[40px]"
|
className="px-[24px] py-[10px] w-full md:w-fit text-textSmall leading-textSmall -tracking-[-1%] font-medium bg-lightPrimary text-lightOnPrimary rounded-[40px]"
|
||||||
onClick={handleDialogOpen}
|
onClick={handleDialogOpen}
|
||||||
disabled={choosePrizeMutation.isLoading}>
|
disabled={choosePrizeMutation.isPending}>
|
||||||
{choosePrizeMutation.isLoading ? 'Ýüklenilýär...' : 'Saýla'}
|
{choosePrizeMutation.isPending ? 'Ýüklenilýär...' : 'Saýla'}
|
||||||
</button>
|
</button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,9 @@ const SmsForm: React.FC = () => {
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={inputValue.length !== 6 || mutation.isLoading}
|
disabled={inputValue.length !== 6 || mutation.isPending}
|
||||||
className="text-textLarge leading-textLarge py-[12px] w-full flex justify-center items-center rounded-[12px] bg-lightPrimary font-medium text-lightOnPrimary">
|
className="text-textLarge leading-textLarge py-[12px] w-full flex justify-center items-center rounded-[12px] bg-lightPrimary font-medium text-lightOnPrimary">
|
||||||
{mutation.isLoading ? 'Ýüklenilýär...' : 'Giriş'}
|
{mutation.isPending ? 'Ýüklenilýär...' : 'Giriş'}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,12 @@ const ReactionsBlock = ({ video_id }: IProps) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutationLikes = useMutation(() => addLikes());
|
const mutationLikes = useMutation({ mutationFn: () => addLikes() });
|
||||||
const mutationDisLikes = useMutation(() => addDisLikes());
|
const mutationDisLikes = useMutation({ mutationFn: () => addDisLikes() });
|
||||||
|
|
||||||
const { data, error } = useQuery({
|
const { data, error } = useQuery({
|
||||||
queryKey: ['video', video_id, mutationLikes, mutationDisLikes],
|
queryKey: ['video', video_id, mutationLikes, mutationDisLikes],
|
||||||
queryFn: () => Queries.getVideo(video_id),
|
queryFn: () => Queries.getVideo(video_id),
|
||||||
keepPreviousData: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (error) return <h1>{JSON.stringify(error)}</h1>;
|
if (error) return <h1>{JSON.stringify(error)}</h1>;
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,12 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }: C
|
||||||
...classNames,
|
...classNames,
|
||||||
}}
|
}}
|
||||||
components={{
|
components={{
|
||||||
IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" />,
|
Chevron: ({ orientation }) =>
|
||||||
IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" />,
|
orientation === 'left' ? (
|
||||||
|
<ChevronLeft className="h-4 w-4" />
|
||||||
|
) : (
|
||||||
|
<ChevronRight className="h-4 w-4" />
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Config } from 'tailwindcss';
|
import type { Config } from 'tailwindcss';
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
darkMode: ['class'],
|
darkMode: 'class',
|
||||||
content: [
|
content: [
|
||||||
'./pages/**/*.{ts,tsx}',
|
'./pages/**/*.{ts,tsx}',
|
||||||
'./components/**/*.{ts,tsx}',
|
'./components/**/*.{ts,tsx}',
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "ES2017",
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"esnext"
|
||||||
|
],
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
|
@ -9,10 +13,10 @@
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve",
|
"jsx": "react-jsx",
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
|
|
@ -20,9 +24,20 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"]
|
"@/*": [
|
||||||
|
"./*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
"include": [
|
||||||
"exclude": ["node_modules"]
|
"next-env.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
".next/types/**/*.ts",
|
||||||
|
".next/dev/types/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"config"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue