Ott 952 popup player actions (#340)
* refactor(952): light settings popup refactoring * fix(952): fetch player actions on format selectkeep-around/af30b88d367751c9e05a735e4a0467a96238ef47
parent
de55ca88b0
commit
5869da52fd
@ -1,37 +1,40 @@ |
|||||||
import { useState } from 'react' |
import { useObjectState } from 'hooks' |
||||||
|
|
||||||
import type { |
import type { |
||||||
EpisodeDuration, |
|
||||||
PlayerPlaylistFormats, |
|
||||||
SelectedActions, |
SelectedActions, |
||||||
|
EpisodeDuration, |
||||||
} from 'features/MatchPopup' |
} from 'features/MatchPopup' |
||||||
|
import { PlayerPlaylistFormats, useMatchPopupStore } from 'features/MatchPopup' |
||||||
|
|
||||||
type Args = { |
export const useSettingsDesktop = () => { |
||||||
episodeDuration: EpisodeDuration, |
const { |
||||||
selectedActions: SelectedActions, |
actions, |
||||||
selectedPlaylistFormat: PlayerPlaylistFormats, |
fetchSportActions, |
||||||
|
settings, |
||||||
|
} = useMatchPopupStore() |
||||||
|
const [localSettings, setSettings] = useObjectState(settings) |
||||||
|
|
||||||
|
const onPlaylistFormatChange = (playlistFormat: PlayerPlaylistFormats) => { |
||||||
|
setSettings({ selectedFormat: playlistFormat }) |
||||||
|
if (playlistFormat === PlayerPlaylistFormats.SELECTED_ACTIONS) { |
||||||
|
fetchSportActions() |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
export const useSettingsDesktop = ({ |
const onActionsChange = (selectedActions: SelectedActions) => { |
||||||
episodeDuration, |
setSettings({ selectedActions }) |
||||||
selectedActions, |
} |
||||||
selectedPlaylistFormat, |
|
||||||
}: Args) => { |
const onEpisodeDurationsChange = (episodeDuration: EpisodeDuration) => { |
||||||
const [actionsValue, setActionsValue] = useState<SelectedActions>(selectedActions) |
setSettings({ episodeDuration }) |
||||||
const [ |
} |
||||||
episodeDurationValue, |
|
||||||
setEpisodeDurationValue] = useState<EpisodeDuration>(episodeDuration) |
|
||||||
const [ |
|
||||||
selectedPlaylistFormatValue, |
|
||||||
setSelectedPlaylistFormatValue, |
|
||||||
] = useState<PlayerPlaylistFormats>(selectedPlaylistFormat) |
|
||||||
|
|
||||||
return { |
return { |
||||||
actionsValue, |
actions, |
||||||
episodeDurationValue, |
localSettings, |
||||||
selectedPlaylistFormatValue, |
onActionsChange, |
||||||
setActionsValue, |
onEpisodeDurationsChange, |
||||||
setEpisodeDurationValue, |
onPlaylistFormatChange, |
||||||
setSelectedPlaylistFormatValue, |
settings, |
||||||
} |
} |
||||||
} |
} |
||||||
|
|||||||
Loading…
Reference in new issue