-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(annotations): update mode if necessary for experiences #1375
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll need to tie this into the "discoverability" conditions in both image and document annotators. Otherwise, the app could wind up in an inconsistent state. I'll reach out directly, as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a change for DocBaseViewer, as well? Or any other viewers?
[true, false], | ||
[false, true], | ||
[false, false], | ||
].forEach(([canShow, enableAnnotationsImageDiscoverability]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use test.each
for this, instead?
const { experiences = {} } = this.options; | ||
const canShow = Object.values(experiences).some(experience => experience.canShow); | ||
|
||
return !canShow && !!this.options[discoverabilityType]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're inside ImageViewer, can we bake the check for this.options.enableAnnotationsImageDiscoverability
inside this method to avoid having to pass in a string?
}; | ||
image.options.enableAnnotationsImageDiscoverability = enableAnnotationsImageDiscoverability; | ||
|
||
expect(image.isDiscoverabilityEnabled('enableAnnotationsImageDiscoverability')).toBe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the string parameter here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, fixed!
* @return {boolean} value of whether discoverability is enabled for given type | ||
*/ | ||
isDiscoverabilityEnabled() { | ||
const { experiences = {} } = this.options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We could destructure enableAnnotationsImageDiscoverability
here as well
*/ | ||
isDiscoverabilityEnabled() { | ||
const { experiences = {} } = this.options; | ||
const canShow = Object.values(experiences).some(experience => experience.canShow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc, annotations is the only experience we're passing through right now, but should this be so generic? What happens if there is a new preview thumbnails siderail experience (which doesn't apply to images) would that prevent image discoverability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ConradJChan - That is a good point. I think it's most likely if any experience can show we would want to disable discoverability. I also think it would be more likely to forget to add than remember to add it, if we created some sort of eligible experiences list. I think it would make sense to address this, when the time comes, but open to make the suggested change. Let me know what you think!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll go ahead and merge this PR and we can make updates in a separate PR if needed!
}; | ||
image.options.enableAnnotationsImageDiscoverability = enableAnnotationsImageDiscoverability; | ||
|
||
expect(image.isDiscoverabilityEnabled()).toBe(!canShow && !!enableAnnotationsImageDiscoverability); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of computing the expected result and embedding logic in the test, could it be passed in as a parameter?
For Images in Preview, we noticed that the Region is default Selected.
We also want the tooltip to close when you click on the mode button