mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 07:32:54 +00:00
* feat(sftp): add onListDirectory to SftpPaneCallbacks interface Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * feat(sftp): implement onListDirectory in left and right callbacks * feat(sftp): add tree view i18n keys * feat(sftp): add list/tree view mode toggle to toolbar * feat(sftp): add viewMode state and tree view conditional rendering to SftpPaneView * feat(sftp): implement SftpPaneTreeView with lazy loading and context menu Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix(sftp): resolve lint errors in tree view implementation Rename inner `t` and `ts` variables in onListDirectory callbacks to `toSize`/`toTs`/`ms` to avoid shadowing the outer `t` translation param. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix(sftp): resolve post-merge lint errors - Remove duplicate sftp.context.copyPath i18n key (upstream added it too) - Remove unused AlertCircle import from SftpPaneFileList (upstream removed usage) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * perf(sftp): optimize SftpPaneTreeView render pipeline Split useMemo into two stages so selection changes no longer rebuild the full node descriptor array. Extract stable selection-aware callbacks (drag, copy, delete) via refs so TreeNode React.memo can reliably bail out. Remove unused props (onNavigateTo, draggedFiles), move NodeDescriptor type to module scope, and fix selectedFiles undefined bug in context menu. * feat(sftp): add path-aware rename and delete for tree view Wire renameFileAtPath and deleteFilesAtPath through the full callback stack so tree view context menu actions operate on full paths instead of basenames. Update useSftpPaneDialogs to accept entryPath in openRenameDialog and resolve parent dir in handleDelete, keeping list view behaviour unchanged. * fix: harden SFTP tree view actions and selection * fix: support tree selection shortcuts and nested create targets * fix: keep SFTP tree view sorting in sync * Improve SFTP tree view interactions and refresh behavior * Optimize SFTP tree refresh and pane state usage * Reduce remaining SFTP tree performance overhead * Fix nested SFTP drop target routing * Restore keyboard access to parent tree entry * Revert "Display approved AI commands in terminal sessions before their output. (#546)" This reverts commit6d19413025. * Fix SFTP tree view review issues: accessibility, view persistence, and polish - Add aria-pressed/aria-checked to view mode toggle buttons for accessibility - Preserve tree expanded state across view mode switches (CSS hidden instead of unmount) - Add cross-window localStorage sync for view mode preferences - Add loading/reconnecting overlay UI for tree view - Fix toggleExpand concurrent load guard and file list memo dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix review round 2: scroll jank, memo correctness, path handling, a11y Critical: - Fix rAF scroll throttle capturing stale scrollTop (use ref for latest value) - Add sftpDefaultViewMode to memo comparator to react to settings changes - Replace ad-hoc path splitting in handleDelete with getParentPath/getFileName - Add fullPath to permissionsState prop type in SftpOverlays Important: - Remove treeSelectionState from handleNodeClick/handleTreeContainerKeyDown deps to prevent full tree re-render on every expand/collapse - Add role="radiogroup" container and aria-label to view toggle buttons - Wrap JSON.parse in try/catch for storage event handler - Deduplicate getParentPath call in renameFileAtPath - Parallelize reloadExpandedPaths with Promise.all Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Clean up review round 3: dead code, logging, and minor optimizations - Remove dead isParentNavigation field from tree selection store (always false since ".." entries are filtered before entering the store) - Replace empty catch blocks in dialog handlers with logger.warn - Extract duplicated initialViewMode expression in SftpPaneView - Stabilize handleSetViewMode by using refs for callbacks instead of depending on the entire callbacks object - Remove redundant FINISH_LOADING dispatch on error path in loadChildrenForPath (LOAD_ERROR already removes from loadingPaths) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add same-pane drag-move, move-to dialog, and fix breadcrumb/tree sync Features: - Same-pane drag-and-drop to move files between directories in tree view - "Move to..." context menu with path input dialog and autocomplete - "Move to parent directory" quick action in context menu - "Navigate to" context menu item for directories - Error state UI with retry button in tree view - Breadcrumb path deferred display during loading Fixes: - Fix breadcrumb and tree content showing different paths during navigation by atomically syncing resolvedRootPath and rootEntries in a single effect - Fix toolbar displayPath updating before files load (defer until !loading) - Reconnection detection and session error reporting in tree directory listing UI improvements: - Column widths use minmax()+fr instead of percentages with min-width protection - Column headers truncate with overflow protection - buildSftpColumnTemplate utility shared between tree and list views - Column resize limits per field Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Reapply "Display approved AI commands in terminal sessions before their output. (#546)" This reverts commitf739e81e8d. * fix: resolve remote-to-local drag transfer source pane * fix: invalidate target cache after transfers * fix: reload tree root after create mutations * fix: use receive callback for tree drop targets * fix: trigger pane refresh after transfer completion * fix: handle transfer refresh tokens only once * fix: show move-to-parent for direct children * fix: refresh list view after move-to-parent changes * fix: address review issues in transfer refresh and retry flows * feat: improve list view keyboard and folder drops * fix: strengthen list view keyboard selection feedback * style: make list view selection more obvious * fix: keep list selection visible during keyboard navigation * fix: rerender list rows when selection changes * fix: sync list selection highlight updates * style: align list selection with tree view * style: hide list selection highlight when pane is unfocused * feat: clear list selection when clicking empty space * refine transfer row layout and clear list selection on empty click * perf: make transfer size discovery asynchronous * perf: parallelize SFTP transfers and show per-file progress for directories - Parallelize file transfers within directories (4 concurrent workers) - Batch pre-create all directories before file uploads begin - Run conflict check and size discovery concurrently - Parallelize external drag-drop file uploads (4 concurrent workers) - Show individual child file progress under parent directory task - Parent directory task displays file count progress (e.g. "3/10 files") - Child tasks auto-cleanup on parent completion or cancellation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refine sftp transfer panel ux * fix sftp sidebar and upload task flow * polish sftp transfer interactions --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
450 lines
16 KiB
TypeScript
450 lines
16 KiB
TypeScript
/**
|
|
* SftpView - SFTP File Browser (Refactored)
|
|
*
|
|
* This is the main SFTP view component that provides a dual-pane file browser
|
|
* for transferring files between local and remote systems.
|
|
*
|
|
* Components have been extracted to:
|
|
* - components/sftp/utils.ts - Utility functions
|
|
* - components/sftp/SftpBreadcrumb.tsx - Path navigation
|
|
* - components/sftp/SftpFileRow.tsx - File list row
|
|
* - components/sftp/SftpTransferItem.tsx - Transfer queue item
|
|
* - components/sftp/SftpConflictDialog.tsx - Conflict resolution
|
|
* - components/sftp/SftpPermissionsDialog.tsx - Permissions editor
|
|
* - components/sftp/SftpHostPicker.tsx - Host selection dialog
|
|
*/
|
|
|
|
import React, { memo, useCallback, useLayoutEffect, useMemo, useRef } from "react";
|
|
import { useI18n } from "../application/i18n/I18nProvider";
|
|
import { useIsSftpActive } from "../application/state/activeTabStore";
|
|
import { useSftpState } from "../application/state/useSftpState";
|
|
import { useSftpBackend } from "../application/state/useSftpBackend";
|
|
import { HotkeyScheme, KeyBinding } from "../domain/models";
|
|
import { logger } from "../lib/logger";
|
|
import { useRenderTracker } from "../lib/useRenderTracker";
|
|
import { cn } from "../lib/utils";
|
|
import { useInstantThemeSwitch } from "../lib/useInstantThemeSwitch";
|
|
import { Host, Identity, SSHKey } from "../types";
|
|
import { useSftpFileAssociations } from "../application/state/useSftpFileAssociations";
|
|
import { toast } from "./ui/toast";
|
|
|
|
// Import extracted components
|
|
import { SftpTabBar } from "./sftp";
|
|
import { SftpPaneView, SftpPaneWrapper } from "./sftp/SftpPaneView";
|
|
import { SftpOverlays } from "./sftp/SftpOverlays";
|
|
import { Loader2 } from "lucide-react";
|
|
|
|
// Import context hooks
|
|
import { SftpContextProvider, activeTabStore } from "./sftp";
|
|
import { useSftpViewPaneCallbacks } from "./sftp/hooks/useSftpViewPaneCallbacks";
|
|
import { useSftpViewTabs } from "./sftp/hooks/useSftpViewTabs";
|
|
import { useSftpKeyboardShortcuts } from "./sftp/hooks/useSftpKeyboardShortcuts";
|
|
import { sftpFocusStore, SftpFocusedSide, useSftpFocusedSide } from "./sftp/hooks/useSftpFocusedPane";
|
|
|
|
// Wrapper component that subscribes to activeTabId for CSS visibility
|
|
// This isolates the activeTabId subscription - only this component re-renders on tab switch
|
|
// Uses visibility:hidden pattern from App.tsx for smooth tab switching
|
|
// Main SftpView component
|
|
interface SftpViewProps {
|
|
hosts: Host[];
|
|
keys: SSHKey[];
|
|
identities: Identity[];
|
|
updateHosts: (hosts: Host[]) => void;
|
|
sftpDefaultViewMode: "list" | "tree";
|
|
sftpDoubleClickBehavior: "open" | "transfer";
|
|
sftpAutoSync: boolean;
|
|
sftpShowHiddenFiles: boolean;
|
|
sftpUseCompressedUpload: boolean;
|
|
hotkeyScheme: HotkeyScheme;
|
|
keyBindings: KeyBinding[];
|
|
editorWordWrap: boolean;
|
|
setEditorWordWrap: (enabled: boolean) => void;
|
|
}
|
|
|
|
const SftpViewInner: React.FC<SftpViewProps> = ({
|
|
hosts,
|
|
keys,
|
|
identities,
|
|
updateHosts,
|
|
sftpDefaultViewMode,
|
|
sftpDoubleClickBehavior,
|
|
sftpAutoSync,
|
|
sftpShowHiddenFiles,
|
|
sftpUseCompressedUpload,
|
|
hotkeyScheme,
|
|
keyBindings,
|
|
editorWordWrap,
|
|
setEditorWordWrap,
|
|
}) => {
|
|
const { t } = useI18n();
|
|
const isActive = useIsSftpActive();
|
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
|
|
useInstantThemeSwitch(rootRef);
|
|
|
|
// File watch event handlers (stable refs to avoid re-creating the useSftpState options)
|
|
const fileWatchHandlers = useMemo(() => ({
|
|
onFileWatchSynced: (payload: { remotePath: string }) => {
|
|
const fileName = payload.remotePath.split('/').pop() || payload.remotePath;
|
|
toast.success(t('sftp.autoSync.success', { fileName }));
|
|
logger.info("[SFTP] File auto-synced to remote", payload);
|
|
},
|
|
onFileWatchError: (payload: { error: string }) => {
|
|
toast.error(t('sftp.autoSync.error', { error: payload.error }));
|
|
logger.error("[SFTP] File auto-sync failed", payload);
|
|
},
|
|
}), [t]);
|
|
|
|
const sftpOptions = useMemo(() => ({
|
|
...fileWatchHandlers,
|
|
useCompressedUpload: sftpUseCompressedUpload,
|
|
defaultShowHiddenFiles: sftpShowHiddenFiles,
|
|
}), [fileWatchHandlers, sftpUseCompressedUpload, sftpShowHiddenFiles]);
|
|
|
|
const sftp = useSftpState(hosts, keys, identities, sftpOptions);
|
|
|
|
// Get backend helpers for file downloads and local filesystem writes.
|
|
const {
|
|
showSaveDialog,
|
|
selectDirectory,
|
|
startStreamTransfer,
|
|
listSftp,
|
|
mkdirLocal,
|
|
deleteLocalFile,
|
|
listLocalDir,
|
|
} = useSftpBackend();
|
|
|
|
// Store sftp in a ref so callbacks can access the latest instance
|
|
// without needing to re-create when sftp changes
|
|
const sftpRef = useRef(sftp);
|
|
sftpRef.current = sftp;
|
|
|
|
// Store behavior setting in ref for stable callbacks
|
|
const behaviorRef = useRef(sftpDoubleClickBehavior);
|
|
behaviorRef.current = sftpDoubleClickBehavior;
|
|
|
|
// Store auto-sync setting in ref for stable callbacks
|
|
const autoSyncRef = useRef(sftpAutoSync);
|
|
autoSyncRef.current = sftpAutoSync;
|
|
|
|
// SFTP keyboard shortcuts handler
|
|
useSftpKeyboardShortcuts({
|
|
keyBindings,
|
|
hotkeyScheme,
|
|
sftpRef,
|
|
isActive,
|
|
});
|
|
|
|
// Subscribe to focused side for visual indicator
|
|
const focusedSide = useSftpFocusedSide();
|
|
|
|
// Handle pane focus when clicking on a pane container
|
|
const handlePaneFocus = useCallback((side: SftpFocusedSide) => {
|
|
sftpFocusStore.setFocusedSide(side);
|
|
}, []);
|
|
|
|
const handleToggleHiddenFiles = useCallback((side: "left" | "right", paneId: string) => {
|
|
const sideTabs = side === "left" ? sftpRef.current.leftTabs : sftpRef.current.rightTabs;
|
|
const pane = sideTabs.tabs.find((tab) => tab.id === paneId);
|
|
if (!pane) return;
|
|
|
|
sftpRef.current.setShowHiddenFiles(side, paneId, !pane.showHiddenFiles);
|
|
}, []);
|
|
|
|
// Sync activeTabId to external store (allows child components to subscribe without parent re-render)
|
|
// Using useLayoutEffect to sync before paint
|
|
useLayoutEffect(() => {
|
|
activeTabStore.setActiveTabId("left", sftp.leftTabs.activeTabId);
|
|
}, [sftp.leftTabs.activeTabId]);
|
|
|
|
useLayoutEffect(() => {
|
|
activeTabStore.setActiveTabId("right", sftp.rightTabs.activeTabId);
|
|
}, [sftp.rightTabs.activeTabId]);
|
|
|
|
// 渲染追踪 - 不追踪 activeTabId(现在通过 store 订阅)
|
|
useRenderTracker("SftpViewInner", {
|
|
isActive,
|
|
hostsCount: hosts.length,
|
|
leftTabsCount: sftp.leftTabs.tabs.length,
|
|
rightTabsCount: sftp.rightTabs.tabs.length,
|
|
});
|
|
const { getOpenerForFile, setOpenerForExtension } = useSftpFileAssociations();
|
|
|
|
const getOpenerForFileRef = useRef(getOpenerForFile);
|
|
getOpenerForFileRef.current = getOpenerForFile;
|
|
|
|
const {
|
|
leftCallbacks,
|
|
rightCallbacks,
|
|
dragCallbacks,
|
|
draggedFiles,
|
|
permissionsState,
|
|
setPermissionsState,
|
|
showTextEditor,
|
|
setShowTextEditor,
|
|
textEditorTarget,
|
|
setTextEditorTarget,
|
|
textEditorContent,
|
|
setTextEditorContent,
|
|
loadingTextContent,
|
|
showFileOpenerDialog,
|
|
setShowFileOpenerDialog,
|
|
fileOpenerTarget,
|
|
setFileOpenerTarget,
|
|
handleSaveTextFile,
|
|
handleFileOpenerSelect,
|
|
handleSelectSystemApp,
|
|
} = useSftpViewPaneCallbacks({
|
|
sftpRef,
|
|
behaviorRef,
|
|
autoSyncRef,
|
|
getOpenerForFileRef,
|
|
setOpenerForExtension,
|
|
t,
|
|
listSftp,
|
|
mkdirLocal,
|
|
deleteLocalFile,
|
|
showSaveDialog,
|
|
selectDirectory,
|
|
startStreamTransfer,
|
|
getSftpIdForConnection: sftp.getSftpIdForConnection,
|
|
listLocalFiles: listLocalDir,
|
|
});
|
|
|
|
const visibleTransfers = useMemo(
|
|
() => [...sftp.transfers].filter((t) => !t.parentTaskId).reverse().slice(0, 5),
|
|
[sftp.transfers],
|
|
);
|
|
|
|
const containerStyle: React.CSSProperties = isActive
|
|
? {}
|
|
: {
|
|
visibility: "hidden",
|
|
pointerEvents: "none",
|
|
position: "absolute",
|
|
zIndex: -1,
|
|
};
|
|
|
|
// Don't read activeTabId here - let SftpTabBar and SftpPaneWrapper subscribe to store
|
|
// This prevents SftpViewInner from re-rendering on tab switch
|
|
|
|
const {
|
|
leftPanes,
|
|
rightPanes,
|
|
leftTabsInfo,
|
|
rightTabsInfo,
|
|
showHostPickerLeft,
|
|
showHostPickerRight,
|
|
hostSearchLeft,
|
|
hostSearchRight,
|
|
setShowHostPickerLeft,
|
|
setShowHostPickerRight,
|
|
setHostSearchLeft,
|
|
setHostSearchRight,
|
|
handleAddTabLeft,
|
|
handleAddTabRight,
|
|
handleCloseTabLeft,
|
|
handleCloseTabRight,
|
|
handleSelectTabLeft,
|
|
handleSelectTabRight,
|
|
handleReorderTabsLeft,
|
|
handleReorderTabsRight,
|
|
handleMoveTabFromLeftToRight,
|
|
handleMoveTabFromRightToLeft,
|
|
handleHostSelectLeft,
|
|
handleHostSelectRight,
|
|
} = useSftpViewTabs({ sftp, sftpRef });
|
|
|
|
return (
|
|
<SftpContextProvider
|
|
hosts={hosts}
|
|
updateHosts={updateHosts}
|
|
draggedFiles={draggedFiles}
|
|
dragCallbacks={dragCallbacks}
|
|
leftCallbacks={leftCallbacks}
|
|
rightCallbacks={rightCallbacks}
|
|
>
|
|
<div
|
|
ref={rootRef}
|
|
className={cn(
|
|
"absolute inset-0 min-h-0 flex flex-col",
|
|
isActive ? "z-20" : "",
|
|
)}
|
|
style={containerStyle}
|
|
>
|
|
<div className="flex-1 grid grid-cols-1 lg:grid-cols-2 min-h-0 border-t border-border/70">
|
|
<div
|
|
className="relative border-r border-border/70 flex flex-col"
|
|
onClick={() => handlePaneFocus("left")}
|
|
>
|
|
{/* Focus indicator triangle */}
|
|
{focusedSide === "left" && (
|
|
<div
|
|
className="absolute top-0 left-0 z-50 pointer-events-none"
|
|
style={{
|
|
width: 0,
|
|
height: 0,
|
|
borderStyle: 'solid',
|
|
borderWidth: '12px 12px 0 0',
|
|
borderColor: 'hsl(var(--primary)) transparent transparent transparent',
|
|
}}
|
|
/>
|
|
)}
|
|
{/* Left side tab bar - only show when there are tabs */}
|
|
{leftTabsInfo.length > 0 && (
|
|
<SftpTabBar
|
|
tabs={leftTabsInfo}
|
|
side="left"
|
|
onSelectTab={handleSelectTabLeft}
|
|
onCloseTab={handleCloseTabLeft}
|
|
onAddTab={handleAddTabLeft}
|
|
onReorderTabs={handleReorderTabsLeft}
|
|
onMoveTabToOtherSide={handleMoveTabFromRightToLeft}
|
|
/>
|
|
)}
|
|
<div className="relative flex-1 min-h-0">
|
|
{leftPanes.map((pane, idx) => (
|
|
<SftpPaneWrapper
|
|
key={pane.id}
|
|
side="left"
|
|
paneId={pane.id}
|
|
isFirstPane={idx === 0}
|
|
>
|
|
<SftpPaneView
|
|
side="left"
|
|
pane={pane}
|
|
isPaneFocused={focusedSide === "left"}
|
|
sftpDefaultViewMode={sftpDefaultViewMode}
|
|
showHeader
|
|
showEmptyHeader={false}
|
|
onToggleShowHiddenFiles={() => handleToggleHiddenFiles("left", pane.id)}
|
|
/>
|
|
</SftpPaneWrapper>
|
|
))}
|
|
{/* Loading overlay for left pane - shown when loading text content */}
|
|
{loadingTextContent && textEditorTarget?.side === "left" && (
|
|
<div className="absolute inset-0 flex items-center justify-center bg-background/80 z-30">
|
|
<div className="flex flex-col items-center gap-2">
|
|
<Loader2 size={24} className="animate-spin text-muted-foreground" />
|
|
<span className="text-sm text-muted-foreground">{t("sftp.status.loading")}</span>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
<div
|
|
className="relative flex flex-col"
|
|
onClick={() => handlePaneFocus("right")}
|
|
>
|
|
{/* Focus indicator triangle */}
|
|
{focusedSide === "right" && (
|
|
<div
|
|
className="absolute top-0 left-0 z-50 pointer-events-none"
|
|
style={{
|
|
width: 0,
|
|
height: 0,
|
|
borderStyle: 'solid',
|
|
borderWidth: '12px 12px 0 0',
|
|
borderColor: 'hsl(var(--primary)) transparent transparent transparent',
|
|
}}
|
|
/>
|
|
)}
|
|
{/* Right side tab bar - only show when there are tabs */}
|
|
{rightTabsInfo.length > 0 && (
|
|
<SftpTabBar
|
|
tabs={rightTabsInfo}
|
|
side="right"
|
|
onSelectTab={handleSelectTabRight}
|
|
onCloseTab={handleCloseTabRight}
|
|
onAddTab={handleAddTabRight}
|
|
onReorderTabs={handleReorderTabsRight}
|
|
onMoveTabToOtherSide={handleMoveTabFromLeftToRight}
|
|
/>
|
|
)}
|
|
<div className="relative flex-1 min-h-0">
|
|
{rightPanes.map((pane, idx) => (
|
|
<SftpPaneWrapper
|
|
key={pane.id}
|
|
side="right"
|
|
paneId={pane.id}
|
|
isFirstPane={idx === 0}
|
|
>
|
|
<SftpPaneView
|
|
side="right"
|
|
pane={pane}
|
|
isPaneFocused={focusedSide === "right"}
|
|
sftpDefaultViewMode={sftpDefaultViewMode}
|
|
showHeader
|
|
showEmptyHeader={false}
|
|
onToggleShowHiddenFiles={() => handleToggleHiddenFiles("right", pane.id)}
|
|
/>
|
|
</SftpPaneWrapper>
|
|
))}
|
|
{/* Loading overlay for right pane - shown when loading text content */}
|
|
{loadingTextContent && textEditorTarget?.side === "right" && (
|
|
<div className="absolute inset-0 flex items-center justify-center bg-background/80 z-30">
|
|
<div className="flex flex-col items-center gap-2">
|
|
<Loader2 size={24} className="animate-spin text-muted-foreground" />
|
|
<span className="text-sm text-muted-foreground">{t("sftp.status.loading")}</span>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<SftpOverlays
|
|
hosts={hosts}
|
|
sftp={sftp}
|
|
visibleTransfers={visibleTransfers}
|
|
showHostPickerLeft={showHostPickerLeft}
|
|
showHostPickerRight={showHostPickerRight}
|
|
hostSearchLeft={hostSearchLeft}
|
|
hostSearchRight={hostSearchRight}
|
|
setShowHostPickerLeft={setShowHostPickerLeft}
|
|
setShowHostPickerRight={setShowHostPickerRight}
|
|
setHostSearchLeft={setHostSearchLeft}
|
|
setHostSearchRight={setHostSearchRight}
|
|
handleHostSelectLeft={handleHostSelectLeft}
|
|
handleHostSelectRight={handleHostSelectRight}
|
|
permissionsState={permissionsState}
|
|
setPermissionsState={setPermissionsState}
|
|
showTextEditor={showTextEditor}
|
|
setShowTextEditor={setShowTextEditor}
|
|
textEditorTarget={textEditorTarget}
|
|
setTextEditorTarget={setTextEditorTarget}
|
|
textEditorContent={textEditorContent}
|
|
setTextEditorContent={setTextEditorContent}
|
|
handleSaveTextFile={handleSaveTextFile}
|
|
editorWordWrap={editorWordWrap}
|
|
setEditorWordWrap={setEditorWordWrap}
|
|
showFileOpenerDialog={showFileOpenerDialog}
|
|
setShowFileOpenerDialog={setShowFileOpenerDialog}
|
|
fileOpenerTarget={fileOpenerTarget}
|
|
setFileOpenerTarget={setFileOpenerTarget}
|
|
handleFileOpenerSelect={handleFileOpenerSelect}
|
|
handleSelectSystemApp={handleSelectSystemApp}
|
|
t={t}
|
|
/>
|
|
</div>
|
|
</SftpContextProvider>
|
|
);
|
|
};
|
|
|
|
const sftpViewAreEqual = (prev: SftpViewProps, next: SftpViewProps): boolean =>
|
|
prev.hosts === next.hosts &&
|
|
prev.keys === next.keys &&
|
|
prev.identities === next.identities &&
|
|
prev.sftpDefaultViewMode === next.sftpDefaultViewMode &&
|
|
prev.sftpDoubleClickBehavior === next.sftpDoubleClickBehavior &&
|
|
prev.sftpAutoSync === next.sftpAutoSync &&
|
|
prev.sftpShowHiddenFiles === next.sftpShowHiddenFiles &&
|
|
prev.sftpUseCompressedUpload === next.sftpUseCompressedUpload &&
|
|
prev.hotkeyScheme === next.hotkeyScheme &&
|
|
prev.keyBindings === next.keyBindings &&
|
|
prev.editorWordWrap === next.editorWordWrap &&
|
|
prev.setEditorWordWrap === next.setEditorWordWrap;
|
|
|
|
export const SftpView = memo(SftpViewInner, sftpViewAreEqual);
|
|
SftpView.displayName = "SftpView";
|