import { Check } from "lucide-react"; import { NavLink } from "react-router"; import { useShallow } from "zustand/react/shallow"; import { useFetchUsers } from "~/hooks/use-fetch-user"; import type { RecipientChannel } from "~/lib/api/types"; import { cn } from "~/lib/utils"; import { useUsersStore } from "~/stores/users-store"; import { Badge } from "../ui/badge"; import { Button } from "../ui/button"; import UserAvatar from "../user-avatar"; import { OnlineStatus } from "./online-status"; interface PrivateChannelListItemProps { channel: RecipientChannel; } export default function PrivateChannelListItem({ channel }: PrivateChannelListItemProps) { const currentUserId = useUsersStore((state) => state.currentUserId); const recipients = channel.recipients.filter((recipient) => recipient !== currentUserId); useFetchUsers(recipients); const recipientsUsers = useUsersStore( useShallow((state) => recipients.map((recipient) => state.users[recipient]).filter(Boolean)), ); const renderSystemBadge = recipientsUsers.some((recipient) => recipient.system) && recipients.length === 1; return ( <> {({ isActive }) => ( )} ); }