mirror of
https://github.com/lumehq/lume.git
synced 2025-04-07 03:18:12 +02:00
added active link to chat/channel
This commit is contained in:
parent
15968db4a6
commit
1924310e41
@ -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 (
|
||||
<div
|
||||
onClick={() => openChannel(data.eventId)}
|
||||
<ActiveLink
|
||||
href={`/channels/${data.eventId}`}
|
||||
activeClassName="dark:bg-zinc-900 dark:text-zinc-100 hover:dark:bg-zinc-800"
|
||||
className="inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900"
|
||||
>
|
||||
<div className="relative h-5 w-5 shrink-0 overflow-hidden rounded">
|
||||
@ -28,6 +23,6 @@ export const ChannelListItem = ({ data }: { data: any }) => {
|
||||
<div>
|
||||
<h5 className="truncate text-sm font-medium text-zinc-400">{channel.name}</h5>
|
||||
</div>
|
||||
</div>
|
||||
</ActiveLink>
|
||||
);
|
||||
};
|
||||
|
@ -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 (
|
||||
<div
|
||||
onClick={() => openChat()}
|
||||
<ActiveLink
|
||||
href={`/chats/${pubkey}`}
|
||||
activeClassName="dark:bg-zinc-900 dark:text-zinc-100 hover:dark:bg-zinc-800"
|
||||
className="inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900"
|
||||
>
|
||||
<div className="relative h-5 w-5 shrink overflow-hidden rounded">
|
||||
@ -33,6 +28,6 @@ export const ChatListItem = ({ pubkey }: { pubkey: string }) => {
|
||||
{profile?.display_name || profile?.name || truncate(pubkey, 16, ' .... ')}
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
</ActiveLink>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user