diff --git a/src/components/Ads/components/AdComponent/styled.tsx b/src/components/Ads/components/AdComponent/styled.tsx index 01534e8f..9e2e5530 100644 --- a/src/components/Ads/components/AdComponent/styled.tsx +++ b/src/components/Ads/components/AdComponent/styled.tsx @@ -1,4 +1,4 @@ -import styled from 'styled-components' +import styled from 'styled-components/macro' import { VIEW_ADS } from '../../types' type Props = { @@ -7,15 +7,15 @@ type Props = { const chooseStyle = (type: number) => { switch (true) { - case VIEW_ADS[type] === 'COLUMN': + case VIEW_ADS.COLUMN === type: return 'grid-row: 1 / 3; img {max-height: none;}' - case VIEW_ADS[type] === 'ROW': + case VIEW_ADS.ROW === type: return 'grid-column: 1 / 3' - case VIEW_ADS[type] === 'SQUARE': + case VIEW_ADS.SQUARE === type: return 'grid-row: 1 / 3; grid-column: 1 / 3; img {max-height: none;}' - case VIEW_ADS[type] === 'SECOND_COLUMN': + case VIEW_ADS.SECOND_COLUMN === type: return 'grid-column: 2 / 3; grid-row: 1 / 1' - case VIEW_ADS[type] === 'SECOND_ROW': + case VIEW_ADS.SECOND_ROW === type: return 'grid-column: 1 / 2; grid-row: 2 / 3;' default: return '' diff --git a/src/components/Ads/components/MobileAd/index.tsx b/src/components/Ads/components/MobileAd/index.tsx index bc117bbe..0ec082b8 100644 --- a/src/components/Ads/components/MobileAd/index.tsx +++ b/src/components/Ads/components/MobileAd/index.tsx @@ -1,4 +1,4 @@ -import { MouseEvent } from 'react' +import type { MouseEvent } from 'react' import type { AdType } from 'requests' @@ -12,10 +12,10 @@ import { import { useAd } from '../AdComponent/hooks' import { EventGA } from '../../types' - type MobileAdTypes = { - ad: AdType, - className?: string, - } +type MobileAdTypes = { + ad: AdType, + className?: string, +} export const MobileAd = ({ ad, diff --git a/src/components/Ads/components/MobileAd/styled.tsx b/src/components/Ads/components/MobileAd/styled.tsx index 98297112..7330167c 100644 --- a/src/components/Ads/components/MobileAd/styled.tsx +++ b/src/components/Ads/components/MobileAd/styled.tsx @@ -1,4 +1,4 @@ -import styled from 'styled-components' +import styled from 'styled-components/macro' type Props = { position: number, diff --git a/src/components/Ads/helpers/calcMaxDurationAds.tsx b/src/components/Ads/helpers/calcMaxDurationAds.tsx index 7e1eac14..d052d7bb 100644 --- a/src/components/Ads/helpers/calcMaxDurationAds.tsx +++ b/src/components/Ads/helpers/calcMaxDurationAds.tsx @@ -1,4 +1,4 @@ -import { AdResponse, AdsListType } from 'requests' +import type { AdResponse, AdsListType } from 'requests' export const calcMaxAdDurationAds = (advertisements: AdResponse) => { const allAds = Object.values(advertisements) diff --git a/src/components/Ads/hooks.tsx b/src/components/Ads/hooks.tsx index f39ddc53..c2ac6fe6 100644 --- a/src/components/Ads/hooks.tsx +++ b/src/components/Ads/hooks.tsx @@ -1,4 +1,7 @@ +import { useMemo } from 'react' + import { useQuery } from 'react-query' + import { useRecoilState } from 'recoil' import { isMobileDevice, querieKeys } from 'config' @@ -7,8 +10,6 @@ import { getAds } from 'requests' import { useLang } from 'features/LexicsStore/hooks/useLang' -import { useMemo } from 'react' - import { useAuthStore } from 'features/AuthStore' import { diff --git a/src/components/Ads/styled.tsx b/src/components/Ads/styled.tsx index 5f36a29c..40296d8a 100644 --- a/src/components/Ads/styled.tsx +++ b/src/components/Ads/styled.tsx @@ -1,4 +1,4 @@ -import styled, { css } from 'styled-components' +import styled, { css } from 'styled-components/macro' import { isMobileDevice } from 'config' diff --git a/src/config/userAgent.tsx b/src/config/userAgent.tsx index 8b4eb3db..4eed50ac 100644 --- a/src/config/userAgent.tsx +++ b/src/config/userAgent.tsx @@ -1,7 +1,8 @@ -export const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) +export const device = navigator.userAgent -export const isAndroid = /Android/.test(navigator.userAgent) +export const isIOS = /iPad|iPhone|iPod/.test(device) -export const isMobileDevice = /iPhone|Android/.test(navigator.userAgent) +export const isAndroid = /Android/.test(device) + +export const isMobileDevice = /iPhone|Android/.test(device) -export const device = navigator.userAgent diff --git a/src/features/MatchesGrid/index.tsx b/src/features/MatchesGrid/index.tsx index e6a48fa5..00bb7ea5 100644 --- a/src/features/MatchesGrid/index.tsx +++ b/src/features/MatchesGrid/index.tsx @@ -1,7 +1,11 @@ import { memo, useEffect } from 'react' + import { useRouteMatch } from 'react-router-dom' + import { useQuery } from 'react-query' +import { useRecoilValue } from 'recoil' + import { isMobileDevice, PAGES } from 'config' import type { AdType, LiveScore } from 'requests' @@ -14,7 +18,6 @@ import { useHeaderFiltersStore } from 'features/HeaderFilters' import { readToken } from 'helpers' -import { useRecoilValue } from 'recoil' import { Wrapper } from './styled' import { useMatchSwitchesStore } from '../MatchSwitches' import { querieKeys } from '../../config' diff --git a/src/requests/getAds/getAds.tsx b/src/requests/getAds/getAds.tsx index 1f7c6982..42a71f3e 100644 --- a/src/requests/getAds/getAds.tsx +++ b/src/requests/getAds/getAds.tsx @@ -10,27 +10,27 @@ export type AdsParams = { } export type AdType = { - 'duration': number, - 'frequency': number, - 'id': number, - 'impressions': number, - 'link': string, - 'media': { + duration: number, + frequency: number, + id: number, + impressions: number, + link: string, + media: { url: string, }, - 'name': string, - 'position': { - 'id': number, - 'name_eng': string, - 'name_rus': string, - 'source_type': string, + name: string, + position: { + id: number, + name_eng: string, + name_rus: string, + source_type: string, }, remaining_views: number, - 'time_close': number, - 'type': { - 'id': number, - 'name_eng': string, - 'name_rus': string, + time_close: number, + type: { + id: number, + name_eng: string, + name_rus: string, }, } diff --git a/src/requests/getAds/updateAdsView.tsx b/src/requests/getAds/updateAdsView.tsx index 27a9af5d..88590e2d 100644 --- a/src/requests/getAds/updateAdsView.tsx +++ b/src/requests/getAds/updateAdsView.tsx @@ -7,10 +7,10 @@ export type AdsViewParams = { } type AdsViewResponse = { - 'data': string, - 'message': string, - 'reason': string, - 'status': 'failed' | 'failed' | 'success', + data: string, + message: string, + reason: string, + status: 'failed' | 'failed' | 'success', } export const updateAdsView = (