Skip to content

Commit f89655e

Browse files
committed
refactor: replace useGetAIArticles with useGetFeed and update rendering logic in AICard component
1 parent 074305c commit f89655e

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

src/features/cards/components/aiCard/AICard.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
import { Card } from 'src/components/Elements'
22
import { ListComponent } from 'src/components/List'
3-
import { useFeatureFlags } from 'src/stores/featureFlags'
3+
import { FeedItem, useGetFeed } from 'src/features/feed'
44
import { useUserPreferences } from 'src/stores/preferences'
5-
import { CardPropsType, FeedItem } from 'src/types'
6-
import { useGetAIArticles } from '../../api/getAIArticles'
7-
import ArticleItem from './ArticleItem'
8-
9-
const SHOW_PANEL_FEATURE_FLAG = 'ai_panel_shown'
5+
import { CardPropsType, FeedItemData } from 'src/types'
106

117
export function AICard({ meta, withAds }: CardPropsType) {
128
const { userSelectedTags } = useUserPreferences()
13-
const { isDone, markDone } = useFeatureFlags()
149
const {
1510
data: articles,
1611
isLoading,
1712
error,
18-
} = useGetAIArticles({
13+
} = useGetFeed({
1914
tags: userSelectedTags.map((tag) => tag.label.toLocaleLowerCase()),
2015
config: {
2116
cacheTime: 0,
@@ -24,13 +19,13 @@ export function AICard({ meta, withAds }: CardPropsType) {
2419
},
2520
})
2621

27-
const renderItem = (item: FeedItem, index: number) => (
28-
<ArticleItem item={item} key={`ai-${index}`} index={index} analyticsTag={meta.analyticsTag} />
22+
const renderItem = (item: FeedItemData, index: number) => (
23+
<FeedItem item={item} key={`ai-${index}`} index={index} analyticsTag={meta.analyticsTag} />
2924
)
3025

3126
return (
3227
<Card card={meta} withAds={withAds}>
33-
<ListComponent<FeedItem>
28+
<ListComponent<FeedItemData>
3429
items={articles?.pages.flatMap((page) => page.data) || []}
3530
error={error}
3631
isLoading={isLoading}

0 commit comments

Comments
 (0)