feat: add shock the web section

This commit is contained in:
MTG2000
2022-03-28 19:38:16 +03:00
parent 501ce08f05
commit 1ce0ca3964
3 changed files with 17 additions and 3 deletions

View File

@@ -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 {

View File

@@ -14,18 +14,24 @@ export default function ProjectsSection() {
{Array(3).fill(0).map((_, idx) => <ProjectsRowSkeleton key={idx} />)}
</div>;
const shockTheWebCategory = data.allCategories.find(c => c.id === 11);
const restCategories = data.allCategories.filter(c => c.id !== 11)
return (
<div className='mt-32 lg:mt-48'>
<ProjectsRow title={shockTheWebCategory?.title}
categoryId={shockTheWebCategory?.id!}
projects={shockTheWebCategory?.project!} />
<ProjectsRow title={<><span className="align-middle mr-8">Newest</span> <MdLocalFireDepartment className='inline-block text-fire scale-125 ' /></>}
categoryId={0}
projects={data.newProjects} />
{data.allCategories.map(({ id, title, project, }) => {
{restCategories.map(({ id, title, project, }) => {
if (project)
return <ProjectsRow
key={id}
categoryId={id}
title={title}
projects={project.map(p => ({ ...p, category: { id, title } }))} />
projects={project} />
else return null
})}
</div>

View File

@@ -7,6 +7,10 @@ query ExploreProjects {
thumbnail_image
title
votes_count
category {
title
id
}
}
}
newProjects {