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
b88069c4
Commit
b88069c4
authored
Aug 12, 2020
by
Kyle Keating
Committed by
Kyle Keating
Aug 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve typechecking (components)
- annotation-share-info - annotation-viewer-content - annotation.js
parent
9cb80d10
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
12 deletions
+34
-12
annotation-share-info.js
src/sidebar/components/annotation-share-info.js
+8
-1
annotation-viewer-content.js
src/sidebar/components/annotation-viewer-content.js
+8
-2
annotation.js
src/sidebar/components/annotation.js
+17
-6
annotations.js
src/sidebar/store/modules/annotations.js
+1
-0
tsconfig.json
src/tsconfig.json
+0
-3
No files found.
src/sidebar/components/annotation-share-info.js
View file @
b88069c4
...
...
@@ -7,12 +7,20 @@ import { isPrivate } from '../util/permissions';
import
SvgIcon
from
'../../shared/components/svg-icon'
;
/**
* @typedef {import("../../types/api").Annotation} Annotation
* @typedef {import('../../types/api').Group} Group
*/
/**
* @typedef AnnotationShareInfoProps
* @prop {Annotation} annotation
*/
/**
* Render information about what group an annotation is in and
* whether it is private to the current user (only me)
*
* @param {AnnotationShareInfoProps} props
*/
function
AnnotationShareInfo
({
annotation
})
{
const
group
=
useStore
(
store
=>
store
.
getGroup
(
annotation
.
group
));
...
...
@@ -52,7 +60,6 @@ function AnnotationShareInfo({ annotation }) {
}
AnnotationShareInfo
.
propTypes
=
{
/** The current annotation object for which sharing info will be rendered */
annotation
:
propTypes
.
object
.
isRequired
,
};
...
...
src/sidebar/components/annotation-viewer-content.js
View file @
b88069c4
...
...
@@ -9,8 +9,16 @@ import useRootThread from './hooks/use-root-thread';
import
ThreadList
from
'./thread-list'
;
import
SidebarContentError
from
'./sidebar-content-error'
;
/**
* @typedef AnnotationViewerContentProps
* @prop {() => any} onLogin
* @prop {Object} [loadAnnotationsService] - Injected service
*/
/**
* The main content for the single annotation page (aka. https://hypothes.is/a/<annotation ID>)
*
* @param {AnnotationViewerContentProps} props
*/
function
AnnotationViewerContent
({
loadAnnotationsService
,
onLogin
})
{
const
annotationId
=
useStore
(
store
=>
store
.
routeParams
().
id
);
...
...
@@ -92,8 +100,6 @@ function AnnotationViewerContent({ loadAnnotationsService, onLogin }) {
AnnotationViewerContent
.
propTypes
=
{
onLogin
:
propTypes
.
func
.
isRequired
,
// Injected.
loadAnnotationsService
:
propTypes
.
object
,
};
...
...
src/sidebar/components/annotation.js
View file @
b88069c4
...
...
@@ -16,8 +16,25 @@ import AnnotationPublishControl from './annotation-publish-control';
import
AnnotationQuote
from
'./annotation-quote'
;
import
Button
from
'./button'
;
/**
* @typedef {import("../../types/api").Annotation} Annotation
* @typedef {import('../../types/api').Group} Group
*/
/**
* @typedef AnnotationProps
* @prop {Annotation} annotation
* @prop {number} replyCount - Number of replies to this annotation (thread)
* @prop {boolean} showDocumentInfo - Should extended document info be rendered (e.g. in non-sidebar contexts)?
* @prop {boolean} threadIsCollapsed - Is the thread to which this annotation belongs currently collapsed?
* @prop {Object} annotationsService - Injected service
* @prop {Object} toastMessenger - Injected service
*/
/**
* A single annotation.
*
* @param {AnnotationProps} props
*/
function
Annotation
({
annotation
,
...
...
@@ -162,15 +179,9 @@ function Annotation({
Annotation
.
propTypes
=
{
annotation
:
propTypes
.
object
.
isRequired
,
/** Number of replies to this annotation (thread) */
replyCount
:
propTypes
.
number
.
isRequired
,
/** Should extended document info be rendered (e.g. in non-sidebar contexts)? */
showDocumentInfo
:
propTypes
.
bool
.
isRequired
,
/** Is the thread to which this annotation belongs currently collapsed? */
threadIsCollapsed
:
propTypes
.
bool
.
isRequired
,
/* Injected services */
annotationsService
:
propTypes
.
object
.
isRequired
,
toastMessenger
:
propTypes
.
object
.
isRequired
,
};
...
...
src/sidebar/store/modules/annotations.js
View file @
b88069c4
...
...
@@ -551,6 +551,7 @@ function savedAnnotations(state) {
* @prop {typeof clearAnnotations} clearAnnotations
* @prop {typeof focusAnnotations} focusAnnotations
* @prop {typeof hideAnnotation} hideAnnotation
* @prop {typeof highlightAnnotations} highlightAnnotations
* @prop {typeof removeAnnotations} removeAnnotations
* @prop {typeof unhideAnnotation} unhideAnnotation
* @prop {typeof updateAnchorStatus} updateAnchorStatus
...
...
src/tsconfig.json
View file @
b88069c4
...
...
@@ -25,9 +25,6 @@
//
Files
in
`src/sidebar/components`
that
may
still
have
errors.
//
Remove
them
from
this
list
as
they
are
resolved.
"sidebar/components/hooks/use-root-thread.js"
,
"sidebar/components/annotation-share-info.js"
,
"sidebar/components/annotation-viewer-content.js"
,
"sidebar/components/annotation.js"
,
"sidebar/components/hypothesis-app.js"
,
"sidebar/components/share-annotations-panel.js"
,
"sidebar/components/sidebar-content-error.js"
,
...
...
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