All files / src/features/GiveNotificationModal/components BodySelector.tsx

80% Statements 8/10
80% Branches 8/10
100% Functions 1/1
71.42% Lines 5/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47                                      30x   30x 20x   8x                               8x            
import React from "react";
import GiveNotificationSkeleton from "./skeletons/GiveNotificationSkeleton";
import { useGiveNotificationContext } from "../provider/GiveNotificationProvider";
import EmptyComponent from "./EmptyComponent";
import ThreadList from "./ThreadList";
import MessageThread from "@features/GiveConversation/components/MessageThread";
import NotificationsList from "./NotificationsList";
 
function BodySelector() {
  const {
    isLoading,
    isEmptyData,
    currentThread,
    isBackgroundFetchingMessages,
    isFetchingNextPageMessages,
    hasNextPageMessages,
    isThreadMessagesLoading,
    messages,
    tab,
  } = useGiveNotificationContext();
 
  if (isLoading) return <GiveNotificationSkeleton />;
  if (isEmptyData) return <EmptyComponent />;
 
  Iif (currentThread && currentThread.id)
    return (
      <MessageThread
        defaultContext={{
          currentThread,
          isBackgroundFetchingMessages,
          isFetchingNextPageMessages,
          hasNextPageMessages,
          isThreadMessagesLoading,
          messages,
          searchState: { searchValue: "", isOpened: false },
          showMentions: false,
        }}
      />
    );
 
  Eif (tab === "notifications") return <NotificationsList />;
 
  return <ThreadList />;
}
 
export default BodySelector;