Commit Graph

55 Commits

Author SHA1 Message Date
SatsAllDay 0ee056b2a1
Toast (#431)
* Prototype of toast system

* More toast adoption

* share
* flag
* bookmark
* subscribe
* delete

* More toast usage:

* forms
* settings save

* Log error during flag failure

* Incorporate PR feedback:

1. return `toaster` from `useToast` hook, with simplified `success` and `danger` methods

2. remove toast header, move close button to body

3. change how toast ids are generated to use a global incrementing int

4. update toast messages

* PR feedback:

* reduce width of toast on narrow screens
* dynamic delete success toast message based on deleted type
* add toasts to auth methods deletion operations

* Dismiss all toasts upon page navigation

* refine style and use delay prop

* more styling

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-25 18:21:51 -05:00
keyan df6575d701 remove slashtags completely 2023-08-17 13:40:21 -05:00
ekzyis f0bc1baed2 Save payment tokens in localStorage 2023-08-12 04:18:32 +02:00
keyan eeaf6e10e5 reduce rerenders in notifications 2023-08-06 10:47:58 -05:00
keyan e4aaaac20f don't use cache for SSR 2023-08-05 14:46:29 -05:00
keyan 23257d8c63 fix notifications glitchiness 2023-08-04 12:08:16 -05:00
keyan b1b8f9de56 implement our own nprogress bar 2023-08-01 21:06:15 -05:00
keyan a426c8b539 fix 404 problem 2023-08-01 12:45:46 -05:00
keyan e1c51075a2 fix conditional nextFetchPolicy overriding cache-only on SSR and suppress time hydration warnings 2023-07-31 14:54:30 -05:00
keyan 10e8cb35df fix import on invites 2023-07-31 09:11:22 -05:00
keyan 5232b59625 upgrade to next-auth 4 (bonus: improve error pages) 2023-07-29 14:38:20 -05:00
keyan 8ab018af88 fix nested comment sorting 2023-07-25 19:45:35 -05:00
keyan ab2046ab0b fix issues with new linting 2023-07-25 09:14:45 -05:00
keyan 6407455def upgrade react-bootstrap 2023-07-24 13:53:53 -05:00
keyan 59f7b6ff26 Revert "Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades""
This reverts commit 18910fa2ed.
2023-07-23 10:08:43 -05:00
keyan 18910fa2ed Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"
This reverts commit d0314ab73c.
2023-07-23 09:16:12 -05:00
keyan d0314ab73c shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades 2023-07-21 17:33:11 -05:00
keyan 09d7e960cc back to lightning animation 2023-07-05 09:47:44 -05:00
keyan 3068252adf merge github master 2023-07-04 15:35:04 -05:00
ekzyis 388e00dd04
Service worker rework, Web Target Share API & Web Push API (#324)
* npm uninstall next-pwa

next-pwa was last updated in August 2022.
There is also an issue which mentions that next-pwa is abandoned (?): https://github.com/shadowwalker/next-pwa/issues/482

But the main reason for me uninstalling it is that it adds a lot of preconfigured stuff which is not necessary for us.
It even lead to a bug since pages were cached without our knowledge.

So I will go with a different PWA approach. This different approach should do the following:
- make it more transparent what the service worker is doing
- gives us more control to configure the service worker and thus making it easier

* Use workbox-webpack-plugin

Every other plugin (`next-offline`, `next-workbox-webpack-plugin`, `next-with-workbox`, ...) added unnecessary configuration which felt contrary to how PWAs should be built.
(PWAs should progressivly enhance the website in small steps, see https://web.dev/learn/pwa/getting-started/#focus-on-a-feature)

These default configurations even lead to worse UX since they made invalid assumptions about stacker.news:
We _do not_ want to cache our start url and we _do not_ want to cache anything unless explicitly told to.
Almost every page on SN should be fresh for the best UX.

To achieve this, by default, the service worker falls back to the network (as if the service worker wasn't there).

Therefore, this should be the simplest configuration with a valid precache and cache busting support.

In the future, we can try to use prefetching to improve performance of navigation requests.

* Add support for Web Share Target API

See https://developer.chrome.com/articles/web-share-target/

* Use Web Push API for push notifications

I followed this (very good!) guide: https://web.dev/notifications/

* Refactor code related to Web Push

* Send push notification to users on events

* Merge notifications

* Send notification to author of every parent recursively

* Remove unused userId param in savePushSubscription

As it should be, the user id is retrieved from the authenticated user in the backend.

* Resubscribe user if push subscription changed

* Update old subscription if oldEndpoint was given

* Allow users to unsubscribe

* Use LTREE operator instead of recursive query

* Always show checkbox for push notifications

* Justify checkbox to end

* Update title of first push notification

* Fix warning from uncontrolled to controlled

* Add comment about Notification.requestPermission

* Fix timestamp

* Catch error on push subscription toggle

* Wrap function bodies in try/catch

* Use Promise.allSettled

* Filter subscriptions by user notification settings

* Fix user notification filter

* Use skipWaiting

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-04 14:36:07 -05:00
keyan b6628eb159 july 4th festivities 2023-07-03 14:46:54 -05:00
ekzyis e97509eea7
Use PWA with display: standalone (#292)
* Use next-pwa

* Use standalone + back button

* Use Notification API

* Use custom service worker

* Use url_handlers

* Add offline page

* Use smaller icon in notification

* Only prompt for notifications if logged in

* small enhancements to standalone pwa

* remove unused back arrow

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-05-31 17:28:33 -05:00
keyan 74df0db035 client side error boundary 2023-02-08 17:59:14 -06:00
keyan ae5c6c457f global modal + small fixes/enhancements 2023-01-10 17:13:37 -06:00
keyan de863021f9 prevent apollo caching on the server 2022-11-24 13:22:58 -06:00
keyan 1bf747c7c0 sats to msats 2022-11-16 10:57:03 -06:00
keyan 525cab2573 upgrade deps 2022-11-06 11:28:58 -06:00
keyan 7efc86427d maintage pagination and other state on back button 2022-09-06 08:32:00 -05:00
keyan b8f57e0c3c add Onion-Location header 2022-07-12 13:18:12 -05:00
keyan fde8937098 add onion address 2022-07-12 11:40:44 -05:00
keyan 44f59f1f34 remove meta tags from _document.js 2022-05-19 11:50:38 -05:00
keyan c7ae5dc8ac ssr me and price 2021-11-28 11:29:17 -06:00
keyan f56315f89f add progress bar and fix reply padding 2021-11-13 07:28:08 -06:00
keyan a3544fb67f dark mode with css variables instead 2021-11-09 16:43:56 -06:00
keyan c6e6ddfa65 half-working local storage version 2021-11-09 11:38:58 -06:00
keyan 20b3a5af63 working backend version 2021-11-08 14:07:37 -06:00
keyan 3bbf3f7470 add dark mode 2021-11-04 19:07:41 -04:00
keyan 2d97314d33 dark mode without ability to switch 2021-11-04 14:22:03 -04:00
keyan 07b9da353b smarter use of SSR and caching 2021-10-26 15:49:37 -05:00
keyan ca1a95094c ssr everything 2021-09-30 10:46:58 -05:00
keyan 0a20f2ea23 WIP tips 2021-09-10 13:55:36 -05:00
keyan 91a2061342 cache magic - use cache and network except when a result of popstate 2021-09-06 17:36:08 -05:00
keyan 09b358397a highlight new notifications 2021-08-19 19:13:32 -05:00
keyan c8df41bfa5 fix clickToContext issue for comments, fix non-inner joins, make notification query work 2021-08-17 18:07:52 -05:00
keyan ae9b4423a4 use rand lightning animation when not logged in 2021-07-16 11:47:18 -05:00
keyan 0f6cb029c3 add plausible and proxy it 2021-07-15 15:49:13 -05:00
keyan 01922e4b88 notifications done 2021-06-24 18:56:01 -05:00
keyan f968ab7954 paginate stories 2021-06-22 12:47:49 -05:00
keyan b594e11891 a little bit of social/seo work with non-flashing skeleton 2021-06-17 13:24:35 -05:00
keyan 80ff13abd6 finish mvp 2021-05-24 19:08:56 -05:00