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

Reduce Phoenix.HTML usage #4675

Merged
merged 19 commits into from
Oct 15, 2024
Merged

Reduce Phoenix.HTML usage #4675

merged 19 commits into from
Oct 15, 2024

Conversation

aerosol
Copy link
Member

@aerosol aerosol commented Oct 14, 2024

Changes

This PR almost completely removes Phoenix.HTML in favor of https://hexdocs.pm/phoenix/components.html#heex

Not all occurrences were removable at this time (due to external dependencies and such).
However, all the templates were changed from EEx to HEEx and separate compile-time usage variants were introduced via use PlausibleWeb, ....

Basically there should be no eex tags anymore (such as <%= form_for ... , <%= link ... etc.) and imports should be simpler to reason about.

There's some more work pending to organize the components further, but will be much clearer if done separately.

Of course due to volume of changes and e2e testing limitations, it's possible that some view will turn out scrambled or slightly worse than before... I'm hoping to address those issues on case by case basis.

Tests

  • Automated tests have been added
  • This PR does not require tests

Changelog

  • Entry has been added to changelog
  • This PR does not make a user-facing change

Documentation

  • Docs have been updated
  • This change does not need a documentation update

Dark mode

  • The UI has been tested both in dark and light mode
  • This PR does not change the UI

@aerosol aerosol changed the title Reduce phoenix html usage 2 Reduce Phoenix.HTML usage Oct 14, 2024
Copy link

Preview environment👷🏼‍♀️🏗️
PR-4675

@aerosol aerosol requested a review from a team October 14, 2024 11:44
@aerosol aerosol marked this pull request as ready for review October 14, 2024 11:44
@aerosol aerosol added this pull request to the merge queue Oct 15, 2024
Merged via the queue into master with commit 70997ab Oct 15, 2024
10 checks passed
@aerosol aerosol deleted the reduce-phoenix-html-usage-2 branch October 15, 2024 05:13
<br /><br /> Do check out your
<.unstyled_link href={"#{plausible_url()}/#{URI.encode_www_form(@site.domain)}"}>
easy to use, fast-loading and privacy-friendly dashboard
</.unstyled_link>. <br /><br /> Something looks off? Take a look at our
Copy link
Contributor

@ruslandoga ruslandoga Oct 16, 2024

Choose a reason for hiding this comment

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

This added newline before the dot seems to translate to whitespace in the rendered HTML

Screenshot 2024-10-16 at 14 59 02

Note how there is no space before the dot and after the first link to dummy.site because it's on the same line.

Copy link
Contributor

@ruslandoga ruslandoga Oct 16, 2024

Choose a reason for hiding this comment

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

An easy workaround is to move the dot inside the link. I'll open a PR.

ruslandoga pushed a commit that referenced this pull request Jan 6, 2025
* Turn .eex templates into .heex

* Add new compile-time presets to `PlausibleWeb`

* Fix remaining templates

* Update static components

* Update live components

* Update live views

* Update rest of the owl

* Update mjml template

* Format

* Format

* Revert MJML stuff, it's coupled with EEx

* yawn at test

* Get rid of `FormHelpers` module

* Ensure YOU label shows up first on IP rules list

* Update lib/plausible_web/templates/email/welcome_email.html.heex

Co-authored-by: Artur Pata <[email protected]>

* Fix create site email link

* Fix server error markup (and turn thanks into heex)

* Format

---------

Co-authored-by: Artur Pata <[email protected]>
@ruslandoga ruslandoga mentioned this pull request Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants