Ott 717 match popup changes (#310)
* fix(717): popup player settings (#308) * Ott 717 part 2 (#309) * fix(717): component changes * fix(717): empty episodes * fix(717): style fix * refactor(717): renamed playlistData to episodeskeep-around/af30b88d367751c9e05a735e4a0467a96238ef47
parent
474e1da8fb
commit
9bf368080c
@ -0,0 +1,38 @@ |
|||||||
|
import { MediaQuery } from 'features/MediaQuery' |
||||||
|
import { T9n } from 'features/T9n' |
||||||
|
import { |
||||||
|
CloseButton, |
||||||
|
Header, |
||||||
|
HeaderActions, |
||||||
|
HeaderTitle, |
||||||
|
} from 'features/PopupComponents' |
||||||
|
|
||||||
|
import { useMatchPopupStore } from '../../store' |
||||||
|
import { BackButton } from '../BackButton' |
||||||
|
import { Content } from '../../styled' |
||||||
|
|
||||||
|
export const MatchSettingsPage = () => { |
||||||
|
const { closePopup } = useMatchPopupStore() |
||||||
|
|
||||||
|
return ( |
||||||
|
<Content height={778}> |
||||||
|
<Header> |
||||||
|
<HeaderActions position='left'> |
||||||
|
<BackButton /> |
||||||
|
</HeaderActions> |
||||||
|
|
||||||
|
<MediaQuery maxDevice='mobile'> |
||||||
|
<HeaderTitle> |
||||||
|
<T9n t='match_settings' /> |
||||||
|
</HeaderTitle> |
||||||
|
</MediaQuery> |
||||||
|
|
||||||
|
<MediaQuery minDevice='tablet'> |
||||||
|
<HeaderActions position='right'> |
||||||
|
<CloseButton onClick={closePopup} /> |
||||||
|
</HeaderActions> |
||||||
|
</MediaQuery> |
||||||
|
</Header> |
||||||
|
</Content> |
||||||
|
) |
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
import styled from 'styled-components/macro' |
||||||
|
|
||||||
|
import { HeaderTitle } from 'features/PopupComponents' |
||||||
|
|
||||||
|
export const TitleWrapper = styled(HeaderTitle)` |
||||||
|
display: flex; |
||||||
|
flex-direction: column; |
||||||
|
line-height: 32px; |
||||||
|
` |
||||||
|
|
||||||
|
export const TeamNames = styled.span` |
||||||
|
font-weight: normal; |
||||||
|
` |
||||||
@ -1,44 +1,46 @@ |
|||||||
import type { MouseEvent } from 'react' |
import type { MouseEvent } from 'react' |
||||||
import { useState, useCallback } from 'react' |
import { useState, useCallback } from 'react' |
||||||
|
|
||||||
import { useToggle } from 'hooks' |
import last from 'lodash/last' |
||||||
|
|
||||||
import { PopupPages } from '../../types' |
import { PopupPages } from '../../types' |
||||||
|
|
||||||
export const usePopupNavigation = () => { |
export const usePopupNavigation = () => { |
||||||
const { |
const [pages, setPages] = useState<Array<PopupPages>>([]) |
||||||
close, |
|
||||||
isOpen, |
|
||||||
open, |
|
||||||
} = useToggle() |
|
||||||
|
|
||||||
const [page, setPage] = useState<PopupPages>(PopupPages.PLAYLIST) |
const goTo = useCallback( |
||||||
|
(step: PopupPages, e?: MouseEvent<HTMLButtonElement>) => setPages((state) => { |
||||||
|
e?.stopPropagation() |
||||||
|
return [...state, step] |
||||||
|
}), |
||||||
|
[], |
||||||
|
) |
||||||
|
|
||||||
const closePopup = useCallback(() => { |
const goBack = useCallback((e?: MouseEvent) => { |
||||||
close() |
|
||||||
setPage(PopupPages.PLAYLIST) |
|
||||||
}, [close]) |
|
||||||
|
|
||||||
const goBack = useCallback((e?: MouseEvent<HTMLElement>) => { |
|
||||||
e?.stopPropagation() |
e?.stopPropagation() |
||||||
if (page === PopupPages.PLAYLIST) { |
setPages((state) => { |
||||||
closePopup() |
const newState = [...state] |
||||||
} else { |
newState.pop() |
||||||
setPage(PopupPages.PLAYLIST) |
return newState |
||||||
} |
}) |
||||||
}, [page, closePopup]) |
}, []) |
||||||
|
|
||||||
const goToSettings = useCallback((e: MouseEvent<HTMLElement>) => { |
const openPopup = () => { |
||||||
e.stopPropagation() |
setPages([PopupPages.PLAYLIST]) |
||||||
setPage(PopupPages.SETTINGS) |
} |
||||||
|
|
||||||
|
const closePopup = useCallback(() => { |
||||||
|
setPages([]) |
||||||
}, []) |
}, []) |
||||||
|
|
||||||
|
const page = last(pages) |
||||||
|
|
||||||
return { |
return { |
||||||
closePopup, |
closePopup, |
||||||
goBack, |
goBack, |
||||||
goToSettings, |
goTo, |
||||||
isOpen, |
isOpen: Boolean(page), |
||||||
openPopup: open, |
openPopup, |
||||||
page, |
page, |
||||||
} |
} |
||||||
} |
} |
||||||
|
|||||||
Loading…
Reference in new issue