import React from "react"; import { getTotalRequestCountInCollection } from 'utils/collections/'; import { IconFolder, IconWorld, IconApi, IconShare } from '@tabler/icons'; import { areItemsLoading, getItemsLoadStats } from "utils/collections/index"; import { useState } from "react"; import ShareCollection from "components/ShareCollection/index"; const Info = ({ collection }) => { const totalRequestsInCollection = getTotalRequestCountInCollection(collection); const isCollectionLoading = areItemsLoading(collection); const { loading: itemsLoadingCount, total: totalItems } = getItemsLoadStats(collection); const [showShareCollectionModal, toggleShowShareCollectionModal] = useState(false); const handleToggleShowShareCollectionModal = (value) => (e) => { toggleShowShareCollectionModal(value); } return (
{/* Location Row */}
Location
{collection.pathname}
{/* Environments Row */}
Environments
{collection.environments?.length || 0} environment{collection.environments?.length !== 1 ? 's' : ''} configured
{/* Requests Row */}
Requests
{ isCollectionLoading? `${totalItems - itemsLoadingCount} out of ${totalItems} requests in the collection loaded` : `${totalRequestsInCollection} request${totalRequestsInCollection !== 1 ? 's' : ''} in collection` }
Share
Share Collection
{showShareCollectionModal && }
); }; export default Info;