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
Hide 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
{
memoize
}
from
'../util/memoize'
;
import
{
generateFacetedFilter
}
from
'../util/search-filter'
;
import
{
generateFacetedFilter
}
from
'../util/search-filter'
;
import
{
buildThread
}
from
'./build-thread'
;
import
{
buildThread
}
from
'./build-thread'
;
import
type
{
Thread
,
BuildThreadOptions
}
from
'./build-thread'
;
import
{
shouldShowInTab
}
from
'./tabs'
;
import
{
shouldShowInTab
}
from
'./tabs'
;
import
{
sorters
}
from
'./thread-sorters'
;
import
{
sorters
}
from
'./thread-sorters'
;
import
{
filterAnnotations
}
from
'./view-filter'
;
import
{
filterAnnotations
}
from
'./view-filter'
;
/** @typedef {import('../../types/api').Annotation} Annotation */
type
ThreadState
=
{
/** @typedef {import('./build-thread').Thread} Thread */
annotations
:
Annotation
[];
/** @typedef {import('./build-thread').BuildThreadOptions} BuildThreadOptions */
route
:
string
|
null
;
selection
:
{
/**
expanded
:
Record
<
string
,
boolean
>
;
* @typedef ThreadState
filterQuery
:
string
|
null
;
* @prop {Annotation[]} annotations
filters
:
Record
<
string
,
string
>
;
* @prop {object} selection
forcedVisible
:
string
[];
* @prop {Record<string,boolean>} selection.expanded
selected
:
string
[];
* @prop {string|null} selection.filterQuery
sortKey
:
keyof
typeof
sorters
;
* @prop {Record<string,string>} selection.filters
selectedTab
:
'annotation'
|
'note'
|
'orphan'
;
* @prop {string[]} selection.forcedVisible
};
* @prop {string[]} selection.selected
};
* @prop {keyof sorters} selection.sortKey
* @prop {'annotation'|'note'|'orphan'} selection.selectedTab
* @prop {string|null} route
*/
/**
/**
* Cobble together the right set of options and filters based on current
* Cobble together the right set of options and filters based on current
* `threadState` to build the root thread.
* `threadState` to build the root thread.
*
* @param {ThreadState} threadState
* @return {Thread}
*/
*/
function
buildRootThread
(
threadState
)
{
function
buildRootThread
(
threadState
:
ThreadState
):
Thread
{
const
selection
=
threadState
.
selection
;
const
selection
=
threadState
.
selection
;
const
options
:
BuildThreadOptions
=
{
/** @type {BuildThreadOptions} */
const
options
=
{
expanded
:
selection
.
expanded
,
expanded
:
selection
.
expanded
,
forcedVisible
:
selection
.
forcedVisible
,
forcedVisible
:
selection
.
forcedVisible
,
selected
:
selection
.
selected
,
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