import React, { ReactNode } from 'react'; import { observer } from 'mobx-react-lite'; import { Box, Loader } from '@wix/design-system'; import { NestedTableNodeState } from '../../state/NestedTableState/NestedTableNodeState'; import { ErrorState } from '../ErrorState'; import { CollectionEmptyState } from '../EmptyState/CollectionEmptyState'; export interface PlaceholderStatesProps { state: NestedTableNodeState; } function _NestedTableRowPlaceholderStates(props: PlaceholderStatesProps) { const { state } = props; const { initTask, showLoadingState, showEmptyState, showErrorState, errorStatus, } = state; let child: ReactNode; if (initTask.status.isError) { child = ( ); } else if (showLoadingState) { child = ( ); } else if (showErrorState && errorStatus) { child = ( ); } else if (showEmptyState) { child = ( { state.levelDescriptor.onAddNewClick?.(); }, }} /> ); } return <>{child}; } export const NestedTableRowPlaceholderStates = observer( _NestedTableRowPlaceholderStates, );