From 1924310e4160c83fb35965168b3cd4dca85b0490 Mon Sep 17 00:00:00 2001
From: Ren Amamiya <123083837+reyamir@users.noreply.github.com>
Date: Mon, 17 Apr 2023 09:02:17 +0700
Subject: [PATCH] added active link to chat/channel
---
src/components/channels/channelListItem.tsx | 15 +++++----------
src/components/chats/chatListItem.tsx | 15 +++++----------
2 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/src/components/channels/channelListItem.tsx b/src/components/channels/channelListItem.tsx
index 75170737..b175ccc4 100644
--- a/src/components/channels/channelListItem.tsx
+++ b/src/components/channels/channelListItem.tsx
@@ -1,20 +1,15 @@
+import { ActiveLink } from '@components/activeLink';
import { ImageWithFallback } from '@components/imageWithFallback';
import { DEFAULT_AVATAR } from '@stores/constants';
-import { useRouter } from 'next/navigation';
-
export const ChannelListItem = ({ data }: { data: any }) => {
- const router = useRouter();
const channel = JSON.parse(data.content);
- const openChannel = (id: string) => {
- router.push(`/channels/${id}`);
- };
-
return (
-
openChannel(data.eventId)}
+
@@ -28,6 +23,6 @@ export const ChannelListItem = ({ data }: { data: any }) => {
{channel.name}
-
+
);
};
diff --git a/src/components/chats/chatListItem.tsx b/src/components/chats/chatListItem.tsx
index b192173b..c6888e90 100644
--- a/src/components/chats/chatListItem.tsx
+++ b/src/components/chats/chatListItem.tsx
@@ -1,3 +1,4 @@
+import { ActiveLink } from '@components/activeLink';
import { ImageWithFallback } from '@components/imageWithFallback';
import { DEFAULT_AVATAR } from '@stores/constants';
@@ -5,19 +6,13 @@ import { DEFAULT_AVATAR } from '@stores/constants';
import { useProfileMetadata } from '@utils/hooks/useProfileMetadata';
import { truncate } from '@utils/truncate';
-import { useRouter } from 'next/navigation';
-
export const ChatListItem = ({ pubkey }: { pubkey: string }) => {
- const router = useRouter();
const profile = useProfileMetadata(pubkey);
- const openChat = () => {
- router.push(`/chats/${pubkey}`);
- };
-
return (
-
openChat()}
+
@@ -33,6 +28,6 @@ export const ChatListItem = ({ pubkey }: { pubkey: string }) => {
{profile?.display_name || profile?.name || truncate(pubkey, 16, ' .... ')}
-
+
);
};