-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
UI set away status #3344
UI set away status #3344
Conversation
b48ede6
to
e2c0f6b
Compare
b1a5af6
to
1a4ffb0
Compare
Ready. |
1a4ffb0
to
7edf2b3
Compare
Thanks @borisyankov !
This comment still applies: #3267 (comment)
Similarly, this would be good to capture as jsdoc on the component:
Huh indeed! Less euphemistically: Prettier has a bug in handling Unicode. 😛 I suspect that it's specifically about non-BMP code points, which includes most emoji -- those are the code points that in JavaScript (and Java) if you're not careful you end up treating as if they're two code points. Like the RN bug that underlay #2787. Searching their tracker, this looks a lot like prettier/prettier#770. ... But that was supposedly fixed in Prettier 1.3.0, and we're on 1.12.1. Hm. Anyway:
Good idea!
Another use case for that selector 🙂
Hmm -- perhaps the "clear" case should change the text to
This is a bit confusing -- it's basically named after one call site, the Perhaps it'd be clearer to name it after what it does? E.g. ... Hmm, in fact it looks like you are already giving up identity across re-render!
If you can fix that reasonably, that'd be good. If you can't... might as well at least make it clearer to read, by writing the
Backticks mean code 🙂 . You want double-quotes, I think. Also there's an unclosed backtick in the commit-message body. Small but it sticks out at me.
Good idea!
|
7edf2b3
to
201275e
Compare
That was written at the time when I wrote the other commit. We have agreed on |
201275e
to
dc0e603
Compare
We close the screen after the button press, so that step is not needed. |
dc0e603
to
a9349bf
Compare
About this: #3267 (comment) I did simplify the Also, currently we don't have a way to not show the These are the reasons that justify this component's existence for me. |
As for whether
It is currently used in |
a9349bf
to
02525c4
Compare
I did update to the latest one |
02525c4
to
4620f68
Compare
I did move it before the creation of
It doesn't change visually. |
46cd5c1
to
42b3881
Compare
I did create several user status selectors (with docs) and did rework the other commits to use them. |
222ffc0
to
3203ce6
Compare
This change takes into account the size passed to the `getAvatarFrom*` functions. If a size larger than `100` is needed, use the 'medium' avatar. We should stop using `getMediumAvatar` directly from now on.
Remove code duplication by reusing the avatar logic from `getAvatarFromUser`. This changes the logic slightly in the case where `user.avatar_url` is missing or undefined, but it remains a pure refactor: previously we would rely on `UserAvatarWithPresence` to handle the fallback to Gravatar, and now the common helper `getAvatarFromUser` does it.
40db5d3
to
43bfda9
Compare
One key thing that's still open is the UserStatusScreen portion of this UI issue:
I did rework the For
Supposedly impossible. We either have an actual avatar url or
I think we have
We should ship as-is but will do this in subsequent commit.
Done.
Tested with the new version and it wasn't fixed. |
43bfda9
to
b32103e
Compare
Thanks again @borisyankov for these revisions! On UserStatusScreen, I'm still seeing the buttons obscured by the keyboard, and no scroll. This is |
Hmm, now it mostly doesn't reproduce, in either of two emulators. I'm not sure what the pattern is. Some observations and tentative patterns:
|
Cool, I'm going to go ahead and merge -- 🤞 that that puzzling symptom won't recur in the wild. If it does, we'll debug it then. Thanks again for the revisions! I think you have several followup items, some of them quick -- and you mentioned some in your last comment. To the question in your last comment:
I meant |
The `avatar_url` value coming from the API and used throughout our codebase can be either a string, or `null`, but never `undefined`. This makes the `?string` type not precise enough, as it allows `undefined` values. This changes each usage of the `avatar_url` value to the more precise `string | null`.
Because we are already showing presence indicator below avatar image, no need to show it over avatar image. Which also doesn't look good. Fixes: zulip#3361
Long time ago we made a design decision to show the user's avatar as wide as the screen (so quite large). While this makes it attractive to look at, the size is often a bit too large. Phones with small screens or phones with wide screens (which makes the height of the avatar a bigger percentage of the total screen height) leave too little space for other UI elements. Now that we are showing a bit more, and especially in the upcoming `ProfileCard`, it makes sense to 'tame' this UI a bit. This makes the avatar a fixed size of 200x200 leaving enough space below it even on smaller screens (tested on iPhone 5s).
Fixes a bug that adds an extra space at the bottom of the list of components if the last component is `null`. While that seems it would occur rarely, if ever, this happens in `AccountDetails` if the `timezone` prop is not set (we render a `null`). We add spacing between elements by applying a `marginBottom` to all but the last component. If the last component (or components) are `null` this logic adds an extra space that misaligns the view, and in cases where the screen real-estate is at a premium that is not a minor problem. The fix simplifies and makes the code more clear. We first filter out any `null`s and `undefined`s and in a separate step apply the styles, using the same logic, which is now correct.
This is very similar to `AccountDetails` but used to show the current user's account. Adding `SwitchAccountButton` and `LogoutButton` buttons there as a natural place for them to be in.
Adds the new `ProfileCard` as a tab to `MainTabs`, the icon is the person's avatar. The end-goal is to replace the Settings tab completely but we will do that change after shipping the User Status feature.
They were placed there not because it made too much sense (they are not a configuration option) but because we did not have a Profile tab/screen. Now we do, so they are removed.
Create a new selector `getUserStatusTextForUser` and use it inside `AccountDetails`. If there is a `status_text` set, show it on screen.
Oh yeah, sure, will do that next. Working on a few follow-up commits, but seeing the agreed changes have not made it to the web yet, we would be fine for that release without them (different icon for 'unavailable' etc.) |
Create a new screen allowing the user to set a status text. The screen is stand-alone as it dispatches the needed Redux action to change the value. Possible presets are given for a one-click entry. Currently they are taken verbatim from another product (rhymes with Flack)
Add a 'Set a status' button to `ProfileCard` that navigates to the newly added `UserStatusScreen`.
b32103e
to
f2c1fee
Compare
And merged! Thanks again for all your work on this. I went and split up a couple of the commits that needed splitting. In one case, one of the needed commits was basically one of the commits in @jainkuniya 's #3362... so I cherry-picked that commit here 😝 . There are various follow-up items mentioned in the thread above, and there are some further cleanups to the avatar logic that I have in some terse notes locally but I don't think I've described. I'll try to collect all those followups in a comment after this one, so they don't fall through the cracks. (I know you're already working on some of them.) And then I'll make a new release with this change! |
Follow-up items, with details in various comments above (Ctrl+F is effective after you tell GitHub to expand the middle of the thread; that widget in turn can be found by Ctrl+F for "hidden item"):
Other follow-up items to clean up the
Other follow-up items:
Other comments:
|
Oh, one other small cleanup that this is likely a good time for, which I just happened to see in the codebase:
In reality I think cross-realm bots have avatars? But we're always falling back to gravatars for them. Seems the data is getting misplaced somewhere. |
Adds a Profile tab and allows setting user's away status and status text.