/** * @flow * @file Versions Sidebar component * @author Box */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import type { MessageDescriptor } from 'react-intl'; import InlineError from '../../../components/inline-error'; import messages from './messages'; import SidebarContent from '../SidebarContent'; import VersionsMenu from './VersionsMenu'; import { BackButton } from '../../common/nav-button'; import { DEFAULT_FETCH_END } from '../../../constants'; import { LoadingIndicatorWrapper } from '../../../components/loading-indicator'; import type { BoxItemVersion } from '../../../common/types/core'; import './VersionsSidebar.scss'; const MAX_VERSIONS = DEFAULT_FETCH_END; type Props = { error?: MessageDescriptor, fileId: string, isLoading: boolean, parentName: string, versionCount: number, versionLimit: number, versions: Array, }; const VersionsSidebar = ({ error, isLoading, parentName, versions, ...rest }: Props) => { const showLimit = versions.length >= MAX_VERSIONS; const showVersions = !!versions.length; const showEmpty = !isLoading && !showVersions; const showError = !!error; return ( } > {showError && ( }> )} {showEmpty && (
)} {showVersions && (
)} {showLimit && (
)}
); }; export default VersionsSidebar;