fix(toolbox) don't mix web and native actions on the same file
This commit is contained in:
parent
a6359e5d4c
commit
b1ebe340cf
|
@ -0,0 +1,55 @@
|
|||
// @flow
|
||||
|
||||
import {
|
||||
SET_TOOLBOX_ALWAYS_VISIBLE,
|
||||
SET_TOOLBOX_ENABLED,
|
||||
SET_TOOLBOX_VISIBLE
|
||||
} from './actionTypes';
|
||||
|
||||
/**
|
||||
* Signals that always visible toolbars value should be changed.
|
||||
*
|
||||
* @param {boolean} alwaysVisible - Value to be set in redux store.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_ALWAYS_VISIBLE,
|
||||
* alwaysVisible: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxAlwaysVisible(alwaysVisible: boolean): Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_ALWAYS_VISIBLE,
|
||||
alwaysVisible
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/disables the toolbox.
|
||||
*
|
||||
* @param {boolean} enabled - True to enable the toolbox or false to disable it.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_ENABLED,
|
||||
* enabled: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxEnabled(enabled: boolean): Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_ENABLED,
|
||||
enabled
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows/hides the toolbox.
|
||||
*
|
||||
* @param {boolean} visible - True to show the toolbox or false to hide it.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_VISIBLE,
|
||||
* visible: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxVisible(visible: boolean): Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_VISIBLE,
|
||||
visible
|
||||
};
|
||||
}
|
|
@ -1,150 +1,8 @@
|
|||
/* @flow */
|
||||
// @flow
|
||||
|
||||
import {
|
||||
CLEAR_TOOLBOX_TIMEOUT,
|
||||
SET_OVERFLOW_MENU_VISIBLE,
|
||||
SET_TOOLBAR_HOVERED,
|
||||
SET_TOOLBOX_ALWAYS_VISIBLE,
|
||||
SET_TOOLBOX_ENABLED,
|
||||
SET_TOOLBOX_TIMEOUT,
|
||||
SET_TOOLBOX_TIMEOUT_MS,
|
||||
SET_TOOLBOX_VISIBLE,
|
||||
TOGGLE_TOOLBOX_VISIBLE
|
||||
} from './actionTypes';
|
||||
import { TOGGLE_TOOLBOX_VISIBLE } from './actionTypes';
|
||||
|
||||
|
||||
/**
|
||||
* Signals that toolbox timeout should be cleared.
|
||||
*
|
||||
* @returns {{
|
||||
* type: CLEAR_TOOLBOX_TIMEOUT
|
||||
* }}
|
||||
*/
|
||||
export function clearToolboxTimeout(): Object {
|
||||
return {
|
||||
type: CLEAR_TOOLBOX_TIMEOUT
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows/hides the overflow menu.
|
||||
*
|
||||
* @param {boolean} visible - True to show it or false to hide it.
|
||||
* @returns {{
|
||||
* type: SET_OVERFLOW_MENU_VISIBLE,
|
||||
* visible: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setOverflowMenuVisible(visible: boolean): Object {
|
||||
return {
|
||||
type: SET_OVERFLOW_MENU_VISIBLE,
|
||||
visible
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Signals that toolbar is hovered value should be changed.
|
||||
*
|
||||
* @param {boolean} hovered - Flag showing whether toolbar is hovered.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBAR_HOVERED,
|
||||
* hovered: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setToolbarHovered(hovered: boolean): Object {
|
||||
return {
|
||||
type: SET_TOOLBAR_HOVERED,
|
||||
hovered
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Signals that always visible toolbars value should be changed.
|
||||
*
|
||||
* @param {boolean} alwaysVisible - Value to be set in redux store.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_ALWAYS_VISIBLE,
|
||||
* alwaysVisible: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxAlwaysVisible(alwaysVisible: boolean): Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_ALWAYS_VISIBLE,
|
||||
alwaysVisible
|
||||
};
|
||||
}
|
||||
|
||||
/* eslint-disable flowtype/space-before-type-colon */
|
||||
|
||||
/**
|
||||
* Enables/disables the toolbox.
|
||||
*
|
||||
* @param {boolean} enabled - True to enable the toolbox or false to disable it.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_ENABLED,
|
||||
* enabled: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxEnabled(enabled: boolean): Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_ENABLED,
|
||||
enabled
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches an action which sets new timeout and clears the previous one.
|
||||
*
|
||||
* @param {Function} handler - Function to be invoked after the timeout.
|
||||
* @param {number} timeoutMS - Delay.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_TIMEOUT,
|
||||
* handler: Function,
|
||||
* timeoutMS: number
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxTimeout(handler: Function, timeoutMS: number)
|
||||
: Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_TIMEOUT,
|
||||
handler,
|
||||
timeoutMS
|
||||
};
|
||||
}
|
||||
|
||||
/* eslint-enable flowtype/space-before-type-colon */
|
||||
|
||||
/**
|
||||
* Dispatches an action which sets new toolbox timeout value.
|
||||
*
|
||||
* @param {number} timeoutMS - Delay.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_TIMEOUT_MS,
|
||||
* timeoutMS: number
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxTimeoutMS(timeoutMS: number): Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_TIMEOUT_MS,
|
||||
timeoutMS
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows/hides the toolbox.
|
||||
*
|
||||
* @param {boolean} visible - True to show the toolbox or false to hide it.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_VISIBLE,
|
||||
* visible: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxVisible(visible: boolean): Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_VISIBLE,
|
||||
visible
|
||||
};
|
||||
}
|
||||
export * from './actions.any';
|
||||
|
||||
/**
|
||||
* Action to toggle the toolbox visibility.
|
||||
|
|
|
@ -5,20 +5,20 @@ import type { Dispatch } from 'redux';
|
|||
import { isLayoutTileView } from '../video-layout';
|
||||
|
||||
import {
|
||||
CLEAR_TOOLBOX_TIMEOUT,
|
||||
FULL_SCREEN_CHANGED,
|
||||
SET_FULL_SCREEN,
|
||||
SET_OVERFLOW_DRAWER
|
||||
SET_OVERFLOW_DRAWER,
|
||||
SET_OVERFLOW_MENU_VISIBLE,
|
||||
SET_TOOLBAR_HOVERED,
|
||||
SET_TOOLBOX_TIMEOUT,
|
||||
SET_TOOLBOX_TIMEOUT_MS
|
||||
} from './actionTypes';
|
||||
import {
|
||||
clearToolboxTimeout,
|
||||
setToolboxTimeout,
|
||||
setToolboxTimeoutMS,
|
||||
setToolboxVisible
|
||||
} from './actions.native';
|
||||
import { setToolboxVisible } from './actions.any';
|
||||
|
||||
declare var interfaceConfig: Object;
|
||||
|
||||
export * from './actions.native';
|
||||
export * from './actions.any';
|
||||
|
||||
/**
|
||||
* Docks/undocks the Toolbox.
|
||||
|
@ -180,9 +180,88 @@ export function hideToolboxOnTileView() {
|
|||
const state = getState();
|
||||
const { overflowDrawer } = state['features/toolbox'];
|
||||
|
||||
|
||||
if (!overflowDrawer && isLayoutTileView(state)) {
|
||||
dispatch(hideToolbox(true));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Signals that toolbox timeout should be cleared.
|
||||
*
|
||||
* @returns {{
|
||||
* type: CLEAR_TOOLBOX_TIMEOUT
|
||||
* }}
|
||||
*/
|
||||
export function clearToolboxTimeout(): Object {
|
||||
return {
|
||||
type: CLEAR_TOOLBOX_TIMEOUT
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows/hides the overflow menu.
|
||||
*
|
||||
* @param {boolean} visible - True to show it or false to hide it.
|
||||
* @returns {{
|
||||
* type: SET_OVERFLOW_MENU_VISIBLE,
|
||||
* visible: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setOverflowMenuVisible(visible: boolean): Object {
|
||||
return {
|
||||
type: SET_OVERFLOW_MENU_VISIBLE,
|
||||
visible
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Signals that toolbar is hovered value should be changed.
|
||||
*
|
||||
* @param {boolean} hovered - Flag showing whether toolbar is hovered.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBAR_HOVERED,
|
||||
* hovered: boolean
|
||||
* }}
|
||||
*/
|
||||
export function setToolbarHovered(hovered: boolean): Object {
|
||||
return {
|
||||
type: SET_TOOLBAR_HOVERED,
|
||||
hovered
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches an action which sets new timeout and clears the previous one.
|
||||
*
|
||||
* @param {Function} handler - Function to be invoked after the timeout.
|
||||
* @param {number} timeoutMS - Delay.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_TIMEOUT,
|
||||
* handler: Function,
|
||||
* timeoutMS: number
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxTimeout(handler: Function, timeoutMS: number): Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_TIMEOUT,
|
||||
handler,
|
||||
timeoutMS
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches an action which sets new toolbox timeout value.
|
||||
*
|
||||
* @param {number} timeoutMS - Delay.
|
||||
* @returns {{
|
||||
* type: SET_TOOLBOX_TIMEOUT_MS,
|
||||
* timeoutMS: number
|
||||
* }}
|
||||
*/
|
||||
export function setToolboxTimeoutMS(timeoutMS: number): Object {
|
||||
return {
|
||||
type: SET_TOOLBOX_TIMEOUT_MS,
|
||||
timeoutMS
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue