fix
This commit is contained in:
@@ -203,6 +203,7 @@ const DocumentsTable = ({
|
||||
subfolders,
|
||||
documents,
|
||||
searchResults,
|
||||
isFilterActive = false,
|
||||
onFolderSelect,
|
||||
onFolderDrop,
|
||||
onFolderDragOver,
|
||||
@@ -473,11 +474,10 @@ const DocumentsTable = ({
|
||||
[activeCorrespondentIdSet, onCorrespondentClick],
|
||||
);
|
||||
|
||||
const showDefaultEmptyState = !showingSearchResults && !subfolders.length && rows.length === 0;
|
||||
const showListSearchEmptyState =
|
||||
showingSearchResults && rows.length === 0 && !isGridView && !isSearchLoading;
|
||||
const showGridSearchEmptyState =
|
||||
isGridView && showingSearchResults && rows.length === 0 && !isSearchLoading;
|
||||
const noResults = rows.length === 0;
|
||||
const showDefaultEmptyState = !showingSearchResults && !isFilterActive && !subfolders.length && noResults;
|
||||
const showListSearchEmptyState = showingSearchResults && noResults && !isGridView && !isSearchLoading;
|
||||
const showGridSearchEmptyState = isGridView && showingSearchResults && noResults && !isSearchLoading;
|
||||
const showSearchHint = showingSearchResults && rows.length > 0;
|
||||
const breadcrumbEntries = useMemo(() => (Array.isArray(breadcrumbs) ? breadcrumbs.filter(Boolean) : []), [breadcrumbs]);
|
||||
const trailEntries = useMemo(() => {
|
||||
@@ -548,41 +548,48 @@ const DocumentsTable = ({
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
{showDefaultEmptyState && (
|
||||
<div className="empty-state">
|
||||
Drop files anywhere or onto a folder to upload documents.
|
||||
{showDefaultEmptyState ? (
|
||||
<div className="panel-section__body">
|
||||
<div className="empty-state">
|
||||
Drop files anywhere or onto a folder to upload documents.
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{showGridSearchEmptyState && (
|
||||
<div className="empty-state empty-state--global">
|
||||
No documents match the current filters.
|
||||
) : showGridSearchEmptyState ? (
|
||||
<div className="panel-section__body">
|
||||
<div className="empty-state empty-state--global">
|
||||
No documents match the current filters.
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="panel-section__body">
|
||||
<div
|
||||
ref={assignScrollRef}
|
||||
className="documents-scroll"
|
||||
onFocus={(event) => {
|
||||
if (event.target === scrollRef.current) {
|
||||
onDocumentListFocus?.();
|
||||
}
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.target !== scrollRef.current) {
|
||||
return;
|
||||
}
|
||||
if (onDocumentListKeyDown) {
|
||||
onDocumentListKeyDown(event);
|
||||
}
|
||||
}}
|
||||
onClick={(event) => {
|
||||
if (event.target === event.currentTarget) {
|
||||
onClearSelection?.();
|
||||
}
|
||||
}}
|
||||
aria-activedescendant={isGridView ? undefined : activeDescendantId}
|
||||
>
|
||||
{showDefaultEmptyState ? null : isGridView ? (
|
||||
) : showListSearchEmptyState ? (
|
||||
<div className="panel-section__body">
|
||||
<div className="empty-state">No documents match the current filters.</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="panel-section__body">
|
||||
<div
|
||||
ref={assignScrollRef}
|
||||
className="documents-scroll"
|
||||
onFocus={(event) => {
|
||||
if (event.target === scrollRef.current) {
|
||||
onDocumentListFocus?.();
|
||||
}
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.target !== scrollRef.current) {
|
||||
return;
|
||||
}
|
||||
if (onDocumentListKeyDown) {
|
||||
onDocumentListKeyDown(event);
|
||||
}
|
||||
}}
|
||||
onClick={(event) => {
|
||||
if (event.target === event.currentTarget) {
|
||||
onClearSelection?.();
|
||||
}
|
||||
}}
|
||||
aria-activedescendant={isGridView ? undefined : activeDescendantId}
|
||||
>
|
||||
{isGridView ? (
|
||||
<div
|
||||
className="documents-grid"
|
||||
role="list"
|
||||
@@ -766,7 +773,7 @@ const DocumentsTable = ({
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
) : noResults ? null : (
|
||||
<table aria-multiselectable="true">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -1060,15 +1067,13 @@ const DocumentsTable = ({
|
||||
</table>
|
||||
)}
|
||||
</div>
|
||||
{showListSearchEmptyState && (
|
||||
<div className="empty-state">No documents match the current filters.</div>
|
||||
)}
|
||||
{showSearchHint && (
|
||||
<div className="search-hint">
|
||||
Showing {rows.length} document{rows.length === 1 ? '' : 's'} in {currentFolderName} and subfolders.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user