fix(#2598): modernization of facr tv

keep-around/daeb0b1c06f9831ca5ee9fece83ee580cb5ad438
Rakov Roman 3 years ago
parent 7e0e4f3c7d
commit daeb0b1c06
  1. 2
      src/features/CompanyInfo/config.tsx
  2. 63
      src/features/CompanyInfo/index.tsx
  3. 35
      src/features/HeaderMobile/index.tsx
  4. 4
      src/features/HeaderMobile/styled.tsx
  5. 6
      src/features/HomePage/Atoms/HomePageAtoms.tsx
  6. 7
      src/features/HomePage/components/HeaderFilters/index.tsx
  7. 19
      src/features/HomePage/hooks.tsx
  8. 15
      src/features/ProfileCard/index.tsx
  9. 26
      src/features/UserAccount/components/PersonalInfoForm/index.tsx
  10. 25
      src/features/UserAccount/index.tsx

@ -1,7 +1,9 @@
export const lexics = [ export const lexics = [
16689,
18081, 18081,
18082, 18082,
18083, 18083,
18084, 18084,
18170, 18170,
19588,
] ]

@ -1,6 +1,11 @@
import { Fragment, useMemo } from 'react'
import { T9n } from 'features/T9n' import { T9n } from 'features/T9n'
import { useLexicsConfig } from 'features/LexicsStore' import { useLexicsConfig } from 'features/LexicsStore'
import { PAGES } from 'config' import { PAGES } from 'config'
import { client } from 'config/clients'
import { ClientNames } from 'config/clients/types'
import { import {
CompanyInfoLink, CompanyInfoLink,
@ -20,26 +25,48 @@ export const CompanyInfo = ({
}: TCompanyInfo) => { }: TCompanyInfo) => {
useLexicsConfig(lexics) useLexicsConfig(lexics)
const companyInfoContent = useMemo(() => {
switch (client.name) {
case ClientNames.Facr:
return (
<Fragment>
<CompanyInfoText>
<T9n t='16689' />
</CompanyInfoText>
<CompanyInfoText>
<T9n t='19588' />
</CompanyInfoText>
</Fragment>
)
default:
return (
<Fragment>
<CompanyInfoText>
<T9n t='18081' />{' | '}
<CompanyInfoLink
to={{ pathname: PAGES.about_the_project }}
target='_blank'
>
<T9n t='18170' />
</CompanyInfoLink>
</CompanyInfoText>
<CompanyInfoText>
<T9n t='18082' />
</CompanyInfoText>
<CompanyInfoText>
<T9n t='18083' />
</CompanyInfoText>
<CompanyInfoText>
<T9n t='18084' />
</CompanyInfoText>
</Fragment>
)
}
}, [])
return ( return (
<CompanyInfoWrapper style={{ maxWidth: width, textAlign }}> <CompanyInfoWrapper style={{ maxWidth: width, textAlign }}>
<CompanyInfoText> {companyInfoContent}
<T9n t='18081' />{' | '}
<CompanyInfoLink
to={{ pathname: PAGES.about_the_project }}
target='_blank'
>
<T9n t='18170' />
</CompanyInfoLink>
</CompanyInfoText>
<CompanyInfoText>
<T9n t='18082' />
</CompanyInfoText>
<CompanyInfoText>
<T9n t='18083' />
</CompanyInfoText>
<CompanyInfoText>
<T9n t='18084' />
</CompanyInfoText>
</CompanyInfoWrapper> </CompanyInfoWrapper>
) )
} }

@ -1,17 +1,30 @@
import { useRecoilValue } from 'recoil'
import { HeaderMenu } from 'features/HeaderMenu' import { HeaderMenu } from 'features/HeaderMenu'
import { DateFilter } from 'features/HeaderFilters' import { DateFilter } from 'features/HeaderFilters'
import { ScoreSwitch } from 'features/MatchSwitches' import { ScoreSwitch } from 'features/MatchSwitches'
import { SportsFilter } from 'features/SportsFilter' import { SportsFilter } from 'features/SportsFilter'
import { isSportFilterShownAtom } from 'features/HomePage/Atoms/HomePageAtoms'
import {
HeaderStyled,
ScoreSwitchWrapper,
ScSportsWrapper,
} from './styled'
import { HeaderStyled, ScSportsWrapper } from './styled' export const HeaderMobile = () => {
const isSportFilterShown = useRecoilValue(isSportFilterShownAtom)
export const HeaderMobile = () => ( return (
<HeaderStyled> <HeaderStyled>
<HeaderMenu /> <HeaderMenu />
<DateFilter /> <DateFilter />
<ScSportsWrapper> <ScSportsWrapper>
<SportsFilter /> {isSportFilterShown ? <SportsFilter /> : null}
<ScoreSwitch /> <ScoreSwitchWrapper>
</ScSportsWrapper> <ScoreSwitch />
</HeaderStyled> </ScoreSwitchWrapper>
) </ScSportsWrapper>
</HeaderStyled>
)
}

@ -210,3 +210,7 @@ export const ScSport = styled.div<SportProps>`
margin-top: 18px; margin-top: 18px;
cursor: pointer; cursor: pointer;
` `
export const ScoreSwitchWrapper = styled.div`
margin-left: auto;
`

@ -0,0 +1,6 @@
import { atom } from 'recoil'
export const isSportFilterShownAtom = atom({
default: true,
key: 'isSportFilterShownAtom',
})

@ -1,3 +1,5 @@
import { useRecoilValue } from 'recoil'
import { SportsFilter } from 'features/SportsFilter' import { SportsFilter } from 'features/SportsFilter'
import { SelectFilter } from 'components/SelectFilter' import { SelectFilter } from 'components/SelectFilter'
import { useHeaderFiltersStore } from 'features/HeaderFilters' import { useHeaderFiltersStore } from 'features/HeaderFilters'
@ -10,6 +12,8 @@ import {
ScFilterItem, ScFilterItem,
} from './styled' } from './styled'
import { isSportFilterShownAtom } from '../../Atoms/HomePageAtoms'
export const HeaderFilters = () => { export const HeaderFilters = () => {
const { const {
isShowTournament, isShowTournament,
@ -19,6 +23,7 @@ export const HeaderFilters = () => {
setSelectedFilters, setSelectedFilters,
setSelectedLeague, setSelectedLeague,
} = useHeaderFiltersStore() } = useHeaderFiltersStore()
const isSportFilterShown = useRecoilValue(isSportFilterShownAtom)
const isActiveFilter = (filterItem: string) => selectedFilters.indexOf(filterItem) >= 0 const isActiveFilter = (filterItem: string) => selectedFilters.indexOf(filterItem) >= 0
@ -52,7 +57,7 @@ export const HeaderFilters = () => {
/> />
</> </>
)} )}
{isShowTournament && <SportsFilter />} {isShowTournament && isSportFilterShown && <SportsFilter />}
{isShowTournament && ( {isShowTournament && (
<ScFilterItemsWrap> <ScFilterItemsWrap>

@ -5,11 +5,18 @@ import {
} from 'react' } from 'react'
import format from 'date-fns/format' import format from 'date-fns/format'
import { getHomeMatches } from 'requests/getMatches' import { useSetRecoilState } from 'recoil'
import { client } from 'config/clients'
import { ClientNames } from 'config/clients/types'
import { useAuthStore } from 'features/AuthStore' import { useAuthStore } from 'features/AuthStore'
import { useHeaderFiltersStore } from 'features/HeaderFilters'
import { getHomeMatches } from 'requests/getMatches'
import { getAgreements, setAgreements } from 'requests/getAgreements' import { getAgreements, setAgreements } from 'requests/getAgreements'
import { useHeaderFiltersStore } from 'features/HeaderFilters' import { isSportFilterShownAtom } from './Atoms/HomePageAtoms'
/** /**
* возвращает смещение в минутах относительно UTC * возвращает смещение в минутах относительно UTC
@ -29,6 +36,7 @@ export const useHomePage = () => {
const { user } = useAuthStore() const { user } = useAuthStore()
const { selectedDate } = useHeaderFiltersStore() const { selectedDate } = useHeaderFiltersStore()
const [isShowConfirmPopup, setIsShowConfirmPopup] = useState(false) const [isShowConfirmPopup, setIsShowConfirmPopup] = useState(false)
const setIsSportFilterShown = useSetRecoilState(isSportFilterShownAtom)
const handleCloseConfirmPopup = useCallback(async () => { const handleCloseConfirmPopup = useCallback(async () => {
await setAgreements(user?.profile?.email || '') await setAgreements(user?.profile?.email || '')
@ -54,6 +62,13 @@ export const useHomePage = () => {
}), }),
[selectedDate], [selectedDate],
) )
useEffect(() => {
if (client.name === ClientNames.Facr) {
setIsSportFilterShown(false)
}
}, [setIsSportFilterShown])
return { return {
fetchMatches, fetchMatches,
handleCloseConfirmPopup, handleCloseConfirmPopup,

@ -1,8 +1,12 @@
import { useMemo } from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import type { ObjectWithName } from 'features/Name' import type { ObjectWithName } from 'features/Name'
import { PAGES, ProfileTypes } from 'config' import { PAGES, ProfileTypes } from 'config'
import { client } from 'config/clients'
import { ClientNames } from 'config/clients/types'
import { checkPage } from 'helpers/checkPage' import { checkPage } from 'helpers/checkPage'
@ -49,6 +53,15 @@ export const ProfileCard = ({ profile }: ProfileType) => {
const tournamentId = profile.additionalInfo?.tournamentId const tournamentId = profile.additionalInfo?.tournamentId
const isPlayerPage = checkPage(PAGES.player) const isPlayerPage = checkPage(PAGES.player)
const isGetHighLightShown = useMemo(() => {
switch (client.name) {
case ClientNames.Facr:
return false
default:
return true
}
}, [])
return ( return (
<Wrapper> <Wrapper>
<Logo <Logo
@ -78,7 +91,7 @@ export const ProfileCard = ({ profile }: ProfileType) => {
<StarIcon isFavorite={isFavorite} /> <StarIcon isFavorite={isFavorite} />
<T9n t='add_to_favorites' /> <T9n t='add_to_favorites' />
</FavoriteButton> </FavoriteButton>
{isPlayerPage && ( {isPlayerPage && isGetHighLightShown && (
<Link to={PAGES.highlights}> <Link to={PAGES.highlights}>
<SсGetHighlightBtn <SсGetHighlightBtn
onClick={() => setPlayerHighlight({ onClick={() => setPlayerHighlight({

@ -1,6 +1,9 @@
import { useMemo } from 'react'
import { client } from 'config/clients' import { client } from 'config/clients'
import { formIds } from 'config/form' import { formIds } from 'config/form'
import { AUTH_SERVICE } from 'config/routes' import { AUTH_SERVICE } from 'config/routes'
import { ClientNames } from 'config/clients/types'
import { Combobox } from 'features/Combobox' import { Combobox } from 'features/Combobox'
import { Input } from 'features/Common' import { Input } from 'features/Common'
@ -43,6 +46,15 @@ export const PersonalInfoForm = (props: Props) => {
updateFormValue, updateFormValue,
} = useUserInfo(props) } = useUserInfo(props)
const isPrivacyPolicyShown = useMemo(() => {
switch (client.name) {
case ClientNames.Facr:
return false
default:
return true
}
}, [])
return ( return (
<Form> <Form>
<Input <Input
@ -118,12 +130,14 @@ export const PersonalInfoForm = (props: Props) => {
> >
<T9n t='terms_and_conditions' /> <T9n t='terms_and_conditions' />
</PrivacyPolicyLink> </PrivacyPolicyLink>
<PrivacyPolicyLink {isPrivacyPolicyShown && (
target='_blank' <PrivacyPolicyLink
href={`${AUTH_SERVICE}${client.privacyLink}`} target='_blank'
> href={`${AUTH_SERVICE}${client.privacyLink}`}
<T9n t='privacy_policy_and_statement' /> >
</PrivacyPolicyLink> <T9n t='privacy_policy_and_statement' />
</PrivacyPolicyLink>
)}
</PrivacyWrapper> </PrivacyWrapper>
</Form> </Form>
) )

@ -1,8 +1,12 @@
import { useMemo } from 'react'
import { Route, Link } from 'react-router-dom' import { Route, Link } from 'react-router-dom'
import { PAGES } from 'config' import { PAGES } from 'config'
import { isProduction } from 'config/env' import { isProduction } from 'config/env'
import { userAccountLexics } from 'config/lexics/userAccount' import { userAccountLexics } from 'config/lexics/userAccount'
import { ClientNames } from 'config/clients/types'
import { useAuthStore } from 'features/AuthStore' import { useAuthStore } from 'features/AuthStore'
import { usePageLogger } from 'hooks/usePageLogger' import { usePageLogger } from 'hooks/usePageLogger'
@ -34,6 +38,15 @@ const UserAccount = () => {
usePageLogger(PAGES.useraccount) usePageLogger(PAGES.useraccount)
useLexicsConfig(userAccountLexics) useLexicsConfig(userAccountLexics)
const isGetHighLightShown = useMemo(() => {
switch (client.name) {
case ClientNames.Facr:
return false
default:
return true
}
}, [])
return ( return (
<UserAccountWrapper> <UserAccountWrapper>
<Header /> <Header />
@ -71,11 +84,13 @@ const UserAccount = () => {
</StyledLink> </StyledLink>
<ScoreSwitch /> <ScoreSwitch />
<Link to={`${PAGES.highlights}`}> {isGetHighLightShown && (
<ScButtonGetHighlight> <Link to={`${PAGES.highlights}`}>
<T9n t='get_highlights' /> <ScButtonGetHighlight>
</ScButtonGetHighlight> <T9n t='get_highlights' />
</Link> </ScButtonGetHighlight>
</Link>
)}
</Navigations> </Navigations>
</Aside> </Aside>
<ContentWrapper> <ContentWrapper>

Loading…
Cancel
Save