File tree Expand file tree Collapse file tree
feed/components/feedItems Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export * from './api/getAd'
12export * from './components/AdvBanner'
Original file line number Diff line number Diff line change 1+ import { GoDotFill } from 'react-icons/go'
2+ import { useGetAd } from 'src/features/adv'
3+ import { useUserPreferences } from 'src/stores/preferences'
4+
5+ export const AdvFeedItem = ( ) => {
6+ const { userSelectedTags } = useUserPreferences ( )
7+
8+ const {
9+ data : ad ,
10+ isLoading,
11+ isError,
12+ } = useGetAd ( {
13+ keywords : userSelectedTags . map ( ( tag ) => tag . label . toLocaleLowerCase ( ) ) ,
14+ aditionalAdQueries : undefined ,
15+ config : {
16+ cacheTime : 0 ,
17+ staleTime : 0 ,
18+ useErrorBoundary : false ,
19+ } ,
20+ } )
21+
22+ if ( isLoading ) {
23+ return (
24+ < div className = "placeholder" >
25+ < div className = "image" > </ div >
26+ < div className = "line" > </ div >
27+ < div className = "smallLine" > </ div >
28+ </ div >
29+ )
30+ }
31+
32+ if ( isError || ! ad ) {
33+ return null
34+ }
35+
36+ return (
37+ < div className = "blockRow" >
38+ < div className = "rowTitle" >
39+ < a className = "rowLink titleWithCover" href = { ad . link } >
40+ < div className = "rowCover" >
41+ < img
42+ src = { ad . imageUrl }
43+ alt = { ad . title }
44+ className = ""
45+ style = { { border : 0 } }
46+ width = { 260 }
47+ height = { 200 }
48+ />
49+ </ div >
50+
51+ < span className = "subTitle" > { ad . description } </ span >
52+ </ a >
53+ </ div >
54+ < div className = "rowDetails" >
55+ < span className = "rowItem" >
56+ < a href = { ad . provider . link } target = "_blank" rel = "noopener sponsored noreferrer" >
57+ < GoDotFill className = "rowItemIcon" /> { ad . provider . title }
58+ </ a >
59+ </ span >
60+ </ div >
61+ { ad . viewUrl &&
62+ ad . viewUrl
63+ . split ( '||' )
64+ . map ( ( viewUrl , i ) => < img key = { i } src = { viewUrl } className = "hidden" alt = "" /> ) }
65+ </ div >
66+ )
67+ }
You can’t perform that action at this time.
0 commit comments