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
f5ed2b90
Commit
f5ed2b90
authored
Nov 14, 2022
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Nov 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert `Annotation` to TS
parent
09ff0e7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
Annotation.tsx
src/sidebar/components/Annotation/Annotation.tsx
+21
-16
No files found.
src/sidebar/components/Annotation/Annotation.
js
→
src/sidebar/components/Annotation/Annotation.
tsx
View file @
f5ed2b90
...
@@ -2,6 +2,7 @@ import { CardActions, Spinner } from '@hypothesis/frontend-shared/lib/next';
...
@@ -2,6 +2,7 @@ import { CardActions, Spinner } from '@hypothesis/frontend-shared/lib/next';
import
classnames
from
'classnames'
;
import
classnames
from
'classnames'
;
import
{
useMemo
}
from
'preact/hooks'
;
import
{
useMemo
}
from
'preact/hooks'
;
import
type
{
Annotation
as
IAnnotation
}
from
'../../../types/api'
;
import
{
useSidebarStore
}
from
'../../store'
;
import
{
useSidebarStore
}
from
'../../store'
;
import
{
import
{
annotationRole
,
annotationRole
,
...
@@ -10,6 +11,7 @@ import {
...
@@ -10,6 +11,7 @@ import {
quote
,
quote
,
}
from
'../../helpers/annotation-metadata'
;
}
from
'../../helpers/annotation-metadata'
;
import
{
annotationDisplayName
}
from
'../../helpers/annotation-user'
;
import
{
annotationDisplayName
}
from
'../../helpers/annotation-user'
;
import
type
{
AnnotationsService
}
from
'../../services/annotations'
;
import
{
withServices
}
from
'../../service-context'
;
import
{
withServices
}
from
'../../service-context'
;
import
AnnotationActionBar
from
'./AnnotationActionBar'
;
import
AnnotationActionBar
from
'./AnnotationActionBar'
;
...
@@ -19,21 +21,6 @@ import AnnotationHeader from './AnnotationHeader';
...
@@ -19,21 +21,6 @@ import AnnotationHeader from './AnnotationHeader';
import
AnnotationQuote
from
'./AnnotationQuote'
;
import
AnnotationQuote
from
'./AnnotationQuote'
;
import
AnnotationReplyToggle
from
'./AnnotationReplyToggle'
;
import
AnnotationReplyToggle
from
'./AnnotationReplyToggle'
;
/**
* @typedef {import("../../../types/api").Annotation} Annotation
*/
/**
* @typedef AnnotationProps
* @prop {Annotation} annotation
* @prop {boolean} isReply
* @prop {VoidFunction} [onToggleReplies] - Callback to expand/collapse reply
* threads. The presence of a function indicates a toggle should be rendered.
* @prop {number} replyCount - Number of replies to this annotation's thread
* @prop {boolean} threadIsCollapsed - Is the thread to which this annotation belongs currently collapsed?
* @prop {import('../../services/annotations').AnnotationsService} annotationsService
*/
function
SavingMessage
()
{
function
SavingMessage
()
{
return
(
return
(
<
div
<
div
...
@@ -56,6 +43,24 @@ function SavingMessage() {
...
@@ -56,6 +43,24 @@ function SavingMessage() {
</
div
>
</
div
>
);
);
}
}
export
type
AnnotationProps
=
{
annotation
:
IAnnotation
;
isReply
:
boolean
;
/** Number of replies to this annotation's thread */
replyCount
:
number
;
/** Is the thread to which this annotation belongs currently collapsed? */
threadIsCollapsed
:
boolean
;
/**
* Callback to expand/collapse reply threads. The presence of a function
* indicates a toggle should be rendered.
*/
onToggleReplies
?:
()
=>
void
;
// injected
annotationsService
:
AnnotationsService
;
};
/**
/**
* A single annotation.
* A single annotation.
*
*
...
@@ -68,7 +73,7 @@ function Annotation({
...
@@ -68,7 +73,7 @@ function Annotation({
replyCount
,
replyCount
,
threadIsCollapsed
,
threadIsCollapsed
,
annotationsService
,
annotationsService
,
})
{
}
:
AnnotationProps
)
{
const
store
=
useSidebarStore
();
const
store
=
useSidebarStore
();
const
annotationQuote
=
quote
(
annotation
);
const
annotationQuote
=
quote
(
annotation
);
...
...
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