Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
04a98682
Commit
04a98682
authored
Dec 04, 2020
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Dec 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused selector
Remove unused selector and tidy up reference ordering
parent
9fb70f45
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
42 deletions
+11
-42
filters.js
src/sidebar/store/modules/filters.js
+8
-10
selection.js
src/sidebar/store/modules/selection.js
+3
-20
selection-test.js
src/sidebar/store/modules/test/selection-test.js
+0
-12
No files found.
src/sidebar/store/modules/filters.js
View file @
04a98682
...
@@ -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.
...
...
src/sidebar/store/modules/selection.js
View file @
04a98682
...
@@ -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
,
...
...
src/sidebar/store/modules/test/selection-test.js
View file @
04a98682
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment