This commit is contained in:
2025-11-13 13:22:10 +01:00
parent 98165f71b0
commit dfbd47f219
12 changed files with 93 additions and 107 deletions
+3 -3
View File
@@ -30,7 +30,7 @@ interface DesktopDocumentCardProps {
getDocumentAsset?: (...args: any[]) => unknown;
handleNavigatorSnapshot?: (...args: any[]) => void;
cardPointerHandlers?: React.HTMLAttributes<HTMLDivElement>;
onDocumentOpen?: (id: string | number) => void;
onInspectDocument?: (id: string | number) => void;
onTagDragEnter?: (event: React.DragEvent<HTMLDivElement>, docId: string | number) => void;
onTagDragOver?: (event: React.DragEvent<HTMLDivElement>, docId: string | number) => void;
onTagDragLeave?: (event: React.DragEvent<HTMLDivElement>, docId: string | number) => void;
@@ -57,7 +57,7 @@ const DesktopDocumentCard: React.FC<DesktopDocumentCardProps> = ({
getDocumentAsset,
handleNavigatorSnapshot,
cardPointerHandlers,
onDocumentOpen,
onInspectDocument,
onTagDragEnter,
onTagDragOver,
onTagDragLeave,
@@ -117,7 +117,7 @@ const DesktopDocumentCard: React.FC<DesktopDocumentCardProps> = ({
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
preventAll(event);
onDocumentOpen?.(doc.id);
onInspectDocument?.(doc.id);
}
}}
>
+2 -8
View File
@@ -119,7 +119,6 @@ type WorkspaceSnapshotState = {
interface DesktopWorkspaceProps {
documents?: DeskDocument[];
searchResults?: DeskDocument[] | null;
onDocumentOpen?: (docId: Identifier | null, options?: Record<string, unknown>) => void;
onInspectDocument?: (...args: unknown[]) => void;
onEntryPointer?: (...args: unknown[]) => void;
onDocumentStackSelect?: (docIds: Identifier[]) => void;
@@ -154,7 +153,6 @@ interface DesktopWorkspaceViewProps {
tagDropTargetId: string | null;
pendingTagDocId: string | null;
pendingRemovalTag: unknown;
onDocumentOpen?: DesktopWorkspaceProps['onDocumentOpen'];
ensureAssetUrl?: DesktopWorkspaceProps['ensureAssetUrl'];
getDocumentAsset?: DesktopWorkspaceProps['getDocumentAsset'];
handleNavigatorSnapshot: (docId: Identifier | null, snapshot: NavigatorSnapshot | null) => void;
@@ -199,7 +197,6 @@ const DEBUG_FOCUS = false;
const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
documents = [],
searchResults = null,
onDocumentOpen,
onInspectDocument = null,
onEntryPointer = null,
onDocumentStackSelect = null,
@@ -717,7 +714,6 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
tagDropTargetId,
pendingTagDocId,
pendingRemovalTag,
onDocumentOpen,
ensureAssetUrl,
getDocumentAsset,
handleNavigatorSnapshot,
@@ -783,7 +779,6 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
layoutSnapshot,
onClearSelection,
onCloseDetailPanel,
onDocumentOpen,
onDocumentStackSelect,
onEntryPointer,
onPromoteSelection,
@@ -824,7 +819,6 @@ function DesktopWorkspaceView({
tagDropTargetId,
pendingTagDocId,
pendingRemovalTag,
onDocumentOpen,
ensureAssetUrl,
getDocumentAsset,
handleNavigatorSnapshot,
@@ -900,7 +894,7 @@ function DesktopWorkspaceView({
onEntryPointer,
onDocumentStackSelect,
onPromoteSelection,
onDocumentOpen,
onInspectDocument,
selectedDocumentIds,
detailPanelOpen,
onCloseDetailPanel,
@@ -1041,7 +1035,7 @@ function DesktopWorkspaceView({
getDocumentAsset={getDocumentAsset}
handleNavigatorSnapshot={handleNavigatorSnapshot}
cardPointerHandlers={cardPointerHandlers}
onDocumentOpen={onDocumentOpen}
onInspectDocument={onInspectDocument}
onTagDragEnter={handleTagDragEnterDoc}
onTagDragOver={handleTagDragOverDoc}
onTagDragLeave={handleTagDragLeaveDoc}
@@ -35,7 +35,7 @@ export const useDeskPointer = ({
onEntryPointer,
onDocumentStackSelect,
onPromoteSelection,
onDocumentOpen,
onInspectDocument,
selectedDocumentIds,
detailPanelOpen,
onCloseDetailPanel,
@@ -327,8 +327,7 @@ export const useDeskPointer = ({
const stillSelected = Array.isArray(selectedDocumentIds)
&& selectedDocumentIds.includes(doc.id);
if (isPrimaryRelease && stillSelected) {
const useSelection = pointerState.selectedAtDown && pointerState.selectionCountAtDown > 0;
safeInvoke(onDocumentOpen, doc.id, { useSelection });
safeInvoke(onInspectDocument, doc.id);
}
}
}
@@ -338,7 +337,7 @@ export const useDeskPointer = ({
},
[
handlePointerUp,
onDocumentOpen,
onInspectDocument,
onDocumentStackSelect,
onEntryPointer,
resetLongPressState,
@@ -62,7 +62,6 @@ interface UseDeskWorkspacePropsArgs {
searchQuery?: string;
activeCorrespondentFilters?: Identifier[];
selectedFolder?: Identifier | string | null;
openDetailPanel?: (args: { documentIds: Identifier[] }) => void;
}
const useDeskWorkspaceProps = ({
@@ -111,7 +110,6 @@ const useDeskWorkspaceProps = ({
searchQuery = '',
activeCorrespondentFilters = [],
selectedFolder,
openDetailPanel,
}: UseDeskWorkspacePropsArgs) => {
const handleDeskDocumentStackSelect: DeskDocumentStackSelectHandler = useCallback(
(docIds) => {
@@ -146,30 +144,6 @@ const useDeskWorkspaceProps = ({
[applySelection, resolveDocumentRowKey, selectedEntries, selectionAnchorRef],
);
const handleDeskDocumentOpen = useCallback(
(docId: Identifier | undefined, { useSelection = false }: { useSelection?: boolean } = {}) => {
const selectionDocIds = Array.isArray(selectedDocumentIds)
? selectedDocumentIds
: [];
let targetIds: Identifier[] = [];
if ((useSelection || selectionDocIds.includes(docId as Identifier)) && selectionDocIds.length) {
targetIds = selectionDocIds;
} else if (selectionDocIds.length) {
targetIds = selectionDocIds;
} else if (docId) {
targetIds = [docId];
}
if (!targetIds.length) {
return;
}
openDetailPanel?.({ documentIds: targetIds });
},
[openDetailPanel, selectedDocumentIds],
);
const deskViewId = useMemo(() => {
if (showingSearchResults) {
const trimmedQuery = searchQuery.trim();
@@ -198,7 +172,6 @@ const useDeskWorkspaceProps = ({
onViewModeChange: handleDocumentsViewModeChange,
onExit: handleDeskExit,
onRefresh: refreshCurrentFolder,
onDocumentOpen: handleDeskDocumentOpen,
onInspectDocument: inspectDocument,
onEntryPointer: handleEntryPointerCore,
onDocumentStackSelect: handleDeskDocumentStackSelect,
@@ -240,7 +213,6 @@ const useDeskWorkspaceProps = ({
handleDocumentsViewModeChange,
handleDeskExit,
refreshCurrentFolder,
handleDeskDocumentOpen,
inspectDocument,
handleEntryPointerCore,
handleDeskDocumentStackSelect,