diff --git a/api/functions/graphql/nexus-typegen.ts b/api/functions/graphql/nexus-typegen.ts index 9339d01..78a7cfd 100644 --- a/api/functions/graphql/nexus-typegen.ts +++ b/api/functions/graphql/nexus-typegen.ts @@ -377,6 +377,7 @@ export interface NexusGenFieldTypes { author: NexusGenRootTypes['Author']; // Author! body: string; // String! comments: NexusGenRootTypes['PostComment'][]; // [PostComment!]! + comments_count: number; // Int! cover_image: string | null; // String createdAt: NexusGenScalars['Date']; // Date! excerpt: string; // String! @@ -585,6 +586,7 @@ export interface NexusGenFieldTypeNames { author: 'Author' body: 'String' comments: 'PostComment' + comments_count: 'Int' cover_image: 'String' createdAt: 'Date' excerpt: 'String' diff --git a/api/functions/graphql/schema.graphql b/api/functions/graphql/schema.graphql index 872f9fa..b2994b5 100644 --- a/api/functions/graphql/schema.graphql +++ b/api/functions/graphql/schema.graphql @@ -187,6 +187,7 @@ type Story implements PostBase { author: Author! body: String! comments: [PostComment!]! + comments_count: Int! cover_image: String createdAt: Date! excerpt: String! diff --git a/api/functions/graphql/types/post.js b/api/functions/graphql/types/post.js index ac682ed..76881c6 100644 --- a/api/functions/graphql/types/post.js +++ b/api/functions/graphql/types/post.js @@ -80,21 +80,21 @@ const Story = objectType({ type: "Tag", resolve: (parent) => prisma.story.findUnique({ where: { id: parent.id } }).tags() }); - // t.nonNull.int('comments_count', { - // resolve: async (parent) => { - // const post = await prisma.story.findUnique({ - // where: { id: parent.id }, - // include: { - // _count: { - // select: { - // comments: true - // } - // } - // } - // }) - // return post._count.comments; - // } - // }); + t.nonNull.int('comments_count', { + resolve: async (parent) => { + const post = await prisma.story.findUnique({ + where: { id: parent.id }, + include: { + _count: { + select: { + comments: true + } + } + } + }) + return post._count.comments; + } + }); t.nonNull.field('author', { type: "Author", resolve: (parent) => diff --git a/src/Components/Button/Button.tsx b/src/Components/Button/Button.tsx index 6b1b7ab..2c58f20 100644 --- a/src/Components/Button/Button.tsx +++ b/src/Components/Button/Button.tsx @@ -1,7 +1,7 @@ import React, { ReactNode } from 'react'; import { UnionToObjectKeys } from 'src/utils/types/utils'; import { Link } from 'react-router-dom' -import { FallingLines, LineWave, TailSpin } from 'react-loader-spinner'; +import { TailSpin } from 'react-loader-spinner'; type Props = { color?: 'primary' | 'red' | 'white' | 'gray' | "black" | 'none', @@ -107,8 +107,10 @@ const Button = React.forwardRef(({ color = 'white', disabled={disabled} {...props} > - {children} - {isLoading &&
+ + {children} + + {isLoading &&
{loadingText ?? - -

- Bolt fun logo -

- - + Guide + + +
  • + + Donate + +
  • + -
    +
    - + - {/* */} - {/* {isWalletConnected ? + {/* {isWalletConnected ? : } */} - {currentSection === 'products' && - - } - - {curUser !== undefined && - (curUser ? - }> - { - e.syntheticEvent.preventDefault(); - navigate(createRoute({ type: 'profile', id: curUser.id, username: curUser.name })); - }} - className='!p-16 font-medium flex gap-16 hover:bg-gray-100 !rounded-12' - > - Profile - - { - e.syntheticEvent.preventDefault(); - navigate("/logout"); - }} - className='!p-16 font-medium flex gap-16 hover:bg-gray-100 !rounded-12' - > - Logout - - - - : - - ) - } -
    - - setSearchOpen(false)} - onResultClick={() => setSearchOpen(false)} - /> + {currentSection === 'products' && + + } + {curUser !== undefined && + (curUser ? + }> + { + e.syntheticEvent.preventDefault(); + navigate(createRoute({ type: 'profile', id: curUser.id, username: curUser.name })); + }} + className='!p-16 font-medium flex gap-16 hover:bg-gray-100 !rounded-12' + > + Profile + + { + e.syntheticEvent.preventDefault(); + navigate("/logout"); + }} + className='!p-16 font-medium flex gap-16 hover:bg-gray-100 !rounded-12' + > + Logout + + + + : + + ) + } +
    + + setSearchOpen(false)} + onResultClick={() => setSearchOpen(false)} + /> + +
    ); diff --git a/src/Components/Navbar/NavMobile.tsx b/src/Components/Navbar/NavMobile.tsx index 40ca731..a7dbd10 100644 --- a/src/Components/Navbar/NavMobile.tsx +++ b/src/Components/Navbar/NavMobile.tsx @@ -74,45 +74,47 @@ export default function NavMobile() { return (
    -