Commit graph

93 commits

Author SHA1 Message Date
Rafael
aaf36e88dd Cleanup Comment and CommentsList and fix new pages
- Fixes new pages not fetching at all inside a drawer component
- Fixes fetching multiple pages at once some times
2022-02-09 11:48:40 -05:00
Rafael
c90efc2078 Add CommentCreate to Modal on Mobile
- Move stickers and emojis to a single menu comment-selectors on both mobile and desktop
- More style improvements
- Some fixes
- Fix livechat scrolling
2022-02-08 12:35:40 -05:00
Rafael
b3ed0027ff SwipeableDrawer improvements
Fix css stuf

Split mobile and small popout window styles

Fix failed logic that broke desktop player
2022-02-08 12:35:40 -05:00
Rafael
c1b84368a9 Fixes
Rename FileReactions index import

Fix fileAction undefined logic

Fix live comment menu

Fix superchats
2022-02-08 12:35:40 -05:00
Rafael
baf51f9c32 Create swipeableDrawer component
- CommentsList needs to return a title with comment amounts
- mobile player dimensions needed to fill in the cover
- hid livestream header for now until figuring out a better presentation
- ~colum-reverse~ was causing problems with MUI's drawer scrolling, so reversed the chat order and made it ~column~ by default
- Hid bottom expand navigation if component not yet opened
- some other style changes in the middle
2022-02-08 12:35:40 -05:00
infinite-persistence
0f68bad3eb
Optimize selectClaimIsMine
## Why
Frequently used; top in perf profile

## Changes
Most of the time, you already have the claim object in the current context. `selectClaimIsMineForUri` will retrieve the claim again, which is wasteful, even if it is memoized (looking up the cache still takes time).

Break apart the logic and added the alternative `selectClaimIsMine` for faster lookup.
2021-11-11 16:10:06 +08:00
infinite-persistence
d211450b5b
Fix selectCommentIdsForUri
- memo not required.
- start to not use the confusing and wrongly-named 'selectCommentsByUri' (per comment from Sean);  use the existing 'selectClaimIdForUri' instead.  This works because currently we do fetch any comments without first visiting a claim/uri, so we'll always have fetched the required claim, and can be queried in 'selectClaimIdForUri'.
2021-11-10 17:35:30 +08:00
infinite-persistence
ece2312ec5 selectClaimIsMineForUri to replace makeSelectClaimIsMine
## Issue
`normalizeUri` | `parseURI` is expensive and has been causing sluggish operations when called repeatedly or within a loop.

## Change
Since I'm not confident enough to remove the call entirely from makeSelectClaimIsMine (although I've yet to find a scenario that the uri is not already normalized), we'll try caching the calls instead.

## Results
- in a simple test of toggling between 2 category pages, we saved 20ms from `parseURI` calls alone.

- in a test of opening all categories one time, the memory usage remained similar. This makes sense since we removed a `makeSelect*` (which creates a selector for each call + not memoizing), and replaced that with a cached selector that's actually memoizing.
2021-11-10 16:49:12 +08:00
infinite-persistence
a65e68d023
Comments: use the lighter selectMyClaimIdsRaw
`selectMyActiveClaims` includes pending claims, so it gets invalidated often.

