framework icon indicating copy to clipboard operation
framework copied to clipboard

chore: major frontend JS cleanup

Open davwheat opened this issue 3 years ago • 0 comments

Fixes #0000

Changes proposed in this pull request:

This PR aims to clean up our JS to utilise more standardised syntax (specifically reducing our usage of empty text nodes as opposed to rendering nothing, cleaning up class name concatenation, and using JSX more).

  • Replace (condition ? < /> : '') with (!!condition && < />)
  • Replace most .component() calls with JSX
  • Clean up some string concatenation
  • Use classList instead of concatenation
  • Replace some array-based fragments with <></>

Reviewers should focus on:

Screenshot

Necessity

  • [ ] Has the problem that is being solved here been clearly explained?
  • [ ] If applicable, have various options for solving this problem been considered?
  • [ ] For core PRs, does this need to be in core, or could it be in an extension?
  • [ ] Are we willing to maintain this for years / potentially forever?

Confirmed

  • [ ] Frontend changes: tested on a local Flarum installation.
  • [ ] Backend changes: tests are green (run composer test).
  • [ ] Core developer confirmed locally this works as intended.
  • [ ] Tests have been added, or are not appropriate here.

Required changes:

  • [ ] Related documentation PR: (Remove if irrelevant)
  • [ ] Related core extension PRs: (Remove if irrelevant)

davwheat avatar Aug 21 '22 22:08 davwheat