Commit Graph

101 Commits

Author SHA1 Message Date
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
keyan 03e0646560 ~meta sub 2023-06-20 11:27:41 -05:00
keyan f0f51438c4 add top posts/comments to subs 2023-06-12 19:40:18 -05:00
keyan 6ed2c87c49 fix ssr and client side rendering difference warnings 2023-06-12 17:59:53 -05:00
keyan ab3b24a072 refine pwa back button 2023-06-12 15:49:48 -05:00
ekzyis b890215b98
Tech sub (#311)
* Add tech sub

* Fix line break in RSS popover

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-06-12 12:41:22 -05:00
keyan 56f08e0144 allow ctrl-click of post button 2023-06-03 17:49:04 -05:00
keyan d4988694c8 make room in header to pwa back button 2023-06-01 19:34:26 -05:00
keyan 56314bac4e fix window navigation error on firefox 2023-06-01 15:29:20 -05:00
keyan c4b96b998f only request notification permissions on the notifications page 2023-06-01 14:41:20 -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 236ee552c6 navbar fixes 2023-05-02 19:22:38 -05:00
keyan 4e817a232d sub related enchancements 2023-05-02 11:55:10 -05:00
keyan 4be5286122 hide cowboy hat setting 2023-05-01 16:52:02 -05:00
keyan a241d683d8 nostr sub 2023-05-01 15:58:30 -05:00
ekzyis 7b838cdeb2
Implement bookmarking of posts and comments (#235) 2023-02-16 16:23:59 -06:00
keyan c1080ec4d7 fixes for top 2023-02-03 13:10:18 -06:00
keyan 072e60c954 streaks 2023-02-01 17:40:49 -06:00
keyan c2685a659e sign up buttons 2023-01-09 18:33:44 -06:00
keyan 7a4a24c6df make notification icon change on hover 2023-01-05 19:15:48 -06:00
keyan 41226245c5 referrals 2022-12-19 16:27:52 -06:00
keyan 8de00c741d poll for notifications less, don't retry gql 2022-11-16 10:57:03 -06:00
keyan 9c5937b9be strike once for lurkers 2022-10-26 11:45:16 -05:00
keyan a398784f26 improved top 2022-10-25 16:35:32 -05:00
keyan 401efbd550 add ln icon to login 2022-09-27 16:27:29 -05:00
keyan b7132cc962 use correct callbackUrl for login with tor 2022-09-06 16:10:13 -05:00
keyan 297270f34d inform user when there are new comments 2022-09-02 11:53:44 -05:00
keyan fba0187b2c add link to recent/comments 2022-08-23 17:34:51 -05:00
keyan a714a13029 fix nested anchor in navbar error 2022-08-18 16:19:37 -05:00
keyan ba4644463f allow lightning address send callback to have query params 2022-05-24 16:15:51 -05:00
keyan 0c95794d74 nym dropdown is also a link to the user 2022-05-18 16:31:09 -05:00
keyan 16957cba34 improve error pages 2022-05-18 15:55:06 -05:00
keyan e2409efbaf indicate to user when there are new jobs 2022-05-09 13:01:23 -05:00
keyan 934c5021a9 a few perf enhancements + gql slowlogs 2022-04-28 13:11:05 -05:00
keyan 74b191837e refine reply-only notifications 2022-04-21 12:48:27 -05:00
keyan 291eab6ada move notifications to icon 2022-04-19 16:37:05 -05:00
keyan 38f7dba27f make sub-header more differentiated 2022-03-10 12:38:48 -06:00
keyan a7a72f0d2d improve navbar on mobile 2022-03-08 14:51:06 -06:00
keyan 1ef824d273 make ~jobs header more consistent with main 2022-03-07 12:11:58 -06:00
keyan 026256c451 prevent header from wrapping 2022-03-03 11:04:02 -06:00
keyan b954186d31 jobs w/o payments yet 2022-02-24 13:05:57 -06:00
keyan ef739d97fc readability enhancements: text size/color/line height 2022-02-09 13:15:38 -06:00
keyan e950b0df7f add job queue 2022-01-05 14:37:34 -06:00
keyan f19bce3659 fix logout redirection issue 2021-12-20 16:34:26 -06:00
keyan a126d5fa94 top users 2021-12-16 18:39:19 -06:00
keyan e43994e36f limit bolt for logged out to one per nav 2021-12-06 10:32:58 -06:00
keyan 1a3fdda382 new bolt 2021-12-05 11:37:55 -06:00