@@ -19,11 +19,16 @@ import { useRouter } from 'next/navigation'
19
19
import { useEffect , useState } from 'react'
20
20
import FontAwesomeIconWrapper from 'wrappers/FontAwesomeIconWrapper'
21
21
import { 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'
27
32
import { aboutText , technologies } from 'utils/aboutData'
28
33
import AnchorTitle from 'components/AnchorTitle'
29
34
import AnimatedCounter from 'components/AnimatedCounter'
@@ -42,14 +47,14 @@ const projectKey = 'nest'
42
47
43
48
const About = ( ) => {
44
49
const { data : projectMetadataResponse , error : projectMetadataRequestError } = useQuery (
45
- GET_PROJECT_METADATA ,
50
+ GetProjectMetadataDocument ,
46
51
{
47
52
variables : { key : projectKey } ,
48
53
}
49
54
)
50
55
51
56
const { data : topContributorsResponse , error : topContributorsRequestError } = useQuery (
52
- GET_TOP_CONTRIBUTORS ,
57
+ GetTopContributorsDocument ,
53
58
{
54
59
variables : {
55
60
excludedUsernames : Object . keys ( leaders ) ,
@@ -60,8 +65,12 @@ const About = () => {
60
65
}
61
66
)
62
67
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
+ > ( [ ] )
65
74
66
75
useEffect ( ( ) => {
67
76
if ( projectMetadataResponse ?. project ) {
@@ -247,7 +256,7 @@ const About = () => {
247
256
}
248
257
249
258
const LeaderData = ( { username } : { username : string } ) => {
250
- const { data, loading, error } = useQuery ( GET_LEADER_DATA , {
259
+ const { data, loading, error } = useQuery ( GetLeaderDataDocument , {
251
260
variables : { key : username } ,
252
261
} )
253
262
const router = useRouter ( )
@@ -261,7 +270,7 @@ const LeaderData = ({ username }: { username: string }) => {
261
270
return < p > No data available for { username } </ p >
262
271
}
263
272
264
- const handleButtonClick = ( user : User ) => {
273
+ const handleButtonClick = ( user : GetLeaderDataQuery [ 'user' ] ) => {
265
274
router . push ( `/members/${ user . login } ` )
266
275
}
267
276
0 commit comments