@@ -19,11 +19,16 @@ import { useRouter } from 'next/navigation'
1919import { useEffect , useState } from 'react'
2020import FontAwesomeIconWrapper from 'wrappers/FontAwesomeIconWrapper'
2121import { ErrorDisplay , handleAppError } from 'app/global-error'
22- import { GET_PROJECT_METADATA , GET_TOP_CONTRIBUTORS } from 'server/queries/projectQueries'
23- import { GET_LEADER_DATA } from 'server/queries/userQueries'
24- import type { Contributor } from 'types/contributor'
25- import type { Project } from 'types/project'
26- import type { User } from 'types/user'
22+ import {
23+ GetProjectMetadataDocument ,
24+ GetProjectMetadataQuery ,
25+ GetTopContributorsDocument ,
26+ GetTopContributorsQuery ,
27+ } from 'types/__generated__/projectQueries.generated'
28+ import {
29+ GetLeaderDataDocument ,
30+ GetLeaderDataQuery ,
31+ } from 'types/__generated__/userQueries.generated'
2732import { aboutText , technologies } from 'utils/aboutData'
2833import AnchorTitle from 'components/AnchorTitle'
2934import AnimatedCounter from 'components/AnimatedCounter'
@@ -42,14 +47,14 @@ const projectKey = 'nest'
4247
4348const About = ( ) => {
4449 const { data : projectMetadataResponse , error : projectMetadataRequestError } = useQuery (
45- GET_PROJECT_METADATA ,
50+ GetProjectMetadataDocument ,
4651 {
4752 variables : { key : projectKey } ,
4853 }
4954 )
5055
5156 const { data : topContributorsResponse , error : topContributorsRequestError } = useQuery (
52- GET_TOP_CONTRIBUTORS ,
57+ GetTopContributorsDocument ,
5358 {
5459 variables : {
5560 excludedUsernames : Object . keys ( leaders ) ,
@@ -60,8 +65,12 @@ const About = () => {
6065 }
6166 )
6267
63- const [ projectMetadata , setProjectMetadata ] = useState < Project | null > ( null )
64- const [ topContributors , setTopContributors ] = useState < Contributor [ ] > ( [ ] )
68+ const [ projectMetadata , setProjectMetadata ] = useState < GetProjectMetadataQuery [ 'project' ] | null > (
69+ null
70+ )
71+ const [ topContributors , setTopContributors ] = useState <
72+ GetTopContributorsQuery [ 'topContributors' ]
73+ > ( [ ] )
6574
6675 useEffect ( ( ) => {
6776 if ( projectMetadataResponse ?. project ) {
@@ -247,7 +256,7 @@ const About = () => {
247256}
248257
249258const LeaderData = ( { username } : { username : string } ) => {
250- const { data, loading, error } = useQuery ( GET_LEADER_DATA , {
259+ const { data, loading, error } = useQuery ( GetLeaderDataDocument , {
251260 variables : { key : username } ,
252261 } )
253262 const router = useRouter ( )
@@ -261,7 +270,7 @@ const LeaderData = ({ username }: { username: string }) => {
261270 return < p > No data available for { username } </ p >
262271 }
263272
264- const handleButtonClick = ( user : User ) => {
273+ const handleButtonClick = ( user : GetLeaderDataQuery [ 'user' ] ) => {
265274 router . push ( `/members/${ user . login } ` )
266275 }
267276
0 commit comments