Skip to content

Commit 9332f2e

Browse files
committed
refactor: clean up Tag type by removing unused values and update Article and Repository types for consistency
1 parent 011639e commit 9332f2e

4 files changed

Lines changed: 15 additions & 35 deletions

File tree

src/features/remoteConfig/stores/remoteConfig.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ export const useRemoteConfigStore = create(
2727
{
2828
value: 'javascript',
2929
label: 'Javascript',
30-
githubValues: ['javascript'],
31-
confsValues: ['javascript'],
32-
devtoValues: ['javascript'],
33-
hashnodeValues: ['javascript'],
34-
mediumValues: ['javascript'],
35-
redditValues: ['javascript'],
36-
freecodecampValues: ['javascript'],
3730
},
3831
],
3932
setRemoteConfig: (remoteConfig: RemoteConfig) =>

src/features/remoteConfig/types/index.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
11
export type Tag = {
2-
confsValues: string[]
3-
devtoValues: string[]
4-
hashnodeValues: string[]
5-
redditValues: string[]
6-
githubValues: string[]
7-
freecodecampValues: string[]
8-
mediumValues: string[]
92
label: string
103
value: string
114
}
125

13-
export type TagValuesFieldType =
14-
| 'confsValues'
15-
| 'devtoValues'
16-
| 'hashnodeValues'
17-
| 'redditValues'
18-
| 'githubValues'
19-
| 'freecodecampValues'
20-
| 'mediumValues'
21-
226
export type RemoteConfig = {
237
supportedTags: Tag[]
248
marketingBannerConfig?: any

src/stores/preferences.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type UserPreferencesStoreActions = {
4040
setOpenLinksNewTab: (openLinksNewTab: boolean) => void
4141
setListingMode: (listingMode: ListingMode) => void
4242
setCards: (selectedCards: SelectedCard[]) => void
43+
removeCard: (cardName: string) => void
4344
setTags: (selectedTags: Tag[]) => void
4445
setMaxVisibleCards: (maxVisibleCards: number) => void
4546
setCardSettings: (card: string, settings: CardSettingsType) => void
@@ -117,13 +118,6 @@ export const useUserPreferences = create(
117118
{
118119
value: 'javascript',
119120
label: 'Javascript',
120-
githubValues: ['javascript'],
121-
confsValues: ['javascript'],
122-
devtoValues: ['javascript'],
123-
hashnodeValues: ['javascript'],
124-
mediumValues: ['javascript'],
125-
redditValues: ['javascript'],
126-
freecodecampValues: ['javascript'],
127121
},
128122
],
129123
layout: 'cards',
@@ -212,6 +206,12 @@ export const useUserPreferences = create(
212206
}
213207
}),
214208
setAdvStatus: (status) => set({ advStatus: status }),
209+
removeCard: (cardName: string) =>
210+
set((state) => {
211+
return {
212+
cards: state.cards.filter((card) => card.name !== cardName),
213+
}
214+
}),
215215
}),
216216
{
217217
name: 'preferences_storage',

src/types/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ export type BaseEntry = {
3737
export type Article = BaseEntry & {
3838
published_at: number
3939
tags: Array<string>
40-
reactions: number
41-
comments: number
40+
points_count: number
41+
comments_count: number
42+
votes_count: number
4243
image_url: string
44+
tagline?: string
4345
source: string
4446
original_url?: string
4547
comments_url?: string
@@ -91,12 +93,12 @@ export type FeedItemData =
9193
| AdFeedItemData
9294

9395
export type Repository = BaseEntry & {
94-
programmingLanguage: string
95-
stars: number
96+
technology: string
97+
stars_count: number
9698
source: string
9799
description: string
98100
owner: string
99-
forks: number
101+
forks_count: number
100102
starsInDateRange?: number
101103
name: string
102104
}
@@ -143,6 +145,7 @@ export type BaseItemPropsType<
143145

144146
export type CardSettingsType = {
145147
language: string
148+
sortBy: string
146149
dateRange?: string
147150
}
148151

0 commit comments

Comments
 (0)