Commit graph

27 commits

Author SHA1 Message Date
SleeplessOne1917
643c1f6f01
Make confirm popup for adult consent (#2419)
* Make confirm popup for adult consent

* Fix import

* Fix blur and adjust user settings

* Make confirmation popup more stylish

* Add setting to site settings form

* Fix modal bug

* Put adult consent logic all in one place

* Make modal use markdown

* Fix consent modal showing up for currently logged in admin

* Add go-back redirect countdown

* Center modal title

* Handle enable_nsfw correctly

* Blur background of modal to hide spicy things

* Add translations
2024-04-18 19:54:16 -04:00
matc-pub
e48590b9d6
Use mixins and decorators for scroll restoration and tippy cleanup (#2415)
* Enable @babel/plugin-proposal-decorators

Dependency already exists

* Use tippy.js delegate addon, cleanup tippy instances from a mixin.

The delegate addon creates tippy instances from mouse and touch events
with a matching `event.target`. This is initially significantly cheaper
than creating all instances at once. The addon keeps all created tippy
instances alive until it is destroyed itself.

`tippyMixin` destroys the addon instance after every render, as long as
all instances are hidden. This drops some tippy instances that may have
to be recreated later (e.g when the mouse moves over the trigger again),
but is otherwise fairly cheap (creates one tippy instance).

* Restore scroll positions when resource loading settles.

The history module generates a random string (`location.key`) for every
browser history entry. The names for saved positions include this key.
The position is saved before a route component unmounts or before the
`location.key` changes.

The `scrollMixin` tires to restore the scroll position after every
change of `location.key`. It only does so after the first render for
which the route components `loadingSettled()` returns true.

Things like `scrollToComments` should only scroll when `history.action`
is not "POP".

* Drop individual scrollTo calls

* Scroll to comments without reloading post

---------

Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
2024-04-11 13:18:07 -04:00
matc-pub
201e5fcd53
Lazy loading less common languages for syntax highlighting (#2388)
* Use fewer syntax highlighter languages.

Reduces client.js size by about 250kB (800kB uncompressed)

Common languages:
bash, c, cpp, csharp, css, diff, go, graphql, ini, java, javascript,
json, kotlin, less, lua, makefile, markdown, objectivec, perl,
php-template, php, plaintext, python-repl, python, r, ruby, rust, scss,
shell, sql, swift, typescript, vbnet, wasm, xml, yaml

Additionally enabled languages:
dockerfile, pgsql

* Configurable syntax highlighter languages

Allows to individually enable languages.

* Lazy load syntax highlighter languages

Allows to enable additional languages that will not be autodetected.

* Include highlight.js in dynamic import check
2024-03-14 08:31:07 -04:00
matc-pub
e832cd2729
Lazy load translations and date-fns, server side support for "Browser Default" language (#2380)
* Lazy load i18n translations.

* Lazy load date-fns

* Fix inconsistent DOMContentLoaded event.

Only when no translations and date-fns have to be dynamically loaded
(e.g. for en-US) the NavBar `componentDidMount` is early enough to
listen for "DOMContentLoaded".

Removes one redundant `requestNotificationPermission()` call.

* Rename interface language code "pt_BR" to "pt-BR".

Browsers ask for "pt-BR", but the "interface_language" saved in the
settings dialog asks for "pt_BR". This change will make the settings
dialog ask for "pt-BR" instead of "pt_BR". For users that already (or
still) have "pt_BR" configured, "pt-BR" will be used, but the settings
dialog will present it as unspecified.

* Use Accept-Language request header

* Prefetch translation and date-fns

---------

Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
2024-03-13 16:39:45 -04:00
SleeplessOne1917
dd3842655a
Update bs theme when site theme is changed (#2226) 2023-11-17 09:35:43 -05:00
SleeplessOne1917
d9fe7d1488
Remote follow (#1875)
* Redirect to page user was trying to access on login

* Make modal

* Make modal look better

* Forgot to include in merge

* Get rid of modal

* Add external interaction page

* Tweak success page

* Add loading screen for remote fetch and refactor loading ellipses

* Add error state for remote fetch page

* Add card to federation success page

* Bring back remote fetch modal

* Add autofocus to remote fetch modal input

* Redirect for remote fetch

* Remove dummy data

* Remove duplicate functions

* Update translations

* Update translations

* Fix linting error

* Fix linting errors

* feat: Add toasts for remote follow error conditions
2023-09-25 23:32:37 -04:00
SleeplessOne1917
3d58baea7c
User inferno prompt instead of handrolled one (#1867) 2023-07-07 19:33:03 -04:00
SleeplessOne1917
322a44bf24
Fix data-bs-theme (#1810)
* Fix data-bs-theme

* Add other dark themes

* Add vaporwave-dark to dark theme list
2023-07-04 16:53:28 -04:00
SleeplessOne1917
847b71319b Change function name 2023-06-23 10:36:21 -04:00
SleeplessOne1917
5d664656a2 Extract date fns setup 2023-06-23 10:10:41 -04:00
SleeplessOne1917
d0dff77377 Replace momentjs with date-fns 2023-06-22 19:33:02 -04:00
SleeplessOne1917
eae0990442 Fix I18 next circular reference 2023-06-21 20:54:35 -04:00
Alec Armbruster
043b522ff1
utils.ts organization, round two (#1427)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update src/shared/utils/app/convert-comment-sort-type.ts

Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>

* prettier pass

---------

Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>
2023-06-21 18:28:24 -04:00
Alec Armbruster
0854af3794
break out all role utils 2023-06-16 17:07:55 -04:00
SleeplessOne1917
2b1af707c3
Use http client (#1081)
* Beginning work on websocket -> http client conversion.

* About 30% done.

* half done.

* more done.

* Almost passing lint.

* Passing lint, but untested.

* Add back in event listeners.

* Fixing some community forms.

* Remove webpack cache.

* fixing some more.

* Fixed ISOwrappers.

* A few more fixes.

* Refactor utils

* Fix instance add/remove buttons

* Not catching errors in isoWrapper.

* Wrap Http client

* Fixing up tagline and ratelimit forms.

* Make all http client wrapping be in one place

* Reworking some more forms.

* Upgrading lemmy-js-client.

* Fixing verify email.

* Fix linting errors

* Upgrading woodpecker node.

* Fix comment scrolling rerender bug.

* Fixing a few things, commenting out props for now.

* v0.18.0-beta.1

* Trying to fix woodpecker, 1.

* Trying to fix woodpecker, 2.

* Handroll prompt

* Add navigation prompt to other pages

* Fix prompt navigation bug

* Fix prompt bug introduced from last bug fix

* Fix PWA bug

* Fix isoData not working

* Fix search page update url

* Fix sharp issue.

* v0.18.0-beta.2

* Make create post pre-fetch communities

* Fix bug from last commit

* Fix issue of posts/comments not being switched when changing select options

* Fix unnecessary fetches on home screen

* Make circular icon buttons not look stupid

* Prevent unnecessary fetches

* Make login experience smoother

* Add PWA shortcuts

* Add related application to PWA

* Update translations

* Forgot to add post editing.

* Fixing site setup.

* Deploy script setup.

* v0.18.0-beta.4

* Sanitize again.

* Adding sanitize json function.

* Upping version.

* Another sanitize fix.

* Upping version.

* Prevent search nav item from disappearing when on search page

* Allow admin and mod actions on non-local comments.

* Fix mobile menu collapse bug

* Completely fix prompt component

* Fix undefined value checks in use_http_client_2 (#1230)

* fix: filter out undefined from posts

* fix: emoji initialisation passing undefined

* fix: || => ?? to be more explicit

* linting

---------

Co-authored-by: Alex Maras <alexmaras@gmail.com>

* Re-add accidentally removed state

* Fix dropdown bug

* Use linkEvent where appropriate

* Fix navigation warnings.

---------

Co-authored-by: Dessalines <tyhou13@gmx.com>
Co-authored-by: Alex Maras <dev@alexmaras.com>
Co-authored-by: Alex Maras <alexmaras@gmail.com>
2023-06-14 08:20:40 -04:00
SleeplessOne1917
ffe95ee1c6
Navbar hide menu fix (#1033)
* Fix navbar not closing on mobile when it should

* Get rid of unnecessary HTML tags
2023-05-21 23:31:08 -04:00
SleeplessOne1917
3526baf465
Make pages use query params instead of route params where appropriate (#977)
* feat: Add multiple image upload

* refactor: Slight cleanup

* feat: Add progress bar for multi-image upload

* fix: Fix progress bar

* fix: Messed up fix last time

* refactor: Use await where possible

* Add query params to search page

* Update translation logic

* Did suggested PR changes

* Updating translations

* Fix i18 issue

* Make prettier actually check src in hopes it will fix CI issue

* Make home page use query params in URL

* Remove unnecessary part of private message url

* Make communities page use query params

* Make community page use query params

* Make user profile use query params

* Make modlog use query params

* Replace choices.js searchable select entirely

* Make 404 screen show up when expected

* Refactor query params code

* Remove unnecessary boolean literal

* Fix query param bug

* Address bug with searchable select and initial fetch

* Only import what is needed from bootstrap

* Undo change to comment nodes component

* Convert closure style functions to normal functions

* Updated translations

* Use translation for loading

* Fix create post select community bug

* Fix community query params bug
2023-04-15 10:47:10 -04:00
Dessalines
b64f47cfe9
Removing monads. Fixes #884 (#886)
* Removing monads. Fixes #884

* Fixing post fetching.

* Dont show not_logged_in error for navbar.

* Adding the lemmy-js-client RC.

* Fixing registration application mode
2023-01-04 11:56:24 -05:00
Dessalines
d905c91e1b
Adding option types 2 (#689)
* Not working, because of wrong API types.

* Adding Rust-style Result and Option types.

- Fixes #646

* Updating to use new lemmy-js-client with Options.
2022-06-21 17:42:29 -04:00
Dessalines
eed07b66aa
Re-organized components folder. (#339)
* Fixing too many large spinners

* Re-organized components folder.

- Cleaned up spans. Fixes #173
- Fixes #320

* Fixing miscolored edit
2021-07-17 16:42:55 -04:00
e3a337fb23 Running newer prettier. 2021-02-21 21:39:04 -05:00
ea317af269 First pass at v2_api 2020-12-23 20:58:27 -05:00
Orvar Segerström
e03fe66a21 Don't flash default theme on page load 2020-10-26 08:12:41 +01:00
241ef72290 Somewhat working webpack. Sponsors and communities pages done. 2020-09-06 22:41:46 -05:00
2eee936026 Partly functioning fuse-box, but moving te webpack now. 2020-09-06 11:15:25 -05:00
3125477c7b Adding prettier 2020-08-23 00:04:58 -04:00
bf8a79e467 Initial commit. 2020-08-22 23:54:33 -04:00