Commit 04a98682 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Remove unused selector

Remove unused selector and tidy up reference ordering
parent 9fb70f45
...@@ -127,16 +127,6 @@ const actions = actionTypes(update); ...@@ -127,16 +127,6 @@ const actions = actionTypes(update);
// Action creators // Action creators
/** Set the query used to filter displayed annotations. */
function setFilterQuery(query) {
return dispatch => {
dispatch({
type: actions.SET_FILTER_QUERY,
query: query,
});
};
}
/** /**
* Clears any applied filters, changes the focused user and sets * Clears any applied filters, changes the focused user and sets
* focused enabled to `true`. * focused enabled to `true`.
...@@ -147,6 +137,14 @@ function changeFocusModeUser(user) { ...@@ -147,6 +137,14 @@ function changeFocusModeUser(user) {
return { type: actions.CHANGE_FOCUS_MODE_USER, user }; return { type: actions.CHANGE_FOCUS_MODE_USER, user };
} }
/** Set the query used to filter displayed annotations. */
function setFilterQuery(query) {
return {
type: actions.SET_FILTER_QUERY,
query: query,
};
}
/** /**
* Toggle whether or not a (user-)focus mode is applied, either inverting the * Toggle whether or not a (user-)focus mode is applied, either inverting the
* current active state or setting it to a target `active` state, if provided. * current active state or setting it to a target `active` state, if provided.
......
...@@ -87,10 +87,6 @@ const setTab = (newTab, oldTab) => { ...@@ -87,10 +87,6 @@ const setTab = (newTab, oldTab) => {
}; };
}; };
/**
* Return state object representing a reset selection. This
* resets user-set filters (but leaves focus mode intact)
*/
const resetSelection = () => { const resetSelection = () => {
return { return {
forcedVisible: {}, forcedVisible: {},
...@@ -311,20 +307,6 @@ const forcedVisibleAnnotations = createSelector( ...@@ -311,20 +307,6 @@ const forcedVisibleAnnotations = createSelector(
forcedVisible => trueKeys(forcedVisible) forcedVisible => trueKeys(forcedVisible)
); );
/**
* Returns the annotation ID of the first annotation in the selection that is
* selected (`true`) or `null` if there are none.
*
* @type {(state: any) => string|null}
*/
const getFirstSelectedAnnotationId = createSelector(
state => state.selected,
selection => {
const selectedIds = trueKeys(selection);
return selectedIds.length ? selectedIds[0] : null;
}
);
/** /**
* Are any annotations currently selected? * Are any annotations currently selected?
* *
...@@ -352,6 +334,9 @@ function selectedTab(state) { ...@@ -352,6 +334,9 @@ function selectedTab(state) {
return state.selectedTab; return state.selectedTab;
} }
/**
* @return {SelectionState}
*/
function selectionState(state) { function selectionState(state) {
const selectionState = { const selectionState = {
expanded: expandedMap(state), expanded: expandedMap(state),
...@@ -401,7 +386,6 @@ function sortKeys(state) { ...@@ -401,7 +386,6 @@ function sortKeys(state) {
* // Selectors * // Selectors
* @prop {() => Object<string,boolean>} expandedMap * @prop {() => Object<string,boolean>} expandedMap
* @prop {() => string[]} forcedVisibleAnnotations * @prop {() => string[]} forcedVisibleAnnotations
* @prop {() => string|null} getFirstSelectedAnnotationId
* @prop {() => boolean} hasSelectedAnnotations * @prop {() => boolean} hasSelectedAnnotations
* @prop {() => string[]} selectedAnnotations * @prop {() => string[]} selectedAnnotations
* @prop {() => string} selectedTab * @prop {() => string} selectedTab
...@@ -429,7 +413,6 @@ export default { ...@@ -429,7 +413,6 @@ export default {
selectors: { selectors: {
expandedMap, expandedMap,
forcedVisibleAnnotations, forcedVisibleAnnotations,
getFirstSelectedAnnotationId,
hasSelectedAnnotations, hasSelectedAnnotations,
selectedAnnotations, selectedAnnotations,
selectedTab, selectedTab,
......
...@@ -18,18 +18,6 @@ describe('sidebar/store/modules/selection', () => { ...@@ -18,18 +18,6 @@ describe('sidebar/store/modules/selection', () => {
store = createStore([annotations, filters, selection, route], fakeSettings); store = createStore([annotations, filters, selection, route], fakeSettings);
}); });
describe('getFirstSelectedAnnotationId', function () {
it('returns the first selected annotation id it finds', function () {
store.selectAnnotations([1, 2]);
assert.equal(store.getFirstSelectedAnnotationId(), 1);
});
it('returns null if no selected annotation ids are found', function () {
store.selectAnnotations([]);
assert.isNull(store.getFirstSelectedAnnotationId());
});
});
describe('setForcedVisible', function () { describe('setForcedVisible', function () {
it('sets the visibility of the annotation', function () { it('sets the visibility of the annotation', function () {
store.setForcedVisible('id1', true); store.setForcedVisible('id1', true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment