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
795a14e2
Commit
795a14e2
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 tabs to TypeScript
parent
4babd7f1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
13 deletions
+4
-13
tabs.ts
src/sidebar/helpers/tabs.ts
+4
-13
No files found.
src/sidebar/helpers/tabs.
j
s
→
src/sidebar/helpers/tabs.
t
s
View file @
795a14e2
// Functions that determine which tab an annotation should be displayed in.
// Functions that determine which tab an annotation should be displayed in.
import
type
{
Annotation
}
from
'../../types/api'
;
import
type
{
TabName
}
from
'../../types/sidebar'
;
import
*
as
metadata
from
'../helpers/annotation-metadata'
;
import
*
as
metadata
from
'../helpers/annotation-metadata'
;
/**
* @typedef {import('../../types/api').Annotation} Annotation
* @typedef {import('../../types/sidebar').TabName} TabName
*/
/**
/**
* Return the tab in which an annotation should be displayed.
* Return the tab in which an annotation should be displayed.
*
* @param {Annotation} ann
* @return {TabName}
*/
*/
export
function
tabForAnnotation
(
ann
)
{
export
function
tabForAnnotation
(
ann
:
Annotation
):
TabName
{
if
(
metadata
.
isOrphan
(
ann
))
{
if
(
metadata
.
isOrphan
(
ann
))
{
return
'orphan'
;
return
'orphan'
;
}
else
if
(
metadata
.
isPageNote
(
ann
))
{
}
else
if
(
metadata
.
isPageNote
(
ann
))
{
...
@@ -24,11 +18,8 @@ export function tabForAnnotation(ann) {
...
@@ -24,11 +18,8 @@ export function tabForAnnotation(ann) {
/**
/**
* Return true if an annotation should be displayed in a given tab.
* Return true if an annotation should be displayed in a given tab.
*
* @param {Annotation} ann
* @param {TabName} tab
*/
*/
export
function
shouldShowInTab
(
ann
,
tab
)
{
export
function
shouldShowInTab
(
ann
:
Annotation
,
tab
:
TabName
):
boolean
{
if
(
metadata
.
isWaitingToAnchor
(
ann
))
{
if
(
metadata
.
isWaitingToAnchor
(
ann
))
{
// Until this annotation anchors or fails to anchor, we do not know which
// Until this annotation anchors or fails to anchor, we do not know which
// tab it should be displayed in.
// tab it should be displayed in.
...
...
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