Commit Graph

58 Commits

Author SHA1 Message Date
keyan 5232b59625 upgrade to next-auth 4 (bonus: improve error pages) 2023-07-29 14:38:20 -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 e8aa0a4dae users? => stackers? 2023-07-09 12:53:50 -05:00
keyan 4e9138dfdc show more info on where zap rewards came from 2023-07-09 12:21:11 -05:00
ekzyis 37e70f9791
Scroll to items on push notification click (#345)
* Scroll from root item in reach on notification click

Instead of going directly to the item of the notification, we now scroll from the root item which is still in reach to the comment.

This should provide more context to the user in most cases.

* Also scroll from root item in reach in /notifications

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-06 10:00:38 -05:00
keyan dc62751df4 dont show push notifications in nonsupporting browsers 2023-07-04 18:44:03 -05:00
keyan 19c743f70d fix safari notifications error 2023-07-04 18:02:22 -05:00
keyan a17b4d1f1a refine push notification ui and catch promises 2023-07-04 17:19:59 -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 3e4161ae8c tip -> zap 2023-06-19 13:21:55 -05:00
keyan ed938527fd simply respect notification alert message 2023-06-12 15:37:12 -05:00
ekzyis 069417d130
Enable push notifications in settings (#301)
* Enable push notifications in settings

* Fix checkbox still checked after user denied permission

The error was related to me thinking that the value prop does anything. It didn't.
The value of the checkbox is handled by formik.
So the solution was to hook into formik and use the handler which actually changes the value.

* Add double opt-in to /notifications

* Better styling of alert in /notifications

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-06-12 13:03:44 -05:00
keyan c4b96b998f only request notification permissions on the notifications page 2023-06-01 14:41:20 -05:00
keyan f4b81b0ff0 fix notification clicking after refactor 2023-06-01 13:22:39 -05:00
ekzyis 40b7fde621
refactor: create component per notification type (#298)
Co-authored-by: ekzyis <ek@stacker.news>
2023-05-31 19:51:30 -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 347a6a54d2 improve comment performance 2023-05-06 16:51:17 -05:00
keyan 072e60c954 streaks 2023-02-01 17:40:49 -06:00
keyan 10ff3fa1c3 delete 2023-01-13 11:52:18 -06:00
kerooke 335125f57b
Merge branch 'stackernews:master' into master 2022-12-29 11:38:53 -05:00
keyan 41226245c5 referrals 2022-12-19 16:27:52 -06:00
kerooke 24263120f3
Update notifications.js 2022-12-11 13:31:44 -05:00
keyan 46ea2f661c make jobs great again 2022-09-29 15:42:33 -05:00
keyan 08893d020c improved earning: more detail, longer top tail 2022-09-14 17:01:30 -05:00
keyan cb313429d5 job board enhancements 2022-07-21 17:55:05 -05:00
keyan cef8a33267 limit displayed comment depth 2022-05-17 17:09:15 -05:00
keyan b68fadc63d allow daily discussion to appear in recent 2022-04-25 12:03:21 -05:00
keyan cef122141f only one earn notification at a time 2022-04-24 11:16:51 -05:00
keyan ef43319cbc add time ago to deposit notifications 2022-04-19 13:35:21 -05:00
keyan d978ff5ea5 forward tips from posts 2022-04-19 13:32:39 -05:00
keyan 9823aedd75 add time of earning 2022-03-31 11:49:35 -05:00
keyan 46a2ac37eb better earn notification 2022-03-23 19:19:20 -05:00
keyan 987a5ed3a3 notify user when invoice is paid 2022-03-23 13:54:39 -05:00
keyan 69155139e6 improve styling of earn notification 2022-03-22 15:35:00 -05:00
keyan 5ff856d061 earning 2022-03-17 15:13:19 -05:00
keyan 022c72b95b remove extra migrations, refine jobs 2022-02-28 14:09:21 -06:00
keyan e97951dd18 notify on any descendant replies 2022-01-30 09:35:57 -06:00
keyan 4c72a69b6c refine clickToContext handling for notifications/flat comments 2022-01-20 13:03:48 -06:00
keyan 6b19b10bb2 invite notifications 2022-01-19 15:02:38 -06:00
keyan 1a3fdda382 new bolt 2021-12-05 11:37:55 -06:00
keyan 996d0a9352 click to comment goes to root thread 2021-11-27 12:01:02 -06:00
keyan dd97710d71 many small design enhancements 2021-11-12 16:39:52 -06: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 91a2061342 cache magic - use cache and network except when a result of popstate 2021-09-06 17:36:08 -05:00