Allow creating new files (#437)

* allow creating new files

* icon and translation key fix

* Change how new file works

* Fix selected file in tree view

* Reword to "New empty file"

* Reword to "Save as"

---------

Co-authored-by: Flemmli97 <Flemmli97@users.noreply.github.com>
Co-authored-by: Misode <misoloo64@gmail.com>
This commit is contained in:
Flemmli97
2023-12-03 22:25:52 +01:00
committed by GitHub
parent fcffbc9712
commit 33d90f9126
3 changed files with 22 additions and 6 deletions

View File

@@ -124,8 +124,9 @@ export function ProjectPanel({ onRename, onCreate, onDeleteProject }: Props) {
evt.preventDefault()
setFocus()
}
return <div class={`entry ${entry === selected ? 'active' : ''} ${focused ? 'focused' : ''}`} onClick={() => selectFile(entry)} onContextMenu={onContextMenu} >
const file = disectEntry(entry)
return <div class={`entry ${file && getFilePath(file) === selected ? 'active' : ''} ${focused ? 'focused' : ''}`} onClick={() => selectFile(entry)} onContextMenu={onContextMenu} >
{Octicon.file}
<span>{entry.split('/').at(-1)}</span>
{focused && <div class="entry-menu">
@@ -135,7 +136,7 @@ export function ProjectPanel({ onRename, onCreate, onDeleteProject }: Props) {
</div>)}
</div>}
</div>
}, [actions])
}, [actions, disectEntry])
return <>
<div class="project-controls">