From d59e21c10e05e80a3fd732ee29371e839571a58e Mon Sep 17 00:00:00 2001 From: Dean Wenstrand Date: Fri, 5 Jun 2026 14:04:33 -0700 Subject: [PATCH] Add GetVideoCard query (single-video VideoCardFields) Returns the full VideoCardFields fragment for one video id, so the session-detail meta header can share one source of truth (and the normalized Apollo cache) with the feed card instead of stitching together GetVideoDetails + GetVideoSocialDetailsById. Co-Authored-By: Claude Opus 4.8 --- src/index.tsx | 170 +++++++++++++++++++++++++++++++++++++++ src/operations/video.gql | 9 +++ 2 files changed, 179 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index dfb9d8e..b567b09 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -6140,6 +6140,102 @@ export type GetVideoSocialDetailsByIdQuery = { }; }; +export type GetVideoCardQueryVariables = Exact<{ + videoId: Scalars["Int"]["input"]; +}>; + +export type GetVideoCardQuery = { + __typename?: "Query"; + getVideo: { + __typename?: "VideoGQL"; + id: number; + name?: string | null; + screenshotUri?: string | null; + totalShots: number; + makePercentage: number; + averageTimeBetweenShots?: number | null; + averageDifficulty?: number | null; + startTime?: any | null; + private: boolean; + elapsedTime?: number | null; + tableSize: number; + pocketSize?: number | null; + owner?: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + } | null; + stream?: { + __typename?: "UploadStreamGQL"; + id: string; + lastIntendedSegmentBound?: number | null; + streamSegmentType: StreamSegmentTypeEnum; + } | null; + tags: Array<{ + __typename?: "VideoTag"; + name: string; + tagClasses: Array<{ __typename?: "VideoTagClass"; name: string }>; + }>; + playerSummaries: Array<{ + __typename?: "PlayerSummaryGQL"; + clusterId: number; + userId?: number | null; + username?: string | null; + profileImageUri?: string | null; + representativeFullFrameUrl?: string | null; + totalShots: number; + totalShotsMade: number; + makePercentage: number; + score?: number | null; + longestRun: number; + averageDifficulty?: number | null; + averageTimeBetweenShots?: number | null; + }>; + currentProcessing?: { + __typename?: "VideoProcessingGQL"; + id: number; + status: ProcessingStatusEnum; + } | null; + reactions: Array<{ + __typename?: "ReactionGQL"; + videoId: number; + reaction: ReactionEnum; + user: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + isFollowedByCurrentUser?: boolean | null; + }; + }>; + comments: Array<{ + __typename?: "CommentGQL"; + id: number; + message: string; + user: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + isFollowedByCurrentUser?: boolean | null; + }; + replies: Array<{ + __typename?: "CommentGQL"; + id: number; + message: string; + user: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + isFollowedByCurrentUser?: boolean | null; + }; + }>; + }>; + }; +}; + export type GetVideosQueryVariables = Exact<{ videoIds: Array | Scalars["Int"]["input"]; }>; @@ -12994,6 +13090,80 @@ export type GetVideoSocialDetailsByIdQueryResult = Apollo.QueryResult< GetVideoSocialDetailsByIdQuery, GetVideoSocialDetailsByIdQueryVariables >; +export const GetVideoCardDocument = gql` + query GetVideoCard($videoId: Int!) { + getVideo(videoId: $videoId) { + ...VideoCardFields + } + } + ${VideoCardFieldsFragmentDoc} +`; + +/** + * __useGetVideoCardQuery__ + * + * To run a query within a React component, call `useGetVideoCardQuery` and pass it any options that fit your needs. + * When your component renders, `useGetVideoCardQuery` 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 } = useGetVideoCardQuery({ + * variables: { + * videoId: // value for 'videoId' + * }, + * }); + */ +export function useGetVideoCardQuery( + baseOptions: Apollo.QueryHookOptions< + GetVideoCardQuery, + GetVideoCardQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + GetVideoCardDocument, + options, + ); +} +export function useGetVideoCardLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetVideoCardQuery, + GetVideoCardQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + GetVideoCardDocument, + options, + ); +} +export function useGetVideoCardSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetVideoCardQuery, + GetVideoCardQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery( + GetVideoCardDocument, + options, + ); +} +export type GetVideoCardQueryHookResult = ReturnType< + typeof useGetVideoCardQuery +>; +export type GetVideoCardLazyQueryHookResult = ReturnType< + typeof useGetVideoCardLazyQuery +>; +export type GetVideoCardSuspenseQueryHookResult = ReturnType< + typeof useGetVideoCardSuspenseQuery +>; +export type GetVideoCardQueryResult = Apollo.QueryResult< + GetVideoCardQuery, + GetVideoCardQueryVariables +>; export const GetVideosDocument = gql` query GetVideos($videoIds: [Int!]!) { getVideos(videoIds: $videoIds) { diff --git a/src/operations/video.gql b/src/operations/video.gql index bbf0c46..ce6c463 100644 --- a/src/operations/video.gql +++ b/src/operations/video.gql @@ -139,6 +139,15 @@ query GetVideoSocialDetailsById($videoId: Int!) { } } +# Full card payload for a single video — reuses the same VideoCardFields +# fragment the feed list uses, so the session-detail meta header shares one +# source of truth (and the normalized Apollo cache) with the feed card. +query GetVideoCard($videoId: Int!) { + getVideo(videoId: $videoId) { + ...VideoCardFields + } +} + query GetVideos($videoIds: [Int!]!) { getVideos(videoIds: $videoIds) { ...VideoStreamMetadata