feat(ott-297): tournament matches (#88)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Ruslan Khayrullin 5 years ago committed by GitHub
parent b4ebffe955
commit 8c093cc0d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/features/PlayerPage/hooks.tsx
  2. 17
      src/features/PlayerPage/index.tsx
  3. 8
      src/features/ProfileCard/hooks.tsx
  4. 2
      src/features/ProfileCard/styled.tsx
  5. 3
      src/features/ProfileCard/types.tsx
  6. 1
      src/features/TournamentPage/hooks.tsx
  7. 12
      src/features/TournamentPage/index.tsx
  8. 5
      src/features/TournamentPage/styled.tsx

@ -39,6 +39,5 @@ export const usePlayerPage = () => {
return {
infoItems,
name: fullName,
sportType,
}
}

@ -1,7 +1,6 @@
import React from 'react'
import { ProfileTypes } from 'config'
import { MainWrapper } from 'features/MainWrapper'
import { UserFavorites } from 'features/UserFavorites'
import { ProfileCard } from 'features/ProfileCard'
import { UserFavoritesStore } from 'features/UserFavorites/store'
@ -12,20 +11,16 @@ export const PlayerPage = () => {
const {
infoItems,
name,
sportType,
} = usePlayerPage()
return (
<UserFavoritesStore>
<MainWrapper>
<UserFavorites />
<ProfileCard
sportType={sportType}
profileType={ProfileTypes.PLAYERS}
name={name}
infoItems={infoItems}
/>
</MainWrapper>
<UserFavorites />
<ProfileCard
profileType={ProfileTypes.PLAYERS}
name={name}
infoItems={infoItems}
/>
</UserFavoritesStore>
)
}

@ -5,16 +5,14 @@ import findIndex from 'lodash/findIndex'
import { handleImageError, getProfileLogo } from 'helpers'
import { useUserFavoritesStore } from 'features/UserFavorites/store'
import { usePageId } from 'hooks'
import { useSportNameParam, usePageId } from 'hooks'
import type { ProfileCardProps } from './types'
export const useProfileCard = ({
profileType,
sportType,
}: ProfileCardProps) => {
export const useProfileCard = ({ profileType }: ProfileCardProps) => {
const { addRemoveFavorite, userFavorites } = useUserFavoritesStore()
const profileId = usePageId()
const { sportType } = useSportNameParam()
const isFavorite = findIndex(userFavorites, {
id: profileId,

@ -4,6 +4,8 @@ import { ProfileTypes } from 'config'
export const Wrapper = styled.div`
display: flex;
margin-left: 70px;
margin-bottom: 50px;
`
export const Name = styled.h1`

@ -1,8 +1,7 @@
import { ProfileTypes, SportTypes } from 'config'
import { ProfileTypes } from 'config'
export type ProfileCardProps = {
infoItems: Array<string>,
name: string,
profileType: ProfileTypes,
sportType: SportTypes,
}

@ -41,6 +41,5 @@ export const useTournamentPage = () => {
return {
infoItems: [country],
name,
sportType,
}
}

@ -2,31 +2,31 @@ import React from 'react'
import { ProfileTypes } from 'config'
import { MainWrapper } from 'features/MainWrapper'
import { UserFavorites } from 'features/UserFavorites'
import { ProfileCard } from 'features/ProfileCard'
import { Matches } from 'features/Matches'
import { UserFavoritesStore } from 'features/UserFavorites/store'
import { useTournamentPage } from './hooks'
import { Content } from './styled'
export const TournamentPage = () => {
const {
infoItems,
name,
sportType,
} = useTournamentPage()
return (
<UserFavoritesStore>
<MainWrapper>
<UserFavorites />
<UserFavorites />
<Content>
<ProfileCard
sportType={sportType}
profileType={ProfileTypes.TOURNAMENTS}
name={name}
infoItems={infoItems}
/>
</MainWrapper>
<Matches />
</Content>
</UserFavoritesStore>
)
}

@ -0,0 +1,5 @@
import styled from 'styled-components/macro'
export const Content = styled.main`
padding: 0 16px;
`
Loading…
Cancel
Save