Skip to content

web: Pack client JS and add hamburger menu to web frontend#121

Merged
binaryoverload merged 17 commits intodevfrom
work/reporting
May 23, 2025
Merged

web: Pack client JS and add hamburger menu to web frontend#121
binaryoverload merged 17 commits intodevfrom
work/reporting

Conversation

@ashquarky
Copy link
Member

Resolves #104

Changes:

  • Runs client JS/CSS through the existing ESBuild pipeline, and remove the corresponding pre-minified files. This enables packing/bundling and some light Babel-y stuff for CTR; though only minification is in use right now.
    • Each build targets a different platform (Node, modern, Chrome20, IE7) so four tsup builds are needed. The watch feature started four Juxt instances because of this? Switch to nodemon so we get one instance.
  • Tidy up the post_template partial (and lightly touch some of the other partials). Refactor out icons into their own files (still inlined by EJS)
  • Refactor the report modal. Previously, you had to go into a post page, and some posts had a flag icon, but others had a large "report" button, and all of those would click another hidden button in JavaScript, which triggered PJAX, which... Just add reporting to a hamburger menu and have it hide/unhide a proper modal.
  • Since we have a hamburger menu, add post deletion ([Feature]: Deletion without a report #104) for moderators.

@ashquarky ashquarky requested a review from mrjvs May 23, 2025 08:56
@mrjvs
Copy link
Contributor

mrjvs commented May 23, 2025

I'm on vacation for the couple days. @binaryoverload can you handle the review?

@mrjvs mrjvs requested a review from binaryoverload May 23, 2025 09:50
Copy link
Member

@binaryoverload binaryoverload left a comment

Choose a reason for hiding this comment

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

Looks pretty good! Just a couple of comments:

@ashquarky ashquarky requested a review from binaryoverload May 23, 2025 10:42
Copy link
Member

@binaryoverload binaryoverload left a comment

Choose a reason for hiding this comment

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

Thanks for making those changes - looks good!

Just needs a npm run lint:fix :)

@ashquarky
Copy link
Member Author

Thanks for making those changes - looks good!

Just needs a npm run lint:fix :)

That's a vendored library :( Not sure why it's started failing now when it didn't before. lint:fix bails out so I'll have to work something else out

@binaryoverload
Copy link
Member

Ah if it's a generated file then it'll be a case of adding ignores for those files!

ashquarky added 3 commits May 24, 2025 01:03
Since we have a bundler, might as well use it! Apparently previous work was (accidentally) using CJS format, which doesn't work on browser. Changing to IIFE means we don't get global scope anymore; which is needed for various places in the Juxt codebase where onclick= etc. are used.

Eventually need to move to addEventListener, but for now explicitly export things by setting them on window.

This allows us to stop vendoring PJAX and actually bundle it properly. Nice!
Since we no longer rely on the global scope for onclick=, re-enable full minification!
@ashquarky
Copy link
Member Author

Since we have a bundler now anyway, I figured it would be better to use it for this rather than manually include the library. I also discovered a problem with the bundler (it was configured for Node/CommonJS) which I've also fixed.

@binaryoverload binaryoverload merged commit e9d13d4 into dev May 23, 2025
10 checks passed
@mrjvs mrjvs mentioned this pull request Jun 11, 2025
@ashquarky ashquarky deleted the work/reporting branch June 22, 2025 10:20
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.

3 participants