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

Fix sidebar layout in compact mode #1338

Merged
merged 1 commit into from
Aug 24, 2020
Merged

Conversation

raimund-schluessler
Copy link
Contributor

Fixes the sidebar layout in compact mode, implements the second part of #1366:

Screenshot_2020-08-21 Tasks - Nextcloud

@skjnldsv Since there are many valid combinations of options (compact, with-star, with-header-figure, with-secondary-actions), it needs a good test to find any possibly remaining issues.

@raimund-schluessler raimund-schluessler added bug Something isn't working 3. to review Waiting for reviews labels Aug 21, 2020
@raimund-schluessler
Copy link
Contributor Author

Had to fix an issue, there are just to many different combinations 🙈

@@ -597,40 +599,35 @@ $top-buttons-spacing: 6px;
margin: 0 10px;
}

&--compact {
&--compact.app-sidebar-header--with-figure {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hum, this seems like a mistake.
I thought you were asking for files, but it's not general, you can have a big one without a figure. 🤔

Otherwise the compact mode should be just a computed like hasFigure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, but if the sidebar has no figure, the compact mode has no effect, right? compact just makes the figure appear smaller on the left of the title instead of large above it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then it doesn't make sense to add this class anyway, the &--compact is enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the compact css should only be applied if a figure is present. If there is no figure and you apply the compact css, there will be issues, since the star is wrongly aligned then. I will check if the compact mode had an effect without a figure before my changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

My point is why complicate the code then? It's unrelated to this pr. We're targetting the compact mode on this css section, this have nothing to do with app-sidebar-header--with-figure.
Let's not mix template conditions and css structure please :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, the CSS might be slightly simpler, but we would duplicate all other code and markup just for the sake of getting rid of rules for 4 selectors.

Not if you just create Wrapping components. Single slot.
You'd just externalise the css into two components.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean whatever we choose, the whole layout needs to be fixed to what it was before.
What troubles me is that we completely broke something that was working and I can't even grasp the code structure anymore.

I was definitely not planning to spend time on this for the next incoming days/week with the upcoming beta/rc and now server is broken because of this and we released 3 minor versions that now ships a broken AppSidebar. So I'm not super happy about the current situation :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I can imagine that, I am sorry I caused this issue.

To my best knowledge this PR and #1337 fix all layout issues you mentioned, so it should repair the sidebar for server.

Since you didn't name any difference the compact mode makes when the sidebar has no figure, I assume that compact mode without figure equals normal mode and created a computed property for this so the --compact selector is not bound to --figure anymore.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am sorry I caused this issue.

No need to be sorry! We should have reviewed better! You're not alone collaborating there! 🤗
That's why I used we and not you! 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And if the code structure is fucked up in your opinion, we can go back to the state it had with vue-components@2.3.0.

All changes to the appsidebar aren't used at the moment anyway, because I just implemented them for the next release of Tasks. And 2.4.0 is only 5 days old, so probably no one makes use of the changes already.

Copy link
Contributor

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

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

  • Main menu in expanded mode is stuck to the right, it shoudl have a right: right: $top-buttons-spacing;
  • The compact mode selector seems bound to the figure, it feels weird

Also, I'll feel honest, the whole css feels like a mess now 🙈
It wasn't perfect before, but now that this was changed with another logic, I fail to understand it (thus was already hard to remember what was in my mind back then 😁 )

How could we improve?
Maybe split the header with two sub-components? One compact one expanded?

@raimund-schluessler
Copy link
Contributor Author

Maybe split the header with two sub-components? One compact one expanded?

Hm, not sure. After all I think both modes are quire similar. As far as I understand it, compact and normal only differ by the figure size/position (#1338 (comment)).

Once we have the correct behavior with all modes and options, I can try to clean up the css. At the moment I still struggle to understand what the correct / desired behavior actually is tbh.

@raimund-schluessler
Copy link
Contributor Author

  • Main menu in expanded mode is stuck to the right, it shoudl have a right: right: $top-buttons-spacing;

Yeah, I see. So it should have the same space to the right as the close button. Do you also want to have space between the close button and the action in case of no figure?

Unbenannt

@raimund-schluessler
Copy link
Contributor Author

@skjnldsv I cleaned up the sidebar css and structure. To be honest, it feels more clean to me now (but I am for sure biased 🙈). It uses less absolute positioning and relies on flex now. Only the actions / menus are absolutely positioned in some cases.

I hope that I understood what the sidebar is actually supposed to do. Let me know if something behaves not as it should.

@skjnldsv
Copy link
Contributor

Yeah, I see. So it should have the same space to the right as the close button. Do you also want to have space between the close button and the action in case of no figure?

you should not be able to have both focused at the same time.
Only the action menu in expanded mode need to have the background as grey by default. In compact it stays as is, transparent :)

@raimund-schluessler
Copy link
Contributor Author

Yeah, I see. So it should have the same space to the right as the close button. Do you also want to have space between the close button and the action in case of no figure?

you should not be able to have both focused at the same time.

Only the action menu in expanded mode need to have the background as grey by default. In compact it stays as is, transparent :)

I didn't change anything in that regard. I think it just looks like this, because I hovered the close button.

@skjnldsv
Copy link
Contributor

I didn't change anything in that regard. I think it just looks like this, because I hovered the close button.

Then it's also a regression from the previous pr. This was part of the original specs :)

@raimund-schluessler
Copy link
Contributor Author

I didn't change anything in that regard. I think it just looks like this, because I hovered the close button.

Then it's also a regression from the previous pr. This was part of the original specs :)

Sorry, if I wasn't clear. The menu is currently focused, since I opened and closed it, and the close button is hovered by the mouse. That's why both have a gray background. I think this is how it was before already, but I will double check.

@skjnldsv
Copy link
Contributor

Sorry, if I wasn't clear. The menu is currently focused, since I opened and closed it, and the close button is hovered by the mouse. That's why both have a gray background. I think this is how it was before already, but I will double check.

Aaaah, then it's fine! 😝

@raimund-schluessler
Copy link
Contributor Author

@skjnldsv Ok, I was wrong. The menu always has a gray background. But it was like that with vue-components@2.3.0 already (before I changed anything):

Screenshot_2020-08-22 Tasks - Nextcloud

Only in compact mode it has no gray background. Should I remove the gray background?

@raimund-schluessler
Copy link
Contributor Author

Some visual regression testing would be nice here, but it seems quite complicated to set up (at least i didn't really managed to do so, the CSS style wouldn't get applied).

@skjnldsv
Copy link
Contributor

Only in compact mode it has no gray background. Should I remove the gray background?

No this is what I was saying 😛

Only the action menu in expanded mode need to have the background as grey by default. In compact it stays as is, transparent :)