For the case of comment-filtering, we don't care about pending or abandoned own claims.
2021-11-04 16:30:50 +08:00
infinite-persistence
da63991972
Comment-selectors: fix memoization 2021-10-20 11:29:18 +08:00
infinite-persistence
9bbd72d179
Fix reaction-selector reference invalidation
## Issue
When comments are refreshed, each `Comment` gets rendered 4-5 times due to reference invalidation for `othersReacts` (the data didn't actually change).

## Change
For selectors without transformation, there is no need to memoize using `createSelector` -- just access it directly. Also, don't do things like `return a[id] || {}` in a reducer, because the reference to the empty object will be different on each call.

Always return directly from the state so that the same reference is returned.

This simple change avoided the wasted resources needed for `createSelector`, and reduced to render to just 2 (initial render, and when reactions are fetched).
2021-10-19 21:15:26 +08:00
infinite-persistence
2a7f89d6b5
Post-merge updates and fixes
- Put back SETTINGS.LANGUAGE.
- Update import for `doResolveUris`.
2021-10-19 20:40:07 +08:00
Merge
30023422b8
Desktop cherry-pick: "7240 Integrate lbry redux and lbryinc" 2021-10-19 20:40:07 +08:00
infinite-persistence
91be939c19
Fix linked-comment scrolling (again)
## Issue
Now that we batch-resolve the comment authors before displaying the comments, the linked-comment scrolling logic didn't work well with nested replies.

## Change
Previously, I didn't want to put the logic at the lowest level (`Comment`) because it was hard for the child to know whether to scroll or not. For example, we don't want to scroll when user changes the comment filters or presses the Refresh Comments button.

Relented and moved the logic to `Comment`, and pass a flag via `window` (I know this is frowned upon by some) to indicate whether a scrolling is needed.

This is probably more efficient overall as we don't need to scan the DOM, and with minimal delay as we scroll immediately after the linked-comment is mounted.

## Known issues
In markdown posts with lots of images, a layout shift due to delayed inline-image fetching can cause the scrolling to be inaccurate. This should be fixed by reserving space for markdown post images.
2021-10-16 13:40:33 +08:00
infinite-persistence
0b0f2848da
i18n - refix total comments
Meant to re-use strings, but I forgot to change the variable name.
2021-10-16 11:20:34 +08:00
Thomas Zarebczan
055d437865
fix total comments 2021-10-15 13:08:31 -04:00
infinite-persistence
d1493d5fb3
i18n 2021-10-15 14:23:40 +08:00
saltrafael
03ea298236
Fix expanding comments and scroll pagination 2021-10-14 21:05:01 +08:00
saltrafael
a3302b1be8
Fix expansion broken with layout change 2021-10-14 21:05:00 +08:00
saltrafael
58db9576b9
Fix infinite resolve 2021-10-14 21:04:59 +08:00
saltrafael
a9b9c3ccf0
Revert "Revert "[Comments] Batch resolve" (#61)"
This reverts commit 0e96f8d468.
2021-10-14 21:04:58 +08:00
infinite-persistence
0e96f8d468
Revert "[Comments] Batch resolve" (#61)
This reverts commit caadd889ce, reversing
changes made to 8b2c7a2b21.

## Issue
- Infinite `resolve` loop when deleted channel is present in the comments.
- Since it was only displayed comments with resolved channels, it masked away those comments. While that may or may not be regarded as a defect, I think we should do it at Commentron instead of at the app if we want to filter deleted channels. I vote to show comments from deleted channels, since it might have good conversation thread.
2021-10-13 08:59:32 -04:00
saltrafael
f7cb39c496
Batch resolve comment list channels 2021-10-11 08:35:49 +08:00
saltrafael
256ed6a106
Remove expand/collapse from channel discussion page 2021-10-05 09:19:56 +08:00
saltrafael
fc2e08c882
Refactor commentsList 2021-10-05 09:19:56 +08:00
infinite-persistence
de6c6f9bfd
List own comments (#7171)
* Add option to pass in url-search params.

Impetus: allow linked comment ID and setting the discussion tab when clicking on the `ClaimPreview`.

* comment.list: fix typos and renamed variables

- Switch from 'author' to 'creator' to disambiguate between comment author and content author. For comment author, we'll use 'commenter' from now on.
- Corrected 'commenterClaimId' to 'creatorClaimId' (just a typo, no functional change).

* doCommentReset: change param from uri to claimId

This reduces one lookup as clients will always have the claimID ready, but might not have the full URI.

It was using URI previously just to match the other APIs.

* Add doCommentListOwn -- command to fetch own comments

Since the redux slice is set up based on content or channel ID (for Channel Discussion page), re-use the channel ID for the case of "own comments". We always clear each ID when fetching page-0, so no worries of conflict when actually browsing the Channel Discussion page.

* Comment: add option to hide the actions section

* Implement own-comments page

* Use new param to remove sort-pins-first.

comment.List currently always pushes pins to the top to support pagination. This new param removes this behavior.
2021-10-01 08:10:27 -04:00
infinite-persistence
c71b90cecf
Fix linked-comment scrolling
I think this the best solution so far, at the expense of a slight delay in scrolling if the network call stalls.

- Added "fetching by ID" state so that we don't need to use the ugly N-retries method.
- `scrollIntoView` doesn't work if the element is already in the viewport, and the `scrollBy` adjustment doesn't take into account the y-position restoration that we perform on certain type of pages. Use `window.scrollTo` instead and taking into account current scroll position.
2021-10-01 15:51:05 +08:00
saltrafael
2f4dedfba2
Add Channel Mention selection ability (#7151)
* Add Channel Mention selection ability

* Fix mentioned user name being smaller than other text

* Improve logic for locating a mention

* Fix mentioning with enter on livestream

* Fix breaking for invalid URI query

* Handle punctuation after mention

* Fix name display and appeareance

* Use canonical url

* Fix missing search
2021-09-30 17:30:32 -04:00
Alexander Schrier
eca9b2fcbf
Fix theater mode layout on small and medium screens (#7108)
* Fix theater mode layout on small and medium screens

* Make comments expandable on medium screens
2021-09-20 10:20:28 -04:00
infinite-persistence
be9dca362d
Fix linked-comment auto scroll
## Ticket
6946: Linked-comment scroll position is inconsistent

## Issues
- If it is a deeply-nested reply, the positioning is incorrect.
- If there are pinned comments, the positioning is way off.
- If there is a delay in mounting, the positioning doesn't happen.
- When clicking on the comment's date to highlight it, the comment goes missing and the scroll position is weird.

## Changes
- Take into account that replies can be linked-comments.
- Perform a "one-time" search for the linked-comment after the initial fetch, if necessary. The expensive DOM search is only be executed minimally.
2021-09-01 16:02:54 +08:00
infinite-persistence
4688b4bf58
Livestream: stop pinned comments from appearing as latest (#6888)
## Ticket
6879: Previously pinned livestream comments show as latest

## Issue
`comment.List` will always display the pinned comment first, hence the problem when the chat is refreshed.

## Approach
Completely split pinned comments from top-level comments in the Reducer, and the let the GUI (e.g. regular comments, livestream comments) decide how they want to display it.

For the case of livestream, there is no need to repeat the pinned comments in the regular chat area, since there is a dedicated area on top.
2021-08-17 12:09:55 -04:00
infinite-persistence
1421a39518
Comment badge to reflect mod and admin status.
## Issue
6467 Add status indicators for messages from creator, delegated moderator, global moderator

## Changes
- Added the required icons.
- Added tooltip.

## Notes
- Left out "creator" since we are already highlighting the creator's name.
- Note that currently the status is only available via websocket deltas. `comment.List` does not provide the data.
- When `comment.List` includes the info, regular comments will automatically include these badges.
2021-08-16 10:08:56 +08:00
infinite-persistence
e9a2f44899
Commentron: incorporate 'setting.Get' into 'doFetchCreatorSettings'
## General
- `setting.List`: returns full creator settings. Requires signature (i.e. you own the channel)
- `setting.Get`: returns a public subset of the creator settings. No signature required, and it is mainly used by the GUI to determine the constraints of a channel (e.g. comments enabled? min tip requirements? etc.). Does not include private settings like "blocked words list".

`doFetchCreatorSettings` will handle both of these. Clients that uses the stashed results (`settingsByChannelId`) just needs to be aware the result might not contain everything, depending on whether you own the channel or not.

## Misc Related Changes
- Finally fix the reducer for COMMENT_FETCH_SETTINGS_COMPLETED to not purge the data on each call.
- Change `doFetchCreatorSettings` to operate on a single channel instead of multiple. We ended up not using the multple mode anyway, so it was wasteful code trying to batch the promises.
- `commentsDisabledChannelIds` is no longer needed. Previously, this was created just to differentiate between Creator (full) and Channel (subset) settings. It's cleaner to just use one object, so eliminated this.
- Remove unused 'commentingEnabled'.

## Aside
- There are now 2 ways to know if a channel has disabled comments: (1) from `comment.list` and `setting.Get|List`. Both of them updates `settingsByChannelId`, so it'll still be a single place for the GUI to check against.
2021-08-12 14:51:41 +08:00
saltrafael
60f4cca007 Fix no expand button bug 2021-08-04 09:33:42 -04:00
zeppi
2d66b8666d styling 2021-08-03 11:05:32 -04:00
saltrafael
f01fb7dd22 Mobile view: Make comments expandable 2021-08-03 11:05:32 -04:00
infinite-persistence
08738ffcee
Reaction-fetch: handle "deleted all channels"
- use `selectActiveChannelClaim` as that takes the current channel list into account (i.e. correct state when all channels are deleted).
    - `selectActiveChannelId` should probably be removed or not exposed through a selector, as it is not updated when channel list changes?
2021-07-20 15:22:50 +08:00
infinite-persistence
c71e4718d0
Remove (revert) reaction-fetch hardstop
Root-cause is known, so removing it to detect other issues.
2021-07-20 15:22:49 +08:00
Anthony
7bb5df97fd Stripe 2
show visible card and add remove card button

show your transactions even if you dont have a card

fix presentational issues

show your transactions even if you dont have a card

fix presentational issues

add link to channel section

update yarn

show donation location

add remove card modal still needs completion and also changed how stripe is used on settings stripe card page

add confirm remove card modal to router

move bank account stuff to settings page

move account functionality to settings page

continuing to move account transactions to settings

list transactions for creator

updating copy

touchup tip error

do a better job autofocusing

bugfix

show an error on the card page if api returns 500

building out frontend for comment tip

display dollar sign if its a fiat tip

more frontend work

more frontend work

more frontend bug fixes

working with hardcoded payment intent id

working but with one bug

bugfixed

add toast if payment fails

add add card button

cant get claim id but otherwise done

more frontend work

call is working

show fiat for livestream comments

add is fiat on comments

round and show values properly

dont allow review if tiperror

copy displaying properly

disable buttons conditionally properly

remove card button working

remove card working with a workaround by refreshing page

bugfix

send toast when tip on comment

jeremy frontend changes

only show cart on lbc
2021-07-17 13:19:33 -04:00
infinite-persistence
cd32fb71c7
Experiment: hardstop reaction-fetch at 500
(Hypothetical max comment of 3000) / (10 comments per page) = 300.
Cap at 500 to stop runnaway loops.
2021-07-17 22:19:15 +08:00
infinite-persistence
47d39b20d3
Stop fetching reacts if failed for 3 times
Not sure if this will ever occur, but technically possible from the code point of view. Try adding this to see if it stops the spikes in `reaction.list` calls.
2021-07-17 13:53:58 +08:00
infinite-persistence
ad7db1e939 Reactions: wait for previous fetch to complete before fetching again.
This was causing duplicate IDs to be fetched over and over again when scrolling quickly.
2021-07-16 10:54:12 -04:00
infinite-persistence
08c701ba19 Restore comment pagination
This reverts commit e6addb8c2a, reversing
changes made to 47b594107a.
2021-07-16 10:54:12 -04:00
infinite-persistence
a2a1ddb403
Revert "Comments Pagination #6390"
This reverts commit 16ef013025, reversing
changes made to fba8b89b3b.
2021-07-15 22:23:26 +08:00
infinite-persistence
08548916df
Revert "Fix continuous reaction fetch in incognito"
This reverts commit ff059c58fd.
2021-07-15 22:23:14 +08:00
infinite-persistence
ff059c58fd
Fix continuous reaction fetch in incognito
myReactions will never be filled in incognito. Also, it's probably enough to just check othersReactions, but for now, still do both when logged in.
2021-07-15 09:58:15 +08:00
infinite-persistence
e77a986125
Load comments if spinner is visible from the start
It was previously only responding to scroll events.
2021-07-14 13:00:26 +08:00
infinite-persistence
3d63ce4666
Load comments when approaching viewport
Seeing the spinner too much can be annoying.

- This approach works, but currently, when the list is very long, something is taking up resources and the handler couldn't be processed, so the effect is lost (still seeing the spinner). See 6473.

- Since we are now prefetching, bumped the debounceMs a bit.
2021-07-14 13:00:25 +08:00
infinite-persistence
0cf6fe3df5
Comments Pagination
## Issue
6158 - Support Comment Pagination
2021-07-14 12:58:25 +08:00
infinite-persistence
d6ac2c7954 Comments: enable 'enable_comments' flag
## Issue
Closes 6159 "Support Comments Enabled/Disabled for comment.List API"

## New behavior
- `disable-comments` tag will block the comments component entirely.
- `settings.commentsEnabled`:
  - When false, will pause comment fetching, posting and replying.
  - Any already-fetched comments will stay on screen (unless user reloads/F5).
2021-06-18 15:46:51 -04:00