From 1ce0ca396407a14483f2c0baaec45c888fa3b9cf Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Mon, 28 Mar 2022 19:38:16 +0300 Subject: [PATCH] feat: add shock the web section --- src/graphql/index.tsx | 6 +++++- .../ExplorePage/ProjectsSection/ProjectsSection.tsx | 10 ++++++++-- .../ProjectsSection/exploreProjects.graphql | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/graphql/index.tsx b/src/graphql/index.tsx index 1bd759e..65508c4 100644 --- a/src/graphql/index.tsx +++ b/src/graphql/index.tsx @@ -182,7 +182,7 @@ export type AllCategoriesQuery = { __typename?: 'Query', allCategories: Array<{ export type ExploreProjectsQueryVariables = Exact<{ [key: string]: never; }>; -export type ExploreProjectsQuery = { __typename?: 'Query', allCategories: Array<{ __typename?: 'Category', id: number, title: string, project: Array<{ __typename?: 'Project', id: number, thumbnail_image: string, title: string, votes_count: number }> }>, newProjects: Array<{ __typename?: 'Project', id: number, title: string, thumbnail_image: string, votes_count: number, category: { __typename?: 'Category', title: string, id: number } }> }; +export type ExploreProjectsQuery = { __typename?: 'Query', allCategories: Array<{ __typename?: 'Category', id: number, title: string, project: Array<{ __typename?: 'Project', id: number, thumbnail_image: string, title: string, votes_count: number, category: { __typename?: 'Category', title: string, id: number } }> }>, newProjects: Array<{ __typename?: 'Project', id: number, title: string, thumbnail_image: string, votes_count: number, category: { __typename?: 'Category', title: string, id: number } }> }; export type HottestProjectsQueryVariables = Exact<{ [key: string]: never; }>; @@ -384,6 +384,10 @@ export const ExploreProjectsDocument = gql` thumbnail_image title votes_count + category { + title + id + } } } newProjects { diff --git a/src/pages/ExplorePage/ProjectsSection/ProjectsSection.tsx b/src/pages/ExplorePage/ProjectsSection/ProjectsSection.tsx index ebf54a8..079c372 100644 --- a/src/pages/ExplorePage/ProjectsSection/ProjectsSection.tsx +++ b/src/pages/ExplorePage/ProjectsSection/ProjectsSection.tsx @@ -14,18 +14,24 @@ export default function ProjectsSection() { {Array(3).fill(0).map((_, idx) => )} ; + const shockTheWebCategory = data.allCategories.find(c => c.id === 11); + const restCategories = data.allCategories.filter(c => c.id !== 11) + return (
+ Newest } categoryId={0} projects={data.newProjects} /> - {data.allCategories.map(({ id, title, project, }) => { + {restCategories.map(({ id, title, project, }) => { if (project) return ({ ...p, category: { id, title } }))} /> + projects={project} /> else return null })}
diff --git a/src/pages/ExplorePage/ProjectsSection/exploreProjects.graphql b/src/pages/ExplorePage/ProjectsSection/exploreProjects.graphql index 45876d5..9e33383 100644 --- a/src/pages/ExplorePage/ProjectsSection/exploreProjects.graphql +++ b/src/pages/ExplorePage/ProjectsSection/exploreProjects.graphql @@ -7,6 +7,10 @@ query ExploreProjects { thumbnail_image title votes_count + category { + title + id + } } } newProjects {