import ChannelMessageItem from "@app/channel/components/messages/item"; import { sortedChannelMessagesAtom } from "@stores/channel"; import { getHourAgo } from "@utils/date"; import { useAtomValue } from "jotai"; import { useCallback, useRef } from "react"; import { Virtuoso } from "react-virtuoso"; export default function ChannelMessageList() { const now = useRef(new Date()); const virtuosoRef = useRef(null); const data = useAtomValue(sortedChannelMessagesAtom); const itemContent: any = useCallback( (index: string | number) => { return ; }, [data], ); const computeItemKey = useCallback( (index: string | number) => { return data[index].id; }, [data], ); return (
(
), EmptyPlaceholder: () => (

Nothing to see here yet

Be the first to share a message in this channel.

), }} computeItemKey={computeItemKey} initialTopMostItemIndex={data.length - 1} alignToBottom={true} followOutput={true} overscan={50} increaseViewportBy={{ top: 200, bottom: 200 }} className="scrollbar-hide h-full w-full overflow-y-auto" />
); }