Commit Graph

988 Commits

Author SHA1 Message Date
ekzyis bdf9b1f0fd
Territory post notifications (#745)
* Notify founders of new posts

* Only merge notifications of same territory

* Show territory posts in /notifications

* Don't notify on own posts
2024-01-11 11:27:54 -06:00
keyan 9a9e81b109 refine territory details on post form 2024-01-08 19:02:00 -06:00
ekzyis f8cbd43be7
Show territory details in post form (#725)
* Show territory details in post form

* Style territory details in post form

* Keep details closed by default

* Use SUB_FULL

* Undo unused changes to specify accordian default

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-01-08 17:46:23 -06:00
keyan 5137f1423d change reply placeholder 2024-01-04 18:48:10 -06:00
keyan 26e0dd6f7e Revert "fix #703"
This reverts commit 8996fd085a.
2024-01-03 20:39:26 -06:00
keyan 6a600c2043 fix null sub in select 2024-01-03 19:45:30 -06:00
ekzyis 31a40e15be
refactor delete notification (#731)
Co-authored-by: ekzyis <ek@stacker.news>
2024-01-03 16:24:46 -06:00
keyan 8996fd085a fix #703 2024-01-03 16:12:33 -06:00
keyan 717f8d1ef6 territory billing notifications 2024-01-03 15:20:10 -06:00
ekzyis 562b243111
Fix usage of hardcoded strings for sw message types (#730)
Co-authored-by: ekzyis <ek@stacker.news>
2024-01-03 14:02:01 -06:00
ekzyis 31cef5a7b7
Only close notifications manually on iOS (#729)
* Only close notifications manually on iOS

* Use function instead of hardcoded string

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-01-03 11:56:29 -06:00
ekzyis ade35b9ea0
Add verbose logging in onPush listener (#724)
* refactor: Use log function in service worker

* Add verbose logging on push listener

* Fix TypeError: Cannot read properties of null (reading 'postMessage')

navigator.serviceWorker.controller is null on forced refreshes:

"""
This property returns null if the request is a force refresh (Shift + refresh) or if there is no active worker.
"""

-- https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller

This means when we unregister a service worker manually (like I do for debugging purposes) and then reload the page, there is no service worker available when this code is run.

Adding a check with a more helpful error message should improve UX.

This error might also happen in other cases where a page refresh should also help.

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-01-03 11:51:04 -06:00
keyan c597acfb8f add mempool link 2024-01-02 16:35:01 -06:00
keyan 240ac3497d refine territory mutes 2023-12-31 10:52:19 -06:00
keyan 76b63240db fix territory mutes for logged out 2023-12-30 19:45:41 -06:00
keyan 0999004646 mute territories in overflow 2023-12-30 19:41:16 -06:00
keyan 9ab1d770eb remove debug log statement 2023-12-30 18:43:41 -06:00
keyan f267137662 add muted section to territory select 2023-12-30 18:19:42 -06:00
keyan 214e863458 mute territories 2023-12-30 17:16:09 -06:00
ekzyis 3a0c50566b
Fix TypeError (reading 'moderated') (#722)
Co-authored-by: ekzyis <ek@stacker.news>
2023-12-30 14:40:06 -06:00
ekzyis c23799be81
Remove ineffective guard against all caps (#723)
Co-authored-by: ekzyis <ek@stacker.news>
2023-12-30 14:38:41 -06:00
keyan dc15be914c opt-in moderation for territory founders 2023-12-29 18:05:16 -06:00
keyan 45e7503784 improve outlawed comment ux 2023-12-27 18:14:22 -06:00
keyan 6170853d72 unify idempotent act and act 2023-12-27 10:15:18 -06:00
keyan 73ad93f2bb idempotent zaps 2023-12-26 20:27:52 -06:00
keyan 374a7985da unify zap/downzap/bounty mutation 2023-12-26 16:51:47 -06:00
keyan 67a9fe23cf stablize act mutation reference 2023-12-26 15:55:48 -06:00
keyan 8c5c29ee45 remove snow 2023-12-25 18:05:45 -06:00
ekzyis 05bdd988fa
Christmas zaps (#707)
* Christmas zaps

* Also add 50px margin on left side

* Remove wrong comment

* Use grey snow in light mode

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-12-24 16:49:41 -06:00
keyan ac1c64e402 reduce redundant messaging in wallet limit banner 2023-12-21 17:52:35 -06:00
keyan f3ac63050e floor the chain fee float 2023-12-21 17:45:03 -06:00
keyan 4c36b7813a refine wallet limit banner slightly 2023-12-21 17:40:11 -06:00
ekzyis 01984c0b43
Add wallet limit banner (#699)
* Colorize balance if over soft limit

* Remove default banner export

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-12-21 17:31:16 -06:00
keyan fdf8f8e395 fix footnote links 2023-12-20 18:54:56 -06:00
keyan 633c96d619 handle hash urls with 'view more' 2023-12-20 18:16:34 -06:00
st4rgut24 e9a5d22a6e
Add chain fees to price carousel (#658)
* add chain fees to price carousel

* restore check for valid carousel values

* add nym to contributors

---------

Co-authored-by: stargut <stargut@starguts-MacBook-Pro.local>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-12-20 16:06:22 -06:00
ekzyis 056be01f15
Request persistent storage (#701)
* Request persistent storage

* Only prompt for persistent storage if push notifications enabled

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-12-20 14:38:43 -06:00
keyan 65744364f1 undo zap/downzap and improve downzap ux 2023-12-19 19:55:19 -06:00
keyan 7e0da18878 down zap ui polish 2023-12-19 18:25:41 -06:00
keyan 9455847484 add timeouts for nostr extension calls 2023-12-19 16:01:48 -06:00
Austin Kelsay 5737027c0f
Nostr crossposting improvements (#629)
* Add nostr event id field to items

* crosspost-item

* crosspost old items, update with nEventId

* Updating noteId encoding, cleaning up a little

* Fixing item-info condition, cleaning up

* Linting

* Spacing nit

* Add createdAt variable back

* Change instances of eventId to noteId

* Adding upsertNoteId mutation

* Cleaning up updateItem, using toasts to communivate success/failure in crosspost-item

* Linting

* Fix type

* Move crosspost to share button, make sure only OP can crosspost

* Lint

* Simplify conditions

* user might have no nostr extension installed

Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>

* change upsertNoteId to updateNoteID for resolver and mutations, change isOp to mine, remove unused noteId params

* Use nostr.com for linking out with noteId

* lint

* add noopener to window.open call

* Simplify condition, throw GraphQLError

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>
2023-12-19 11:48:48 -06:00
ekzyis 6682817578
Do not remove orientation EXIF data (#683)
* Keep orientation metadata

* npm install piexifjs

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-12-19 09:45:21 -06:00
keyan fc3f46a343 fix #687 2023-12-17 13:23:52 -06:00
keyan 3a7d899ce7 fix missing view more? #687 2023-12-15 18:18:30 -06:00
keyan a5e50821b7 gofac yourself 2023-12-14 11:30:51 -06:00
keyan ca02d627c1 make anon fees consistent 2023-12-10 16:56:22 -06:00
keyan c8bca3ef63 allow territory founders to disable freebies 2023-12-10 15:41:20 -06:00
keyan e08fca15b6 set billing state from existing on edit 2023-12-08 19:11:25 -06:00
keyan 1d66be68cc make territory billing renewal opt-in 2023-12-08 14:02:00 -06:00
ekzyis 5e51fe5330
Fix bio replies (#669)
Co-authored-by: ekzyis <ek@stacker.news>
2023-12-07 15:50:36 -06:00
keyan c33d4b9b01 fix horizontal layout shift from select 2023-12-06 13:40:14 -06:00
keyan 5496fe82e9 fix select width on mobile 2023-12-06 13:19:39 -06:00
keyan 10203f565c territories 2023-12-04 21:34:06 -06:00
keyan 82a1b450f5 view more viewheight 2023-12-04 20:08:52 -06:00
keyan e8e22ad7d4 fix click to reveal text initial render 2023-12-04 18:02:48 -06:00
keyan 86cdb69082 add copyright policy 2023-12-04 16:56:13 -06:00
keyan 4127adb169 click to reveal text when very long 2023-12-04 16:30:39 -06:00
keyan 6c576bda84 legal footer 2023-12-04 13:42:39 -06:00
keyan f465c6d881 remove negative lookbehind for #656 and fix mention regex 2023-12-03 12:58:28 -06:00
ekzyis 32403d0c29
Unsubscribe on signout (#653)
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-25 14:29:42 -06:00
keyan a1114e5270 fix mention positioning 2023-11-22 09:12:43 -06:00
keyan 8e01568622 remove dead gql 2023-11-21 17:26:24 -06:00
keyan 70e4b27c03 fix youtube/twitter embed styling when there's text 2023-11-21 16:20:54 -06:00
keyan 6bc1b08606 fix twitter embed styling 2023-11-21 15:39:53 -06:00
keyan 20e46e747d small refinements to image min-width 2023-11-21 14:58:15 -06:00
keyan 47a5b311c3 refine mentions 2023-11-21 14:49:39 -06:00
keyan a74c5201bc reply cancel confirm 2023-11-21 12:49:22 -06:00
keyan 21c1fd11ba refine quote reply hook and #643 2023-11-21 12:35:37 -06:00
keyan d211fe93ea fix quote reply by removing imperative logic 2023-11-20 21:38:18 -06:00
keyan 2bcf3acda6 fix small images #619 2023-11-20 19:54:22 -06:00
keyan 58a9d03e28 only query for deleteScheduledAt when needed 2023-11-20 15:38:49 -06:00
keyan a12e969bd1 fix #631 2023-11-20 13:54:09 -06:00
keyan 1266ae2983 fee button improvements 2023-11-20 13:20:28 -06:00
keyan af59e3ef54 merge non-normalized user subtypes fixing #645 2023-11-20 09:05:02 -06:00
SatsAllDay 44e12a4b44
Move the `AD` badge to be alongside other item info badges (#647) 2023-11-20 08:33:59 -06:00
SatsAllDay 4596681fbc
Toast on delete bot directive usage (#620)
* Toast on successful delete bot directive

* refactor duplicate code into a reusable function

* restore empty spacing lines to clean up the diff

* perf optimization, only query for deleteScheduledAt for your own items

* Issue a warning toast if the delete bot was mentioned but the item was not scheduled for deletion

* use bs-secondary color for warning

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-11-19 15:09:47 -06:00
st4rgut24 d84c46df81
Dont display price component until after initial render (#637)
* Dont display price component until after initial render

* change variable name and remove log

* fix linting issues

---------

Co-authored-by: stargut <stargut@starguts-MBP.fios-router.home>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-11-19 15:01:12 -06:00
SatsAllDay 64a16373c5
Fix client-side error boundary (#623)
* * add error boundary immediately above page component

* send error logs to server via LoggerContext

* display error stack and component stack in copyable text area

* wrap every context provider in an error boundary

* memoize context values to fix error boundary propagation issue

* Wrap page component in an error boundary so we can use our context utilities
for a better experience, like toast and logger

Still have a top-level error boundary that catches things from the context providers,
just in case.

Don't display the whole error stack, just because it's ugly, but make it copyable
2023-11-19 14:24:56 -06:00
ekzyis 158baa61e3
Strip EXIF data before upload on client (#634)
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-19 14:22:46 -06:00
keyan a318727f9c fix freebie dialog (#460) 2023-11-19 14:16:35 -06:00
keyan 589b15b597 fix custom dates to use ms since epoch 2023-11-14 10:23:44 -06:00
keyan ffe9983b80 fix successive zap timing issues? 2023-11-13 20:02:34 -06:00
keyan 7b58edb77b reintroduce searching by most recent 2023-11-13 18:17:45 -06:00
ekzyis 503f4c380b
Disable reply button while uploading (#627)
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-13 09:30:01 -06:00
keyan d599ec76ce fix mention clientside cache problems 2023-11-12 14:51:12 -06:00
keyan 03acce2305 fix nostr auth (#621) 2023-11-12 11:59:18 -06:00
keyan 081e22f63e fix post headings 2023-11-12 09:04:28 -06:00
keyan a78661c6e7 omit op from self-reply fee escalation 2023-11-11 16:47:54 -06:00
keyan c23e49872a make fee button less of a hack 2023-11-10 18:18:10 -06:00
keyan 3499f92436 dramatically improve search 2023-11-10 09:22:30 -06:00
keyan 7cb3a7ad64 small receipt styling 2023-11-10 09:22:14 -06:00
keyan 494b8b3dcd better organize user graphql types 2023-11-09 19:05:35 -06:00
rleed d86d8b3bac
Provide option to clear withdrawal invoices (#591)
* add settings option

* add auto-drop worker

* add manual delete option

* add warning and note

* cleanup

* incorporate most review feedback

* add warning to settings option

* remove debugging tweaks and simplify

* refine auto delete bolt11s

* refine UI

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-11-09 11:50:43 -06:00
ekzyis 41a1c686dc
Fix stale images (#618)
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-08 18:17:51 -06:00
SatsAllDay 522c821c89
Notification badges (#595)
* First pass of implementing Badging API for notifications

* Only show app badge when driven from push notifications

* Display number of unread push notifications instead of just an empty badge

Clear badge via postMessage when notifications page is loaded

* de-dupe some code, update badge counter on each notification click

* remove ids, track open note count instead

* restore optional chaining

* ensure note count doesn't go below 0, and fix event.waitUntil error when clearing badge

* incorporate PR feedback
2023-11-08 18:17:01 -06:00
rleed 3a56782572
Custom date selector for more pages (#567)
* add custom range option to top items page

* add custom range option to profile page

* add date filter option to chart pages

* cleanup

* fix x-axis date labels

* date picker improvements

* enhancements to custom date selection

* remove unneeded condition

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-11-08 18:15:36 -06:00
ekzyis 8f590425dc
Image uploads (#576)
* Add icon to add images

* Open file explorer to select image

* Upload images to S3 on selection

* Show uploaded images below text input

* Link and remove image

* Fetch unsubmitted images from database

* Mark S3 images as submitted in imgproxy job

* Add margin-top

* Mark images as submitted on client after successful mutation

* Also delete objects in S3

* Allow items to have multiple uploads linked

* Overwrite old avatar

* Add fees for presigned URLs

* Use Github style upload

* removed upfront fees
* removed images provider since we no longer need to keep track of unsubmitted images on the client
* removed User.images resolver
* removed deleteImage mutation
* use Github style upload where it shows ![Uploading <filename>...]() first and then replaces that with ![<filename>](<url>) after successful upload

* Add Upload.paid boolean column

One item can have multiple images linked to it, but an image can also be used in multiple items (many-to-many relation).

Since we don't really care to which item an image is linked and vice versa, we just use a boolean column to mark if an image was already paid for.

This makes fee calculation easier since no JOINs are required.

* Add image fees during item creation/update

* we calculate image fees during item creation and update now
* function imageFees returns queries which deduct fees from user and mark images as paid + fees
* queries need to be run inside same transaction as item creation/update

* Allow anons to get presigned URLs

* Add comments regarding avatar upload

* Use megabytes in error message

* Remove unnecessary avatar check during image fees calculation

* Show image fees in frontend

* Also update image fees on blur

This makes sure that the images fees reflect the current state. For example, if an image was removed.

We could also add debounced requests.

* Show amount of unpaid images in receipt

* Fix fees in sats deducted from msats

* Fix algebraic order of fees

Spam fees must come immediately after the base fee since it multiplies the base fee.

* Fix image fees in edit receipt

* Fix stale fees shown

If we pay for an image and then want to edit the comment, the cache might return stale date; suggesting we didn't pay for the existing image yet.

* Add 0 base fee in edit receipt

* Remove 's' from 'image fees' in receipts

* Remove unnecessary async

* Remove 'Uploading <name>...' from text input on error

* Support upload of multiple files at once

* Add schedule to delete unused images

* Fix image fee display in receipts

* Use Drag and Drop API for image upload

* Remove dragOver style on drop

* Increase max upload size to 10MB to allow HQ camera pictures

* Fix free upload quota

* Fix stale image fees served

* Fix bad image fee return statements

* Fix multiplication with feesPerImage

* Fix NULL returned for size24h, sizeNow

* Remove unnecessary text field in query

* refactor: Unify <ImageUpload> and <Upload> component

* Add avatar cache busting using random query param

* Calculate image fee info in postgres function

* we now calculate image fee info in a postgres function which is much cleaner
* we use this function inside `create_item` and `update_item`: image fees are now deducted in the same transaction as creating/updating the item!
* reversed changes in `serializeInvoiceable`

* Fix line break in receipt

* Update upload limits

* Add comment about `e.target.value = null`

* Use debounce instead of onBlur to update image fees info

* Fix invoice amount

* Refactor avatar upload control flow

* Update image fees in onChange

* Fix rescheduling of other jobs

* also update schedule from every minute to every hour

* Add image fees in calling context

* keep item ids on uploads

* Fix incompatible onSubmit signature

* Revert "keep item ids on uploads"

This reverts commit 4688962abc.

* many2many item uploads

* pretty subdomain for images

* handle upload conditions for profile images and job logos

---------

Co-authored-by: ekzyis <ek@ekzyis.com>
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-06 14:53:33 -06:00
ekzyis 5dfeb700bc
Resubscribe if service worker lost push subscription (#597)
* Also delete push subscription in IndexedDB

* Fix pushsubscriptionchange function signature

* Send SYNC_SUBSCRIPTION after successful registration

* Resubscribe if service worker lost subscription

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-11-05 15:08:44 -06:00
keyan 8bc3f5b384 Revert "halloween animation"
This reverts commit e939026295.
2023-11-01 11:57:55 -05:00
keyan 8881b19e45 Revert "protect zaps from webgl occasionally being unavailable"
This reverts commit b5828cdf94.
2023-11-01 11:57:17 -05:00
keyan b5828cdf94 protect zaps from webgl occasionally being unavailable 2023-10-31 09:48:39 -05:00
keyan e939026295 halloween animation 2023-10-29 16:50:03 -05:00
keyan 30d8c92fe2 fix accidental reply hit on mobile 2023-10-26 15:49:28 -05:00
keyan 835554b3cd small adjustments to secondary form text 2023-10-26 15:12:21 -05:00
keyan 7589295e8c fix url UX exposing state 2023-10-26 14:36:20 -05:00
keyan 43a54d407e keep as much context as possible when navigating deeper in comment threads 2023-10-26 14:24:49 -05:00
keyan 39625f7e08 improve markdown tab spacing 2023-10-26 13:28:12 -05:00
keyan 43d3ba1807 better search layout spacing 2023-10-26 13:01:01 -05:00
keyan e8aaf1956e fix spacing on mixed items 2023-10-26 12:52:06 -05:00
keyan 4d98110282 restore ctrl+click on item title clicking 2023-10-26 12:30:13 -05:00
keyan 02b98582b8 add spacing to comment reply button 2023-10-26 12:17:43 -05:00
keyan 41cb6ac3d8 continue notification polling even if found 2023-10-26 11:53:27 -05:00
ekzyis cbcf80e1ba
Fix QR code overflow on mobile (#589)
Co-authored-by: ekzyis <ek@stacker.news>
2023-10-26 10:36:46 -05:00
keyan 0c9131f698 only show invoice data on full page 2023-10-23 19:58:33 -05:00
keyan 302f3459a1 fix markdown inline code and headings 2023-10-23 17:14:37 -05:00
keyan 67ec82b6d9 disambiguate preimage after payment from hold preimage 2023-10-23 16:44:09 -05:00
keyan 3929593d90 don't poll for notifications if we already know 2023-10-22 16:26:52 -05:00
keyan 7b0021d933 enhance youtube embeds in markdown 2023-10-22 13:28:18 -05:00
keyan b853cacfa7 simplify optional text on link 2023-10-22 11:54:27 -05:00
G 40f63baa05
Embed Youtube videos in posts for valid Youtube URLs (#572)
* Render video if it's valid Youtube URL

* Fix lint
2023-10-22 11:13:16 -05:00
rleed e713387920
migrate to ThreadSubscription model and enable self-unsubscribe (#569)
Co-authored-by: rleed <rleed1@pm.me>
2023-10-22 11:00:23 -05:00
rleed 92c5303d81
Add optional text input for link posts (#558)
* add link comment functionality

* handle anon case

* revise info text

* simplify by using item.text

* remove hint

* cleanup

---------

Co-authored-by: rleed <rleed1@pm.me>
2023-10-22 10:55:50 -05:00
keyan d1db762ecb don't show link share failure when close share options 2023-10-20 20:27:07 -05:00
SatsAllDay 56111efd6a
SN wallet transaction details (#550)
* display bolt11 info and preimage for invoices

* Remove preimage attempt for wdrwl, since it doesn't make sense

Other various code cleanup

* Only include preimage for confirmed paid and settled invoices
2023-10-20 19:25:22 -05:00
Keyan 01f36184b1
Merge pull request #565 from SatsAllDay/share-url
Dynamic protocol, host for share URLs so they work on localhost and in prod
2023-10-20 19:07:46 -05:00
ekzyis cac956b88d Fix typo 2023-10-18 16:50:33 +02:00
keyan e12e2481f4 nofollow on unqualified content 2023-10-16 13:44:07 -05:00
keyan a19b392787 fix duplicate key issue when rendering search highlights 2023-10-15 16:13:54 -05:00
keyan 0daff7a01f update packages 2023-10-15 15:43:06 -05:00
Satoshi Nakamoto 411c08d9e8 Dynamic protocol, host for share URLs so they work on localhost and in prod 2023-10-15 13:45:21 -04:00
keyan 8f034f0e0a fix corner cases in lightning address autosuggestions 2023-10-12 15:29:22 -05:00
keyan 6516ce9c9e don't immediate clear mention suggestions on blur (in case clicking a suggestion) 2023-10-12 13:45:29 -05:00
Keyan 6cb813f421
Merge branch 'master' into autocomplete-ln-addr 2023-10-12 13:16:54 -05:00
Keyan ad9465acda
Merge pull request #556 from AustinKelsay/bugfix-crosspost-remove-a-tag
Removing a tag, retested crossposts and edits
2023-10-12 13:08:20 -05:00
Keyan e792d18467
Merge pull request #551 from AustinKelsay/bugfix-adv-post-form-crosspost-checkbox
crosspost to nostr checkbox only appears on discussion forms
2023-10-12 13:07:45 -05:00
keyan a7e016e9ba fix? markdown input rerendering more than needed 2023-10-12 12:46:22 -05:00
austinkelsay cdd3e4fdd4 Removing a tag, retested crossposts and edits 2023-10-11 17:26:25 -05:00
Satoshi Nakamoto e907b40845 * Hide suggestions if the user is typing a ln addr that is not on stacker.news
* Don't select suggestion with tab in this particular instance of InputUseSuggest
2023-10-10 19:15:10 -04:00
Satoshi Nakamoto 6d3482a288 Add auto-complete support when withdrawing to ln addr
adds auto-complete support for other stacker.news users when withdrawing
to a lightning address

implemented via adding an optional `transformUser` prop to the `UserSuggest` and `InputUserSuggest`
components, which allows you to transform fetched user results before displaying in the suggestion
dropdown

this is used to transform a user nym to nym@stacker.news, the corresponding
lightning address

by default, `transformUser` is an identity fn aka no transformation

this change also clears suggestions when the surrounding input field is blurred, which
is a better UX IMO
2023-10-10 11:15:59 -04:00
austinkelsay 06c55be6a5 crosspost to nostr checkbox only appears on discussion forms 2023-10-09 16:08:33 -05:00
keyan 8ace053be5 remove freebie tag from pinned items 2023-10-06 19:32:48 -05:00
keyan 91ccc80a97 fix issues related to syntax highlighting 2023-10-06 18:51:38 -05:00
keyan 9aa8d8a688 trigger autocomplete with just 2023-10-06 18:20:12 -05:00
keyan dc1fda64dc remove unused debounce callback deps 2023-10-06 16:34:16 -05:00
keyan 58c5844492 fix mention regex 2023-10-06 16:01:19 -05:00
keyan b995b7dd3b raise nofollow limits 2023-10-06 15:54:46 -05:00
Keyan 6d370aa019
Merge pull request #548 from SatsAllDay/copy-ln-addr
Copy lightning address on click
2023-10-06 15:23:18 -05:00
keyan 1b283fbe94 fix treating ref as primitive 2023-10-06 15:04:50 -05:00
keyan 8ca8bb985e reuse debounce hook more places 2023-10-06 15:01:51 -05:00
Satoshi Nakamoto c073847eb7 Copy ln addr when you click on the ln addr button on user profile 2023-10-06 09:24:40 -04:00
keyan 0a35bca650 memoize debounced function 2023-10-05 21:14:57 -05:00
keyan d1a7dca46b use and make a debounce callback hook 2023-10-05 20:33:14 -05:00
SatsAllDay 6b8820b7ab
Fix quote selection reply in iOS Safari (#544)
* Handle quote reply of selections in iOS Safari

Approach borrowed from https://stackoverflow.com/a/72537632

Basically this makes a copy of the selection when the "touchend" event
occurs, so we can use it for processing later

This code listens to that event for each instance of the reply component,
removing the event listener on unmount

* Update docker-compose up command in dev notes

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-10-05 19:32:54 -05:00
ekzyis 425220d8cb
More push notification types (#530)
* Add push notifications for referrals

* Add push notifications for daily rewards

* Add push notifications for deposits

* Add push notifications for earning cowboy hats

* Use streak id to synchronize blurb

* Fix usage of magic number for blurbs

* Fix missing catch

* Add push notification for losing cowboy hats

* Fix null in deposit push notification

* Add push notification for invites

* Don't replace streak push notifications

* Fix missing unit in daily reward push notification title

* Attach sats to payload options instead of parsing title

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-10-04 18:20:52 -05:00
SatsAllDay 502bfee072
Mention auto-complete (#532)
* uber rough first pass at mention autocompletes

* support custom limit on topUsers query

* hot keys for selecting user suggestion in markdown input

* query top stackers for mentions with no search query

* refactor UserSuggestion to help with reusability

textarea-caret for placing the user suggest dropdown appropriately

other various code cleanup items to make it easier to use

off by one errors are fun!

various code cleanup and reuse the UserSuggest component in InputUserSuggest to reduce duplication

* change default users to week query

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-10-04 15:10:56 -05:00
rleed 247744a83c
Add a date selector to the search function (#494)
* add date picker

* lint

* add date picker

* lint

* refine

* fix/finish the date picker UI part

* finish query parameter passing & incremental cleanup

* fix/finish the date picker UI part

* finish query parameter passing & incremental cleanup

* fix bad merge

* fix linting errors

* wrap for mobile

* add date picker

* lint

* add date picker

* lint

* refine

* fix/finish the date picker UI part

* finish query parameter passing & incremental cleanup

* fix/finish the date picker UI part

* finish query parameter passing & incremental cleanup

* fix bad merge

* fix linting errors

* wrap for mobile

* merge glitch?

* enhance a little

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-10-04 14:44:06 -05:00
Austin Kelsay b3aee502a0
Crosspost discussion items to nostr (#522)
* Crossposting discussion function, crossposting setting migration

* Passing in id, adding relays to test

* Adding checkbox setting for crossposting enabled

* Adding paramaterized event fields to crosspostDiscussion, successfully crossposting discussions

* Cleaning up for rebase

* Removing nostrRelays

* Retry crosspost toast

* Adding nostrCrossposting to settings, fixing migration

* Full flow is working with error surfacing, retries, and skips for a retry

* Updates to error handling/retries for crossposting, fixing settings for crossposting

* Allowing recursive retries for crossposting to specific relays

* Fixing / syncing crossposting settings, cleaning up and seperating out nostr functions

* Cleaning up

* Running linter

* make nostr crossposter a hook

---------

Co-authored-by: Austin <austin@pop-os.localdomain>
Co-authored-by: plebdev <plebdev@plebdevs-MacBook-Pro.local>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-10-04 13:47:09 -05:00
SatsAllDay f6141a6965
Quote reply support on text-based posts and comments (#526)
* Quote reply support on text-based posts and comments

* Clean up the `onQuoteReply` prop usage

* Refactor to use `useImperativeHandle` for Reply

* quote selected text if any, otherwise quote whole item

* Only quote selected text if it's from the item we're replying to, not just any selected text

* add trailing newline to copied text

* onPointerDown for mobile, quote+reply quotes text

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-10-03 20:12:12 -05:00
SatsAllDay 362f95add9
LUD-18 Wallet implementation (#531)
* LUD-18 Wallet implementation

Query the lightning address provider client-side to learn of capabilities

Conditionally render LUD-12 and LUD-18 fields based on what the remote
server says is supported

Allow identifier, name, and email to be sent from the SN side during the withdrawal flow. Auth seems too complicated for our use case, and idk about pubkey?

* Clear inputs if the new ln addr provier doesn't support those fields

* various ux improvements

* dynamic client-side validation for required payer data

* don't re-init form state on error

* correct min and max amount values

* only send applicable data to graphql api based on payerdata schema

* input type for numeric values (amount, max fee)

* update step for amount and max fee

* Fix identifier optional and field blur

* reuse more code

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-10-03 18:22:56 -05:00
SatsAllDay 3acaee377b
LUD-18 Service Support (#518)
* first pass of LUD-18 support

* Various LUD-18 updates

* don't cache the well-known response, since it includes randomly generated single use values

* validate k1 from well-known response to pay URL

* only keep k1's for 10 minutes if they go unused

* fix validation logic to make auth object optional

* Various LUD18 updates

* move k1 cache to database

* store payer data in invoice db table

* show payer data in invoices on satistics page

* show comments and payer data on invoice page

* Show lud18 data in invoice notification

* PayerData component for easier display of info in invoice, notification, wallet history

* `payerData` -> `invoicePayerData` in fact schema

* Merge prisma migrations

* lint fixes

* worker job to clear out unused lnurlp requests after 30 minutes

* More linting

* Move migration to older

* WIP review

* enhance lud-18

* refine notification ui

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-10-03 14:35:53 -05:00
ekzyis 1e417ba670
Image refactor refactor (#541)
* Remove outdated comments about srcSet value

We no longer distinguish between `undefined` and `null` for `srcSet`.

* Fix misleading URL shown

* Update/fix comments in <ImageOriginal>

* Simplify condition when to show image

I think this is not required since `showImage` will always stay false if tab !== 'preview' or me?.clickToLoadImg are true.

* Rename to imgproxyOnly

* Add info to imgproxyOnly setting

* Fix text of markdown links not used on imgproxy errors

* Fix rendering markdown links with text as images

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-10-03 13:05:04 -05:00
SatsAllDay 65fa3cf966
fix singular/plural for invoice deposit notification (#527) 2023-10-02 19:19:20 -05:00
keyan 62b53e1b3e make zoomable image fallback to link, fix styling, refine text component, search highlighting without remark-directive 2023-10-02 19:07:05 -05:00
ekzyis 1e23f787bd
Fix image preview not ignoring privacy setting (#536)
* Fix images not ignoring privacy setting during preview

* Fix image detection not ignoring privacy setting during preview

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-10-02 07:28:39 -05:00
keyan 1ee3d6aa0a small bug fixes 2023-10-01 19:29:07 -05:00
ekzyis b2b38d8924
Images v2 (#513) 2023-10-01 18:03:52 -05:00
keyan 523b6674b8 make sub changing more intuitive 2023-09-29 14:20:07 -05:00
keyan 08e4093877 increase poll choice length to 40 chars 2023-09-28 16:52:11 -05:00
keyan 4bd489a36a mutes 2023-09-28 15:02:25 -05:00
keyan b6cb895871 opg => fwd 2023-09-27 13:20:16 -05:00
keyan cfb8fa7014 remove expiration when invoice is confirmed 2023-09-27 12:19:56 -05:00
keyan cf5b296a9f add prism logo 2023-09-26 16:44:57 -05:00
keyan f27cd2d6dd protect against comment root not having forwards 2023-09-26 15:15:31 -05:00
keyan 370e3c1c48 raise boost minimum to 25k, enhance editing boost, JIT fund editing costs 2023-09-25 19:54:35 -05:00
keyan 374cc26224 indicate commenter is part of forwarded group 2023-09-25 16:47:24 -05:00
SatsAllDay 8017355924
Lightning strike on donation, if enabled. Else success toast (#517)
* Lightning strike on donation, if enabled. Else success toast

* remove extra toast from merge

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-09-24 15:10:44 -05:00
SatsAllDay d60a589bc0
Implementing LUD-12 comments on payRequest in LNURLP Lightning Address flow (sending and receiving) (#498)
* Prototype implementing LUD-12 comments on payRequest in LNURLP Lightning Address flow

* Support sending comment when withdrawing to ln addr (LUD-12)

* Prevent `initialError` from being toasted informs multiple times

* delete the old create_invoice function

* improve lightning addr withdrawal styling

* allow lnaddr comment to show up in notifications

* enhance satistics

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-09-23 20:14:49 -05:00
keyan 14d2573dd2 fix non-unique bountyPaidTo display 2023-09-18 19:15:02 -05:00
keyan fb3837ea0a use number formatting more places 2023-09-18 18:09:08 -05:00
ekzyis 3a7c3f7af2
Add setting to send diagnostics back to SN (#463)
* Add diagnostics settings & endpoint

Stackers can now help us to identify and fix bugs by enabling diagnostics.

This will send anonymized data to us.

For now, this is only used to send events around push notifications.

* Send diagnostics to slack

* Detect OS

* Diagnostics data is only pseudonymous, not anonymous

It's only pseudonymous since with additional knowledge (which stacker uses which fancy name), we could trace the events back to individual stackers.

Data is only anonymous if this is not possible - it must be irreversible.

* Check if window.navigator is defined

* Use Slack SDK

* Catch errors of slack requests

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-18 18:00:16 -05:00
SatsAllDay 786c185464
Introduce format option on `numWithUnits` fn, consumed by bounty listing (#496) 2023-09-18 17:49:13 -05:00
keyan ccb1c07c3f use code icon for contibutors 2023-09-18 14:17:22 -05:00
SatsAllDay bc2363dfab
Verified contributors (#474)
* `isContributor`, `hideIsContributor` user fields and basic UI decoration on profile page

* Update verified contributor decoration on profile page

* Add contributors instructions

* update setting label

* Remove `isContributor` from DB, load contributors from file into memory

* fix merge error

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-18 13:57:02 -05:00
SatsAllDay 8ab58fff87
Proposal: User Subscriptions: separate posts and comments (#470)
* Subscribe to user posts and comments independently

* Track when comments and posts subscriptions are set to filter out old items

* Only send push notification to subscribed user if posts/comments enabled

* Remove `posts` and `comments` boolean fields on UserSub, rely solely on timestamps
2023-09-18 13:20:02 -05:00
keyan cee00af83c fix job image upload 2023-09-14 10:35:13 -05:00
keyan 7d170a654f variable downzaps 2023-09-13 21:08:03 -05:00
keyan 4b543ae733 prevent wallet balance overflow 2023-09-12 20:21:59 -05:00
keyan bd07fc7a25 fix height of foward percent on validation err 2023-09-12 17:04:49 -05:00
keyan 52d938a22a remove block from blockheight 2023-09-12 16:36:26 -05:00
keyan 79b58600e9 fix styling of forwards 2023-09-12 15:56:03 -05:00
keyan c3498be5ba signup => sign up in welcome banner 2023-09-12 14:51:55 -05:00
keyan 490edd6833 prevent horizontal layout shift when balance is hidden 2023-09-12 14:50:06 -05:00
keyan b1d6bf058e make balance hiding work on mobile using pointer events 2023-09-12 14:37:13 -05:00
ekzyis 6df654b208
Hide wallet balance (#481)
* Hide wallet balance on long press

* Use setting to hide wallet balance

* Fix layout shift on hover

* Fix SSR warning about useLayoutEffect

See https://reactjs.org/link/uselayouteffect-ssr

* Also hide balance in wallet

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-09-12 12:19:26 -05:00
SatsAllDay 1a6dc879a2
Dependency inject `me` into post validation schemas to enforce no forwarding posts to self (#485)
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-12 11:56:59 -05:00
SatsAllDay 16a6f93708
Add block height to price carousel (#484)
* Add block height to price carousel

source block height from mempool.space API
https://mempool.space/docs/api/rest#get-block-tip-height

* Add block height to SSR, clean up fragment query

* Cache block height for 1 minute, not 30 seconds

use `numWithUnits` for block height label

* Replace mempool.space API with LND API call

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-12 10:56:02 -05:00
SatsAllDay 94fbabcdf9
Notifications for when you are forwarded sats from a post (#467)
* Notifications for when you are forwarded sats from a post

Support notifications when a post for which you are forwarded gets zapped

This is controlled by a new boolean flag in user settings

* Send push notifications to forwarded users when they get forwarded sats

* Add `Promise.allSettled` per PR feedback

* Remove `FEE` act type when building forwarded zaps notifications

Don't include `FEE` actions, only `TIP` actions to avoid "0 sats forwarded" notifications

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-12 10:31:46 -05:00
keyan 9064224fd3 allow input character overflow for editting 2023-09-11 19:59:36 -05:00
SatsAllDay 77daa458cf
Visual Character counter for post titles, poll options (#466)
* Indicate how many chars remain for title field and poll options

Live counter update to help authors know how many more chars they have
to use in their post titles, and also poll options

* Use InputInner for consistency

* Refactor to reuse title hint across all forms

* Character(s)

* Move maxLength hint impl to InputInner, per PR feedback

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-11 19:20:44 -05:00
rleed 1969d82741
move search bar to top of page (#433)
* move search bar to top of page

* move select inputs below search bar

* reduce complexity

* default search to zaprank

* votes => zaprank

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-09-11 18:11:47 -05:00