From b53aa172faace54056d555f85eec4ce596570a16 Mon Sep 17 00:00:00 2001 From: Loewy <loewymalkov@gmail.com> Date: Fri, 4 Apr 2025 12:18:20 -0700 Subject: [PATCH 1/3] Add reactions mutation to operations --- src/index.tsx | 59 ++++++++++++++++++++++++++++++++++++ src/operations/reactions.gql | 3 ++ 2 files changed, 62 insertions(+) create mode 100644 src/operations/reactions.gql diff --git a/src/index.tsx b/src/index.tsx index 803f048..b9da9cb 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3528,6 +3528,16 @@ export type GetMedalsQuery = { }; }; +export type ReactToVideoMutationVariables = Exact<{ + videoId: Scalars["Int"]["input"]; + reaction?: InputMaybe<ReactionEnum>; +}>; + +export type ReactToVideoMutation = { + __typename?: "Mutation"; + reactToVideo: boolean; +}; + export type GetRunsForHighlightsQueryVariables = Exact<{ filterInput: RunFilterInput; runIds?: InputMaybe<Array<Scalars["Int"]["input"]> | Scalars["Int"]["input"]>; @@ -5931,6 +5941,55 @@ export type GetMedalsQueryResult = Apollo.QueryResult< GetMedalsQuery, GetMedalsQueryVariables >; +export const ReactToVideoDocument = gql` + mutation ReactToVideo($videoId: Int!, $reaction: ReactionEnum) { + reactToVideo(videoId: $videoId, reaction: $reaction) + } +`; +export type ReactToVideoMutationFn = Apollo.MutationFunction< + ReactToVideoMutation, + ReactToVideoMutationVariables +>; + +/** + * __useReactToVideoMutation__ + * + * To run a mutation, you first call `useReactToVideoMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useReactToVideoMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [reactToVideoMutation, { data, loading, error }] = useReactToVideoMutation({ + * variables: { + * videoId: // value for 'videoId' + * reaction: // value for 'reaction' + * }, + * }); + */ +export function useReactToVideoMutation( + baseOptions?: Apollo.MutationHookOptions< + ReactToVideoMutation, + ReactToVideoMutationVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useMutation< + ReactToVideoMutation, + ReactToVideoMutationVariables + >(ReactToVideoDocument, options); +} +export type ReactToVideoMutationHookResult = ReturnType< + typeof useReactToVideoMutation +>; +export type ReactToVideoMutationResult = + Apollo.MutationResult<ReactToVideoMutation>; +export type ReactToVideoMutationOptions = Apollo.BaseMutationOptions< + ReactToVideoMutation, + ReactToVideoMutationVariables +>; export const GetRunsForHighlightsDocument = gql` query GetRunsForHighlights( $filterInput: RunFilterInput! diff --git a/src/operations/reactions.gql b/src/operations/reactions.gql new file mode 100644 index 0000000..d64d39c --- /dev/null +++ b/src/operations/reactions.gql @@ -0,0 +1,3 @@ +mutation ReactToVideo($videoId: Int!, $reaction: ReactionEnum) { + reactToVideo(videoId: $videoId, reaction: $reaction) +} From 85cd37f70ff8883bf53ca13351184f75a9316c34 Mon Sep 17 00:00:00 2001 From: Loewy <loewymalkov@gmail.com> Date: Fri, 4 Apr 2025 12:30:02 -0700 Subject: [PATCH 2/3] add gql to fragment --- src/index.tsx | 26 ++++++++++++++++++++++++++ src/operations/feed.gql | 8 ++++++++ 2 files changed, 34 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index b9da9cb..dfd37eb 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3210,6 +3210,12 @@ export type GetFeedQuery = { status: ProcessingStatusEnum; }>; } | null; + reactions: Array<{ + __typename?: "ReactionGQL"; + videoId: number; + reaction: ReactionEnum; + user: { __typename?: "UserGQL"; id: number; username: string }; + }>; }>; pageInfo: { __typename?: "PageInfoGQL"; @@ -3263,6 +3269,12 @@ export type VideoCardFieldsFragment = { status: ProcessingStatusEnum; }>; } | null; + reactions: Array<{ + __typename?: "ReactionGQL"; + videoId: number; + reaction: ReactionEnum; + user: { __typename?: "UserGQL"; id: number; username: string }; + }>; }; export type GetVideoFeedQueryVariables = Exact<{ @@ -3325,6 +3337,12 @@ export type GetVideoFeedQuery = { status: ProcessingStatusEnum; }>; } | null; + reactions: Array<{ + __typename?: "ReactionGQL"; + videoId: number; + reaction: ReactionEnum; + user: { __typename?: "UserGQL"; id: number; username: string }; + }>; }>; pageInfo: { __typename?: "PageInfoGQL"; @@ -5016,6 +5034,14 @@ export const VideoCardFieldsFragmentDoc = gql` status } } + reactions { + videoId + user { + id + username + } + reaction + } } `; export const MedalFieldsFragmentDoc = gql` diff --git a/src/operations/feed.gql b/src/operations/feed.gql index 0e5b7bd..a077bc9 100644 --- a/src/operations/feed.gql +++ b/src/operations/feed.gql @@ -58,6 +58,14 @@ fragment VideoCardFields on VideoGQL { status } } + reactions { + videoId + user { + id + username + } + reaction + } } query GetVideoFeed( From 31baa2b0960165170b831d922145544f3f32e56e Mon Sep 17 00:00:00 2001 From: Loewy <loewymalkov@gmail.com> Date: Fri, 4 Apr 2025 13:19:42 -0700 Subject: [PATCH 3/3] add profile image uri --- src/index.tsx | 22 +++++++++++++++++++--- src/operations/feed.gql | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index dfd37eb..93b6516 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3214,7 +3214,12 @@ export type GetFeedQuery = { __typename?: "ReactionGQL"; videoId: number; reaction: ReactionEnum; - user: { __typename?: "UserGQL"; id: number; username: string }; + user: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + }; }>; }>; pageInfo: { @@ -3273,7 +3278,12 @@ export type VideoCardFieldsFragment = { __typename?: "ReactionGQL"; videoId: number; reaction: ReactionEnum; - user: { __typename?: "UserGQL"; id: number; username: string }; + user: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + }; }>; }; @@ -3341,7 +3351,12 @@ export type GetVideoFeedQuery = { __typename?: "ReactionGQL"; videoId: number; reaction: ReactionEnum; - user: { __typename?: "UserGQL"; id: number; username: string }; + user: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + }; }>; }>; pageInfo: { @@ -5039,6 +5054,7 @@ export const VideoCardFieldsFragmentDoc = gql` user { id username + profileImageUri } reaction } diff --git a/src/operations/feed.gql b/src/operations/feed.gql index a077bc9..a9c605f 100644 --- a/src/operations/feed.gql +++ b/src/operations/feed.gql @@ -63,6 +63,7 @@ fragment VideoCardFields on VideoGQL { user { id username + profileImageUri } reaction }