formatting
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { useEffect } from "react";
|
||||
import { SecondaryButton } from "../../../components/button/SecondaryButton";
|
||||
import { cn } from "../../../lib/cn";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
import ContestsBlock from "./ContestsBlock";
|
||||
import { setMenuActivePage } from "../../../redux/slices/store";
|
||||
import { fetchContests } from "../../../redux/slices/contests";
|
||||
import { useEffect } from 'react';
|
||||
import { SecondaryButton } from '../../../components/button/SecondaryButton';
|
||||
import { cn } from '../../../lib/cn';
|
||||
import { useAppDispatch, useAppSelector } from '../../../redux/hooks';
|
||||
import ContestsBlock from './ContestsBlock';
|
||||
import { setMenuActivePage } from '../../../redux/slices/store';
|
||||
import { fetchContests } from '../../../redux/slices/contests';
|
||||
|
||||
const Contests = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
@@ -17,12 +17,14 @@ const Contests = () => {
|
||||
|
||||
// При загрузке страницы — выставляем активную вкладку и подгружаем контесты
|
||||
useEffect(() => {
|
||||
dispatch(setMenuActivePage("contests"));
|
||||
dispatch(setMenuActivePage('contests'));
|
||||
dispatch(fetchContests({}));
|
||||
}, []);
|
||||
|
||||
if (loading == "loading") {
|
||||
return <div className="text-liquid-white p-4">Загрузка контестов...</div>;
|
||||
if (loading == 'loading') {
|
||||
return (
|
||||
<div className="text-liquid-white p-4">Загрузка контестов...</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
@@ -33,7 +35,11 @@ const Contests = () => {
|
||||
<div className="h-full w-[calc(100%+250px)] box-border p-[20px] pt-[20p]">
|
||||
<div className="h-full box-border">
|
||||
<div className="relative flex items-center mb-[20px]">
|
||||
<div className={cn("h-[50px] text-[40px] font-bold text-liquid-white flex items-center")}>
|
||||
<div
|
||||
className={cn(
|
||||
'h-[50px] text-[40px] font-bold text-liquid-white flex items-center',
|
||||
)}
|
||||
>
|
||||
Контесты
|
||||
</div>
|
||||
<SecondaryButton
|
||||
@@ -49,8 +55,7 @@ const Contests = () => {
|
||||
className="mb-[20px]"
|
||||
title="Текущие"
|
||||
contests={contests.filter((contest) => {
|
||||
const endTime =
|
||||
new Date(contest.endsAt).getTime()
|
||||
const endTime = new Date(contest.endsAt).getTime();
|
||||
return endTime >= now.getTime();
|
||||
})}
|
||||
/>
|
||||
@@ -59,8 +64,7 @@ const Contests = () => {
|
||||
className="mb-[20px]"
|
||||
title="Прошедшие"
|
||||
contests={contests.filter((contest) => {
|
||||
const endTime =
|
||||
new Date(contest.endsAt).getTime()
|
||||
const endTime = new Date(contest.endsAt).getTime();
|
||||
return endTime < now.getTime();
|
||||
})}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user