mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-29 10:56:24 +02:00
feat(chat): implement target comment navigation and highlight functionality in chat components
This commit is contained in:
parent
6eedce839a
commit
72c421eeb1
5 changed files with 128 additions and 34 deletions
|
|
@ -76,3 +76,20 @@ export const toggleCommentsCollapsedAtom = atom(null, (get, set) => {
|
|||
export const setCommentsCollapsedAtom = atom(null, (get, set, collapsed: boolean) => {
|
||||
set(currentThreadAtom, { ...get(currentThreadAtom), commentsCollapsed: collapsed });
|
||||
});
|
||||
|
||||
/** Target comment ID to scroll to (from URL navigation or inbox click) */
|
||||
export const targetCommentIdAtom = atom<number | null>(null);
|
||||
|
||||
/** Setter for target comment ID - also ensures comments are not collapsed */
|
||||
export const setTargetCommentIdAtom = atom(null, (get, set, commentId: number | null) => {
|
||||
// Ensure comments are not collapsed when navigating to a comment
|
||||
if (commentId !== null) {
|
||||
set(currentThreadAtom, { ...get(currentThreadAtom), commentsCollapsed: false });
|
||||
}
|
||||
set(targetCommentIdAtom, commentId);
|
||||
});
|
||||
|
||||
/** Clear target after navigation completes */
|
||||
export const clearTargetCommentIdAtom = atom(null, (_, set) => {
|
||||
set(targetCommentIdAtom, null);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue