Unverified Commit e04c8ce9 authored by Lyza Gardner's avatar Lyza Gardner Committed by GitHub

Merge pull request #2176 from hypothesis/restore-document-info

Restore document metadata to annotation cards
parents cd6c4c31 29ff84cc
......@@ -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();
......
......@@ -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>
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment