32 Commits

Author SHA1 Message Date
soxa
6b440cfdf3
Live updates to comment threads (#2115)
* check new comments every 10 seconds

* enhance: clear newComments on child comments when we show a topLevel new comment; cleanup: resolvers, logs

* handle comments of comments, new structure to clear newComments on childs

* use original recursive comments data structure

* correct comment structure after deduplication

* faster newComments query deduplication, don't need to know how many comments are there

* cleanup: comments on newComments fetches and dedupes

* cleanup, use correct function declarations

* stop polling after 30 minutes, pause polling if user is not on the page

* ActionTooltip indicating that the user is in a live comment section

* handleVisibilityChange to control polling by visibility

* paused polling styling, check activity on 1 minute intervals and visibility change, light cleanup

* user can resume polling without refreshing the page

* better naming, straightforward dedupeComment on newComment arrival

* cleanup: better naming, get latest comment creation, correct order of comment injection

* cleanup: refactor live comments related functions to use-live-comments.js

* refactor: clearer naming, optimized polling and date retrieval logic, use of constants, general cleanup

* ui: place ShowNewComments in the bottom-right corner of nested comments

* fix: make updateQuery sort-aware to correctly inject the comment in the correct Item query

* cleanup: better naming; fix: usecallback on live comments component; fix leak on useEffect because of missing sort
atomic apollo cache manipulations; manage top sort not being present in item query cache
queue nested comments without a parent, retry on the next poll
fix commit messages

* fix: don't show unpaid comments; cleanup: compact cache merge/dedupe, queue comments via state

* fix: read new comments fragments to inject fresh new comments, fixing dropped comments;

ui: show amount of new comments

refactor: correct function positioning;

cleanup: useless logs

* enhance: queuedComments Ref, cache-and-network fetch policy; freshNewComments readFragment fallback to received comment

* cleanup: detailed comments and better ShowNewComment text

* fix: while showing new comments, also update ncomments for UI and pagination

* refactor: ShowNewComments is its own component; cleanup: proven useless dedupe on ShowNewComments, count nested ncomments from fresh new comments

* enhance: direct latest comment createdAt calc with reduce

* cleanup queue on unmount

* feat: live comments indicator for bottomed-out replies, ncomments updates; fix: nested comment structures

- new comments indicator for bottomed-out replies
- ncomments sync for parent and its ancestors
- limited comments fragment for comments that don't have CommentsRecursive
- reduce cache complexity by removing useless roundtrips

ux: live comments indicator on bottomedOut replies

fix: dedupe newComments before displaying ShowNewComments to avoid false positives

enhance: store ids of new comments in the cache, instead of carrying full comments that would get discarded anyway

hotfix: newComments deduplication ID mismatch, filter null comments from freshNewComments

fix: ncomments not updating for all comment levels; refactor: share Reply update ancestors' ncomments function with ShowNewComments

cleanup: better naming to indicate the total number of comments including nested comments

fix: increment parent comment ncomments

cleanup: Items that will have comments will always have a structure where item.comments is true

cleanup: reduce code complexity checking the nested comment update result instead of preventively reading the fragment

cleanup: avoid double-updating ncomments on parent

fix: don't use CommentsRecursive for bottomed-out comments

cleanup: better fragment naming; add TODO for absolute bottom comments

* backport live comments logic enhancements

use-live-comments:
- remove useless dedupe against already present comments
- check newComments.comments length to tell if there are new comments
- code reordering

show-new-comments:
- show all new comments recursively for nested comments
- get always the newest comments to inject also their own child new comments
- update local storage commentsViewedAt on comment injection
- respect depth on comment injection

comments.js
- apollo cache manipulations now live here

* hotfix: handle undefined item.comments.comments on dedupe

* hotfix: limited fragment for recursive comment collection; protect from null fragments; add missing deps to memoization

* docs: clarify ncomments updates

* cleanup: remove unused export

* count and show only the direct new comments and recursively their children

enhance: dedupe against existing comments only in the component
enhance: recursive count/injection share the same logic

* fix regression on top level counting

* hotfix: introduce readNestedCommentsFragment in lib/comments.js

* fix: count also existing comments of a new comment; cleanup: use readCommentFragment also for prepareComments; reduce freshNewComments usage

* add support for comments at the deepest level

fixes:
- client-side navigation re-fetched all new comments because 'after' was cached, now the latest new comment time persists in sessionStorage

enhancements:
- use CommentWithNewMinimal fragment fallback for comments at the deepest level
- tweak ReplyOnAnotherPage to show also how many direct new comments are there

cleanup:
- queue management is not needed anymore, therefore it has been removed

* cleanup: remove logs

* revert counting on ReplyOnAnotherPage, TODO for enhancements PR

* move ShowNewComments to CommentsHeader for top level comments

* fix: update commentsViewedAfterComment to support ncomments

* fix typo, lint

* cleanup: remove old CSS

* enhance: inject topLevel and its children new comments, simplify injection logic

- top-level and nested comment handling share the same recursion logic
- ShowNewComments references the item object for every type of comments
— note: item from item-full.js is passed to comments.js
- depth now starts at 0 to support top level comments
- injection and counting now reach the deepest level, updating also the deepest comment

* cleanup: remove unused topLevel prop

* fix: deepest comments don't have CommentsRecursive structure, don't access it on injection

* move top level ShowNewComments above CommentsHeader; preserve space to avoid vertical layout shifting

* cleanup: remove unused item on CommentsHeader

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2025-07-21 15:38:15 -05:00
keyan
da65191cd8 refine comment padding 2024-07-12 15:18:13 -05:00
keyan
28c4fa160c fix item spacing 2024-07-11 16:58:55 -05:00
keyan
6a6f4a88aa refine bounty icon margin for wrapping in comments 2024-03-06 14:20:03 -06:00
ekzyis
d1ed72bb85
Allow territory founders to pin items (#767)
* Add pinning of items

* Fix empty section in context menu

* Pin comments

* Fix layout shift during comment pinning

* Add comments, rename, formatting

* Max 3 pins allowed

* Fix argument

* Fix missing position update for other items

* Improve error message

* only show saloon in home

* refine pinItem style and transaction usage

* pin styling enhancements

* simpler handling of excess pins

* fix pin positioning like mergePins

* give existing pins null subName

* prevent empty items on load

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-01-30 11:04:56 -06:00
keyan
45e7503784 improve outlawed comment ux 2023-12-27 18:14:22 -06:00
keyan
65744364f1 undo zap/downzap and improve downzap ux 2023-12-19 19:55:19 -06:00
keyan
4bfd021342 enhance styling 2023-07-25 13:32:48 -05:00
keyan
6407455def upgrade react-bootstrap 2023-07-24 13:53:53 -05:00
Austin Kelsay
e13e37744e
stackernews bounties (#227)
bounties
2023-01-26 10:11:55 -06:00
keyan
7faae425b3 wild west mode 2022-09-21 14:57:36 -05:00
keyan
4d444d1286 fix notification spacing 2022-08-18 14:19:01 -05:00
keyan
70cbdd057a add table of contents 2022-07-18 16:24:28 -05:00
keyan
beef34abfa linkable headers 2022-07-17 10:35:50 -05:00
keyan
ef739d97fc readability enhancements: text size/color/line height 2022-02-09 13:15:38 -06:00
keyan
0dfda596b0 comment sorting 2021-12-21 15:35:25 -06:00
keyan
1a3fdda382 new bolt 2021-12-05 11:37:55 -06:00
keyan
dd97710d71 many small design enhancements 2021-11-12 16:39:52 -06:00
keyan
a3544fb67f dark mode with css variables instead 2021-11-09 16:43:56 -06:00
keyan
2d97314d33 dark mode without ability to switch 2021-11-04 14:22:03 -04:00
keyan
02c44dca63 refactor replies and full items 2021-09-23 15:09:07 -05:00
keyan
6dff4c6815 fix spacing in notifications 2021-08-18 13:59:30 -05:00
keyan
0afe46c030 continued notification work 2021-08-17 18:59:22 -05:00
keyan
b4be2c613b comment edit spagetti 2021-08-10 17:59:06 -05:00
keyan
01922e4b88 notifications done 2021-06-24 18:56:01 -05:00
keyan
10d848b5bd collapse 'em 2021-04-30 16:42:51 -05:00
keyan
057bb0f10a localstorage price as sats 2021-04-29 13:43:17 -05:00
keyan
2da1ee1a4b fix skeletons 2021-04-28 17:52:03 -05:00
keyan
6ea9ff7e11 a number of style updates 2021-04-28 14:30:14 -05:00
keyan
ec3f6b922d a bunch of new stuff 2021-04-22 17:14:32 -05:00
keyan
6792d1d5ff working comments with cache updates 2021-04-17 13:15:18 -05:00
keyan
28ed42fc29 more progress 2021-04-14 18:56:29 -05:00