Commit Graph

80 Commits

Author SHA1 Message Date
ekzyis a6713f9793
Account Switching (#644)
* WIP: Account switching

* Fix empty USER query

ANON_USER_ID was undefined and thus the query for @anon had no variables.

* Apply multiAuthMiddleware in /api/graphql

* Fix 'you must be logged in' query error on switch to anon

* Add smart 'switch account' button

"smart" means that it only shows if there are accounts to which one can switch

* Fix multiAuth not set in backend

* Comment fixes, minor changes

* Use fw-bold instead of 'selected'

* Close dropdown and offcanvas

Inside a dropdown, we can rely on autoClose but need to wrap the buttons with <Dropdown.Item> for that to work.

For the offcanvas, we need to pass down handleClose.

* Use button to add account

* Some pages require hard reload on account switch

* Reinit settings form on account switch

* Also don't refetch WalletHistory

* Formatting

* Use width: fit-content for standalone SignUpButton

* Remove unused className

* Use fw-bold and text-underline on selected

* Fix inconsistent padding of login buttons

* Fix duplicate redirect from /settings on anon switch

* Never throw during refetch

* Throw errors which extend GraphQLError

* Only use meAnonSats if logged out

* Use reactive variable for meAnonSats

The previous commit broke the UI update after anon zaps because we actually updated item.meSats in the cache and not item.meAnonSats.

Updating item.meAnonSats was not possible because it's a local field. For that, one needs to use reactive variables.

We do this now and thus also don't need the useEffect hack in item-info.js anymore.

* Switch to new user

* Fix missing cleanup during logout

If we logged in but never switched to any other account, the 'multi_auth.user-id' cookie was not set.

This meant that during logout, the other 'multi_auth.*' cookies were not deleted.

This broke the account switch modal.

This is fixed by setting the 'multi_auth.user-id' cookie on login.

Additionally, we now cleanup if cookie pointer OR session is set (instead of only if both are set).

* Fix comments in middleware

* Remove unnecessary effect dependencies

setState is stable and thus only noise in effect dependencies

* Show but disable unavailable auth methods

* make signup button consistent with others

* Always reload page on switch

* refine account switch styling

* logout barrier

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-09-12 13:05:11 -05:00
Keyan 15b038cd78
refactor embeds to be reused (#1368)
* refactor embeds to be reused

* adjust the meaning of settings for embeds

* add wavlake embed (close #1359)

* add spotify embed (closes #1360)

* fix 'format' appearing in srcSet

* add nostr embed

* refine nostr embed

* Update components/media-or-link.js

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

* Update pages/settings/index.js

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

* ek suggestions

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-09-07 12:07:10 -05:00
Keyan 2f546facb2
get dimensions for video and refactor images (#1366)
* get dimensions for video and refactor images

* improve rendering performance

* more rendering perf enhancements
2024-09-06 09:34:44 -05:00
Tom 4fe920d12b
Handle Peertube Embeds (#1223)
* Handle peertube embeds

* Permit full screen for Rumble and PeerTube

* Use sandbox='allow-scripts' for iframes

* Restore frame-src domains

* Use endsWith

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-06-20 11:28:25 -05:00
Tom 0576716c4a
Close related section (#1207)
* Fix issue with closing accordian

* Use onSelect

* Remove change to AccoridanCard

* Fix className typo

* Restore conditional
2024-05-31 10:20:52 -05:00
Tom 52f57f8ac5
Embed Rumble Video (#1191)
* Render Rumble video in preview and posts

* Display Rumble video

* Remove workspace

* Add util function

* Use searchParam for id

* Update check for Rumble

* Update youtube match strings

* fix hostname conditions

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-05-28 08:18:32 -05:00
Abhi Shandilya 0fda8907e7
fix: show related items on pinned items (#1157)
* fix: show related items on pinned items

* fix condition

* use subName since sub could be undefined

* Update components/item-full.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Revert "Update components/item-full.js"

This reverts commit d1b785b8490c9356548ef1bfe246ae526f0237c6.

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-05-11 20:41:59 -05:00
Abhi Shandilya bddc2b1508
fix: hide related posts in deleted item (#1119) 2024-04-28 17:17:19 -05:00
Felipe Bueno 170bf7464b fullItemContainer div -> article to make it compatible with browser's reader view 2024-03-26 14:10:18 -03:00
ekzyis d237861ff5
Use module path aliases (#938)
* Use module path aliases

* fix broken refactor

* path mapping for svgs, style, and remaining places (bonus: lose babel dep)

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-03-19 19:37:31 -05:00
keyan b5de515f5e render outlawed images and links as text 2024-03-04 19:29:50 -06:00
keyan b16234630b better link rel attr handling 2024-03-04 19:20:14 -06:00
keyan dc8d35fdcf only open related posts when there aren't comments 2024-01-20 15:17:34 -06:00
keyan 61a66127d1 search/related posts refinements 2024-01-17 17:39:48 -06:00
keyan 5137f1423d change reply placeholder 2024-01-04 18:48:10 -06:00
keyan 214e863458 mute territories 2023-12-30 17:16:09 -06:00
keyan fdf8f8e395 fix footnote links 2023-12-20 18:54:56 -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 d211fe93ea fix quote reply by removing imperative logic 2023-11-20 21:38:18 -06: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
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 b2b38d8924
Images v2 (#513) 2023-10-01 18:03:52 -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
SatsAllDay 786c185464
Introduce format option on `numWithUnits` fn, consumed by bounty listing (#496) 2023-09-18 17:49:13 -05:00
SatsAllDay 1872d6a7ad
Update twitter url regexs to match x.com or twitter.com (#454)
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-08-30 20:13:43 -05:00
keyan a0af954d60 add how many times bounty has been paid 2023-08-28 14:14:14 -05:00
keyan 169c762a1f rm commas in forward lists 2023-08-28 09:59:01 -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
ekzyis 427fc9aeec
Fix youtube player x-overflow (#426)
Co-authored-by: ekzyis <ek@stacker.news>
2023-08-23 15:29:09 -05:00
SatsAllDay 6e05cd38f9
Singular/Plural "Sats" labels (#380)
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-08 16:04:06 -05:00
keyan 8ab018af88 fix nested comment sorting 2023-07-25 19:45:35 -05:00
keyan 4c1ef62386 fix edit bio button location 2023-07-25 15:32:49 -05:00
keyan 6407455def upgrade react-bootstrap 2023-07-24 13:53:53 -05:00
keyan 59f7b6ff26 Revert "Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades""
This reverts commit 18910fa2ed.
2023-07-23 10:08:43 -05:00
keyan 18910fa2ed Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"
This reverts commit d0314ab73c.
2023-07-23 09:16:12 -05:00
keyan d0314ab73c shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades 2023-07-21 17:33:11 -05:00
Jo Wo bf4b8714fe
Render images without markdown and use image proxy (#245)
* Parse image links during markdown rendering

* Use imgproxy to replace links

* Add healthcheck

See https://docs.imgproxy.net/healthcheck

* Enable WebP and animation support

* Only replace image URLs

* Replace all occurrences

* Fix creating posts with no text

* Embed image on link posts where link is image

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-12 19:10:01 -05:00
keyan 3e4161ae8c tip -> zap 2023-06-19 13:21:55 -05:00
keyan 6d8780373a form enhancements 2023-05-11 14:34:42 -05:00
keyan 5bb6b5f2e7 placeholder when there aren't comments 2023-05-10 19:41:17 -05:00
keyan 347a6a54d2 improve comment performance 2023-05-06 16:51:17 -05:00
keyan e4a3095cb4 give pinned item recent sort by default 2023-03-19 10:43:33 -05:00
ekzyis 7b838cdeb2
Implement bookmarking of posts and comments (#235) 2023-02-16 16:23:59 -06:00
keyan 670f071177 fix item spacing generically 2023-01-27 15:10:38 -06:00
keyan 82502e724f fix spacing on item text 2023-01-27 11:43:48 -06:00
keyan 5306b11157 improve bounty performance 2023-01-26 13:09:57 -06:00
Austin Kelsay e13e37744e
stackernews bounties (#227)
bounties
2023-01-26 10:11:55 -06:00
keyan 9644a9f867 slashtags auth 2023-01-18 12:49:20 -06:00