Feature/lbx 793#2390
Conversation
Introduced a new helper component for rendering file entry icons based on file extensions. This includes support for image, audio, video, archive, disc, script, save, patch, and code file types, enhancing the user interface for file management.
Added a new FileExplorerModal component to facilitate directory selection within the application. This modal allows users to navigate their file system, view directory contents, and select directories for download paths. Integrated necessary hooks and state management for loading directories and handling user interactions. Updated relevant styles and added new helper functions for file handling.
Greptile SummaryThis PR adds a custom
Confidence Score: 4/5Safe to merge once the symlink resolution in readDirectory is addressed; all other changes are additive and well-structured. The readDirectory handler classifies Dirent entries using isDirectory()/isFile() which return false for symlinks. On macOS and Linux, symlinked directories silently become unnavigable in selectDirectory mode — the user can see them but clicking navigates nowhere useful. This is a real usability defect on non-Windows platforms. Everything else (drive listing, filter logic, gamepad navigation hooks, cancellation) looks correct. src/main/events/misc/file-system.ts — the symlink classification block inside readDirectory's Promise.all mapper Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant UI as FileExplorerModal
participant Hook as useFileExplorer
participant Preload as contextBridge
participant Main as file-system.ts (main)
UI->>Hook: "visible=true, initialPath"
Hook->>Preload: listDrives()
Preload->>Main: ipcRenderer.invoke("listDrives")
Main-->>Preload: string[] (drive letters / "/")
Preload-->>Hook: drives[]
Hook->>Hook: setDrives / showDriveList
UI->>Hook: user selects drive / types path
Hook->>Preload: readDirectory(path)
Preload->>Main: ipcRenderer.invoke("readDirectory", path)
Main-->>Preload: DirectoryEntry[]
Preload-->>Hook: entries[]
Hook->>Hook: filteredEntries (matchesFilters)
UI->>Hook: user types path + Enter
Hook->>Preload: getPathInfo(path)
Preload->>Main: ipcRenderer.invoke("getPathInfo", path)
Main-->>Preload: "PathInfo {exists, isDirectory}"
Preload-->>Hook: pathInfo
Hook->>Hook: setCurrentPath or reset input
UI->>Hook: user clicks Select this directory
Hook->>UI: onSelect(currentPath)
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant UI as FileExplorerModal
participant Hook as useFileExplorer
participant Preload as contextBridge
participant Main as file-system.ts (main)
UI->>Hook: "visible=true, initialPath"
Hook->>Preload: listDrives()
Preload->>Main: ipcRenderer.invoke("listDrives")
Main-->>Preload: string[] (drive letters / "/")
Preload-->>Hook: drives[]
Hook->>Hook: setDrives / showDriveList
UI->>Hook: user selects drive / types path
Hook->>Preload: readDirectory(path)
Preload->>Main: ipcRenderer.invoke("readDirectory", path)
Main-->>Preload: DirectoryEntry[]
Preload-->>Hook: entries[]
Hook->>Hook: filteredEntries (matchesFilters)
UI->>Hook: user types path + Enter
Hook->>Preload: getPathInfo(path)
Preload->>Main: ipcRenderer.invoke("getPathInfo", path)
Main-->>Preload: "PathInfo {exists, isDirectory}"
Preload-->>Hook: pathInfo
Hook->>Hook: setCurrentPath or reset input
UI->>Hook: user clicks Select this directory
Hook->>UI: onSelect(currentPath)
Reviews (2): Last reviewed commit: "refactor: restructure FileExplorerModal ..." | Re-trigger Greptile |
|
@greptile |
Refactored the FileExplorerModal to use dynamic titles for empty states and improved error handling in the useFileExplorer hook. Introduced a new error message mapping for better user feedback and ensured proper path management when navigating directories. Updated the preload API to streamline file system interactions.
Modified the type definitions in declaration.d.ts to use rest parameters for the listener functions in the on and off methods. This change enhances type safety and aligns with TypeScript best practices.
Updated the useFileExplorer hook to resolve the initial path dynamically, improving path management and user experience. Refactored the GameCompatibilitySettingsTab and GameCustomizationSettingsTab components to integrate the FileExplorerModal for selecting wine prefixes and assets, respectively. Adjusted state handling and callback functions for better clarity and functionality across the game settings modal components.
… and state management Updated the GameCompatibilitySettingsTab to include a dynamic initial path for the wine prefix selection. Refactored the GameLaunchSettingsTab to implement platform-specific executable filters, improving the user experience when selecting game executables. Adjusted the GameCustomizationSettingsTab to use explicit image file extensions, ensuring clarity and consistency in asset selection.
|



No description provided.