Commit Graph

1795 Commits

Author SHA1 Message Date
keyan f305013aaf fix back button to rewards again 2024-03-02 11:48:11 -06:00
JP Melanson fb1281dfd2
Trigger image upload from keyboard (#891) (#893)
* Adding tabindex to ImageUpload div wrapper in order to make it selectable
* Adding keyboard event handler to listen to Enter key stroke and trigger file upload selection

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-03-01 18:42:47 -06:00
keyan aa7c233177 fix bolt color hover on mobile 2024-03-01 18:32:40 -06:00
keyan 71619dfa2c fix back button to rewards page 2024-03-01 18:21:52 -06:00
Keyan 0b0e36e3cb
Monthly rewards (#890)
* show placeholder for hidden stackers in top

* top rewardability views

* make territory revenue idependent job

* monthly rewards and leaderboard on rewards pages

* fix earn reschedule

* add query for rewards leaderboard

* reduce likelihood of rewards racing with views

* fix earn and refine values views
2024-03-01 10:28:55 -06:00
ekzyis 508008f586
Fix Sub.meSubscription not resolved on page load (#888) 2024-02-28 09:31:31 -06:00
ekzyis 1c488b13df
Drop noteTerritoryPosts column (#887) 2024-02-28 09:16:20 -06:00
ekzyis 89de8a9907
Fix out of order undos for turbo zaps (#883)
Turbo zaps had different toast bodies so they weren't merged together. This gave stackers the option to undo these zaps out of order.

When zaps are undone out of order, the client cache can get in a bad state. Using the item id as a tag fixes that such that zaps for the same item will always get merged together.

This can be seen as a workaround for hacky zap undo code but I think it's also better UX so maybe we should do this anyway.
2024-02-26 18:10:43 -06:00
ekzyis bbdd969394
Fix missing progress bar for custom zaps (#882) 2024-02-26 18:09:29 -06:00
ekzyis 38f2aa309d
Fix bolt hover ignores turbozaps (#881)
* Fix bolt hover color ignores turbo zaps

* Refactor next tip code into own function
2024-02-26 18:09:09 -06:00
ekzyis 9cb657ab9a
Fix territory context menu visible for anon (#877) 2024-02-25 10:21:10 -06:00
ekzyis 1ea28b748c
Drop unused function signature of create_item (#876)
We only use create_item at a single location. It uses the function signature with integer[] at the end.
2024-02-25 10:20:17 -06:00
ekzyis 5f602e24fa
Fix conflict on duplicate image in post (#875)
The create_item function was missing ON CONFLICT DO NOTHING for insertions into the ItemUpload table as in update_item.

This means that if the same image was used multiple times in the same item, creation failed. But it worked during editing.
2024-02-25 10:19:48 -06:00
ekzyis 8cd147f67f
Insert image at cursor position (#874) 2024-02-25 10:18:07 -06:00
ekzyis a067a9fcf1
Use progress bar for pending payments (#873)
The progress bar indicates when the invoice will expire.

This works by passing in a timeout to the withToastFlow wrapper.

If timeout is set, progressBar option will be true for the toast and delay will be set to the timeout.

If progressBar is set, the progress bar will use the delay for its duration.
2024-02-24 14:33:08 -06:00
ekzyis 817234a7fa
More zap undo fixes (#872)
* Don't throw error if invoice attached

* Only show progress bar for undo toasts

* Update zap undo info in settings

* Skip zap undo toast flow for external payments
2024-02-24 11:38:40 -06:00
keyan cd4f243106 fix missing field in schema 2024-02-23 09:35:20 -06:00
ekzyis d987069fae
Fix toast progress bar desync (#871)
* Fix toast progress bar desync

If a toast gets rendered again with the same animation-delay, the animation-delay seems to get added.

This commit fixes that by ensuring that animation-delay is only set if the toast was not rendered before.

* Fix comment
2024-02-23 09:14:51 -06:00
ekzyis fa4f09ddca
Territory notifications for everyone (#870)
* Territory notifications

* Migrate old setting to new table

* Auto subscribe founders to their territories on creation

* Fix (un)subscribe not shown to founder

* Rename to toggleSubSubscription

* Fix inconsistency between toggleSubSubscription and toggleMuteSub

* Add dedicated button in header for following territories

* Don't drop noteTerritoryPosts column

* Fix db dip in Sub.meSubscription resolver

* Move territory subscribe to new territory context menu

* Decrease space between share icon and mute button

* Fix eslint
2024-02-23 09:12:49 -06:00
keyan 96ff26f26e include comments in territory revenue 2024-02-22 15:32:42 -06:00
keyan b42a4eabab reward everything again 2024-02-22 15:31:52 -06:00
mzivil b0bf7add34
Show founded territories on profile (#868)
* add nterritories field to User

* add userSubs query

* show territories tab on user profiles

hide the tab if user has 0 territories, except when the
viewer navigated directly to the user's territories page

* add USER_WITH_SUBS query for user territories page

* add user territories page
2024-02-21 19:55:48 -06:00
ekzyis 6f8b6c36d8
Remove console.log (#869) 2024-02-21 19:34:51 -06:00
Austin Kelsay 565e939245
Nostr crossposting all item types (#779)
* crosspost-item

* crosspost old items, update with nEventId

* Updating noteId encoding, cleaning up a little

* Fixing item-info condition, cleaning up

* Linting

* 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

* 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

* Basic setup for crossposting poll / link items

* post rebase fixes and Bounty and job crossposts

* Job crossposting working

* adding back accidentally removed import

* Lint / rebase

* Outsource as much crossposting logic from discussion-form into use-crossposter as possible

* Fix incorrect property for user relays, fix itemId param in updateNoteId

* Fix toast messages / error cases in use-crossposter

* Update item forms to for updated use-crossposter hook

* CrosspostDropdownItem in share updated to accomodate use-crossposter update

* Encode paramaterized replacable event id's in naddress format with nostr-tools, bounty to follw nip-99 spec

* Increase timeout on relay connection / cleaning up

* No longer crossposting job

* Add blastr, fix crosspost button in item-info for polls/discussions, finish removing job crosspostr code

* Fix toaster error, create reusable crossposterror function to surface toaster

* Cleaning up / comments / linting

* Update copy

* Simplify CrosspostdropdownItem, keep replies from being crossposted

* Moved query for missing item fields when crossposting to use-crossposter hook

* Remove unneeded param in CrosspostDropdownItem, lint

* Small fixes post rebase

* Remove unused import

* fix nostr-tools version, fix package-lock.json

* Update components/item-info.js

Co-authored-by: ekzyis <ek@stacker.news>

* Remove unused param, determine poll item type from pollCost field, add mutiny strfry relay to defaults

* Update toaster implementations, use no-cache for item query, restructure crosspostItem to use await with try catch

* crosspost info modal that lives under adv-post-form now has dynamic crossposting info

* Move determineItemType into handleEventCreation, mover item/event handing outside of do ... while loop

* Lint

* Reconcile skip method with onCancel function in toaster

* Handle failedRelays being undefined

* determine item type from router.query.type if available otherwise use item fields

* Initiliaze failerRelays as undefined but handle error explicitly

* Lint

* Fix crosspost default value for link, poll, bounty forms

---------

Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>
Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-02-21 19:18:36 -06:00
ekzyis c57fcd6518
Allow zap undo's for short period of time (#857)
* Cancel zaps

* Hide zap error toast

* Immediately throw error about insufficient funds

* Optimistic UX

* Also hide success zap toast

* Show undo instead of cancel

* Include sat amount in toast

* Fix undo toasts removed on navigation

* Add setting for zap undos

* Add undo to custom zaps

* Use WithUndos suffix

* Fix toast flow transition

* Fix setting not respected

* Skip undo flow if funds insufficient

* Remove brackets around undo

* Fix insufficient funds detection

* Fix downzap undo

* Add progress bar to toasts

* Use 'button' instead of 'notification' in zap undo info

* Remove console.log

* Fix toast progress bar restarts

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-02-21 18:48:42 -06:00
mzivil 46a0af19eb
Make poll expiration configurable (#860)
* add poll expires at column to Item table

* update upsertPoll mutation for pollExpiresAt param

* use pollExpiresAt to show time left for poll

* correctly pluralize days for timeLeft

* correctly update pollExpiresAt when item is updated to remove poll expiration

* add DateTimePicker and DateTimeInput components to select datetimes

* update pollExpiresAt to be nullable and more than 1 day in the future

* hide time left text if poll has no expiration

* initialize pollExpiresAt with current value or default of 25 hours in the future

we add a one hour time buffer so that the user doesn't get a validation error
for pollExpiresAt if they post their poll within an hour from creation. there's
still a chance they'll hit the validation error but they should see the error
message toast

* add DateTimeInput into the options part of the poll form

add right padding to make room for the "clear" button.

allow field to be cleared (i.e. null pollExpiresAt) to allow
non-ending polls.

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-02-21 12:18:43 -06:00
ekzyis 843471e5dc
Fill bolts on hover with next zap color (#867) 2024-02-20 17:46:27 -06:00
ekzyis 5de014cba8
Toast flows (#856)
* Use toast flows

"Toast flows" are a group of toasts that should be shown after each other.

Before this commit, they were implemented by manually removing previous toasts in the same flow.

Now a flowId can be passed and ToastProvider will make sure that there always only exists one toast with the same flowId.

This is different to toast tags since tags don't replace toasts with the same tag, they only are shown "above" them.

* Create wrapper for toast flows
2024-02-19 19:03:30 -06:00
keyan fe0d960208 handle other possible base64-like string encodings 2024-02-18 15:08:55 -06:00
keyan a9ade0354d wip 2024-02-18 15:08:55 -06:00
ekzyis a7018e25c6
Refactor removeToast (#854) 2024-02-18 13:33:32 -06:00
benthecarman 2d5b1f090d
Handle space separated NWC info event (#855) 2024-02-18 13:29:53 -06:00
ekzyis 6e6c355a3f
Add tests for internal linking (#808)
* Add tests for internal linking

* Add workflow for unit tests

* Use jest
2024-02-17 15:53:36 -06:00
ekzyis 81ab960d92
Fix NWC support detection (#845)
* Fix NWC support detection

* Fix missing toast if support for pay_invoice not detected
2024-02-17 10:30:13 -06:00
keyan 7065008f5d remove overspecified condition 2024-02-16 13:26:15 -06:00
keyan 0d549abff9 fix erronous reference to me in user profile 2024-02-16 13:15:00 -06:00
keyan 3106850ce9 fix reference to old materialized view 2024-02-16 12:58:50 -06:00
ekzyis 03b1b173ad
Rename HODL to JIT in frontend comments (#843) 2024-02-16 12:27:15 -06:00
ekzyis 3d1bcd38c6
Fix onSubmit not ignoring payment cancels from WebLN payments (#842) 2024-02-16 12:26:43 -06:00
ekzyis 5c56267aaa
Changed my nym to ek (#844) 2024-02-16 12:25:43 -06:00
Keyan 798fab097d
Make territory billing period changeable (#840)
* allow updates to territory billing

* simplify prorating

* handle updates during grace period and rehydrating archive
2024-02-16 12:25:12 -06:00
ekzyis cfd762a5b6
Fix toast autohide (#839) 2024-02-15 16:49:54 -06:00
keyan b5bf0c88e3 fix sub apollo cache merge errors 2024-02-15 11:32:09 -06:00
ekzyis afe096e516
Fix QR code interaction with WebLN provider (#834)
* Fix passing of bolt11 for QR payments

* Fix missing provider check

* Only cancel invoice if hash and hmac were given

* Fix duplicate toast on error

* Fix relay might not be set yet when sendPayment is called
2024-02-15 11:20:15 -06:00
mzivil 8727f95fd9
remove filter for ItemAct where act is TIP (#835)
The spent and stacked calculations are showing the same number because
we only select ItemActs with act = 'TIP'.

The fix is to remove the `act` filter
2024-02-15 09:43:38 -06:00
keyan 57917d47a2 fix lnaddr autowithdraw 2024-02-15 08:59:45 -06:00
Dillon 35d212573e
auto canceling bolt11s from lnd when auto dropped from DB (#793)
* auto canceling bolt11s from lnd when auto dropped from DB

* auto canceling bolt11s from lnd when auto dropped from DB

* removed semicolon for lint

* changed cancleHodlInvoic to deletePayment function

* updated code to account for failed LND deletes

* linter fixes

* updated to only remove hashes and bolt11's from model when successfully deleted from LND

* updated to revert unsuccessful deletes from LND and add those values back into the db

* linter fix and renaming for clarity

* updated WITH query

* added if statement to account for invoices not returning from db

* fixed linter

* reverted docker-compose.yml

* made it dry

* made it dry

* added a comment because the query might be confusing

* made query moar dry

* Query formatting

* Fix query returns number of rows instead of rows

* updated  to

* fixed linter

* removed lnbits dir

* removed gitignore and docker-compose.yml from pr

* added deleting from LND in wallet resolver

* linter + added missing import

* fixed merge conflict

* refine invoice deletion

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-02-14 17:31:25 -06:00
ekzyis 1444ff476e
Validate pubkey, relay URL and secret of NWC URL (#810)
* Validate pubkey, relay URL and secret of NWC URL

* Fix NWC secret regexp

* Use sequential validation in Yup schema

* Add note about possible mismatch between hostnames and pubkeys

* Remove unused param
2024-02-14 15:09:13 -06:00
keyan bbbd5060d0 add numbering to top stacker and territories 2024-02-14 15:06:42 -06:00
mzivil f59ee5df17
Add ranked territories to 'top' page (#828)
* add subViewGroup function to create view to read sub stats from

* add topSubs resolver to graphql query

* add TOP_SUBS query fragment

* add SUB_SORTS for top territory sorting

* add custom cache policy for topSubs

* add territories to top header select

* add top territories page

* add db views for sub stats

* configure sub_stats views to refresh by worker

* filter rows with empty subName

* update msats_spent calculation to include all ItemAct in sub

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-02-14 14:27:00 -06:00