mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
refactor(OptionsMenu): better naming
This commit is contained in:
parent
72d4e740e1
commit
dddc390952
2 changed files with 9 additions and 9 deletions
|
|
@ -7,12 +7,12 @@ const Icon = require('@stremio/stremio-icons/dom');
|
|||
const { Button } = require('stremio/common');
|
||||
const styles = require('./styles');
|
||||
|
||||
const Option = ({ icon, label, playerId, disabled, onClick }) => {
|
||||
const Option = ({ icon, label, deviceId, disabled, onClick }) => {
|
||||
const onButtonClick = React.useCallback(() => {
|
||||
if (typeof onClick === 'function') {
|
||||
onClick(playerId);
|
||||
onClick(deviceId);
|
||||
}
|
||||
}, [onClick, playerId]);
|
||||
}, [onClick, deviceId]);
|
||||
return (
|
||||
<Button className={classnames(styles['option-container'], { 'disabled': disabled })} disabled={disabled} onClick={onButtonClick}>
|
||||
<Icon className={styles['icon']} icon={icon} />
|
||||
|
|
@ -24,7 +24,7 @@ const Option = ({ icon, label, playerId, disabled, onClick }) => {
|
|||
Option.propTypes = {
|
||||
icon: PropTypes.string,
|
||||
label: PropTypes.string,
|
||||
playerId: PropTypes.string,
|
||||
deviceId: PropTypes.string,
|
||||
disabled: PropTypes.bool,
|
||||
onClick: PropTypes.func,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const OptionsMenu = ({ className, stream, playbackDevices }) => {
|
|||
:
|
||||
null;
|
||||
}, [stream]);
|
||||
const externalPlayers = React.useMemo(() => {
|
||||
const externalDevices = React.useMemo(() => {
|
||||
return playbackDevices.filter(({ type }) => type === 'external');
|
||||
}, [playbackDevices]);
|
||||
const onCopyStreamButtonClick = React.useCallback(() => {
|
||||
|
|
@ -52,7 +52,7 @@ const OptionsMenu = ({ className, stream, playbackDevices }) => {
|
|||
window.open(streamUrl);
|
||||
}
|
||||
}, [streamUrl]);
|
||||
const onExternalPlayRequested = React.useCallback((deviceId) => {
|
||||
const onExternalDeviceRequested = React.useCallback((deviceId) => {
|
||||
if (streamUrl !== null) {
|
||||
core.transport.dispatch({
|
||||
action: 'StreamingServer',
|
||||
|
|
@ -84,14 +84,14 @@ const OptionsMenu = ({ className, stream, playbackDevices }) => {
|
|||
onClick={onDownloadVideoButtonClick}
|
||||
/>
|
||||
{
|
||||
!stream.infoHash && externalPlayers.map(({ id, name }) => (
|
||||
!stream.infoHash && externalDevices.map(({ id, name }) => (
|
||||
<Option
|
||||
key={id}
|
||||
icon={'ic_vlc'}
|
||||
label={`Play in ${name}`}
|
||||
playerId={id}
|
||||
deviceId={id}
|
||||
disabled={stream === null}
|
||||
onClick={onExternalPlayRequested}
|
||||
onClick={onExternalDeviceRequested}
|
||||
/>
|
||||
))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue