Skip to content

Commit 082c686

Browse files
committed
feat: add 'Stars today' metric to GitHub cards and feed items
1 parent 6d91884 commit 082c686

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

src/features/cards/components/githubCard/GithubCard.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ export function GithubCard(props: CardPropsType) {
9393
value: 'stars_count',
9494
icon: <VscStarFull />,
9595
},
96+
{
97+
label: 'Stars today',
98+
value: 'stars_in_range',
99+
icon: <VscStarFull />,
100+
},
96101
{
97102
label: 'Forks',
98103
value: 'forks_count',

src/features/cards/components/githubCard/RepoItem.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ const RepoItem = ({ item, selectedTag, analyticsTag }: BaseItemPropsType<Reposit
4242
<VscStarFull className="rowItemIcon" /> {numberWithCommas(item.stars_count)} stars
4343
</span>
4444
)}
45+
{item.stars_in_range && (
46+
<span className="rowItem">
47+
<VscStarFull className="rowItemIcon" />{' '}
48+
{numberWithCommas(item.stars_in_range || 0)} stars today
49+
</span>
50+
)}
4551
{item.forks_count && (
4652
<span className="rowItem">
4753
<VscRepoForked className="rowItemIcon" /> {numberWithCommas(item.forks_count)}{' '}

src/features/feed/components/feedItems/RepoFeedItem.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ export const RepoFeedItem = (props: BaseItemPropsType<GithubFeedItemData>) => {
5454
stars
5555
</span>
5656
)}
57+
{item.stars_in_range && (
58+
<span className="rowItem">
59+
<VscStarFull className="rowItemIcon" />{' '}
60+
{numberWithCommas(item.stars_in_range || 0)} stars today
61+
</span>
62+
)}
5763
<span className="rowItem">
5864
<VscRepoForked className="rowItemIcon" /> {numberWithCommas(item?.forks || 0)}{' '}
5965
forks

src/types/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export type ProductHuntFeedItemData = FeedItem & {
7575
export type GithubFeedItemData = FeedItem & {
7676
type: 'github'
7777
stars: number
78+
stars_in_range: number
7879
forks: number
7980
programmingLanguage: string
8081
description?: string
@@ -98,7 +99,7 @@ export type Repository = BaseEntry & {
9899
description: string
99100
owner: string
100101
forks_count: number
101-
starsInDateRange?: number
102+
stars_in_range: number
102103
name: string
103104
}
104105

0 commit comments

Comments
 (0)