diff --git a/packages/shared/src/graphql/users.ts b/packages/shared/src/graphql/users.ts index 5e4ae1dac6..c67c83f282 100644 --- a/packages/shared/src/graphql/users.ts +++ b/packages/shared/src/graphql/users.ts @@ -616,18 +616,6 @@ export interface UserPostsAnalyticsHistoryNode { impressionsAds: number; } -export interface UserPostWithAnalytics { - id: string; - title: string | null; - image: string | null; - createdAt: string; - impressions: number; - upvotes: number; - reputation: number; - isBoosted: boolean; - commentsPermalink: string; -} - export const getReadingStreak = async (): Promise => { const res = await gqlClient.request(USER_STREAK_QUERY); @@ -959,6 +947,20 @@ export const USER_POSTS_ANALYTICS_HISTORY_QUERY = gql` } `; +export interface UserPostWithAnalytics { + id: string; + title: string | null; + image: string | null; + createdAt: string; + commentsPermalink: string; + isBoosted: boolean; + analytics: { + impressions: number; + upvotes: number; + reputation: number; + } | null; +} + export const USER_POSTS_WITH_ANALYTICS_QUERY = gql` query UserPostsWithAnalytics($after: String, $first: Int) { userPostsWithAnalytics(after: $after, first: $first) { @@ -969,11 +971,12 @@ export const USER_POSTS_WITH_ANALYTICS_QUERY = gql` title image createdAt - impressions - upvotes - reputation - isBoosted commentsPermalink + analytics { + impressions + upvotes + reputation + } } } pageInfo { diff --git a/packages/webapp/components/analytics/AnalyticsEmptyState.tsx b/packages/webapp/components/analytics/AnalyticsEmptyState.tsx index 9549f88fc1..96ee35f060 100644 --- a/packages/webapp/components/analytics/AnalyticsEmptyState.tsx +++ b/packages/webapp/components/analytics/AnalyticsEmptyState.tsx @@ -5,12 +5,12 @@ import { TypographyColor, TypographyType, } from '@dailydotdev/shared/src/components/typography/Typography'; +import { link } from '@dailydotdev/shared/src/lib'; import { Button, ButtonVariant, } from '@dailydotdev/shared/src/components/buttons/Button'; import { PlusIcon } from '@dailydotdev/shared/src/components/icons'; -import { link } from '@dailydotdev/shared/src/lib/links'; import Link from '@dailydotdev/shared/src/components/utilities/Link'; export const AnalyticsEmptyState = (): ReactElement => { diff --git a/packages/webapp/components/analytics/UserPostsAnalyticsTable.tsx b/packages/webapp/components/analytics/UserPostsAnalyticsTable.tsx index 2c2d7979d5..dc99ef85dc 100644 --- a/packages/webapp/components/analytics/UserPostsAnalyticsTable.tsx +++ b/packages/webapp/components/analytics/UserPostsAnalyticsTable.tsx @@ -152,7 +152,7 @@ export const UserPostsAnalyticsTable = ({ type={TypographyType.Callout} color={TypographyColor.Primary} > - {largeNumberFormat(post.reputation)} + {largeNumberFormat(post.analytics?.reputation ?? 0)} @@ -160,7 +160,7 @@ export const UserPostsAnalyticsTable = ({ type={TypographyType.Callout} color={TypographyColor.Primary} > - {largeNumberFormat(post.impressions)} + {largeNumberFormat(post.analytics?.impressions ?? 0)} @@ -168,7 +168,7 @@ export const UserPostsAnalyticsTable = ({ type={TypographyType.Callout} color={TypographyColor.Primary} > - {largeNumberFormat(post.upvotes)} + {largeNumberFormat(post.analytics?.upvotes ?? 0)}