Ott 43 tournaments header (#82)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Armen 5 years ago committed by GitHub
parent 53cd031d5e
commit 2fb847c6c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      package.json
  2. 7
      public/images/home-btn-hover.svg
  3. 7
      public/images/home-btn.svg
  4. 7
      src/config/lexics/homeLexics.tsx
  5. 4
      src/config/lexics/indexLexics.tsx
  6. 10
      src/config/lexics/playerLexics.tsx
  7. 1
      src/config/procedures.tsx
  8. 72
      src/features/App/AuthenticatedApp.tsx
  9. 1
      src/features/App/index.tsx
  10. 66
      src/features/Header/index.tsx
  11. 26
      src/features/Header/styled.tsx
  12. 1
      src/features/HeaderFilters/components/SportTypeFilter/hooks.tsx
  13. 1
      src/features/HeaderFilters/store/hooks/index.tsx
  14. 51
      src/features/HomePage/index.tsx
  15. 7
      src/features/HomePage/styled.tsx
  16. 1
      src/features/MatchCard/CardLive/index.tsx
  17. 3
      src/features/MatchPage/index.tsx
  18. 4
      src/features/Menu/styled.tsx
  19. 8
      src/features/OutsideClick/index.tsx
  20. 20
      src/features/PlayerPage/index.tsx
  21. 2
      src/features/ProfileCard/index.tsx
  22. 9
      src/features/ProfileCard/styled.tsx
  23. 2
      src/features/Search/index.tsx
  24. 1
      src/features/Search/styled.tsx
  25. 46
      src/features/TournamentPage/hooks.tsx
  26. 38
      src/features/TournamentPage/index.tsx
  27. 2
      src/features/UserAccount/UserAccountSubscription/styled.tsx
  28. 2
      src/helpers/getProfileFallbackLogo/index.tsx
  29. 39
      src/requests/getTournamentInfo.tsx
  30. 1
      src/requests/index.tsx

@ -50,7 +50,7 @@
"@types/react-router-dom": "^5.1.5", "@types/react-router-dom": "^5.1.5",
"@types/styled-components": "^5.1.0", "@types/styled-components": "^5.1.0",
"commitizen": "^4.1.2", "commitizen": "^4.1.2",
"eslint": "6.8.0", "eslint": "^6.8.0",
"eslint-config-airbnb": "18.1.0", "eslint-config-airbnb": "18.1.0",
"eslint-plugin-import": "^2.20.1", "eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-jsx-a11y": "^6.2.3",

@ -0,0 +1,7 @@
<svg width="24" height="21" viewBox="0 0 24 21" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="path-1-inside-1" fill="white">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.3122 0.234697C12.1297 0.0887601 11.8704 0.0887597 11.6878 0.234697L0.661804 9.04897C0.292558 9.34415 0.501281 9.93951 0.97401 9.93951H3.33599L4.21949 20.5415C4.24109 20.8006 4.45772 21 4.71776 21H19.2823C19.5423 21 19.7589 20.8006 19.7805 20.5415L20.664 9.93951H23.026C23.4987 9.93951 23.7075 9.34415 23.3382 9.04897L12.3122 0.234697Z"/>
</mask>
<path d="M11.6878 0.234697L13.124 2.03121L13.124 2.03121L11.6878 0.234697ZM12.3122 0.234697L13.7484 -1.56182L13.7484 -1.56182L12.3122 0.234697ZM0.661804 9.04897L-0.774346 7.25245H-0.774346L0.661804 9.04897ZM3.33599 9.93951L5.62805 9.74851L5.4523 7.63951H3.33599V9.93951ZM4.21949 20.5415L6.51155 20.3505L4.21949 20.5415ZM19.7805 20.5415L17.4885 20.3505V20.3505L19.7805 20.5415ZM20.664 9.93951V7.63951H18.5477L18.372 9.74851L20.664 9.93951ZM23.3382 9.04897L21.9021 10.8455L21.9021 10.8455L23.3382 9.04897ZM13.124 2.03121C12.4667 2.55659 11.5333 2.55658 10.8761 2.03122L13.7484 -1.56182C12.7261 -2.37906 11.274 -2.37907 10.2516 -1.56182L13.124 2.03121ZM2.09795 10.8455L13.124 2.03121L10.2517 -1.56182L-0.774346 7.25245L2.09795 10.8455ZM0.97401 7.63951C2.67585 7.63951 3.42723 9.78285 2.09795 10.8455L-0.774346 7.25245C-2.84212 8.90544 -1.67328 12.2395 0.97401 12.2395V7.63951ZM3.33599 7.63951H0.97401V12.2395H3.33599V7.63951ZM6.51155 20.3505L5.62805 9.74851L1.04394 10.1305L1.92744 20.7325L6.51155 20.3505ZM4.71776 18.7C5.65392 18.7 6.4338 19.4175 6.51155 20.3505L1.92744 20.7325C2.04837 22.1837 3.26152 23.3 4.71776 23.3V18.7ZM19.2823 18.7H4.71776V23.3H19.2823V18.7ZM17.4885 20.3505C17.5662 19.4176 18.3461 18.7 19.2823 18.7V23.3C20.7385 23.3 21.9516 22.1837 22.0726 20.7325L17.4885 20.3505ZM18.372 9.74851L17.4885 20.3505L22.0726 20.7325L22.9561 10.1305L18.372 9.74851ZM23.026 7.63951H20.664V12.2395H23.026V7.63951ZM21.9021 10.8455C20.5728 9.78284 21.3242 7.63951 23.026 7.63951V12.2395C25.6733 12.2395 26.8422 8.90546 24.7744 7.25245L21.9021 10.8455ZM10.8761 2.03121L21.9021 10.8455L24.7744 7.25245L13.7484 -1.56182L10.8761 2.03121Z" fill="white" mask="url(#path-1-inside-1)"/>
<circle cx="12" cy="12" r="3.05" stroke="white" stroke-width="2.1"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -0,0 +1,7 @@
<svg width="24" height="21" viewBox="0 0 24 21" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="path-1-inside-1" fill="white">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.3122 0.234697C12.1297 0.0887601 11.8704 0.0887597 11.6878 0.234697L0.661804 9.04897C0.292558 9.34415 0.501281 9.93951 0.97401 9.93951H3.33599L4.21949 20.5415C4.24109 20.8006 4.45772 21 4.71776 21H19.2823C19.5423 21 19.7589 20.8006 19.7805 20.5415L20.664 9.93951H23.026C23.4987 9.93951 23.7075 9.34415 23.3382 9.04897L12.3122 0.234697Z"/>
</mask>
<path d="M11.6878 0.234697L13.124 2.03121L13.124 2.03121L11.6878 0.234697ZM12.3122 0.234697L13.7484 -1.56182L13.7484 -1.56182L12.3122 0.234697ZM0.661804 9.04897L-0.774346 7.25245H-0.774346L0.661804 9.04897ZM3.33599 9.93951L5.62805 9.74851L5.4523 7.63951H3.33599V9.93951ZM4.21949 20.5415L6.51155 20.3505L4.21949 20.5415ZM19.7805 20.5415L17.4885 20.3505V20.3505L19.7805 20.5415ZM20.664 9.93951V7.63951H18.5477L18.372 9.74851L20.664 9.93951ZM23.3382 9.04897L21.9021 10.8455L21.9021 10.8455L23.3382 9.04897ZM13.124 2.03121C12.4667 2.55659 11.5333 2.55658 10.8761 2.03122L13.7484 -1.56182C12.7261 -2.37906 11.274 -2.37907 10.2516 -1.56182L13.124 2.03121ZM2.09795 10.8455L13.124 2.03121L10.2517 -1.56182L-0.774346 7.25245L2.09795 10.8455ZM0.97401 7.63951C2.67585 7.63951 3.42723 9.78285 2.09795 10.8455L-0.774346 7.25245C-2.84212 8.90544 -1.67328 12.2395 0.97401 12.2395V7.63951ZM3.33599 7.63951H0.97401V12.2395H3.33599V7.63951ZM6.51155 20.3505L5.62805 9.74851L1.04394 10.1305L1.92744 20.7325L6.51155 20.3505ZM4.71776 18.7C5.65392 18.7 6.4338 19.4175 6.51155 20.3505L1.92744 20.7325C2.04837 22.1837 3.26152 23.3 4.71776 23.3V18.7ZM19.2823 18.7H4.71776V23.3H19.2823V18.7ZM17.4885 20.3505C17.5662 19.4176 18.3461 18.7 19.2823 18.7V23.3C20.7385 23.3 21.9516 22.1837 22.0726 20.7325L17.4885 20.3505ZM18.372 9.74851L17.4885 20.3505L22.0726 20.7325L22.9561 10.1305L18.372 9.74851ZM23.026 7.63951H20.664V12.2395H23.026V7.63951ZM21.9021 10.8455C20.5728 9.78284 21.3242 7.63951 23.026 7.63951V12.2395C25.6733 12.2395 26.8422 8.90546 24.7744 7.25245L21.9021 10.8455ZM10.8761 2.03121L21.9021 10.8455L24.7744 7.25245L13.7484 -1.56182L10.8761 2.03121Z" fill="#666666" mask="url(#path-1-inside-1)"/>
<circle cx="12" cy="12" r="3.05" stroke="#666666" stroke-width="2.1"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -1,7 +0,0 @@
import { indexLexics } from './indexLexics'
export const homeLexics = {
...indexLexics,
video_from_my_subscriptions: 13023,
}

@ -1,8 +1,11 @@
import { proceduresLexics } from './procedures' import { proceduresLexics } from './procedures'
export const indexLexics = { export const indexLexics = {
add_to_favorites: 1701,
added_to_favorites: 13048,
basketball: 6960, basketball: 6960,
broadcast: 13049, broadcast: 13049,
cm: 817,
features: 13051, features: 13051,
football: 6958, football: 6958,
full_game: 13028, full_game: 13028,
@ -13,6 +16,7 @@ export const indexLexics = {
highlights: 13033, highlights: 13033,
hockey: 6959, hockey: 6959,
interview: 13031, interview: 13031,
kg: 652,
kickoff_in: 13027, kickoff_in: 13027,
live: 13024, live: 13024,
logout: 4306, logout: 4306,

@ -1,10 +0,0 @@
import { indexLexics } from './indexLexics'
export const playerLexics = {
...indexLexics,
add_to_favorites: 1701,
added_to_favorites: 13048,
cm: 817,
kg: 652,
}

@ -6,6 +6,7 @@ export const PROCEDURES = {
get_player_info: 'get_player_info', get_player_info: 'get_player_info',
get_players_teams_tournaments: 'get_players_teams_tournaments', get_players_teams_tournaments: 'get_players_teams_tournaments',
get_sport_list: 'get_sport_list', get_sport_list: 'get_sport_list',
get_tournament_info: 'get_tournament_info',
get_tournament_list: 'get_tournament_list', get_tournament_list: 'get_tournament_list',
get_user_favorites: 'get_user_favorites', get_user_favorites: 'get_user_favorites',
logout_user: 'logout_user', logout_user: 'logout_user',

@ -5,8 +5,9 @@ import {
Switch, Switch,
} from 'react-router-dom' } from 'react-router-dom'
import { indexLexics } from 'config/lexics/indexLexics'
import { useLexicsConfig } from 'features/LexicsStore'
import { PAGES } from 'config' import { PAGES } from 'config'
import { HomePage } from 'features/HomePage' import { HomePage } from 'features/HomePage'
import { TeamPage } from 'features/TeamPage' import { TeamPage } from 'features/TeamPage'
import { MatchPage } from 'features/MatchPage' import { MatchPage } from 'features/MatchPage'
@ -15,36 +16,51 @@ import { TournamentPage } from 'features/TournamentPage'
import { LanguageSelect } from 'features/LanguageSelect' import { LanguageSelect } from 'features/LanguageSelect'
import { UserAccount } from 'features/UserAccount' import { UserAccount } from 'features/UserAccount'
import { ScoreStore, ToggleScore } from 'features/ToggleScore' import { ScoreStore, ToggleScore } from 'features/ToggleScore'
import { Header } from 'features/Header'
import { MainWrapper } from 'features/MainWrapper'
import {
HeaderFiltersStore,
} from 'features/HeaderFilters'
import { UserFavorites } from 'features/UserFavorites'
export const AuthenticatedApp = () => ( export const AuthenticatedApp = () => {
<ScoreStore> useLexicsConfig(indexLexics)
<ToggleScore />
<LanguageSelect />
<Switch>
<Route exact path={PAGES.home}>
<HomePage />
</Route>
<Route path={`/:sportName${PAGES.tournament}/:pageId`}> return (
<TournamentPage /> <ScoreStore>
</Route> <ToggleScore />
<LanguageSelect />
<Switch>
<Route path={PAGES.useraccount}>
<UserAccount />
</Route>
<Route path={`/:sportName${PAGES.team}/:pageId`}> <HeaderFiltersStore>
<TeamPage /> <MainWrapper>
</Route> <UserFavorites />
<Route path={`/:sportName${PAGES.player}/:pageId`}> <Header />
<PlayerPage /> <Route exact path={PAGES.home}>
</Route> <HomePage />
</Route>
<Route path={`/:sportName${PAGES.match}/:pageId`}> <Route path={`/:sportName${PAGES.tournament}/:pageId`}>
<MatchPage /> <TournamentPage />
</Route> </Route>
<Route path={PAGES.useraccount}> <Route path={`/:sportName${PAGES.team}/:pageId`}>
<UserAccount /> <TeamPage />
</Route> </Route>
<Route path={`/:sportName${PAGES.player}/:pageId`}>
<PlayerPage />
</Route>
<Route path={`/:sportName${PAGES.match}/:pageId`}>
<MatchPage />
</Route>
<Redirect to={PAGES.home} /> </MainWrapper>
</Switch> </HeaderFiltersStore>
</ScoreStore> <Redirect to={PAGES.home} />
) </Switch>
</ScoreStore>
)
}

@ -15,6 +15,7 @@ const history = createBrowserHistory()
const Main = () => { const Main = () => {
const { token } = useAuthStore() const { token } = useAuthStore()
return ( return (
<Background> <Background>
{ {

@ -1,16 +1,60 @@
import React, { ReactNode } from 'react' import React, { Fragment } from 'react'
import { useRouteMatch } from 'react-router-dom'
import { Menu } from 'features/Menu' import { Menu } from 'features/Menu'
import { Search } from 'features/Search'
import { Wrapper } from './styled' import {
DateFilter,
MatchStatusFilter,
SportTypeFilter,
TournamentFilter,
} from 'features/HeaderFilters'
type HeaderProps = { import { PAGES } from 'config'
children: ReactNode,
} import {
Wrapper,
FilterWrapper,
HomeButtonLink,
SearchWrapper,
} from './styled'
export const Header = () => {
const isOnHome = useRouteMatch(PAGES.home)?.isExact
const isMatch = useRouteMatch(`/:sportName${PAGES.match}/:pageId`)?.isExact
return (
<Wrapper>
<Menu />
{!isOnHome && <HomeButtonLink to={PAGES.home} />}
{isMatch
? (
<FilterWrapper size='900px'>
<Search />
</FilterWrapper>
)
: (
<Fragment>
<SearchWrapper>
<Search />
</SearchWrapper>
export const Header = ({ children }: HeaderProps) => ( <FilterWrapper>
<Wrapper> <DateFilter />
<Menu /> </FilterWrapper>
{children}
</Wrapper> <FilterWrapper>
) <MatchStatusFilter />
</FilterWrapper>
{isOnHome && (
<FilterWrapper>
<SportTypeFilter />
<TournamentFilter />
</FilterWrapper>
)}
</Fragment>
)}
</Wrapper>
)
}

@ -1,6 +1,32 @@
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { Link } from 'react-router-dom'
export const HomeButtonLink = styled(Link)`
width: 55px;
height: 48px;
background-image: url('/images/home-btn.svg');
background-repeat: no-repeat;
background-position: center;
&:hover{
background-image: url('/images/home-btn-hover.svg');
cursor:pointer;
}
`
export const Wrapper = styled.header` export const Wrapper = styled.header`
display: flex; display: flex;
padding-top: 16px; padding-top: 16px;
margin-bottom: 30px;
`
export const FilterWrapper = styled.div<{ size?: string }>`
width: ${({ size }) => size || '288px'};
height: 48px;
margin-right: 16px;
display: flex;
`
export const SearchWrapper = styled(FilterWrapper)`
width: ${({ size }) => size || '288px'};
height: 48px;
margin-right: 16px;
margin-left: 57px;
display: flex;
` `

@ -32,7 +32,6 @@ export const useSportTypeFilter = () => {
} }
const selectedSportType = find(sportList, (sport) => sport.id === selectedSportTypeId) const selectedSportType = find(sportList, (sport) => sport.id === selectedSportTypeId)
return { return {
close, close,
isOpen, isOpen,

@ -64,7 +64,6 @@ export const useFilters = () => {
// можно эту логику вырезать и вставить в компонент матчей // можно эту логику вырезать и вставить в компонент матчей
useEffect(() => { useEffect(() => {
const formattedDate = format(startOfDay(selectedDate), dateFormat) const formattedDate = format(startOfDay(selectedDate), dateFormat)
getMatches({ getMatches({
date: formattedDate, date: formattedDate,
matchStatus: selectedMatchStatus, matchStatus: selectedMatchStatus,

@ -1,51 +1,16 @@
import React from 'react' import React from 'react'
import { homeLexics } from 'config/lexics/homeLexics'
import { useLexicsConfig } from 'features/LexicsStore'
import { Header } from 'features/Header'
import { MainWrapper } from 'features/MainWrapper'
import { Search } from 'features/Search'
import { import {
DateFilter,
MatchStatusFilter,
SportTypeFilter,
TournamentFilter,
HeaderFiltersStore, HeaderFiltersStore,
} from 'features/HeaderFilters' } from 'features/HeaderFilters'
import { UserFavorites } from 'features/UserFavorites'
import { Matches } from 'features/Matches' import { Matches } from 'features/Matches'
import { FilterWrapper, Content } from './styled' import { Content } from './styled'
export const HomePage = () => { export const HomePage = () => (
useLexicsConfig(homeLexics) <HeaderFiltersStore>
<Content>
return ( <Matches />
<HeaderFiltersStore> </Content>
<MainWrapper> </HeaderFiltersStore>
<UserFavorites /> )
<Header>
<FilterWrapper>
<Search />
</FilterWrapper>
<FilterWrapper>
<DateFilter />
</FilterWrapper>
<FilterWrapper>
<MatchStatusFilter />
</FilterWrapper>
<FilterWrapper>
<SportTypeFilter />
<TournamentFilter />
</FilterWrapper>
</Header>
<Content>
<Matches />
</Content>
</MainWrapper>
</HeaderFiltersStore>
)
}

@ -1,12 +1,5 @@
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
export const FilterWrapper = styled.div`
width: 288px;
height: 48px;
margin-right: 16px;
display: flex;
`
export const Content = styled.main` export const Content = styled.main`
margin-top: 75px; margin-top: 75px;
padding: 0 16px; padding: 0 16px;

@ -76,7 +76,6 @@ export const CardLive = ({
}, [getMs]) }, [getMs])
if (isOpen) return <CardLiveHover onClose={close} /> if (isOpen) return <CardLiveHover onClose={close} />
return ( return (
<CardWrapper <CardWrapper
onClick={open} onClick={open}

@ -6,7 +6,6 @@ const TempPageTitle = styled.span`
font-size: 20px; font-size: 20px;
color: white; color: white;
` `
export const MatchPage = () => ( export const MatchPage = () => (
<TempPageTitle>MATCH PAGE</TempPageTitle> <TempPageTitle>MATCH PAGE!</TempPageTitle>
) )

@ -7,8 +7,10 @@ export const Wrapper = styled.nav`
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 320px; width: auto;
height: 48px; height: 48px;
margin-left: 90px;
margin-right: 14px;
` `
export const ToggleButton = styled.button` export const ToggleButton = styled.button`
width: 18px; width: 18px;

@ -8,20 +8,24 @@ import { useOutsideClickEffect } from './hooks'
type Props = { type Props = {
/** элемент, которому необходим функционал `OutsideClick` */ /** элемент, которому необходим функционал `OutsideClick` */
children: ReactNode, children: ReactNode,
fullSize?: boolean,
/** функция-коллбек, отрабатывающая по клику вне области элемента */ /** функция-коллбек, отрабатывающая по клику вне области элемента */
onClick: () => void, onClick: () => void,
} }
const OutsideClickWrapper = styled.div`` const OutsideClickWrapper = styled.div<{fullSize?:boolean}>`
width: ${({ fullSize }) => (fullSize ? '100%' : 'auto')}
`
export const OutsideClick = ({ export const OutsideClick = ({
children, children,
fullSize,
onClick, onClick,
}: Props) => { }: Props) => {
const wrapperRef = useOutsideClickEffect({ onClick }) const wrapperRef = useOutsideClickEffect({ onClick })
return ( return (
<OutsideClickWrapper ref={wrapperRef}> <OutsideClickWrapper ref={wrapperRef} fullSize={fullSize}>
{children} {children}
</OutsideClickWrapper> </OutsideClickWrapper>
) )

@ -1,11 +1,7 @@
import React from 'react' import React from 'react'
import { ProfileTypes } from 'config' import { ProfileTypes } from 'config'
import { playerLexics } from 'config/lexics/playerLexics'
import { useLexicsConfig } from 'features/LexicsStore'
import { Header } from 'features/Header'
import { MainWrapper } from 'features/MainWrapper' import { MainWrapper } from 'features/MainWrapper'
import { Search } from 'features/Search'
import { UserFavorites } from 'features/UserFavorites' import { UserFavorites } from 'features/UserFavorites'
import { ProfileCard } from 'features/ProfileCard' import { ProfileCard } from 'features/ProfileCard'
import { UserFavoritesStore } from 'features/UserFavorites/store' import { UserFavoritesStore } from 'features/UserFavorites/store'
@ -18,21 +14,17 @@ export const PlayerPage = () => {
name, name,
sportType, sportType,
} = usePlayerPage() } = usePlayerPage()
useLexicsConfig(playerLexics)
return ( return (
<UserFavoritesStore> <UserFavoritesStore>
<MainWrapper> <MainWrapper>
<UserFavorites /> <UserFavorites />
<Header> <ProfileCard
<ProfileCard sportType={sportType}
sportType={sportType} profileType={ProfileTypes.PLAYERS}
profileType={ProfileTypes.PLAYERS} name={name}
name={name} infoItems={infoItems}
infoItems={infoItems} />
/>
<Search />
</Header>
</MainWrapper> </MainWrapper>
</UserFavoritesStore> </UserFavoritesStore>
) )

@ -23,6 +23,7 @@ export const ProfileCard = (props: ProfileCardProps) => {
const { const {
infoItems, infoItems,
name, name,
profileType,
} = props } = props
const { const {
@ -38,6 +39,7 @@ export const ProfileCard = (props: ProfileCardProps) => {
src={logo} src={logo}
alt={name} alt={name}
onError={onError} onError={onError}
profileType={profileType}
/> />
<Details> <Details>
<Name>{name}</Name> <Name>{name}</Name>

@ -1,5 +1,7 @@
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ProfileTypes } from 'config'
export const Wrapper = styled.div` export const Wrapper = styled.div`
display: flex; display: flex;
max-width: 815px; max-width: 815px;
@ -15,12 +17,13 @@ export const Name = styled.h1`
color: #fff; color: #fff;
` `
export const Logo = styled.img` export const Logo = styled.img<{ profileType: number }>`
width: 88px; width: 88px;
height: 88px; height: 88px;
margin-right: 15px; margin-right: 15px;
border-radius: 50%; border-radius: ${({ profileType }) => (
background-color: #000; profileType === ProfileTypes.TOURNAMENTS ? '0' : '50%'
)};
` `
export const Details = styled.div`` export const Details = styled.div``

@ -29,7 +29,7 @@ export const Search = () => {
} = useSearch() } = useSearch()
return ( return (
<OutsideClick onClick={close}> <OutsideClick onClick={close} fullSize>
<Wrapper> <Wrapper>
<Form role='search' onSubmit={onSubmit}> <Form role='search' onSubmit={onSubmit}>
<Input <Input

@ -8,6 +8,7 @@ import {
} from 'features/Common/Input/styled' } from 'features/Common/Input/styled'
export const Wrapper = styled.div` export const Wrapper = styled.div`
width: 100%;
position: relative; position: relative;
` `

@ -0,0 +1,46 @@
import type { TournamentInfo } from 'requests'
import { useEffect, useState } from 'react'
import { useHeaderFiltersStore } from 'features/HeaderFilters'
import { useLexicsStore } from 'features/LexicsStore'
import { getTournamentInfo } from 'requests'
import { useSportNameParam, usePageId } from 'hooks'
type Name = 'name_rus' | 'name_eng'
export const useTournamentPage = () => {
const [tournamentProfile, setTournamentProfile] = useState<TournamentInfo>(null)
const { sportType } = useSportNameParam()
const pageId = usePageId()
const { suffix } = useLexicsStore()
const {
setSelectedSportTypeId,
setSelectedTournamentId,
} = useHeaderFiltersStore()
setSelectedSportTypeId(sportType)
setSelectedTournamentId(pageId)
const {
[`name_${suffix}` as Name]: name = '',
} = tournamentProfile || {}
const {
[`name_${suffix}` as Name]: country = '',
} = tournamentProfile?.country || {}
useEffect(() => {
getTournamentInfo(sportType, pageId)
.then(setTournamentProfile)
}, [pageId, sportType])
return {
infoItems: [country],
name,
sportType,
}
}

@ -1,12 +1,32 @@
import React from 'react' import React from 'react'
import styled from 'styled-components'
const TempPageTitle = styled.span` import { ProfileTypes } from 'config'
padding: 20px;
font-size: 20px;
color: white;
`
export const TournamentPage = () => ( import { MainWrapper } from 'features/MainWrapper'
<TempPageTitle>TOURNAMENT PAGE</TempPageTitle> import { UserFavorites } from 'features/UserFavorites'
) import { ProfileCard } from 'features/ProfileCard'
import { UserFavoritesStore } from 'features/UserFavorites/store'
import { useTournamentPage } from './hooks'
export const TournamentPage = () => {
const {
infoItems,
name,
sportType,
} = useTournamentPage()
return (
<UserFavoritesStore>
<MainWrapper>
<UserFavorites />
<ProfileCard
sportType={sportType}
profileType={ProfileTypes.TOURNAMENTS}
name={name}
infoItems={infoItems}
/>
</MainWrapper>
</UserFavoritesStore>
)
}

@ -3,7 +3,7 @@ import styled, { css } from 'styled-components/macro'
import { Label as CheckboxLabel } from 'features/Common/Checkbox/styled' import { Label as CheckboxLabel } from 'features/Common/Checkbox/styled'
import { Label as RadioLabel } from 'features/Common/Radio/styled' import { Label as RadioLabel } from 'features/Common/Radio/styled'
import { TextWrapper } from '../CardNumber/styled'; import { TextWrapper } from '../CardNumber/styled'
export type TUserAccountSubscriptionWrapper = { export type TUserAccountSubscriptionWrapper = {
noMarginBottom?: boolean, noMarginBottom?: boolean,

@ -10,7 +10,7 @@ const FALLBACK_LOGOS = {
[SportTypes.FOOTBALL]: { [SportTypes.FOOTBALL]: {
[ProfileTypes.PLAYERS]: 'https://football.instatscout.com/images/player-no-photo.png', [ProfileTypes.PLAYERS]: 'https://football.instatscout.com/images/player-no-photo.png',
[ProfileTypes.TEAMS]: 'https://football.instatscout.com/images/team-no-photo.png', [ProfileTypes.TEAMS]: 'https://football.instatscout.com/images/team-no-photo.png',
[ProfileTypes.TOURNAMENTS]: 'https://football.instatscout.com/images/tournament-no-photo.png', [ProfileTypes.TOURNAMENTS]: 'https://hockey.instatscout.com/images/tournaments/180/no-photo.png',
}, },
[SportTypes.HOCKEY]: { [SportTypes.HOCKEY]: {

@ -0,0 +1,39 @@
import {
DATA_URL,
PROCEDURES,
} from 'config'
import { callApi, getResponseData } from 'helpers'
const proc = PROCEDURES.get_tournament_info
export type TournamentInfo = {
country: {
id: number,
name_eng: string,
name_rus: string,
},
id: number,
is_favorite: boolean,
name_eng: string,
name_rus: string,
short_name_eng: string,
short_name_rus: string,
} | null
export const getTournamentInfo = (sportId: number, tournamentId: number)
: Promise<TournamentInfo> => {
const config = {
body: {
params: {
_p_sport: sportId,
_p_tournament_id: tournamentId,
},
proc,
},
}
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
}

@ -9,3 +9,4 @@ export * from './getMatches'
export * from './getUserSportFavs' export * from './getUserSportFavs'
export * from './modifyUserSportFavs' export * from './modifyUserSportFavs'
export * from './getSportTournaments' export * from './getSportTournaments'
export * from './getTournamentInfo'

Loading…
Cancel
Save