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 { useState, useCallback } from 'react' |
||||
|
||||
import { useToggle } from 'hooks' |
||||
import last from 'lodash/last' |
||||
|
||||
import { PopupPages } from '../../types' |
||||
|
||||
export const usePopupNavigation = () => { |
||||
const { |
||||
close, |
||||
isOpen, |
||||
open, |
||||
} = useToggle() |
||||
const [pages, setPages] = useState<Array<PopupPages>>([]) |
||||
|
||||
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(() => { |
||||
close() |
||||
setPage(PopupPages.PLAYLIST) |
||||
}, [close]) |
||||
|
||||
const goBack = useCallback((e?: MouseEvent<HTMLElement>) => { |
||||
const goBack = useCallback((e?: MouseEvent) => { |
||||
e?.stopPropagation() |
||||
if (page === PopupPages.PLAYLIST) { |
||||
closePopup() |
||||
} else { |
||||
setPage(PopupPages.PLAYLIST) |
||||
} |
||||
}, [page, closePopup]) |
||||
|
||||
const goToSettings = useCallback((e: MouseEvent<HTMLElement>) => { |
||||
e.stopPropagation() |
||||
setPage(PopupPages.SETTINGS) |
||||
setPages((state) => { |
||||
const newState = [...state] |
||||
newState.pop() |
||||
return newState |
||||
}) |
||||
}, []) |
||||
|
||||
const openPopup = () => { |
||||
setPages([PopupPages.PLAYLIST]) |
||||
} |
||||
|
||||
const closePopup = useCallback(() => { |
||||
setPages([]) |
||||
}, []) |
||||
|
||||
const page = last(pages) |
||||
|
||||
return { |
||||
closePopup, |
||||
goBack, |
||||
goToSettings, |
||||
isOpen, |
||||
openPopup: open, |
||||
goTo, |
||||
isOpen: Boolean(page), |
||||
openPopup, |
||||
page, |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue