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
e04c8ce9
Unverified
Commit
e04c8ce9
authored
May 18, 2020
by
Lyza Gardner
Committed by
GitHub
May 18, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2176 from hypothesis/restore-document-info
Restore document metadata to annotation cards
parents
cd6c4c31
29ff84cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
thread-card-test.js
src/sidebar/components/test/thread-card-test.js
+17
-0
thread-card.js
src/sidebar/components/thread-card.js
+2
-1
No files found.
src/sidebar/components/test/thread-card-test.js
View file @
e04c8ce9
...
...
@@ -32,6 +32,7 @@ describe('ThreadCard', () => {
};
fakeStore
=
{
isAnnotationFocused
:
sinon
.
stub
().
returns
(
false
),
route
:
sinon
.
stub
(),
};
fakeThread
=
{
...
...
@@ -69,6 +70,22 @@ describe('ThreadCard', () => {
assert
(
wrapper
.
find
(
'.thread-card'
).
hasClass
(
'thread-card--theme-clean'
));
});
it
(
'shows document info if current route is not sidebar'
,
()
=>
{
fakeStore
.
route
.
returns
(
'whatever'
);
const
wrapper
=
createComponent
();
assert
.
isTrue
(
wrapper
.
find
(
'Thread'
).
props
().
showDocumentInfo
);
});
it
(
'does not show document info if current route is sidebar'
,
()
=>
{
fakeStore
.
route
.
returns
(
'sidebar'
);
const
wrapper
=
createComponent
();
assert
.
isFalse
(
wrapper
.
find
(
'Thread'
).
props
().
showDocumentInfo
);
});
describe
(
'mouse and click events'
,
()
=>
{
it
(
'scrolls to the annotation when the `ThreadCard` is clicked'
,
()
=>
{
const
wrapper
=
createComponent
();
...
...
src/sidebar/components/thread-card.js
View file @
e04c8ce9
...
...
@@ -16,6 +16,7 @@ import Thread from './thread';
function
ThreadCard
({
frameSync
,
settings
=
{},
thread
})
{
const
threadTag
=
thread
.
annotation
&&
thread
.
annotation
.
$tag
;
const
isFocused
=
useStore
(
store
=>
store
.
isAnnotationFocused
(
threadTag
));
const
showDocumentInfo
=
useStore
(
store
=>
store
.
route
()
!==
'sidebar'
);
const
focusThreadAnnotation
=
useCallback
(
debounce
(
tag
=>
{
...
...
@@ -44,7 +45,7 @@ function ThreadCard({ frameSync, settings = {}, thread }) {
'thread-card--theme-clean'
:
settings
.
theme
===
'clean'
,
})}
>
<
Thread
thread
=
{
thread
}
showDocumentInfo
=
{
false
}
/
>
<
Thread
thread
=
{
thread
}
showDocumentInfo
=
{
showDocumentInfo
}
/
>
<
/div
>
);
}
...
...
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