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
6ed0156a
Commit
6ed0156a
authored
Apr 20, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Apr 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate to TS remaining js files in sidebar/components module
parent
2c37c7e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
15 deletions
+8
-15
index.ts
src/sidebar/components/Annotation/index.ts
+0
-0
use-filter-options.ts
src/sidebar/components/hooks/use-filter-options.ts
+3
-7
use-root-thread.ts
src/sidebar/components/hooks/use-root-thread.ts
+4
-7
thread-annotations.ts
src/sidebar/helpers/thread-annotations.ts
+1
-1
No files found.
src/sidebar/components/Annotation/index.
j
s
→
src/sidebar/components/Annotation/index.
t
s
View file @
6ed0156a
File moved
src/sidebar/components/hooks/use-filter-options.
j
s
→
src/sidebar/components/hooks/use-filter-options.
t
s
View file @
6ed0156a
...
...
@@ -3,16 +3,13 @@ import { useMemo } from 'preact/hooks';
import
{
username
}
from
'../../helpers/account-id'
;
import
{
annotationDisplayName
}
from
'../../helpers/annotation-user'
;
import
{
useSidebarStore
}
from
'../../store'
;
/** @typedef {import('../../store/modules/filters').FilterOption} FilterOption */
import
type
{
FilterOption
}
from
'../../store/modules/filters'
;
/**
* Generate a list of users for filtering annotations; update when set of
* annotations or filter state changes meaningfully.
*
* @return {FilterOption[]}
*/
export
function
useUserFilterOptions
()
{
export
function
useUserFilterOptions
()
:
FilterOption
[]
{
const
store
=
useSidebarStore
();
const
annotations
=
store
.
allAnnotations
();
const
focusFilters
=
store
.
getFocusFilters
();
...
...
@@ -22,8 +19,7 @@ export function useUserFilterOptions() {
return
useMemo
(()
=>
{
// Determine unique users (authors) in annotation collection
/** @type {Record<string, string>} */
const
users
=
{};
const
users
:
Record
<
string
,
string
>
=
{};
annotations
.
forEach
(
annotation
=>
{
const
username_
=
username
(
annotation
.
user
);
users
[
username_
]
=
annotationDisplayName
(
...
...
src/sidebar/components/hooks/use-root-thread.
j
s
→
src/sidebar/components/hooks/use-root-thread.
t
s
View file @
6ed0156a
import
{
useMemo
}
from
'preact/hooks'
;
import
type
{
Thread
}
from
'../../helpers/build-thread'
;
import
{
threadAnnotations
}
from
'../../helpers/thread-annotations'
;
import
type
{
ThreadState
}
from
'../../helpers/thread-annotations'
;
import
{
useSidebarStore
}
from
'../../store'
;
/** @typedef {import('../../helpers/build-thread').Thread} Thread */
/**
* Gather together state relevant to building a root thread of annotations and
* replies and return an updated root thread when changes occur.
*
* @return {Thread}
*/
export
function
useRootThread
()
{
export
function
useRootThread
()
:
Thread
{
const
store
=
useSidebarStore
();
const
annotations
=
store
.
allAnnotations
();
const
query
=
store
.
filterQuery
();
...
...
@@ -19,8 +17,7 @@ export function useRootThread() {
const
selectionState
=
store
.
selectionState
();
const
filters
=
store
.
getFilterValues
();
const
threadState
=
useMemo
(()
=>
{
/** @type {Record<string,string>} */
const
threadState
=
useMemo
(():
ThreadState
=>
{
return
{
annotations
,
route
,
...
...
src/sidebar/helpers/thread-annotations.ts
View file @
6ed0156a
...
...
@@ -7,7 +7,7 @@ import { shouldShowInTab } from './tabs';
import
{
sorters
}
from
'./thread-sorters'
;
import
{
filterAnnotations
}
from
'./view-filter'
;
type
ThreadState
=
{
export
type
ThreadState
=
{
annotations
:
Annotation
[];
route
:
string
|
null
;
selection
:
{
...
...
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