File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { useQuery } from '@tanstack/react-query'
22import { axios } from 'src/lib/axios'
33import { ExtractFnReturnType , QueryConfig } from 'src/lib/react-query'
4+ import { Ad } from '../types'
45
56const getAd = async ( keywords : string [ ] ) : Promise < Ad [ ] > => {
67 let params = { keywords : keywords . join ( ',' ) }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import jsonPath from 'jsonpath'
22import { useEffect , useMemo } from 'react'
33import { useMediaQuery } from 'react-responsive'
44import { useAdStore } from 'src/features/adv/stores/AdStore'
5+ import type { StickyAd } from 'src/features/adv/types'
56import { useAuth } from 'src/features/auth'
67import { trackAdvOpen , trackAdvView } from 'src/lib/analytics'
78import { useUserPreferences } from 'src/stores/preferences'
@@ -15,7 +16,8 @@ export const StickyBanner = () => {
1516 const isMobile = useMediaQuery ( { maxWidth : 767 } )
1617 const { ads } = useAdStore ( )
1718
18- const ad = ads . length > 0 ? ads . find ( ( ad ) => ad . type === 'sticky-ad' ) : null
19+ const ad =
20+ ads . length > 0 ? ( ads . find ( ( ad ) => ad . type === 'sticky-ad' ) as StickyAd | undefined ) : null
1921
2022 const onAdClick = ( ) => {
2123 if ( ad ?. id ) {
Original file line number Diff line number Diff line change 11import { create } from 'zustand'
2+ import { Ad } from '../types'
23
34type AdStore = {
45 ads : Ad [ ]
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ type LargeImageAd = CommonAdFields & {
2929 imageUrl : string
3030}
3131
32- type StickyAd = CommonAdFields & {
32+ export type StickyAd = CommonAdFields & {
3333 type : 'sticky-ad'
3434 title : string
3535 imageUrl : string
@@ -39,4 +39,4 @@ type StickyAd = CommonAdFields & {
3939 dismissible ?: boolean
4040}
4141
42- type Ad = SmallImageAd | LargeImageAd | StickyAd
42+ export type Ad = SmallImageAd | LargeImageAd | StickyAd
You can’t perform that action at this time.
0 commit comments