2018-02-12 17:42:38 +00:00
|
|
|
// @flow
|
|
|
|
|
2017-05-23 18:58:07 +00:00
|
|
|
import { ReducerRegistry } from '../base/redux';
|
2018-02-05 21:52:41 +00:00
|
|
|
|
2018-02-06 09:40:16 +00:00
|
|
|
import {
|
|
|
|
SET_FILMSTRIP_ENABLED,
|
|
|
|
SET_FILMSTRIP_HOVERED,
|
2020-01-24 16:28:47 +00:00
|
|
|
SET_FILMSTRIP_VISIBLE,
|
|
|
|
SET_HORIZONTAL_VIEW_DIMENSIONS,
|
|
|
|
SET_TILE_VIEW_DIMENSIONS
|
2018-02-06 09:40:16 +00:00
|
|
|
} from './actionTypes';
|
2017-05-23 18:58:07 +00:00
|
|
|
|
|
|
|
const DEFAULT_STATE = {
|
2018-02-12 17:42:38 +00:00
|
|
|
/**
|
|
|
|
* The indicator which determines whether the {@link Filmstrip} is enabled.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
2018-02-06 09:40:16 +00:00
|
|
|
enabled: true,
|
2018-02-12 17:42:38 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
/**
|
|
|
|
* The horizontal view dimensions.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
|
|
|
horizontalViewDimensions: {},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The tile view dimensions.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
|
|
|
tileViewDimensions: {},
|
|
|
|
|
2018-02-12 17:42:38 +00:00
|
|
|
/**
|
|
|
|
* The indicator which determines whether the {@link Filmstrip} is visible.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
2017-05-23 18:58:07 +00:00
|
|
|
visible: true
|
|
|
|
};
|
|
|
|
|
|
|
|
ReducerRegistry.register(
|
|
|
|
'features/filmstrip',
|
|
|
|
(state = DEFAULT_STATE, action) => {
|
|
|
|
switch (action.type) {
|
2018-02-06 09:40:16 +00:00
|
|
|
case SET_FILMSTRIP_ENABLED:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
enabled: action.enabled
|
|
|
|
};
|
|
|
|
|
2017-09-01 21:40:05 +00:00
|
|
|
case SET_FILMSTRIP_HOVERED:
|
|
|
|
return {
|
|
|
|
...state,
|
2018-02-12 17:42:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The indicator which determines whether the {@link Filmstrip}
|
|
|
|
* is being hovered (over).
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
2017-09-01 21:40:05 +00:00
|
|
|
hovered: action.hovered
|
|
|
|
};
|
|
|
|
|
2018-02-05 21:52:41 +00:00
|
|
|
case SET_FILMSTRIP_VISIBLE:
|
2017-05-23 18:58:07 +00:00
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
visible: action.visible
|
|
|
|
};
|
2020-01-24 16:28:47 +00:00
|
|
|
|
|
|
|
case SET_HORIZONTAL_VIEW_DIMENSIONS:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
horizontalViewDimensions: action.dimensions
|
|
|
|
};
|
|
|
|
case SET_TILE_VIEW_DIMENSIONS:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
tileViewDimensions: action.dimensions
|
|
|
|
};
|
2017-05-23 18:58:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
|
|
|
});
|