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
54782fc1
Commit
54782fc1
authored
Mar 13, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Mar 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate thread-annotations to TypeScript
parent
082de109
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
24 deletions
+17
-24
thread-annotations.ts
src/sidebar/helpers/thread-annotations.ts
+17
-24
No files found.
src/sidebar/helpers/thread-annotations.
j
s
→
src/sidebar/helpers/thread-annotations.
t
s
View file @
54782fc1
import
type
{
Annotation
}
from
'../../types/api'
;
import
{
memoize
}
from
'../util/memoize'
;
import
{
generateFacetedFilter
}
from
'../util/search-filter'
;
import
{
buildThread
}
from
'./build-thread'
;
import
type
{
Thread
,
BuildThreadOptions
}
from
'./build-thread'
;
import
{
shouldShowInTab
}
from
'./tabs'
;
import
{
sorters
}
from
'./thread-sorters'
;
import
{
filterAnnotations
}
from
'./view-filter'
;
/** @typedef {import('../../types/api').Annotation} Annotation */
/** @typedef {import('./build-thread').Thread} Thread */
/** @typedef {import('./build-thread').BuildThreadOptions} BuildThreadOptions */
/**
* @typedef ThreadState
* @prop {Annotation[]} annotations
* @prop {object} selection
* @prop {Record<string,boolean>} selection.expanded
* @prop {string|null} selection.filterQuery
* @prop {Record<string,string>} selection.filters
* @prop {string[]} selection.forcedVisible
* @prop {string[]} selection.selected
* @prop {keyof sorters} selection.sortKey
* @prop {'annotation'|'note'|'orphan'} selection.selectedTab
* @prop {string|null} route
*/
type
ThreadState
=
{
annotations
:
Annotation
[];
route
:
string
|
null
;
selection
:
{
expanded
:
Record
<
string
,
boolean
>
;
filterQuery
:
string
|
null
;
filters
:
Record
<
string
,
string
>
;
forcedVisible
:
string
[];
selected
:
string
[];
sortKey
:
keyof
typeof
sorters
;
selectedTab
:
'annotation'
|
'note'
|
'orphan'
;
};
};
/**
* Cobble together the right set of options and filters based on current
* `threadState` to build the root thread.
*
* @param {ThreadState} threadState
* @return {Thread}
*/
function
buildRootThread
(
threadState
)
{
function
buildRootThread
(
threadState
:
ThreadState
):
Thread
{
const
selection
=
threadState
.
selection
;
/** @type {BuildThreadOptions} */
const
options
=
{
const
options
:
BuildThreadOptions
=
{
expanded
:
selection
.
expanded
,
forcedVisible
:
selection
.
forcedVisible
,
selected
:
selection
.
selected
,
...
...
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