From 84a7c439aaf39b2c11ed7a00fca6782352c43e3f Mon Sep 17 00:00:00 2001 From: Volodymyr Smolianinov Date: Fri, 15 Nov 2024 20:27:37 +0100 Subject: [PATCH] Medals --- src/index.tsx | 216 ++++++++++++++++++++++++++++++++++++++ src/operations/medals.gql | 106 +++++++++++++++++++ 2 files changed, 322 insertions(+) create mode 100644 src/operations/medals.gql diff --git a/src/index.tsx b/src/index.tsx index 408c09a..ddf63cd 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2942,6 +2942,52 @@ export type GetVideoMakePercentageIntervalsQuery = { }>; }; +export type GetMedalsQueryVariables = Exact<{ + scope: MedalScope; + userId?: InputMaybe; +}>; + +export type GetMedalsQuery = { + __typename?: "Query"; + getMedals: { + __typename?: "RequestedMedalsGQL"; + dayStreak2?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak3?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak4?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak5?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak6?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak7?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak14?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak21?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak30?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak60?: { __typename?: "MedalGQL"; count: number } | null; + dayStreak90?: { __typename?: "MedalGQL"; count: number } | null; + distanceOver66?: { __typename?: "MedalGQL"; count: number } | null; + distanceOver78?: { __typename?: "MedalGQL"; count: number } | null; + distanceOver90?: { __typename?: "MedalGQL"; count: number } | null; + runLength3?: { __typename?: "MedalGQL"; count: number } | null; + runLength5?: { __typename?: "MedalGQL"; count: number } | null; + runLength8?: { __typename?: "MedalGQL"; count: number } | null; + runLength10?: { __typename?: "MedalGQL"; count: number } | null; + runLength15?: { __typename?: "MedalGQL"; count: number } | null; + runLength20?: { __typename?: "MedalGQL"; count: number } | null; + runLength25?: { __typename?: "MedalGQL"; count: number } | null; + runLength30?: { __typename?: "MedalGQL"; count: number } | null; + runLength40?: { __typename?: "MedalGQL"; count: number } | null; + runLength50?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes25?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes50?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes75?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes100?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes200?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes300?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes400?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes500?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes750?: { __typename?: "MedalGQL"; count: number } | null; + totalMakes1000?: { __typename?: "MedalGQL"; count: number } | null; + }; +}; + export type GetSerializedShotPathsQueryVariables = Exact<{ filterInput: FilterInput; }>; @@ -4766,6 +4812,176 @@ export type GetVideoMakePercentageIntervalsQueryResult = Apollo.QueryResult< GetVideoMakePercentageIntervalsQuery, GetVideoMakePercentageIntervalsQueryVariables >; +export const GetMedalsDocument = gql` + query getMedals($scope: MedalScope!, $userId: Int) { + getMedals(scope: $scope, userId: $userId) { + dayStreak2 { + count + } + dayStreak3 { + count + } + dayStreak4 { + count + } + dayStreak5 { + count + } + dayStreak6 { + count + } + dayStreak7 { + count + } + dayStreak14 { + count + } + dayStreak21 { + count + } + dayStreak30 { + count + } + dayStreak60 { + count + } + dayStreak90 { + count + } + distanceOver66 { + count + } + distanceOver78 { + count + } + distanceOver90 { + count + } + runLength3 { + count + } + runLength5 { + count + } + runLength8 { + count + } + runLength10 { + count + } + runLength15 { + count + } + runLength20 { + count + } + runLength25 { + count + } + runLength30 { + count + } + runLength40 { + count + } + runLength50 { + count + } + totalMakes25 { + count + } + totalMakes50 { + count + } + totalMakes75 { + count + } + totalMakes100 { + count + } + totalMakes200 { + count + } + totalMakes300 { + count + } + totalMakes400 { + count + } + totalMakes500 { + count + } + totalMakes750 { + count + } + totalMakes1000 { + count + } + } + } +`; + +/** + * __useGetMedalsQuery__ + * + * To run a query within a React component, call `useGetMedalsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetMedalsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetMedalsQuery({ + * variables: { + * scope: // value for 'scope' + * userId: // value for 'userId' + * }, + * }); + */ +export function useGetMedalsQuery( + baseOptions: Apollo.QueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + GetMedalsDocument, + options, + ); +} +export function useGetMedalsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetMedalsQuery, + GetMedalsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + GetMedalsDocument, + options, + ); +} +export function useGetMedalsSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetMedalsQuery, + GetMedalsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery( + GetMedalsDocument, + options, + ); +} +export type GetMedalsQueryHookResult = ReturnType; +export type GetMedalsLazyQueryHookResult = ReturnType< + typeof useGetMedalsLazyQuery +>; +export type GetMedalsSuspenseQueryHookResult = ReturnType< + typeof useGetMedalsSuspenseQuery +>; +export type GetMedalsQueryResult = Apollo.QueryResult< + GetMedalsQuery, + GetMedalsQueryVariables +>; export const GetSerializedShotPathsDocument = gql` query GetSerializedShotPaths($filterInput: FilterInput!) { getShots(filterInput: $filterInput) { diff --git a/src/operations/medals.gql b/src/operations/medals.gql new file mode 100644 index 0000000..85336f1 --- /dev/null +++ b/src/operations/medals.gql @@ -0,0 +1,106 @@ +query getMedals($scope: MedalScope!, $userId: Int) { + getMedals(scope: $scope, userId: $userId) { + dayStreak2 { + count + } + dayStreak3 { + count + } + dayStreak4 { + count + } + dayStreak5 { + count + } + dayStreak6 { + count + } + dayStreak7 { + count + } + dayStreak14 { + count + } + dayStreak21 { + count + } + dayStreak30 { + count + } + dayStreak60 { + count + } + dayStreak90 { + count + } + distanceOver66 { + count + } + distanceOver78 { + count + } + distanceOver90 { + count + } + runLength3 { + count + } + runLength5 { + count + } + runLength8 { + count + } + runLength10 { + count + } + runLength15 { + count + } + runLength20 { + count + } + runLength25 { + count + } + runLength30 { + count + } + runLength40 { + count + } + runLength50 { + count + } + totalMakes25 { + count + } + totalMakes50 { + count + } + totalMakes75 { + count + } + totalMakes100 { + count + } + totalMakes200 { + count + } + totalMakes300 { + count + } + totalMakes400 { + count + } + totalMakes500 { + count + } + totalMakes750 { + count + } + totalMakes1000 { + count + } + } +}