Skip to content
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

Avatar picker empty views #338

Merged
merged 15 commits into from
Aug 8, 2024
Merged

Avatar picker empty views #338

merged 15 commits into from
Aug 8, 2024

Conversation

pinarol
Copy link
Contributor

@pinarol pinarol commented Aug 6, 2024

Closes #

Description

Adds the subviews inside the borders to handle empty avatar state and the error state.

Screenshot 2024-08-07 at 15 27 44 Screenshot 2024-08-06 at 11 33 08 Screenshot 2024-08-07 at 15 58 42

Testing Steps

  • Use the previews "Empty elements" and "Load from network"
@pinarol pinarol marked this pull request as ready for review August 6, 2024 08:42
@pinarol pinarol self-assigned this Aug 6, 2024
@pinarol pinarol marked this pull request as draft August 6, 2024 12:30
@pinarol
Copy link
Contributor Author

pinarol commented Aug 6, 2024

I'll wait for #337 to be merged first. We'll have some conflicts otherwise.

@pinarol pinarol marked this pull request as ready for review August 7, 2024 12:59
Comment on lines 37 to 39
imagePicker {
CTAButtonView("Upload image")
}
Copy link
Contributor

@etoledom etoledom Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button now is scrolling out of view together with the grid.

I guess we don't have a good definition on the design of how the elements should scroll, so probably no need to be too strict about this right now.
I'd say for example that the avatar card shouldn't scroll out either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll revert this change. Not directly related with this PR anyway.

private func contentLoadingErrorView(
title: String,
subtext: String,
image: Image?,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image could default to nil to avoid sending nil from the init call.

Comment on lines 68 to 73
image: Image("setup-avatar-emoji", bundle: .module), actionButton: {
imagePicker {
CTAButtonView("Upload image")
}
}
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actionButton: should probably go on a new line, right? 🤔

Interesting that the swift formatter didn't catch this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

Copy link
Contributor

@etoledom etoledom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great!

I have two questions:

I get this error message even when the token is not expired, but just wrong.
I'm not sure if we can differentiate these two scenarios, can we?

If we don't I guess is fine since this is the scenario we want to cover more carefully.


I've been trying to figure out from where the different subtitle text color come from:

Text(title)
    .font(.title2)
    .fontWeight(.semibold)
    .foregroundColor(Color(UIColor.label))
    .padding(.init(top: 0, leading: 0, bottom: .DS.Padding.half, trailing: 0))
Text(subtext)
    .font(.subheadline)

Text(subtext) doesn't specify the color, so I'd spect it to be black/white as is shown on the ContentLoadingErrorView preview. But it's grey on the AvatarPickerView preview and runtime 🤔

I'm very curious 😅

Copy link
Contributor

@etoledom etoledom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code change proposals won't need a new review (feel free to change or keep what you think is best)

And the questions are not blocking, so I'd say let's merge when ready 👍

@pinarol
Copy link
Contributor Author

pinarol commented Aug 8, 2024

I get this error message even when the token is not expired, but just wrong.
I'm not sure if we can differentiate these two scenarios, can we?

It depends on the backend but usually we get 401 on both cases. We should still test these in real life once Gravatar OAUTH is ready.

@etoledom
Copy link
Contributor

etoledom commented Aug 8, 2024

It depends on the backend but usually we get 401 on both cases. We should still test these in real life once Gravatar OAUTH is ready.

Okay, let's keep it this way for now 👍

@pinarol
Copy link
Contributor Author

pinarol commented Aug 8, 2024

Text(subtext) doesn't specify the color, so I'd spect it to be black/white as is shown on the ContentLoadingErrorView preview. But it's grey on the AvatarPickerView preview and runtime 🤔

Interesting inconsistency. Should be solved when I set the color explicitly. I just forgot to do that.

@pinarol pinarol merged commit df88d0a into trunk Aug 8, 2024
6 checks passed
@pinarol pinarol deleted the wppinar/avatar-picker-empty-view branch August 8, 2024 12:33
@pinarol pinarol added this to the Milestone 4 - Quick Editor milestone Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants