* Fix duplicate comment on pessimistic creation
- comment creation checks for comment's ID existence in cache
- invoice.confirmedAt included in useCanEdit deps for anons live comments
* switch to some as sets are not worth it
* only check for duplicates if a pessimistic payment method has been used
* default to empty array
* add comment about side-effects
* record ownership of an item to avoid injecting it via live comments
* trigger check only if the incoming comment is ours, cleanup
* correct conditions, correct comments, light cleanup
* fix: add defensive condition to ownership recorder, better name
* refactor: unified comment injection logic with deduplication, useCommentsView hook; revert sessionStorage-based fix
* adjust live comments naming around the codebase
* listen for hmac presence for anon edits
* always return the injected comment createdAt to bump live comments
* refactor: improve live comments hook readability
- latest comment createdAt persistence helper
- preserveScroll returns the returning value of the callback
- compact conditional logic
- refresh code comments
- refresh naming
- group constants
- reorder imports
* flat comment injection, fetch flat comments instead of the entire subtree that would've been deduplicated anyway, cleanup
* always align new comment fragment to the comments query structure
* generic useCommentsView hook
* update comment counts if live injecting into fragments without comments field
* fix: pass parentId, if a comment has a top level parent it always has the comments field
* fix: update CommentsViewAt only if we actually injected a comment into cache
* correct injectComment result usage
* pass markViewedAt to further centralize side effects, remove live from Item server typedefs
* fix: don't update counts for ancestors that are already up to date, update commentsViewedAt per batch not per comment
* port: fix coalesce, useCommentsView hook and outline changes
* update hmac field in cache on paid invoice, hmac as useCanEdit effect dependency
* comments and light cleanup, update useCommentsView
* efficient hasComments logic for live comments, establish a gql fragment
* fix: typo on topLevel evaluation
* limit extra evaluations to live comments scenarios
* update comments
* support live comments ncomments increments for anon view tracking
* backport useCommentsView from comments refactor
* adapt live comments and creation to useCommentsView; better outline conditions
* better deps usage, remove unused props
* safer usage of root and item
* light cleanup
* cleanup: remove unused useRoot on live comments
* light cleanup and affirm purpose of each function
* fallback to createdAt if no lastCommentAt only if we actually visit the item, not by default
* fix: don't track comments, remove unused useRoot, fix signature
* server-side comments view tracking, model structure, mutation
* full commentsViewedAt refactor, adjust comment creation and injection, adjust item navigation
* update server-side tracking only if there's a change, light cleanup
* coalesce meCommentsViewedAt to the item's createdAt, wip PoC comment outlining
* don't update cache on item visit, use useRoot hook for outlining
* add meCommentsViewedAt to root, better naming, light cleanup
* better timestamp logic and comparisons, add lastCommentAt to root item object, added TODOs
* fix: track commentsViewedAt only for root item, use topLevelId to fetch live comments only for the current item
* only track commentsViewedAt for root item, light cleanup
* light cleanup, correct live comments timestamp deps
* worker: on midnight, untrack items that were never viewed and had no comments in the last 21 days
* automatic toc generation in markdown
* don't open hash links in new tab
* only process toc for top level items
---------
Co-authored-by: ekzyis <ek@stacker.news>
* enhance: toggle live comments on posts, default status set by user settings
* wip: toggle via mutation, footer placement
* chat icon on footer, consistent naming, perf tweaks
* update all tabs on toggle by dispatching events, correct icon, cleanup
cleanup:
- remove useless window checks
- use skip instead of conditional options
- correct naming
* update localstorage on user setting change
* revert disableLiveComments user setting
* avoid redundant setState and usage of maybe stale state
---------
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
* Wallet flow
* Prepopulate fields of complementary protocol
* Remove TODO about one mutation for save
We need to save protocols in separate mutations so we can use the wallet id returned by the first protocol save for the following protocol saves and save them all to the same wallet.
* Fix badges not updated on wallet delete
* Fix useProtocol call
* Fix lightning address save via prompt
* Don't pass share as attribute to DOM
* Fix useCallback dependency
* Progress numbers as SVGs
* Fix progress line margins
* Remove unused saveWallet arguments
* Update cache with settings response
* Fix line does not connect with number 1
* Don't reuse page nav arrows in form nav
* Fix missing SVG hover style
* Fix missing space in wallet save log message
* Reuse CSS from nav.module.css
* align buttons and their icons/text
* center form progress line
* increase top padding of form on smaller screens
* provide margin above button bar on settings form
---------
Co-authored-by: k00b <k00b@stacker.news>
* remove free comments
* working on logic with bios and fees
* Revert "working on logic with bios and fees"
This reverts commit 0de31cbaaddd6733d8a2e8c099d0108d9f634512.
---------
Co-authored-by: pory-gone <pory-gone@users.noreply.github.com>
* live comments: stable navigator for new outlined comments
* favicons: FaviconProvider, handle new comments favicon via navigator
* navigator keyboard shortcuts: arrow right/escape key
* enhance: responsive fixed positioning; cleanup
enhance:
- two types of padding for desktop and mobile via CSS
cleanup:
- use appropriate <aside> for navigator
- reorder CSS
* Comments Navigator Context, new comments dot UI, refs autosorting, auto-untrack children
- Navigator Context for item pages
UI/UX
- WIP: compact comments dot UI on navbars
- long press to clear tracked refs
- auto-untrack node's children on scroll
Logic
- auto-sort comment refs via createdAt
- remove outline on untrack if called by scroll
* stable navigator dot UI positioning
* cleanup: better naming, clear structure
* re-instate favicon state updates on navigator
* CSS visibility tweaks
* scroll to start position of ref
* fix undefined navigator on other comment calls
* add explanation for early favicon clear
---------
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
* live comments: stable navigator for new outlined comments
* navigator keyboard shortcuts: arrow right/escape key
* enhance: responsive fixed positioning; cleanup
enhance:
- two types of padding for desktop and mobile via CSS
cleanup:
- use appropriate <aside> for navigator
- reorder CSS
* Comments Navigator Context, new comments dot UI, refs autosorting, auto-untrack children
- Navigator Context for item pages
UI/UX
- WIP: compact comments dot UI on navbars
- long press to clear tracked refs
- auto-untrack node's children on scroll
Logic
- auto-sort comment refs via createdAt
- remove outline on untrack if called by scroll
* stable navigator dot UI positioning
* cleanup: better naming, clear structure
* CSS visibility tweaks
* scroll to start position of ref
* fix undefined navigator on other comment calls
* remove pulse animation
* carousel sort in deterministic order
* imgIndex 0 for ItemEmbed
* fix order for item-full
* fix indexing in ItemEmbed
* Revert "fix indexing in ItemEmbed"
This reverts commit f7863af30a1a02b189bfc79237606851c4da1abf.
* Revert "fix order for item-full"
This reverts commit 489e25ea82056bd83a818e581eb2bbfcf947e401.
* Revert "imgIndex 0 for ItemEmbed"
This reverts commit cd5fff1bae151e44db717f2a2173f673793bc6d0.
* carousel preserves ordering rendered on screen
* reorder carousel when sort changes
* fix cursor detected bugs
* register media to carousel before image load, confirm afterwards
* Remove unnecessary ref from dependencies
* Add missing dependencies
* Add missing dependencies
* Check if src was found in Carousel
---------
Co-authored-by: ekzyis <ek@stacker.news>
* enhance: FaviconProvider, keep track of new comment IDs to change favicon, remove new comment IDs per outline removal
* don't track oneself comments
* enhance: auto-show new comments, idempotency by ignoring already injected comments, preserveScroll utility
* fadeIn animation on comment injection; cleanup: remove unused counts and thread handling; non-critical fix: always give rootLastCommentAt a value
* reliably preserve scroll position by tracking a reference found at the center of the viewport; cleanup: add more comments, add cleanup function
* mitigate fractional scrolling subtle layout shifts by rounding the new reference element position
* enhanced outlining system, favicon context keeps track of new comments presence
- de-outlining now happens only for outlined comments
- enhanced outlining: add outline only if isNewComment
- de-outlining will remove the new comments favicon
- on unmount remove the new comments favicon
* remove the new comments favicon on new comments injection
* track only deduplicated new comments
* fix typo
* clearer unsetOutline conditions, fix typo in live comments hook
* backport: remove the injectedComment class from injected comments after animation ends
* set the new comments favicon on any new outlined comment
* enhance: directly inject new comments; cleanup: dismantle ShowNewComments, remove newComments field
* tweaks: slower injection animation, clear favicon on Comment section unmount
* change nDirectComments bug strategy to avoiding updates on comment edit
* cleanup: better naming, re-instate injected comments outline
* injection: major cache utilities refactor, don't preserve scroll if no comments have been injected
- don't preserve scroll if after deduplication we don't inject any comments
- use manual read/write cache updates to control the flow
-- allows to check if we are really injecting or not
- reduce polling to 5 seconds instead of 10
- light cleanup
-- removed update cache functions
-- added 'injected' to typeDefs (gql consistency)
* cleanup: detailed comments, refactor, remove clutter
Refactor:
+ clearer variables
+ depth calculation utility function
+ use destructured Apollo cache
+ extract item object from item query
+ skip ignored comment instead of ending the loop
CSS:
+ from-to fadeIn animation keyframes
- floatingComments unused class
Favicon:
+ provider exported by default
* fix wrong merge
* split: remove favicon context
* split: remove favicon pngs
* regression: revert to updateQuery for multiple comment fragments handling
* reverse multiple reads for deduplication on comment injection
* fix regression on apollo manipulations via fn; cleanup: remove wrong deps from outlining
* livecomments: patches for paginated comments; broader ViewMoreReplies component
live comments:
- don't show the thread button for thread comments that are shown as full items (top level)
- don't try to count/inject on paginated comments, just show the live comments dot
- dedupe new comments being fetched with already existing comments, useful for just showing the dot, but not the button
comments:
- live comments dot now appears on both paginated and bottomed out comments
-- merge ViewAllReplies with ReplyToAnotherPage
* fix thread comment recognition, now based on depth
* fix: recurse through existing comments only if we're in the newComments subtree or if it's the start of a thread
* cleanup: better comment
* cleanup: re-order parameters, comment touchup