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 for details button misbehaving on mobile #1114

Merged
merged 14 commits into from
Jun 15, 2021

Conversation

MaybeThisIsRu
Copy link
Contributor

@MaybeThisIsRu MaybeThisIsRu commented Jun 8, 2021

Changes

This is a "first pass" for the details button issue being tracked in #972 titled "Details button issue on Firefox specifically". I'd love some testing and feedback on this. I'm certain I may have missed something! 😅

While it includes a bunch of changes related to development documentation and (optionally) usage (detailed below), I'd love feedback on MaybeThisIsRu@4cec202, which is the one and only commit to ultimately build on and tackle the mobile responsiveness issue.

While I have tried to add some comments at some places, they were not a focus so far. If something is unclear, please let me know, and I'll work on adding some. Context is easy to lose. :)

For development related changes...

  • It introduces two more convenience commands that I really enjoy using: make install and make server. They are documented in the CONTRIBUTING.md file. Since I am not familiar with the Phoenix framework, this saves me a ton of time whenever I boot up the project.
  • It also adds a note about docker volumes.
  • And finally, there are instructions for using pre-commit, which was PR'ed by @maco some six months ago. 🧡
  • pre-commit requires Python so that has also been added to the asdf config file.

A further commit is pending for updating the Changelog.

Tests

  • This PR does not require tests

Changelog

  • Entry has been added to changelog

Documentation

  • This change does not need a documentation update

* Move render methods to the last (together) in the order list
* Remove unused component import
* React lifecycle to come first before our own methods
* General styling and eslint changes
* Cleaner renderContent method using switch/case (fixes an eslint error as well!)
* Cleaner renderPill method with proper spacing + removing uncessary else
* Use newer Fragment syntax
* Remove unnecessary else statement
* Use backtick strings for concatenating strings
* Remove unnecessary space
* Remove unused imports and variable declarations
* Bunch render methods together as last in the order list
This _mostly_ fixes one of the issues being tracked on plausible#972, titled "Details button issue on Firefox specifically"
@MaybeThisIsRu MaybeThisIsRu changed the title Feature/mobile details btn Fix for details button misbehaving on mobile Jun 8, 2021
Copy link
Contributor

@ukutaht ukutaht left a comment

Choose a reason for hiding this comment

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

Works great! The button no longer overlaps and I really like that you've added it some extra spacing for the button in mobile. Fat-fingered users like myself with appreciate it :)

All the quality-of-life improvements are also much appreciated ❤️

Looking through the code, 2 main things stand out to me.

  1. I know people have differing opinions on TailwindCSS or utility-first CSS in general. On this project we've went the utility-based CSS route. I think we should completely commit to it because mixing multiple different styles is way worse than just picking one. The goal is to do everything we can using default Tailwind classes so ideally the app.css file would be empty. I remember adding a .stats-item class because I couldn't do a specific height or calc(50% - 6px) widths in Tailwind. So some things need to stay in the css file currently but everything that can be added directly to the elements should be added directly to keep a consistent style. I'd like to see how much stuff we can move out of app.css and in the context of this PR, how much we can keep from being added to it.

Let me know what you think.

=== OUT OF SCOPE FOR THIS PR ===

I think we could get rid of the whole .stats-item class by using Tailwind's grid primitives instead of flex. It has sligthly worse browser support but I don't think we need to worry about IE in our dashboard.

  1. I also know it feels bad to duplicate the Tailwind classes over and over. This is something I've been very bad at doing but the idea in Tailwind is to extract something like a React component instead of a CSS class. (like assets/js/dashboard/stats/more-link.js).

The codebase is really at a point where further duplication is pointless and some refactoring is needed. To explain my approach, I like to let duplication get pretty bad before tackling it. Once you have many duplicates of the same thing, it's much clearer to see how one should extract it into a reusable thing. Inspired by Sandi Metz :)

@MaybeThisIsRu
Copy link
Contributor Author

🎉 That's great to hear!

Happy to write them as classes instead. It really helped me to name them so I could understand the structure, but I'm absolutely happy to make those changes now. I think we should be able to move most or all from the classes I introduced to Tailwind style declaration. :)

As for the CSS grid property, I'm generally not too familiar with the vanilla syntax (and therefore Tailwind's), so I'll probably refrain from using that here.

P.s. Solid link-drop there, perhaps I can take some of that into my work today. 😀

@maco
Copy link
Contributor

maco commented Jun 10, 2021

👍🏼 thanks for the precommit docs :)

@MaybeThisIsRu MaybeThisIsRu requested a review from ukutaht June 11, 2021 12:02
@MaybeThisIsRu
Copy link
Contributor Author

That should take care of the issue now, @ukutaht. :)

@ukutaht
Copy link
Contributor

ukutaht commented Jun 15, 2021

Great, thanks @hirusi !

@ukutaht ukutaht merged commit c95d375 into plausible:master Jun 15, 2021
@MaybeThisIsRu MaybeThisIsRu mentioned this pull request Jun 16, 2021
3 tasks
@metmarkosaric
Copy link
Contributor

this is now live and the details buttons work all fine on my mobile firefox! thanks @hirusi!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants