floating selection box
This commit is contained in:
@@ -6,8 +6,6 @@ import {
|
||||
RefreshIcon,
|
||||
MinusVerticalIcon,
|
||||
InfoIcon,
|
||||
FileIcon,
|
||||
FolderOutlineIcon,
|
||||
} from '../ui/icons';
|
||||
import BreadcrumbTrail from '../ui/BreadcrumbTrail';
|
||||
import createWorkspaceSurfaceConfig from './workspaceHeader';
|
||||
@@ -609,6 +607,7 @@ export const createDocumentsSurface = ({
|
||||
selectedDocumentIds,
|
||||
selectedFolderIds,
|
||||
onDeleteSelection,
|
||||
onClearSelection,
|
||||
tags,
|
||||
correspondents,
|
||||
documentLookup,
|
||||
@@ -629,45 +628,6 @@ export const createDocumentsSurface = ({
|
||||
const documentSelectionCount = Array.isArray(selectedDocumentIds) ? selectedDocumentIds.length : 0;
|
||||
const folderSelectionCount = Array.isArray(selectedFolderIds) ? selectedFolderIds.length : 0;
|
||||
const selectionCount = documentSelectionCount + folderSelectionCount;
|
||||
let selectionLabel = null;
|
||||
if (selectionCount) {
|
||||
const tokens = [];
|
||||
|
||||
if (documentSelectionCount) {
|
||||
tokens.push({
|
||||
key: 'documents',
|
||||
count: documentSelectionCount,
|
||||
icon: <FileIcon className="selection-summary__icon" size={16} />,
|
||||
});
|
||||
}
|
||||
|
||||
if (folderSelectionCount) {
|
||||
tokens.push({
|
||||
key: 'folders',
|
||||
count: folderSelectionCount,
|
||||
icon: <FolderOutlineIcon className="selection-summary__icon" size={16} />,
|
||||
});
|
||||
}
|
||||
|
||||
if (tokens.length) {
|
||||
selectionLabel = (
|
||||
<span className="selection-summary">
|
||||
{tokens.map((token, index) => (
|
||||
<React.Fragment key={token.key}>
|
||||
{index > 0 ? <span className="selection-summary__separator">·</span> : null}
|
||||
<span className="selection-summary__token">
|
||||
<span className="selection-summary__count">{token.count}</span>
|
||||
<span className="selection-summary__multiply">×</span>
|
||||
{token.icon}
|
||||
</span>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
selectionLabel = `${selectionCount} item${selectionCount === 1 ? '' : 's'}`;
|
||||
}
|
||||
}
|
||||
|
||||
const actions = createDocumentsTableHeaderActions({
|
||||
viewMode,
|
||||
@@ -675,11 +635,12 @@ export const createDocumentsSurface = ({
|
||||
onRefresh,
|
||||
});
|
||||
|
||||
const floatingActions = selectionLabel
|
||||
const floatingActions = selectionCount > 0
|
||||
? (
|
||||
<SelectionFloatingActions
|
||||
selectionCount={selectionCount}
|
||||
selectedDocumentIds={selectedDocumentIds}
|
||||
selectedFolderIds={selectedFolderIds}
|
||||
documentLookup={documentLookup}
|
||||
tags={tags}
|
||||
tagLookupById={tagLookupById}
|
||||
@@ -690,6 +651,7 @@ export const createDocumentsSurface = ({
|
||||
onBulkCorrespondentRemove={onBulkCorrespondentRemove}
|
||||
onBulkReanalyze={onBulkReanalyze}
|
||||
onDeleteSelection={onDeleteSelection}
|
||||
onClearSelection={onClearSelection}
|
||||
/>
|
||||
)
|
||||
: null;
|
||||
@@ -708,7 +670,7 @@ export const createDocumentsSurface = ({
|
||||
onNavigateParent,
|
||||
actions,
|
||||
breadcrumbs,
|
||||
selectionLabel,
|
||||
selectionLabel: null,
|
||||
floatingActions,
|
||||
content: <DocumentsPanel {...tableProps} showHeader={false} />,
|
||||
detail,
|
||||
|
||||
Reference in New Issue
Block a user