cleanup
This commit is contained in:
@@ -60,7 +60,6 @@ export type DocumentEventHandler = (document: DocumentLike, event: MouseEvent<HT
|
||||
|
||||
export interface DocumentsListProps {
|
||||
entries: DocumentsListEntry[];
|
||||
focusedRowKey?: string | null;
|
||||
draggingDocumentIdsSet?: Set<Identifier> | null;
|
||||
draggedFolderId?: Identifier | 'root' | null;
|
||||
ensureAssetUrl?: (...args: any[]) => unknown;
|
||||
@@ -91,7 +90,6 @@ export interface DocumentsListProps {
|
||||
|
||||
const DocumentsList: React.FC<DocumentsListProps> = ({
|
||||
entries,
|
||||
focusedRowKey,
|
||||
draggingDocumentIdsSet,
|
||||
draggedFolderId,
|
||||
ensureAssetUrl,
|
||||
@@ -185,7 +183,6 @@ const DocumentsList: React.FC<DocumentsListProps> = ({
|
||||
const canDragFolder = folder.id !== 'root';
|
||||
const isDraggingFolder = draggedFolderId === folder.id;
|
||||
const isSelectedFolder = selectedFolderIdsSet?.has(folder.id);
|
||||
const rowKey = `folder:${folder.id}`;
|
||||
const canRenameFolder = Boolean(onFolderRename) && folder.id !== 'root';
|
||||
const isFolderEditing = editingFolderId === folder.id;
|
||||
const folderDraftValue = isFolderEditing ? folderDraft : folder.name;
|
||||
@@ -198,9 +195,7 @@ const DocumentsList: React.FC<DocumentsListProps> = ({
|
||||
return (
|
||||
<tr
|
||||
key={entry.key}
|
||||
className={`folder${isDraggingFolder ? ' is-dragging' : ''}${
|
||||
focusedRowKey === rowKey ? ' focused' : ''
|
||||
}${isSelectedFolder ? ' selected' : ''}`}
|
||||
className={`folder${isDraggingFolder ? ' is-dragging' : ''}${isSelectedFolder ? ' selected' : ''}`}
|
||||
id={`folder-row-${folder.id}`}
|
||||
onClick={(event) => onFolderClick?.(folder, event)}
|
||||
onDoubleClick={(event) => {
|
||||
|
||||
@@ -55,7 +55,7 @@ export interface UseDocumentsPanelPropsArgs {
|
||||
clearDocumentSelection?: () => void;
|
||||
handleDeleteSelection?: () => void;
|
||||
handleEntryPointerCore?: (...args: unknown[]) => void;
|
||||
inspectDocument?: (docId: Identifier | null, metadata?: unknown) => void;
|
||||
onDocumentActivate?: (docId: Identifier | null, metadata?: unknown) => void;
|
||||
tags?: unknown[];
|
||||
correspondents?: unknown[];
|
||||
documentLookup?: unknown;
|
||||
@@ -107,7 +107,7 @@ const useDocumentsPanelProps = (props: UseDocumentsPanelPropsArgs) => {
|
||||
handleDocumentsViewModeChange,
|
||||
handleDeleteSelection,
|
||||
handleEntryPointerCore,
|
||||
inspectDocument,
|
||||
onDocumentActivate,
|
||||
tags,
|
||||
correspondents,
|
||||
documentLookup,
|
||||
@@ -159,7 +159,7 @@ const useDocumentsPanelProps = (props: UseDocumentsPanelPropsArgs) => {
|
||||
onViewModeChange: handleDocumentsViewModeChange,
|
||||
onDeleteSelection: handleDeleteSelection,
|
||||
onEntryPointer: handleEntryPointerCore,
|
||||
onInspectDocument: inspectDocument,
|
||||
onDocumentActivate,
|
||||
tags,
|
||||
correspondents,
|
||||
documentLookup,
|
||||
@@ -206,7 +206,7 @@ const useDocumentsPanelProps = (props: UseDocumentsPanelPropsArgs) => {
|
||||
handleFolderDragEnd,
|
||||
handleFolderDragStart,
|
||||
handleFolderRename,
|
||||
inspectDocument,
|
||||
onDocumentActivate,
|
||||
moveDocumentsToFolder,
|
||||
openDocumentPreview,
|
||||
refreshCurrentFolder,
|
||||
|
||||
@@ -61,7 +61,7 @@ const DocumentsPanelInner: React.FC<DocumentsPanelInnerProps> = ({
|
||||
onDocumentDragEnd,
|
||||
onDocumentRename,
|
||||
onEntryPointer = null,
|
||||
onInspectDocument = null,
|
||||
onDocumentActivate = null,
|
||||
tagLookupById,
|
||||
activeCorrespondentIds = [],
|
||||
ensureAssetUrl = null,
|
||||
@@ -368,9 +368,9 @@ type ZoomSource = { url: string; alt?: string | null; mimeType?: string | null }
|
||||
handleDocumentPreviewZoom(doc);
|
||||
return;
|
||||
}
|
||||
onInspectDocument?.(doc.id);
|
||||
onDocumentActivate?.(doc.id);
|
||||
},
|
||||
[handleDocumentPreviewZoom, onInspectDocument],
|
||||
[handleDocumentPreviewZoom, onDocumentActivate],
|
||||
);
|
||||
|
||||
const navigableRows = useMemo(
|
||||
|
||||
@@ -29,7 +29,7 @@ interface UseEntryPointerOptions {
|
||||
resolveDocumentRowKey?: (id: string | number) => string | null;
|
||||
resolveFolderRowKey?: (id: string | number) => string | null;
|
||||
onSelectEntry?: (entry: WorkspaceEntry, event?: PointerEventLike | null, metadata?: EntryPointerMetadata) => void;
|
||||
onInspectDocument?: (id: string | number, metadata?: EntryPointerMetadata) => void;
|
||||
onDocumentActivate?: (id: string | number, metadata?: EntryPointerMetadata) => void;
|
||||
}
|
||||
|
||||
export interface EntryPointerMetadata {
|
||||
@@ -44,7 +44,7 @@ export const useEntryPointer = ({
|
||||
resolveDocumentRowKey,
|
||||
resolveFolderRowKey,
|
||||
onSelectEntry,
|
||||
onInspectDocument,
|
||||
onDocumentActivate,
|
||||
}: UseEntryPointerOptions) =>
|
||||
useCallback(
|
||||
(entry?: WorkspaceEntry | null, event?: PointerEventLike | null) => {
|
||||
@@ -70,10 +70,10 @@ export const useEntryPointer = ({
|
||||
onSelectEntry?.(entry, event, metadata);
|
||||
|
||||
if (type === 'document' && !modifierClick && primaryClick) {
|
||||
onInspectDocument?.(id, metadata);
|
||||
onDocumentActivate?.(id, metadata);
|
||||
}
|
||||
},
|
||||
[resolveDocumentRowKey, resolveFolderRowKey, onSelectEntry, onInspectDocument],
|
||||
[resolveDocumentRowKey, resolveFolderRowKey, onSelectEntry, onDocumentActivate],
|
||||
);
|
||||
|
||||
export default useEntryPointer;
|
||||
|
||||
Reference in New Issue
Block a user