{channel.name}
@@ -63,7 +67,7 @@ export function ChatSidebarChannel({
return isLink ? (
setShowContextMenu(v)}
@@ -162,7 +163,6 @@ export function ChatSidebarDirectContact({ contact, onClick, isLink = true }: Pr
onTouchStart={() => setHoldStarted(true)}
onTouchEnd={() => {
setHoldStarted(false);
- console.log("touch ended");
setTimeout(() => {
if (!holdStarted) {
@@ -186,7 +186,7 @@ export function ChatSidebarDirectContact({ contact, onClick, isLink = true }: Pr
setShowContextMenu(true);
}}
className={classNameObject({
- "flex items-center text-dark-200 gap-3 p-3 border-b border-[--border-color] last:border-0 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer":
+ "flex items-center text-dark-200 gap-3 p-3 last:border-0 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer":
true,
"bg-gray-100 dark:bg-gray-800": receiverPubKey === contact.pubkey
})}
diff --git a/src/common/features/chats/components/chats-sidebar/index.tsx b/src/common/features/chats/components/chats-sidebar/index.tsx
index e8e74c6ccda..9b0a1bd53da 100644
--- a/src/common/features/chats/components/chats-sidebar/index.tsx
+++ b/src/common/features/chats/components/chats-sidebar/index.tsx
@@ -12,7 +12,7 @@ import {
useChannelsQuery,
useDirectContactsQuery
} from "@ecency/ns-query";
-import { useSearchUsersQuery } from "../../queries";
+import { useComposedContactsAndChannelsQuery, useSearchUsersQuery } from "../../queries";
import { useSearchCommunitiesQuery } from "../../queries/search-communities-query";
import { Community } from "../../../../store/communities";
import { Reputations } from "../../../../api/hive";
@@ -32,6 +32,7 @@ export default function ChatsSideBar(props: Props) {
const { data: directContacts } = useDirectContactsQuery();
const { data: channels } = useChannelsQuery();
+ const composedContactsAndChannels = useComposedContactsAndChannelsQuery();
const chatsSideBarRef = React.createRef
();
const [selectedAccount, setSelectedAccount] = useState("");
@@ -75,27 +76,22 @@ export default function ChatsSideBar(props: Props) {
))
) : (
<>
- {channels?.length !== 0 && (
-
- {_t("chat.communities")}
-
+ {composedContactsAndChannels.map((contactOrChannel) =>
+ "id" in contactOrChannel ? (
+
+ ) : (
+
+ )
)}
- {channels?.map((channel) => (
-
- ))}
- {directContacts?.length !== 0 && (
-
- {_t("chat.direct-messages")}
-
- )}
- {directContacts?.map((contact) => (
-
- ))}
>
)}
diff --git a/src/common/features/chats/queries/composed-contacts-and-channels-query.ts b/src/common/features/chats/queries/composed-contacts-and-channels-query.ts
new file mode 100644
index 00000000000..ce41cbfeb64
--- /dev/null
+++ b/src/common/features/chats/queries/composed-contacts-and-channels-query.ts
@@ -0,0 +1,73 @@
+import {
+ useChannelsQuery,
+ useDirectContactsQuery,
+ useKeysQuery,
+ useNostrGetUserProfileQuery
+} from "@ecency/ns-query";
+import { useMemo } from "react";
+import { isAfter } from "date-fns";
+
+export function useComposedContactsAndChannelsQuery() {
+ const { publicKey } = useKeysQuery();
+ const { data: contactsData } = useDirectContactsQuery();
+ const { data: channelsData } = useChannelsQuery();
+
+ const { data: activeUserNostrProfiles } = useNostrGetUserProfileQuery(publicKey);
+
+ const channelsLastSeenDate = useMemo(
+ () =>
+ channelsData.reduce