Revert "fix(#564): fix styles ads ads types"

This reverts commit e188c32fcd.
pull/230/head
andreidekterev 3 years ago
parent 1e0a2cfc2d
commit 36fe1fff03
  1. 12
      src/components/Ads/components/AdComponent/styled.tsx
  2. 10
      src/components/Ads/components/MobileAd/index.tsx
  3. 2
      src/components/Ads/components/MobileAd/styled.tsx
  4. 2
      src/components/Ads/helpers/calcMaxDurationAds.tsx
  5. 5
      src/components/Ads/hooks.tsx
  6. 2
      src/components/Ads/styled.tsx
  7. 9
      src/config/userAgent.tsx
  8. 5
      src/features/MatchesGrid/index.tsx
  9. 34
      src/requests/getAds/getAds.tsx
  10. 8
      src/requests/getAds/updateAdsView.tsx

@ -1,4 +1,4 @@
import styled from 'styled-components/macro' import styled from 'styled-components'
import { VIEW_ADS } from '../../types' import { VIEW_ADS } from '../../types'
type Props = { type Props = {
@ -7,15 +7,15 @@ type Props = {
const chooseStyle = (type: number) => { const chooseStyle = (type: number) => {
switch (true) { switch (true) {
case VIEW_ADS.COLUMN === type: case VIEW_ADS[type] === 'COLUMN':
return 'grid-row: 1 / 3; img {max-height: none;}' return 'grid-row: 1 / 3; img {max-height: none;}'
case VIEW_ADS.ROW === type: case VIEW_ADS[type] === 'ROW':
return 'grid-column: 1 / 3' return 'grid-column: 1 / 3'
case VIEW_ADS.SQUARE === type: case VIEW_ADS[type] === 'SQUARE':
return 'grid-row: 1 / 3; grid-column: 1 / 3; img {max-height: none;}' return 'grid-row: 1 / 3; grid-column: 1 / 3; img {max-height: none;}'
case VIEW_ADS.SECOND_COLUMN === type: case VIEW_ADS[type] === 'SECOND_COLUMN':
return 'grid-column: 2 / 3; grid-row: 1 / 1' return 'grid-column: 2 / 3; grid-row: 1 / 1'
case VIEW_ADS.SECOND_ROW === type: case VIEW_ADS[type] === 'SECOND_ROW':
return 'grid-column: 1 / 2; grid-row: 2 / 3;' return 'grid-column: 1 / 2; grid-row: 2 / 3;'
default: default:
return '' return ''

@ -1,4 +1,4 @@
import type { MouseEvent } from 'react' import { MouseEvent } from 'react'
import type { AdType } from 'requests' import type { AdType } from 'requests'
@ -12,10 +12,10 @@ import {
import { useAd } from '../AdComponent/hooks' import { useAd } from '../AdComponent/hooks'
import { EventGA } from '../../types' import { EventGA } from '../../types'
type MobileAdTypes = { type MobileAdTypes = {
ad: AdType, ad: AdType,
className?: string, className?: string,
} }
export const MobileAd = ({ export const MobileAd = ({
ad, ad,

@ -1,4 +1,4 @@
import styled from 'styled-components/macro' import styled from 'styled-components'
type Props = { type Props = {
position: number, position: number,

@ -1,4 +1,4 @@
import type { AdResponse, AdsListType } from 'requests' import { AdResponse, AdsListType } from 'requests'
export const calcMaxAdDurationAds = (advertisements: AdResponse) => { export const calcMaxAdDurationAds = (advertisements: AdResponse) => {
const allAds = Object.values(advertisements) const allAds = Object.values(advertisements)

@ -1,7 +1,4 @@
import { useMemo } from 'react'
import { useQuery } from 'react-query' import { useQuery } from 'react-query'
import { useRecoilState } from 'recoil' import { useRecoilState } from 'recoil'
import { isMobileDevice, querieKeys } from 'config' import { isMobileDevice, querieKeys } from 'config'
@ -10,6 +7,8 @@ import { getAds } from 'requests'
import { useLang } from 'features/LexicsStore/hooks/useLang' import { useLang } from 'features/LexicsStore/hooks/useLang'
import { useMemo } from 'react'
import { useAuthStore } from 'features/AuthStore' import { useAuthStore } from 'features/AuthStore'
import { import {

@ -1,4 +1,4 @@
import styled, { css } from 'styled-components/macro' import styled, { css } from 'styled-components'
import { isMobileDevice } from 'config' import { isMobileDevice } from 'config'

@ -1,8 +1,7 @@
export const device = navigator.userAgent export const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent)
export const isIOS = /iPad|iPhone|iPod/.test(device)
export const isAndroid = /Android/.test(device) export const isAndroid = /Android/.test(navigator.userAgent)
export const isMobileDevice = /iPhone|Android/.test(device) export const isMobileDevice = /iPhone|Android/.test(navigator.userAgent)
export const device = navigator.userAgent

@ -1,11 +1,7 @@
import { memo, useEffect } from 'react' import { memo, useEffect } from 'react'
import { useRouteMatch } from 'react-router-dom' import { useRouteMatch } from 'react-router-dom'
import { useQuery } from 'react-query' import { useQuery } from 'react-query'
import { useRecoilValue } from 'recoil'
import { isMobileDevice, PAGES } from 'config' import { isMobileDevice, PAGES } from 'config'
import type { AdType, LiveScore } from 'requests' import type { AdType, LiveScore } from 'requests'
@ -18,6 +14,7 @@ import { useHeaderFiltersStore } from 'features/HeaderFilters'
import { readToken } from 'helpers' import { readToken } from 'helpers'
import { useRecoilValue } from 'recoil'
import { Wrapper } from './styled' import { Wrapper } from './styled'
import { useMatchSwitchesStore } from '../MatchSwitches' import { useMatchSwitchesStore } from '../MatchSwitches'
import { querieKeys } from '../../config' import { querieKeys } from '../../config'

@ -10,27 +10,27 @@ export type AdsParams = {
} }
export type AdType = { export type AdType = {
duration: number, 'duration': number,
frequency: number, 'frequency': number,
id: number, 'id': number,
impressions: number, 'impressions': number,
link: string, 'link': string,
media: { 'media': {
url: string, url: string,
}, },
name: string, 'name': string,
position: { 'position': {
id: number, 'id': number,
name_eng: string, 'name_eng': string,
name_rus: string, 'name_rus': string,
source_type: string, 'source_type': string,
}, },
remaining_views: number, remaining_views: number,
time_close: number, 'time_close': number,
type: { 'type': {
id: number, 'id': number,
name_eng: string, 'name_eng': string,
name_rus: string, 'name_rus': string,
}, },
} }

@ -7,10 +7,10 @@ export type AdsViewParams = {
} }
type AdsViewResponse = { type AdsViewResponse = {
data: string, 'data': string,
message: string, 'message': string,
reason: string, 'reason': string,
status: 'failed' | 'failed' | 'success', 'status': 'failed' | 'failed' | 'success',
} }
export const updateAdsView = ( export const updateAdsView = (

Loading…
Cancel
Save