mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-26 09:44:21 +01:00
feat: add api query to get tournament open for registeration
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import Button from 'src/Components/Button/Button';
|
||||
import { useGetTournamentsToRegisterQuery } from 'src/graphql';
|
||||
import { random } from 'src/utils/helperFunctions';
|
||||
|
||||
interface Props {
|
||||
@@ -8,6 +9,8 @@ interface Props {
|
||||
|
||||
export default function TournamentsInput(props: Props) {
|
||||
|
||||
const query = useGetTournamentsToRegisterQuery();
|
||||
|
||||
|
||||
const handleClick = (clickedValue: number) => {
|
||||
if (props.value.includes(clickedValue))
|
||||
@@ -19,39 +22,39 @@ export default function TournamentsInput(props: Props) {
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap gap-8">
|
||||
{false ?
|
||||
Array(10).fill(0).map((_, idx) =>
|
||||
{query.loading ?
|
||||
Array(4).fill(0).map((_, idx) =>
|
||||
<div
|
||||
key={idx}
|
||||
className="bg-gray-100 border border-gray-200 p-8 rounded-10">
|
||||
<span className='invisible'>{"loading category skeleton".slice(random(6, 12))}</span>
|
||||
</div>)
|
||||
:
|
||||
data.map(item =>
|
||||
<Button
|
||||
key={item.id}
|
||||
color='none'
|
||||
size='sm'
|
||||
className={`
|
||||
border border-gray-200
|
||||
((query.data?.getTournamentToRegister && query.data?.getTournamentToRegister.length < 0) ?
|
||||
query.data?.getTournamentToRegister.map(item =>
|
||||
<Button
|
||||
key={item.id}
|
||||
color='none'
|
||||
size='sm'
|
||||
className={`
|
||||
border text-gray-800
|
||||
${props.value.includes(item.id) ?
|
||||
'title-primary-600 bg-primary-100'
|
||||
:
|
||||
"bg-gray-100"
|
||||
}
|
||||
'title-primary-600 bg-primary-100 border-primary-200'
|
||||
:
|
||||
"bg-gray-100 border-gray-200"
|
||||
}
|
||||
`}
|
||||
onClick={() => handleClick(item.id)}
|
||||
>
|
||||
{item.title}
|
||||
</Button>)
|
||||
onClick={() => handleClick(item.id)}
|
||||
>
|
||||
{item.title}
|
||||
</Button>)
|
||||
:
|
||||
<p className='text-gray-400 font-medium'>
|
||||
There is no running tournaments currently.
|
||||
</p>)
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const data = [
|
||||
{
|
||||
id: 1,
|
||||
title: 'Legends of Lightning',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
query GetTournamentsToRegister {
|
||||
getTournamentToRegister {
|
||||
id
|
||||
title
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { BsJoystick } from 'react-icons/bs'
|
||||
import { MdClose, MdLocalFireDepartment } from 'react-icons/md';
|
||||
import { ModalCard } from 'src/Components/Modals/ModalsContainer/ModalsContainer';
|
||||
import { useAppDispatch, useAppSelector, useMediaQuery } from 'src/utils/hooks';
|
||||
import { openModal, scheduleModal } from 'src/redux/features/modals.slice';
|
||||
import { setProject } from 'src/redux/features/project.slice';
|
||||
import Button from 'src/Components/Button/Button';
|
||||
import { AiFillThunderbolt } from 'react-icons/ai';
|
||||
import ProjectCardSkeleton from './ProjectDetailsCard.Skeleton'
|
||||
// import VoteButton from 'src/features/Projects/pages/ProjectPage/VoteButton/VoteButton';
|
||||
import { NotificationsService, Wallet_Service } from 'src/services'
|
||||
|
||||
Reference in New Issue
Block a user