diff --git a/api/functions/graphql/nexus-typegen.ts b/api/functions/graphql/nexus-typegen.ts
index 0b1d32b..448a3db 100644
--- a/api/functions/graphql/nexus-typegen.ts
+++ b/api/functions/graphql/nexus-typegen.ts
@@ -613,6 +613,7 @@ export interface NexusGenFieldTypes {
getProject: NexusGenRootTypes['Project']; // Project!
getProjectsInTournament: NexusGenRootTypes['TournamentProjectsResponse']; // TournamentProjectsResponse!
getTournamentById: NexusGenRootTypes['Tournament']; // Tournament!
+ getTournamentToRegister: NexusGenRootTypes['Tournament'][]; // [Tournament!]!
getTrendingPosts: NexusGenRootTypes['Post'][]; // [Post!]!
hottestProjects: NexusGenRootTypes['Project'][]; // [Project!]!
me: NexusGenRootTypes['MyProfile'] | null; // MyProfile
@@ -996,6 +997,7 @@ export interface NexusGenFieldTypeNames {
getProject: 'Project'
getProjectsInTournament: 'TournamentProjectsResponse'
getTournamentById: 'Tournament'
+ getTournamentToRegister: 'Tournament'
getTrendingPosts: 'Post'
hottestProjects: 'Project'
me: 'MyProfile'
diff --git a/api/functions/graphql/schema.graphql b/api/functions/graphql/schema.graphql
index b9a82aa..4ec2313 100644
--- a/api/functions/graphql/schema.graphql
+++ b/api/functions/graphql/schema.graphql
@@ -333,6 +333,7 @@ type Query {
getProject(id: Int!): Project!
getProjectsInTournament(roleId: Int, search: String, skip: Int = 0, take: Int = 10, tournamentId: Int!): TournamentProjectsResponse!
getTournamentById(id: Int!): Tournament!
+ getTournamentToRegister: [Tournament!]!
getTrendingPosts: [Post!]!
hottestProjects(skip: Int = 0, take: Int = 50): [Project!]!
me: MyProfile
diff --git a/api/functions/graphql/types/tournament.js b/api/functions/graphql/types/tournament.js
index 7e05b78..5d9102b 100644
--- a/api/functions/graphql/types/tournament.js
+++ b/api/functions/graphql/types/tournament.js
@@ -214,6 +214,28 @@ const getTournamentById = extendType({
}
})
+
+const getTournamentToRegister = extendType({
+ type: "Query",
+ definition(t) {
+ t.nonNull.list.nonNull.field('getTournamentToRegister', {
+ type: Tournament,
+ args: {
+ },
+ resolve() {
+
+ return prisma.tournament.findMany({
+ where: {
+ end_date: {
+ gt: new Date()
+ },
+ }
+ })
+ }
+ })
+ }
+})
+
const ParticipationInfo = objectType({
name: "ParticipationInfo",
definition(t) {
@@ -538,6 +560,7 @@ module.exports = {
getMakersInTournament,
getProjectsInTournament,
tournamentParticipationInfo,
+ getTournamentToRegister,
// Mutations
registerInTournament,
diff --git a/src/features/Projects/pages/ListProjectPage/Components/TournamentsInput/TournamentsInput.tsx b/src/features/Projects/pages/ListProjectPage/Components/TournamentsInput/TournamentsInput.tsx
index 7ed5dbb..edf6b75 100644
--- a/src/features/Projects/pages/ListProjectPage/Components/TournamentsInput/TournamentsInput.tsx
+++ b/src/features/Projects/pages/ListProjectPage/Components/TournamentsInput/TournamentsInput.tsx
@@ -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 (
- {false ?
- Array(10).fill(0).map((_, idx) =>
+ {query.loading ?
+ Array(4).fill(0).map((_, idx) =>
{"loading category skeleton".slice(random(6, 12))}
)
:
- data.map(item =>
-
)
+ :
+
+ There is no running tournaments currently.
+
)
}
)
}
-const data = [
- {
- id: 1,
- title: 'Legends of Lightning',
- },
-]
+
diff --git a/src/features/Projects/pages/ListProjectPage/Components/TournamentsInput/tournamentsToRegister.graphql b/src/features/Projects/pages/ListProjectPage/Components/TournamentsInput/tournamentsToRegister.graphql
new file mode 100644
index 0000000..84c0927
--- /dev/null
+++ b/src/features/Projects/pages/ListProjectPage/Components/TournamentsInput/tournamentsToRegister.graphql
@@ -0,0 +1,6 @@
+query GetTournamentsToRegister {
+ getTournamentToRegister {
+ id
+ title
+ }
+}
diff --git a/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx b/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx
index aaca8ee..cc5e5a0 100644
--- a/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx
+++ b/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx
@@ -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'
diff --git a/src/graphql/index.tsx b/src/graphql/index.tsx
index 76de547..176c020 100644
--- a/src/graphql/index.tsx
+++ b/src/graphql/index.tsx
@@ -452,6 +452,7 @@ export type Query = {
getProject: Project;
getProjectsInTournament: TournamentProjectsResponse;
getTournamentById: Tournament;
+ getTournamentToRegister: Array;
getTrendingPosts: Array;
hottestProjects: Array;
me: Maybe;
@@ -1035,6 +1036,11 @@ export type UpdateProjectMutationVariables = Exact<{
export type UpdateProjectMutation = { __typename?: 'Mutation', updateProject: { __typename?: 'CreateProjectResponse', project: { __typename?: 'Project', id: number, title: string, description: string, cover_image: string, thumbnail_image: string, screenshots: Array, website: string, lightning_address: string | null, lnurl_callback_url: string | null, votes_count: number, category: { __typename?: 'Category', id: number, title: string, icon: string | null }, tags: Array<{ __typename?: 'Tag', id: number, title: string, icon: string | null }>, recruit_roles: Array<{ __typename?: 'MakerRole', id: number, title: string, icon: string, level: RoleLevelEnum }> } } | null };
+export type GetTournamentsToRegisterQueryVariables = Exact<{ [key: string]: never; }>;
+
+
+export type GetTournamentsToRegisterQuery = { __typename?: 'Query', getTournamentToRegister: Array<{ __typename?: 'Tournament', id: number, title: string }> };
+
export type ProjectDetailsQueryVariables = Exact<{
projectId: Scalars['Int'];
}>;
@@ -2561,6 +2567,41 @@ export function useUpdateProjectMutation(baseOptions?: Apollo.MutationHookOption
export type UpdateProjectMutationHookResult = ReturnType;
export type UpdateProjectMutationResult = Apollo.MutationResult;
export type UpdateProjectMutationOptions = Apollo.BaseMutationOptions;
+export const GetTournamentsToRegisterDocument = gql`
+ query GetTournamentsToRegister {
+ getTournamentToRegister {
+ id
+ title
+ }
+}
+ `;
+
+/**
+ * __useGetTournamentsToRegisterQuery__
+ *
+ * To run a query within a React component, call `useGetTournamentsToRegisterQuery` and pass it any options that fit your needs.
+ * When your component renders, `useGetTournamentsToRegisterQuery` returns an object from Apollo Client that contains loading, error, and data properties
+ * you can use to render your UI.
+ *
+ * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
+ *
+ * @example
+ * const { data, loading, error } = useGetTournamentsToRegisterQuery({
+ * variables: {
+ * },
+ * });
+ */
+export function useGetTournamentsToRegisterQuery(baseOptions?: Apollo.QueryHookOptions) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useQuery(GetTournamentsToRegisterDocument, options);
+ }
+export function useGetTournamentsToRegisterLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useLazyQuery(GetTournamentsToRegisterDocument, options);
+ }
+export type GetTournamentsToRegisterQueryHookResult = ReturnType;
+export type GetTournamentsToRegisterLazyQueryHookResult = ReturnType;
+export type GetTournamentsToRegisterQueryResult = Apollo.QueryResult;
export const ProjectDetailsDocument = gql`
query ProjectDetails($projectId: Int!) {
getProject(id: $projectId) {