Franknoirot/file tree fixes (#2525)

* Navigate between files with single-click

* Better semantic name for optional event passed into FileTree

* Bug fix: reset modeling state when navigating to a new file

* Add more context to E2E test TODO comment

* Newly-created file tree items are immediately set to renaming mode

* Bug fix: redirect to working file if you delete your current one

* Remove ContextMenu, unrelated branch

* Turn off autocorrect in renaming form

* Gracefully handle renaming a folder that our current file is inside of

* Update cargo.lock

* Fix renaming queue

* Navigate to newly-created files

* Make delete project and delete file/folder share deletion confirmation component

* Bug fix: navigate to project root if we delete our current file's parent directory

* Don't navigate to newly-created directories
This commit is contained in:
Frank Noirot
2024-05-24 18:12:39 -04:00
committed by GitHub
parent c93ed0f306
commit 062abd148f
8 changed files with 296 additions and 252 deletions

View File

@ -5,7 +5,7 @@ import { ActionButton } from '../ActionButton'
import { FILE_EXT } from 'lib/constants'
import { useHotkeys } from 'react-hotkeys-hook'
import Tooltip from '../Tooltip'
import { DeleteProjectDialog } from './DeleteProjectDialog'
import { DeleteConfirmationDialog } from './DeleteProjectDialog'
import { ProjectCardRenameForm } from './ProjectCardRenameForm'
import { Project } from 'wasm-lib/kcl/bindings/Project'
@ -160,14 +160,23 @@ function ProjectCard({
</div>
)}
{isConfirmingDelete && (
<DeleteProjectDialog
projectName={project.name}
<DeleteConfirmationDialog
title="Delete Project"
onConfirm={async () => {
await handleDeleteProject(project)
setIsConfirmingDelete(false)
}}
onDismiss={() => setIsConfirmingDelete(false)}
/>
>
<p className="my-4">
This will permanently delete "{project.name || 'this file'}
".
</p>
<p className="my-4">
Are you sure you want to delete "{project.name || 'this file'}
"? This action cannot be undone.
</p>
</DeleteConfirmationDialog>
)}
</li>
)