114 Commits

Author SHA1 Message Date
ekzyis
17b39d9982 Add image fees in calling context 2023-11-02 01:48:34 +01:00
ekzyis
90c563d921 Update image fees in onChange 2023-11-02 01:48:34 +01:00
ekzyis
227e1737da Use debounce instead of onBlur to update image fees info 2023-11-02 01:48:34 +01:00
ekzyis
fe267cd3b9 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`
2023-11-02 01:48:34 +01:00
ekzyis
7043b4f1d1 refactor: Unify <ImageUpload> and <Upload> component 2023-11-02 01:48:34 +01:00
ekzyis
30a413e494 Fix multiplication with feesPerImage 2023-11-02 01:48:34 +01:00
ekzyis
7f38d750b9 Fix stale image fees served 2023-11-02 01:48:34 +01:00
ekzyis
fe503140e9 Remove dragOver style on drop 2023-11-02 01:48:34 +01:00
ekzyis
d6f6cd8b0b Use Drag and Drop API for image upload 2023-11-02 01:48:34 +01:00
ekzyis
1b7b869fdb Remove 'Uploading <name>...' from text input on error 2023-11-02 01:48:34 +01:00
ekzyis
af7cbd0846 Remove unnecessary async 2023-11-02 01:48:34 +01:00
ekzyis
1272e15a0e 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.
2023-11-02 01:48:34 +01:00
ekzyis
28bde328fc Show amount of unpaid images in receipt 2023-11-02 01:48:34 +01:00
ekzyis
a8998df4b0 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.
2023-11-02 01:48:34 +01:00
ekzyis
221dd5bb1d Show image fees in frontend 2023-11-02 01:48:34 +01:00
ekzyis
30aed4e805 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
2023-11-02 01:48:34 +01:00
ekzyis
f79792cd4d Add margin-top 2023-11-02 01:48:34 +01:00
ekzyis
a61d00ba8b Fetch unsubmitted images from database 2023-11-02 01:48:34 +01:00
ekzyis
9ac774c0e7 Link and remove image 2023-11-02 01:48:34 +01:00
ekzyis
d2b93502bc Show uploaded images below text input 2023-11-02 01:48:34 +01:00
ekzyis
7a83813c85 Upload images to S3 on selection 2023-11-02 01:48:34 +01:00
ekzyis
de7b8547ec Open file explorer to select image 2023-11-02 01:48:34 +01:00
ekzyis
955e5cfc88 Add icon to add images 2023-11-02 01:48:34 +01:00
keyan
835554b3cd small adjustments to secondary form text 2023-10-26 15:12:21 -05:00
keyan
39625f7e08 improve markdown tab spacing 2023-10-26 13:28:12 -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
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
a7e016e9ba fix? markdown input rerendering more than needed 2023-10-12 12:46:22 -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
keyan
9aa8d8a688 trigger autocomplete with just 2023-10-06 18:20:12 -05:00
keyan
58c5844492 fix mention regex 2023-10-06 16:01:19 -05:00
keyan
1b283fbe94 fix treating ref as primitive 2023-10-06 15:04:50 -05:00
keyan
d1a7dca46b use and make a debounce callback hook 2023-10-05 20:33:14 -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
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
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
ekzyis
b2b38d8924
Images v2 (#513) 2023-10-01 18:03:52 -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
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
ekzyis
6c203a4476
Use callback to clear local storage on success (#462)
Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-08-31 10:15:52 -05:00
ekzyis
ac45fdc234
Use HODL invoices (#432)
* Use HODL invoices

* Fix expiry check comparing string with Date

* Fix unconfirmed user balance for HODL invoices

This is done by syncing the data from LND to the Invoice table.

If the columns is_held and msatsReceived are set, the frontend is told that we're ready to execute the action.

We then update the user balance in the same tx as the action.

We need to still keep checking the invoice for expiration though.

* Fix worker acting upon deleted invoices

* Prevent usage of invoice after expiration

* Use onComplete from <Countdown> to show expired status

* Remove unused lnd argument

* Fix item destructuring from query

* Fix balance added to every stacker

* Fix hmac required

* Fix invoices not used when logged in

* refactor: move invoiceable code into form

* renamed invoiceHash, invoiceHmac to hash, hmac since it's less verbose all over the place
* form now supports `invoiceable` in its props
* form then wraps `onSubmit` with `useInvoiceable` and passes optional invoice options

* Show expired if expired and canceled

* Also use useCallback for zapping

* Always expire modal invoices after 3m

* little styling thing

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-08-30 21:48:49 -05:00
keyan
e77bc819bb fix forward percentage width on mobile 2023-08-28 14:31:28 -05:00
SatsAllDay
0ee056b2a1
Toast (#431)
* Prototype of toast system

* More toast adoption

* share
* flag
* bookmark
* subscribe
* delete

* More toast usage:

* forms
* settings save

* Log error during flag failure

* Incorporate PR feedback:

1. return `toaster` from `useToast` hook, with simplified `success` and `danger` methods

2. remove toast header, move close button to body

3. change how toast ids are generated to use a global incrementing int

4. update toast messages

* PR feedback:

* reduce width of toast on narrow screens
* dynamic delete success toast message based on deleted type
* add toasts to auth methods deletion operations

* Dismiss all toasts upon page navigation

* refine style and use delay prop

* more styling

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-25 18:21:51 -05:00
SatsAllDay
3da395a792
multiple forwards on a post (#403)
* multiple forwards on a post

first phase of the multi-forward support

* update the graphql mutation for discussion posts to accept and validate multiple forwards

* update the discussion form to allow multiple forwards in the UI

* start working on db schema changes

* uncomment db schema, add migration to create the new model, and update create_item, update_item
stored procedures

* Propagate updates from discussion to poll, link, and bounty forms

Update the create, update poll sql functions for multi forward support

* Update gql, typedefs, and resolver to return forwarded users in items responses

* UI changes to show multiple forward recipients, and conditional upvote logic changes

* Update notification text to reflect multiple forwards upon vote action

* Disallow duplicate stacker entries

* reduce duplication in populating adv-post-form initial values

* Update item_act sql function to implement multi-way forwarding

* Update referral functions to scale referral bonuses for forwarded users

* Update notification text to reflect non-100% forwarded sats cases

* Update wallet history sql queries to accommodate multi-forward use cases

* Block zaps for posts you are forwarded zaps at the API layer, in addition
to in the UI

* Delete fwdUserId column from Item table as part of migration

* Fix how we calculate stacked sats after partial forwards in wallet history

* Exclude entries from wallet history that are 0 stacked sats from posts with 100% forwarded to other users

* Fix wallet history query for forwarded stacked sats to be scaled by the fwd pct

* Reduce duplication in adv post form, and do some style tweaks for better layout

* Use MAX_FORWARDS constants

* Address various PR feedback

* first enhancement pass

* enhancement pass too

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-08-23 17:44:17 -05:00