Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions packages/shared/src/graphql/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserStreak> => {
const res = await gqlClient.request(USER_STREAK_QUERY);

Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,23 @@ export const UserPostsAnalyticsTable = ({
type={TypographyType.Callout}
color={TypographyColor.Primary}
>
{largeNumberFormat(post.reputation)}
{largeNumberFormat(post.analytics?.reputation ?? 0)}
</Typography>
</td>
<td className="py-3 text-right">
<Typography
type={TypographyType.Callout}
color={TypographyColor.Primary}
>
{largeNumberFormat(post.impressions)}
{largeNumberFormat(post.analytics?.impressions ?? 0)}
</Typography>
</td>
<td className="py-3 text-right">
<Typography
type={TypographyType.Callout}
color={TypographyColor.Primary}
>
{largeNumberFormat(post.upvotes)}
{largeNumberFormat(post.analytics?.upvotes ?? 0)}
</Typography>
</td>
</tr>
Expand Down