From bbe42bdf930be9bf9a3eebf1ce644804100705d0 Mon Sep 17 00:00:00 2001
From: Ajay Bura <32841439+ajbura@users.noreply.github.com>
Date: Wed, 4 Nov 2026 20:17:13 +0530
Subject: [PATCH] add view more button to thread items in sidebar
---
src/app/features/room-nav/ThreadNavItems.tsx | 66 +++++++++++++-------
src/app/features/room-nav/styles.css.ts | 5 ++
2 files changed, 48 insertions(+), 23 deletions(-)
diff --git a/src/app/features/room-nav/ThreadNavItems.tsx b/src/app/features/room-nav/ThreadNavItems.tsx
index 68efae74f..47a2389bd 100644
--- a/src/app/features/room-nav/ThreadNavItems.tsx
+++ b/src/app/features/room-nav/ThreadNavItems.tsx
@@ -7,9 +7,9 @@ https://cinny.in
Please see LICENSE file in root of repository for full details.
*/
-import React, { useMemo } from 'react';
+import React, { useMemo, useState } from 'react';
import { MessageEventWithoutRoomId, UnreadNotificationCounts } from 'neurone/lib/api/types';
-import { Box, Text } from 'folds';
+import { Box, Chip, Icon, Icons, Text } from 'folds';
import { HTMLReactParserOptions } from 'html-react-parser';
import { Opts as LinkifyOpts } from 'linkifyjs';
import { Timeline } from '../../../client/room';
@@ -130,6 +130,7 @@ export function ThreadNavItems({
}: ThreadNavItemsProps) {
const ct = useClient();
const useAuthentication = useMediaAuthentication();
+ const [viewMore, setViewMore] = useState(false);
const threads = useObservableValue(timeline.threads);
const edits = useObservableValue(timeline.relations.edits.eventToRelations);
@@ -166,27 +167,46 @@ export function ThreadNavItems({
[ct, timeline, linkifyOpts, useAuthentication]
);
- return (
-
- {Array.from(threadNotifications.keys()).map((threadId) => {
- const notification = threadNotifications.get(threadId);
- if (!notification) return null;
- const thread = threads.get(threadId) ?? timeline.registerThread(threadId);
+ const threadIds = Array.from(threadNotifications.keys());
+ const slicedThreadIds = viewMore ? threadIds : threadIds.slice(0, 5);
- return (
- timeline.openThread(threadId)}
- />
- );
- })}
-
+ return (
+ <>
+
+ {slicedThreadIds.slice().map((threadId) => {
+ const notification = threadNotifications.get(threadId);
+ if (!notification) return null;
+ const thread = threads.get(threadId) ?? timeline.registerThread(threadId);
+
+ return (
+ timeline.openThread(threadId)}
+ />
+ );
+ })}
+
+ {threadIds.length > 5 && (
+ }
+ onClick={() => setViewMore(!viewMore)}
+ >
+
+ {viewMore ? 'View Less' : `View ${threadIds.length - slicedThreadIds.length} More`}
+
+
+ )}
+ >
);
}
diff --git a/src/app/features/room-nav/styles.css.ts b/src/app/features/room-nav/styles.css.ts
index 1405e8af5..c67f76366 100644
--- a/src/app/features/room-nav/styles.css.ts
+++ b/src/app/features/room-nav/styles.css.ts
@@ -60,3 +60,8 @@ export const ThreadNavItem = style({
},
},
});
+
+export const ThreadViewMoreChip = style({
+ marginLeft: toRem(6),
+ marginBottom: config.space.S200,
+});