import { Fragment, useCallback } from "react"; import { InfiniteData } from "@tanstack/react-query"; import { Button, Drawer, DrawerContent } from "@app/components/v2"; import timeSince from "@app/ee/utilities/timeSince"; import { TSecretSnapshot } from "@app/hooks/api/secretSnapshots/types"; type Props = { isDrawerOpen: boolean; onOpenChange: (isOpen: boolean) => void; secretSnaphots?: InfiniteData; onSelectSnapshot: (id: string) => void; snapshotId: string | null; isFetchingNextPage?: boolean; hasNextPage?: boolean; fetchNextPage: () => void; }; export const PitDrawer = ({ isDrawerOpen, onOpenChange, secretSnaphots, onSelectSnapshot, snapshotId, isFetchingNextPage, hasNextPage, fetchNextPage }: Props): JSX.Element => { const getButtonLabel = useCallback((isFirstChild: boolean, isSelectedSnapshot: boolean) => { if (isFirstChild) return "Current Version"; if (isSelectedSnapshot) return "Currently Viewing"; return "Explore"; }, []); return (
{secretSnaphots?.pages?.map((group, i) => ( {group.map(({ _id, createdAt }, index) => ( ))} ))}
); };