Skip to content

v3.0.3: feat(first-run): Add folder browser for path selection

Choose a tag to compare

@github-actions github-actions released this 30 Apr 11:23
· 71 commits to main since this release
Adds a folder browser dialog to the first-run configuration wizard,
allowing users to select directory paths instead of manually typing them.
This improves user experience and reduces potential path errors.

- Frontend (`first_run_frontend`):
  - Added new `FolderBrowserDialog` component (`src/FolderBrowserDialog.tsx`)
    using `@radix-ui/react-dialog` and `lucide-react` icons.
  - Component fetches directory listings from the backend `/api/browse`.
  - Supports navigating directories, showing/hiding hidden files, and
    selecting the current path.
  - Added basic styling in `src/FolderBrowserDialog.css`.
  - Integrated the dialog into `src/App.tsx`:
    - Added state to manage dialog visibility and the target field.
    - Added folder icon buttons next to `folderPath`, `dbPath`, and
      `backupFolderPath` fields to trigger the dialog.
    - Updated form fields with the selected path using `setValue`.
    - Added `@radix-ui/react-dialog` and `lucide-react` dependencies
      in `package.json`.
  - Updated error handling in `onSubmit` in `src/App.tsx` for better
    type checking.
  - **Unrelated Change**: Adjusted the range and step of the
    `maxThumbnailWorkers` slider in `src/App.tsx` from 240-1024 (step 16)
    to 1-32 (step 1).

- Backend (`src/server/first_run.rs`):
  - Added a new POST endpoint `/api/browse`.
  - Implemented the `browse_directory` handler function:
    - Accepts a path and a `showHidden` flag in the request body.
    - Reads the contents of the specified directory.
    - Filters results to show only directories.
    - Optionally includes hidden directories (starting with '.').
    - Sorts directory entries alphabetically.
    - Includes a ".." entry for navigating to the parent directory.
    - Returns a JSON response with the list of `DirectoryItem`s.
  - Added `DirectoryItem` and `BrowseRequest` structs with
    `Serialize`/`Deserialize`.
  - Implemented `Ord`, `PartialOrd`, `PartialEq`, `Eq` for `DirectoryItem`
    to enable sorting.

- Documentation (`TODO.md`):
  - Marked the task for adding folder exploration as complete.
  - Removed duplicate TODO item.