It's good as it is then. Transparent in compact, grey bg when expanded! 👌

@skjnldsv
Copy link
Contributor

Some visual regression testing would be nice here, but it seems quite complicated to set up (at least i didn't really managed to do so, the CSS style wouldn't get applied).

Cypress works fine. We could do that with https://github.com/bahmutov/cypress-vue-unit-test

@raimund-schluessler
Copy link
Contributor Author

Some visual regression testing would be nice here, but it seems quite complicated to set up (at least i didn't really managed to do so, the CSS style wouldn't get applied).

Cypress works fine. We could do that with https://github.com/bahmutov/cypress-vue-unit-test

I will have a look.

@@ -338,6 +342,9 @@ export default {
hasFigureClickListener() {
return this.$listeners['figure-click']
},
isCompact() {
return this.hasFigure && this.compact
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, so, sorry about that, but I actually thought about this and I forgot one edge case.
One future addition is to go compact when scrolling down the sidebar. It will be cleaner for super long list like sharing can be.

Thus maybe leaving this to just the compact prop would be better?
What do you think?

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 don't mind, we can leave it to the prop.

Copy link
Contributor

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

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

Css is much cleaner now :)

  • Menu in expanded still misses the right alignment like close
    Capture d’écran_2020-08-24_12-42-10
  • Thumbnail is not square anymore
    Capture d’écran_2020-08-24_12-43-31

@raimund-schluessler
Copy link
Contributor Author

@skjnldsv Given the huge number of valid combinations of props and slots for the component, I am quite afraid that I will break something else when fixing the issues you mentioned. Since #1339 seems to basically work now, I would like to take screenshots of the AppSidebar component for every combination we have before continuing here. We could then identify the combinations with layout issues and make sure that we don't introduce new problems when fixing the issues found. I will try to do so in the evening.

@skjnldsv
Copy link
Contributor

@skjnldsv Given the huge number of valid combinations of props and slots for the component, I am quite afraid that I will break something else when fixing the issues you mentioned. Since #1339 seems to basically work now, I would like to take screenshots of the AppSidebar component for every combination we have before continuing here. We could then identify the combinations with layout issues and make sure that we don't introduce new problems when fixing the issues found. I will try to do so in the evening.

I'm fine doing this in a follow up yes :)

Copy link
Contributor

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

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

Please move to just compact and rebase :)

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 24, 2020
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
@raimund-schluessler
Copy link
Contributor Author

Please move to just compact and rebase :)

Done.

I cannot reproduce the issues you described in #1338 (review) by the way. To me it looks fine. Are you sure you tested the latest state?

@skjnldsv
Copy link
Contributor

Are you sure you tested the latest state?

I think I pulled yes, let's get this in and see what comes next :)

@raimund-schluessler
Copy link
Contributor Author

I will work on #1339 in the evening. Hopefully we can then check all different options properly.

@raimund-schluessler raimund-schluessler merged commit 394d72f into master Aug 24, 2020
@raimund-schluessler raimund-schluessler deleted the fix/1366/layout branch August 24, 2020 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues after AppNavigation update #1288
2 participants