Commit Graph

50 Commits

Author SHA1 Message Date
keyan 672853a7ea upgrade to prisma 3 2023-07-26 11:01:31 -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 4e9138dfdc show more info on where zap rewards came from 2023-07-09 12:21:11 -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 8ac570d403 fixing subscribe and child reply duplicates 2023-06-02 16:48:39 -05:00
ekzyis 0c251ca376
Add thread subscriptions (#293)
* Add thread subscriptions

* remove dead code: reply only notifications

* break out thread subscription queries to reduce search space

* one db dip for item lists/threads re:meSubscription

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-05-31 19:44:06 -05:00
keyan d948a653c9 add earned sats to items 2023-05-08 18:10:41 -05:00
keyan 7b60dc5e9f use getItem meta helper more places 2023-05-07 15:21:58 -05:00
keyan 072e60c954 streaks 2023-02-01 17:40:49 -06:00
keyan 41226245c5 referrals 2022-12-19 16:27:52 -06:00
keyan 7df375e752 improvements to jobs 2022-11-29 11:29:43 -06:00
keyan 5746160893 let tips affect ranking 2022-11-23 12:12:09 -06:00
keyan 1bf747c7c0 sats to msats 2022-11-16 10:57:03 -06:00
keyan 46ea2f661c make jobs great again 2022-09-29 15:42:33 -05:00
keyan 7faae425b3 wild west mode 2022-09-21 14:57:36 -05:00
keyan 08893d020c improved earning: more detail, longer top tail 2022-09-14 17:01:30 -05:00
keyan 9581160944 better reward notifications 2022-07-05 15:18:59 -05:00
keyan 9d3c52ed00 improve trust 2022-07-05 14:51:13 -05:00
keyan 798b055fb9 remove unecessary queries on resp critical path 2022-05-01 20:01:33 -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 188230c37c add notification settings 2022-04-21 17:50:02 -05:00
keyan 74b191837e refine reply-only notifications 2022-04-21 12:48:27 -05:00
keyan e1ffef8308 allow just showing replies in notifications 2022-04-20 16:35:30 -05:00
keyan 3d6a7dc286 re-simplify notifications 2022-04-13 15:48:16 -05:00
keyan 987a5ed3a3 notify user when invoice is paid 2022-03-23 13:54:39 -05:00
keyan 7dda1748cb hack notifications to be faster 2022-03-22 14:53:48 -05:00
keyan 5ff856d061 earning 2022-03-17 15:13:19 -05:00
keyan 4a43a9b864 don't group by more than id in notifications 2022-03-15 11:30:11 -05:00
keyan 022c72b95b remove extra migrations, refine jobs 2022-02-28 14:09:21 -06:00
keyan 32ea1bd12a make notifications faster distinct -> group by 2022-01-31 16:33:00 -06:00
keyan ebb3da07d1 fix duplicate notifications to your own descendant of a descendant 2022-01-31 09:56:21 -06:00
keyan e97951dd18 notify on any descendant replies 2022-01-30 09:35:57 -06:00
keyan 6b19b10bb2 invite notifications 2022-01-19 15:02:38 -06:00
keyan 0f3db83ebc make notifications slightly more concise 2021-10-28 17:22:19 -05:00
keyan 75a8ca2163 fix notification subsorts to desc 2021-10-06 20:45:38 -07:00
keyan 782dc78652 speed hack notification query 2021-10-06 20:20:59 -07:00
keyan 00fff8a67d remove logging 2021-09-24 18:06:32 -05:00
keyan 77514575f4 fix mention notifications in root posts 2021-09-24 18:05:29 -05:00
keyan 93428e3183 tips WIP 2021-09-08 16:51:23 -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 38ba31f2b4 case insensitive names 2021-09-02 17:22:00 -05:00
keyan 09b358397a highlight new notifications 2021-08-19 19:13:32 -05:00
keyan d97608a710 don't double notify when mentioned in reply to your own content 2021-08-18 18:14:18 -05:00
keyan 4b64912333 mention notifications are functional 2021-08-18 18:00:54 -05:00
keyan 0afe46c030 continued notification work 2021-08-17 18:59:22 -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 96a18e6c9d query is working 2021-08-17 13:15:24 -05:00