fix(#2572): fix audio player and some layout

keep-around/af97087ab78c2ed15d86ddf963fb78f0946962ba
Andrei Dekterev 3 years ago
parent ce3940b957
commit ea4879f761
  1. 7
      src/components/AudioPlayer/hooks.tsx
  2. 12
      src/features/AddCardForm/components/ElementContainer/index.tsx
  3. 5
      src/features/AddCardForm/components/Form/index.tsx
  4. 13
      src/features/AddCardForm/styled.tsx
  5. 4
      src/features/BuyMatchPopup/components/CardsList/index.tsx
  6. 2
      src/features/BuyMatchPopup/styled.tsx
  7. 2
      src/features/Combobox/index.tsx
  8. 21
      src/features/ProfileCard/styled.tsx
  9. 4
      src/pages/HighlightsPage/components/FormHighlights/hooks.tsx
  10. 3
      src/pages/HighlightsPage/components/FormHighlights/index.tsx
  11. 12
      src/pages/HighlightsPage/components/FormHighlights/styled.tsx
  12. 6
      src/pages/HighlightsPage/components/MatchesHighlights/styled.tsx
  13. 3
      src/pages/HighlightsPage/components/PriceInfo/styled.tsx
  14. 3
      src/pages/HighlightsPage/components/ThanksPopup/styled.tsx

@ -6,7 +6,7 @@ import {
import { readToken } from 'helpers' import { readToken } from 'helpers'
export const useAudioPlayer = (asset: string) => { export const useAudioPlayer = (asset: string) => {
const [audio, setAudio] = useState<HTMLAudioElement>() const [audio, setAudio] = useState<HTMLAudioElement | null>(null)
const [playing, setPlaying] = useState(false) const [playing, setPlaying] = useState(false)
const toggle = (e: SyntheticEvent) => { const toggle = (e: SyntheticEvent) => {
@ -16,15 +16,16 @@ export const useAudioPlayer = (asset: string) => {
} }
useEffect(() => { useEffect(() => {
setPlaying(false)
audio?.pause()
asset && setAudio(new Audio(`${asset}?access_token=${readToken()}`)) asset && setAudio(new Audio(`${asset}?access_token=${readToken()}`))
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [asset]) }, [asset])
useEffect(() => { useEffect(() => {
if (!audio) return
playing ? audio?.play() : audio?.pause() playing ? audio?.play() : audio?.pause()
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [playing, audio]) }, [playing])
useEffect(() => { useEffect(() => {
audio?.addEventListener('ended', () => setPlaying(false)) audio?.addEventListener('ended', () => setPlaying(false))

@ -32,13 +32,19 @@ const Label = styled.label<LabelProps>`
${isMobileDevice ${isMobileDevice
? css` ? css`
height: 36px; height: 27px;
font-size: 12px; font-size: 12px;
padding: 0 13px; padding: 0 13px;
align-items: center; align-items: center;
:nth-child(3){ :nth-child(3){
width: 48%; width: 48%;
} }
/* & .test_class {
width: 48%;
} */
:nth-child(4){ :nth-child(4){
width: 48%; width: 48%;
} }
@ -74,6 +80,7 @@ const ElementWrapper = styled.div`
type Props = { type Props = {
backgroundColor?: string, backgroundColor?: string,
children: ReactNode, children: ReactNode,
className?: string,
label?: string, label?: string,
width?: string, width?: string,
} }
@ -81,10 +88,11 @@ type Props = {
export const ElementContainer = ({ export const ElementContainer = ({
backgroundColor, backgroundColor,
children, children,
className,
label, label,
width, width,
}: Props) => ( }: Props) => (
<Label width={width} backgroundColor={backgroundColor}> <Label width={width} backgroundColor={backgroundColor} className={className}>
{label && <Text t={label} />} {label && <Text t={label} />}
<ElementWrapper> <ElementWrapper>
{children} {children}

@ -120,6 +120,7 @@ export const AddCardFormInner = (props: Props) => {
<ElementContainer <ElementContainer
label={isLabelVisible(ElementTypes.CardExpiry) ? 'form_card_expiration' : ''} label={isLabelVisible(ElementTypes.CardExpiry) ? 'form_card_expiration' : ''}
width='275px' width='275px'
className='test_class'
backgroundColor={inputsBackground} backgroundColor={inputsBackground}
> >
<CardExpiryElement <CardExpiryElement
@ -161,7 +162,7 @@ export const AddCardFormInner = (props: Props) => {
</CountryWrapper> </CountryWrapper>
<ElementContainer <ElementContainer
label={isLabelVisible(ElementTypes.CardCity) ? 'city' : ''} label={isLabelVisible(ElementTypes.CardCity) ? 'city' : ''}
width='275px' width={isMobileDevice ? '100%' : '275px'}
backgroundColor={inputsBackground} backgroundColor={inputsBackground}
> >
<Input <Input
@ -175,6 +176,7 @@ export const AddCardFormInner = (props: Props) => {
</ElementContainer> </ElementContainer>
<ElementContainer <ElementContainer
label={isLabelVisible(ElementTypes.CardAddress) ? 'address' : ''} label={isLabelVisible(ElementTypes.CardAddress) ? 'address' : ''}
width='100%'
backgroundColor={inputsBackground} backgroundColor={inputsBackground}
> >
<Input <Input
@ -184,6 +186,7 @@ export const AddCardFormInner = (props: Props) => {
onChange={onAddressChange} onChange={onAddressChange}
onFocus={onInputsFocus(ElementTypes.CardAddress)} onFocus={onInputsFocus(ElementTypes.CardAddress)}
onBlur={onInputsBlur(ElementTypes.CardAddress)} onBlur={onInputsBlur(ElementTypes.CardAddress)}
className='ChangeCard__Form__Address'
/> />
</ElementContainer> </ElementContainer>
</Column> </Column>

@ -90,7 +90,6 @@ export const SectionTitle = styled.span`
} }
` `
: ''}; : ''};
` `
export const CountryWrapper = styled.div` export const CountryWrapper = styled.div`
@ -101,10 +100,22 @@ export const CustomCombobox = styled(Combobox)`
${InputWrapper}{ ${InputWrapper}{
height: 50px; height: 50px;
margin-top: 0; margin-top: 0;
${isMobileDevice
? css`
height: 27px;
`
: ''};
} }
${LabelTitle}{ ${LabelTitle}{
line-height:45px; line-height:45px;
font-size: 16px; font-size: 16px;
${isMobileDevice
? css`
font-size: 12px;
`
: ''};
} }
${InputStyled}{ ${InputStyled}{
height: 50px; height: 50px;

@ -31,7 +31,7 @@ const Item = styled.li`
? css` ? css`
width: 100%; width: 100%;
height: 21px; height: 21px;
margin-bottom: 14px; /* margin-bottom: 14px; */
` `
: ''} : ''}
` `
@ -53,7 +53,7 @@ const Radio = styled(RadioBase)`
margin-right: 12px; margin-right: 12px;
${isMobileDevice ${isMobileDevice
? css` ? css`
margin-right: 18px; /* margin-right: 18px; */
width: 16px; width: 16px;
height: 16px; height: 16px;
` `

@ -103,7 +103,7 @@ export const Wrapper = styled.div<WrapperProps>`
@media (max-width: 1370px) { @media (max-width: 1370px) {
max-width: 743px; max-width: 743px;
max-height: 650px; /* max-height: 650px; */
} }
@media (max-width: 650px){ @media (max-width: 650px){

@ -117,7 +117,7 @@ export const Combobox = <T extends Option>(props: Props<T>) => {
<WrapperIcon> <WrapperIcon>
<Icon refIcon={iconName} /> <Icon refIcon={iconName} />
</WrapperIcon> </WrapperIcon>
) : ( ) : !disabled && (
<Arrow isExpanded={isOpen} toggle={toggle} /> <Arrow isExpanded={isOpen} toggle={toggle} />
)} )}
{isOpen && !isEmpty(options) && ( {isOpen && !isEmpty(options) && (

@ -104,7 +104,7 @@ ${isMobileDevice
? css` ? css`
@media (max-width: 650px),(orientation: landscape){ @media (max-width: 650px),(orientation: landscape){
width: 100px; width: 100px;
height: 22px; min-height: 17px;
font-size: 10px; font-size: 10px;
border-radius: 7px; border-radius: 7px;
border: 0.7px solid #fff; border: 0.7px solid #fff;
@ -172,6 +172,12 @@ export const StyledLink = styled(ProfileLink)`
export const SсBtnWrapper = styled.div` export const SсBtnWrapper = styled.div`
display: flex; display: flex;
flex-direction: row; flex-direction: row;
${isMobileDevice
? css`
flex-direction: column;
`
: ''};
` `
export const SсGetHighlightBtn = styled(ButtonSolid)` export const SсGetHighlightBtn = styled(ButtonSolid)`
@ -186,4 +192,17 @@ export const SсGetHighlightBtn = styled(ButtonSolid)`
height: 1.95rem; height: 1.95rem;
border-radius: 13px; border-radius: 13px;
margin-left: 5px; margin-left: 5px;
${isMobileDevice
? css`
width: 100%;
min-height: 17px;
font-size: 10px;
border-radius: 7px;
margin: 0;
border: 0.7px solid #fff;
font-size: 10px;
line-height: 24px;
`
: ''};
` `

@ -329,6 +329,10 @@ export const useHighlightsForm = () => {
...player, ...player,
name: `${player?.firstname_eng} ${player?.lastname_eng}`, name: `${player?.firstname_eng} ${player?.lastname_eng}`,
}))) })))
setPlayers(state?.map((player: Player) => ({
...player,
name: `${player?.firstname_eng} ${player?.lastname_eng}`,
})))
}) })
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [formState?.selectedTeam, playerHighlight]) }, [formState?.selectedTeam, playerHighlight])

@ -141,7 +141,8 @@ export const FormHighlights = ({ price }: PriceInfoType) => {
withError={false} withError={false}
wrapperHeight={wrapperHeight} wrapperHeight={wrapperHeight}
labelBefore={selectedSound?.asset} labelBefore={selectedSound?.asset}
className='FormHighlights__input__sound' className={selectedSound?.asset
? 'FormHighlights__input__sound' : ''}
/> />
<Combobox <Combobox
disabled disabled

@ -95,6 +95,18 @@ export const ScForm = styled.form`
} }
} }
.FormHighlights__input__sound {
& input {
margin-left: 33px;
${isMobileDevice
? css`
margin-left: 20px;
`
: ''};
}
}
${isMobileDevice ${isMobileDevice
? css` ? css`
max-width: 100%; max-width: 100%;

@ -152,6 +152,12 @@ export const ScLoaderWrapper = styled.div`
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
${isMobileDevice
? css`
left: 15%;
`
: ''};
` `
export const ScCountMatches = styled.span` export const ScCountMatches = styled.span`

@ -3,7 +3,6 @@ import styled, { css } from 'styled-components/macro'
export const ScPriceInfo = styled.div` export const ScPriceInfo = styled.div`
height: 186px; height: 186px;
min-width: 150px;
border: 1px solid #FFFFFF; border: 1px solid #FFFFFF;
border-radius: 34px; border-radius: 34px;
display: flex; display: flex;
@ -11,7 +10,7 @@ export const ScPriceInfo = styled.div`
justify-content: center; justify-content: center;
align-content: center; align-content: center;
color: #FFFFFF; color: #FFFFFF;
padding: 21px; padding: 21px 21px 21px 40px;
font-weight: 600; font-weight: 600;
font-size: 20px; font-size: 20px;

@ -18,7 +18,7 @@ export const ScModal = styled(BaseModal)`
flex-direction: column; flex-direction: column;
padding: 50px; padding: 50px;
width: 497px; width: 497px;
height: 430px; height: 470px;
> * { > * {
margin-bottom: 25px; margin-bottom: 25px;
@ -61,6 +61,7 @@ export const ScText = styled.span`
export const ScButton = styled(ButtonSolid)` export const ScButton = styled(ButtonSolid)`
width: 194px; width: 194px;
height: 50px; height: 50px;
min-height: 50px;
font-weight: 600; font-weight: 600;
font-size: 20px; font-size: 20px;
line-height: 50px; line-height: 50px;

Loading…
Cancel
Save