Commit Graph

348 Commits

Author SHA1 Message Date
ekzyis 3c3a97fb8e
Fix reward countdown for other time zones (#347)
Co-authored-by: ekzyis <ek@stacker.news>
2023-07-06 20:55:18 -05:00
keyan 0c51309520 enhance pwa presentation 2023-07-06 16:53:48 -05:00
keyan ec9a424bf4 reward countdown in footer 2023-07-06 12:43:51 -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
keyan 747371a4e4 snl live banner 2023-06-20 09:57:06 -05:00
keyan 59ee15b551 new user email copy 2023-06-19 17:42:47 -05:00
keyan cc6dc8c68b add daily discussion thread permalink 2023-06-19 14:40:24 -05:00
keyan 3e4161ae8c tip -> zap 2023-06-19 13:21:55 -05:00
keyan f0f51438c4 add top posts/comments to subs 2023-06-12 19:40:18 -05:00
keyan ed938527fd simply respect notification alert message 2023-06-12 15:37:12 -05:00
keyan 342a165ced refine cancel button 2023-06-12 14:39:27 -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
ekzyis e243c1c224
Add cancel button for editing all post types + bio (#310)
* Add cancel button when editing any post type

* Add cancel button when editing bio

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-06-12 12:35:28 -05:00
ekzyis 3ee16422f7
Fix code style (#303)
Co-authored-by: ekzyis <ek@stacker.news>
2023-06-05 14:07:29 -05:00
keyan d4988694c8 make room in header to pwa back button 2023-06-01 19:34:26 -05:00
ekzyis 88372b6a9e
Use fallback instead of 500 if callback malformed (#296)
Co-authored-by: ekzyis <ek@stacker.news>
2023-05-31 19:48:14 -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 244cff14b0 fix for user stat dashboard 2023-05-21 12:08:41 -05:00
keyan 4aee2c745f stats are averages now 2023-05-19 18:12:48 -05:00
keyan 0a3f5fd201 materialize dashboard in views 2023-05-19 17:38:39 -05:00
keyan 236dcae13b remove user analytics dos vector 2023-05-17 17:56:34 -05:00
keyan 6d8780373a form enhancements 2023-05-11 14:34:42 -05:00
keyan df1f1a483a require sub selection, allow editting 2023-05-10 19:30:51 -05:00
keyan 01d29e013e fix job editting bug 2023-05-08 14:14:32 -05:00
keyan 8830b8ee9c slight mods to open redirect fix 2023-05-07 08:34:08 -05:00
ekzyis a396933be2 Fix slash after stacker.news not required
The slash should be required else we could still redirect to external sites.

For example, a site could just use "stacker.news" as a subdomain: https://stacker.news.mallory.com/
2023-05-07 07:52:56 -05:00
ekzyis decca40c94 Return 500 if callback URL is external 2023-05-07 07:52:56 -05:00
keyan 347a6a54d2 improve comment performance 2023-05-06 16:51:17 -05:00
keyan b406f0c340 avoid db dip for sub 2023-05-05 12:39:57 -05:00
keyan 5e6e6a18e6 a little cleanup on new rss feeds 2023-05-04 15:05:07 -05:00
ekzyis d98421d9cd Add RSS feeds for ~bitcoin and ~nostr 2023-05-04 13:43:40 -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
mvpratt 48b08d2aff limit oauth scope to minimum possible: public github info for user 2023-04-26 13:02:42 -05:00
keyan a3e928dc42 correct lnurlp nostr pubkey stuff 2023-02-24 10:41:47 -06:00
ekzyis 98daae478f
Fix broken link to top users in settings (#241) 2023-02-24 09:49:57 -06:00
ekzyis 7b838cdeb2
Implement bookmarking of posts and comments (#235) 2023-02-16 16:23:59 -06:00
keyan 30cde2ea38 fix nip57? 2023-02-15 11:20:43 -06:00
keyan 9f2c8d64bc use decodeURIComponent instead 2023-02-14 19:04:05 -06:00
keyan 93d4581360 complete nip 57 support 2023-02-14 16:58:12 -06:00
keyan ef5346000b support NIP-57 2023-02-14 12:52:15 -06:00
keyan 97f74da0fd top cowboys 2023-02-09 12:41:28 -06:00
keyan 74df0db035 client side error boundary 2023-02-08 17:59:14 -06:00
keyan 4cae1ae230 reuse validation on server 2023-02-08 13:39:53 -06:00
keyan 0a0f10b290 update user count 2023-02-04 17:31:18 -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 a6ce93c2bb support NIP-19 in NIP-05 2023-02-01 09:54:08 -06:00
Austin Kelsay e13e37744e
stackernews bounties (#227)
bounties
2023-01-26 10:11:55 -06:00
keyan 29c59d93ea open timestamps 2023-01-22 14:17:50 -06:00
keyan 9644a9f867 slashtags auth 2023-01-18 12:49:20 -06:00
keyan 10ff3fa1c3 delete 2023-01-13 11:52:18 -06:00
Keyan 7c91f279c5
Merge branch 'master' into master 2023-01-11 12:26:57 -06:00
keyan ae5c6c457f global modal + small fixes/enhancements 2023-01-10 17:13:37 -06:00
keyan 79af1b5852 add missing signup file 2023-01-09 18:56:19 -06:00
keyan c2685a659e sign up buttons 2023-01-09 18:33:44 -06:00
keyan eada9d92ad fix empty nostr relay settings 2023-01-06 19:18:03 -06:00
keyan 2d012ba7fe allow nip05 for users 2023-01-06 18:53:29 -06:00
keyan 76b5b7743e fix blockquote spacing 2023-01-05 19:06:31 -06:00
keyan 2080cb896d lexical beta test url 2023-01-05 13:24:09 -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 cd56416e3f
Update satistics.js 2022-12-11 13:30:35 -05:00
keyan 3579e3346f fix learn about rewards link typo 2022-12-09 15:23:45 -06:00
keyan 7b7ed0047c turbo tipping 2022-12-09 13:25:38 -06:00
keyan e1bdb9c769 donations to rewards 2022-12-07 18:04:02 -06:00
keyan f6a95c81eb add spender/stacker types 2022-12-06 13:26:33 -06:00
keyan e28b74fd85 extract day/month/year as UTC 2022-12-01 17:46:56 -06:00
keyan 2a4e5a0617 add more filters to recent 2022-12-01 16:42:49 -06:00
keyan a2db3e18b4 better user analytics mostly 2022-12-01 15:31:04 -06:00
keyan ebbd1175b1 don't mix int types 2022-11-26 18:23:49 -06:00
keyan de863021f9 prevent apollo caching on the server 2022-11-24 13:22:58 -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 525cab2573 upgrade deps 2022-11-06 11:28:58 -06:00
keyan a1690ed511 improve freebie wrt boost, get off free earlier 2022-11-01 14:32:56 -05:00
keyan 760b6b6e10 related items 2022-10-27 15:25:42 -05:00
keyan a398784f26 improved top 2022-10-25 16:35:32 -05:00
keyan 30b1ee33aa user search 2022-10-25 12:13:06 -05:00
keyan e4d150413b search filters 2022-10-20 17:44:44 -05:00
keyan 729bcead69 select instead of dropdown for currency 2022-10-04 16:21:42 -05:00
ekzyis 2dd4b1ce98
Merge branch 'master' into 103-add-other-currencies 2022-10-04 01:01:43 +02:00
keyan 46ea2f661c make jobs great again 2022-09-29 15:42:33 -05:00
keyan d9d426e5c3 add freebies 2022-09-27 16:19:15 -05:00
keyan dd233346d9 don't rank outlawed/borderland 2022-09-23 09:27:01 -05:00
keyan 9c4d74888f add borderland 2022-09-22 15:42:04 -05:00
keyan 2c7c237fc7 show when items are outlawed 2022-09-22 13:44:50 -05:00
keyan 7faae425b3 wild west mode 2022-09-21 14:57:36 -05:00
ekzyis c184faf017 Use dropdown for fiat selection in settings 2022-09-18 03:45:21 +02:00
ekzyis 455ca25efa Validate currency input 2022-09-13 02:03:45 +02:00
ekzyis 5d4abecf3c Add input for fiat currency in settings 2022-09-13 02:02:55 +02:00
keyan 52de4a253e max amount for alby 2022-09-06 09:37:53 -05:00
keyan 7efc86427d maintage pagination and other state on back button 2022-09-06 08:32:00 -05:00
keyan 58eb840adb prevent default on privacy invoice info click 2022-09-02 11:58:16 -05:00
keyan 172d6c3c2f optionally hide invoice descriptions 2022-08-30 16:50:47 -05:00
keyan 0ad886ffc0 constrain invoice quantity and amount 2022-08-30 15:33:39 -05:00