-
Notifications
You must be signed in to change notification settings - Fork 203
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
Provide a UI path for sharing when a page's or annotation's URI is not web-accessible #2874
Conversation
@lyzadanger nice & elegant solution, IMO! kudos! |
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.
The UI changes look good. I left a few comments in the implementation. In particular:
- It may be worth combining the
pageSharingLink
andisShareableURI
functions - Should we still show the social media share links if the link is an HTML rather than in-context link?
- What should the panel show if the document URI is not known yet (eg. because it is a PDF that is still loading)?
@@ -95,7 +98,7 @@ function ShareAnnotationsPanel({ analytics, toastMessenger }) { | |||
) : ( | |||
<span> | |||
Anyone using this link may view the annotations in the group{' '} | |||
<em>{focusedGroup.name}</em>. | |||
<em>{focusedGroup?.name}</em>. |
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.
This ?
isn't needed any more.
c34787a
to
77129d5
Compare
Codecov Report
@@ Coverage Diff @@
## master #2874 +/- ##
=======================================
Coverage 97.74% 97.75%
=======================================
Files 206 207 +1
Lines 7677 7693 +16
Branches 1694 1705 +11
=======================================
+ Hits 7504 7520 +16
Misses 173 173
Continue to review full report at Codecov.
|
@robertknight I've addressed this round of changes, involving:
|
@@ -59,55 +58,70 @@ function ShareAnnotationsPanel({ analytics, toastMessenger }) { | |||
title={panelTitle} | |||
panelName={uiConstants.PANEL_SHARE_ANNOTATIONS} | |||
> | |||
{focusedGroup && mainFrame && ( | |||
{!sharingReady && ( |
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 hope the states are more clear now. There is one top-level branch now: "is shiz loaded enough yet?" and one secondary branch when the answer is "yes": "Do we have a valid share URI?"
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.
This makes sense to me. If it gets significantly more complex in future that it might help to factor out a helper component in the same module.
@@ -19,4 +19,12 @@ | |||
&__icon-button { | |||
@include buttons.button--input; | |||
} | |||
|
|||
// FIXME: Centralize styling of different sizes of Spinner in a reusable |
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.
Note this: spinner sizing is a function of font sizing, as it is in em
s (which is fine). At some point we should encapsulate some patterns here so that we have the right small set of defined spinner sizes. The spinner at the panel's font size was too small.
@robertknight I should point out two things that have not been addressed:
Trying to bound the scope of this work, but if you feel passionately on either of these, let me know. |
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.
LGTM with a few minor comments.
@@ -59,55 +58,70 @@ function ShareAnnotationsPanel({ analytics, toastMessenger }) { | |||
title={panelTitle} | |||
panelName={uiConstants.PANEL_SHARE_ANNOTATIONS} | |||
> | |||
{focusedGroup && mainFrame && ( | |||
{!sharingReady && ( |
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.
This makes sense to me. If it gets significantly more complex in future that it might help to factor out a helper component in the same module.
assert.isUndefined(sharingUtil.annotationSharingLink(fakeAnnotation)); | ||
}); | ||
|
||
it('returns `undefined` if no links on annotation', () => { |
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 this ever actually happen with the API or will it always set links
but possibly leave the object empty?
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 do not know offhand.
Add a typing utility module with a helper function to "cast" the input so that TS understands that it is not null/undefined. This is useful in situations where logic would prevent a reference from being empty but TS can't follow that logic.
77129d5
to
cc0c93a
Compare
In both the share-this-annotation and share-this-page's-annotations components, provide a UI path for when the annotation's URI or the page's URI (respectively) are not web-available. That is, to be "shareable in context", the URI in question needs to have an `http:` or `https:` protocol. For "share this page's annotations" when the page is not web-accessible, explain why the page's annotations can't be shared in context and don't provide a sharing link, as it won't work. For "share this annotation," when the annotation's URI (document) isn't web-accessible, provide some explanatory text about how it can't be shared in-context, but provide a link to the single-annotation view, when available. These changes are intended to avoid confusion when users try to share an annotation or a set of annotations that have been made on a local (e.g. PDF) document. Some SCSS patterns have also been adjusted to accommodate more flexible styling of the share-single-annotation panel. The width of the compact panel pattern has been increased slightly so that the new wording variant for not-shareable-in-context single annotations doesn't risk taking up too much vertical space. Fixes #2786
cc0c93a
to
14ef85f
Compare
There has been some (understandable) ongoing confusion around share links for single annotations or sets of annotations that pertain to a URI that is not available on the web. Specifically, it's confusing if one annotates a local PDF and then attempts to share a single annotation or a set of annotations on that PDF. Before these changes, the application would happily cook up a bouncer (sharing) link for you, but that link wouldn't do anything useful.
This PR replaces #2871
With these changes...
These changes create a new UI path for both "share this page's annotations" and "share this annotation" when the page's URI or the annotation's URI (respectively) are not web-accessible.
When the page's URI is not web-accessible, using the share-this-page's-annotations button will now result in:
When an annotation's URI is not web-accessible, using the share-this-annotation button will now result in:
The link provided, as explained, will go to the single-annotation view.
The "panel" that the share-this-annotation content shows up in has been slightly widened—from
20em
to24em
(with amax-width
of85vw
to keep it from getting ungainly on narrow viewports). This accommodates the longer text needed to explain the not-available-in-context wording without risking that this panel on the first annotation in the list could overlap the top bar.I manually tested that:
Fixes #2786