feat(annotations): update url on annotation selection#2079
feat(annotations): update url on annotation selection#2079mickr merged 13 commits intobox:masterfrom mickr:add-handler-for-annotation-activity-card
Conversation
|
Few thoughts on this:
In this way, we can avoid the
|
src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.scss
Show resolved
Hide resolved
| const { history } = this.props; | ||
|
|
||
| const urlPrefix = this.getUrlPrefix(history.location.pathname); | ||
| history.replace(`/${urlPrefix}/annotations/${annotationId}`); |
There was a problem hiding this comment.
Do we want to push instead of replace here?
There was a problem hiding this comment.
Is this URL going to suffice for our purposes? Will we be able to determine the version we need to load?
There was a problem hiding this comment.
No, but I talked with the BE team and they have not worked through the versions url yet and what it will look like.
* Add history replace to update url when clicking annotation activity item * Add proper activeFeedEntryType for focus * Fix focus state for activity item * pass callback function to sidebar to be called on annotation selection
* Fix flow errors * Add message for missing annotation
* adding unit tests
* Adding handler to annotationContext
* Remove old annotationSelect
* Update tests for withAnnotations
* Re-add an instance of onAnnotationSelect
* Add annotator to withAnnotations context to emit back to annotations.
* temporarily fix ts-lint
|
|
||
| export interface AnnotatorContext { | ||
| state: AnnotatorState; | ||
| emitActiveChangeEvent: (id: string) => void; |
There was a problem hiding this comment.
What do you think about naming this as something more like setActiveAnnotationId instead to abstract away the implementation details of how we set the active annotation id?
There was a problem hiding this comment.
I think it is more descriptive with this name, not sure if this detail needs to be abstracted away.
There was a problem hiding this comment.
ok then at least make it emitActiveSetEvent?
src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js
Outdated
Show resolved
Hide resolved
src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.scss
Show resolved
Hide resolved
src/elements/common/annotator-context/__tests__/withAnnotatorContext.test.tsx
Outdated
Show resolved
Hide resolved
| > | ||
| <WrappedComponent | ||
| {...this.props} | ||
| onAnnotator={this.handleOnAnnotator} |
There was a problem hiding this comment.
handleAnnotator instead of handleOnAnnotator
There was a problem hiding this comment.
I can follow up on this
src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js
Show resolved
Hide resolved
* Add the annotator emit handler to context * Move annotatorState to state object * Updated tests
Adding handler to update URL from annotation activity card, and call the callback from contentPreview to handle selecting annotation in Preview