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 <noreply@anthropic.com>
This commit is contained in:
Dean Wenstrand
2026-06-05 14:04:33 -07:00
parent 9250e4c639
commit d59e21c10e
2 changed files with 179 additions and 0 deletions

View File

@@ -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"]> | 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<GetVideoCardQuery, GetVideoCardQueryVariables>(
GetVideoCardDocument,
options,
);
}
export function useGetVideoCardLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
GetVideoCardQuery,
GetVideoCardQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<GetVideoCardQuery, GetVideoCardQueryVariables>(
GetVideoCardDocument,
options,
);
}
export function useGetVideoCardSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
GetVideoCardQuery,
GetVideoCardQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<GetVideoCardQuery, GetVideoCardQueryVariables>(
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) {

View File

@@ -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