move folder creation to sidebar
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
SettingsIcon,
|
||||
CheckIcon,
|
||||
PlusIcon,
|
||||
FolderPlusIcon,
|
||||
} from '../ui/icons';
|
||||
|
||||
import { getTagColorStyle } from '../utils/colors';
|
||||
@@ -139,6 +140,8 @@ const Sidebar = ({
|
||||
onFolderDragStart,
|
||||
onFolderDragEnd,
|
||||
draggedFolderId,
|
||||
onCreateFolder,
|
||||
creatingFolder = false,
|
||||
tags = [],
|
||||
activeTagIds = [],
|
||||
onToggleTagFilter,
|
||||
@@ -209,6 +212,14 @@ const Sidebar = ({
|
||||
console.error('[sidebar] failed to create correspondent', error);
|
||||
}
|
||||
}, [onCreateCorrespondent]);
|
||||
|
||||
const handleCreateFolder = useCallback(() => {
|
||||
if (creatingFolder) {
|
||||
return;
|
||||
}
|
||||
onCreateFolder?.();
|
||||
}, [creatingFolder, onCreateFolder]);
|
||||
|
||||
const handleSearchInputChange = useCallback(
|
||||
(event) => {
|
||||
onSearchChange?.(event.target.value);
|
||||
@@ -442,6 +453,19 @@ const Sidebar = ({
|
||||
<div className="sidebar-section sidebar-section--folders">
|
||||
<div className="sidebar-section__header">
|
||||
<h3>Folders</h3>
|
||||
{onCreateFolder ? (
|
||||
<div className="sidebar-section__actions">
|
||||
<button
|
||||
type="button"
|
||||
className="icon-button"
|
||||
onClick={handleCreateFolder}
|
||||
aria-label="Create folder"
|
||||
disabled={creatingFolder}
|
||||
>
|
||||
<FolderPlusIcon size={16} />
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<ul className="folder-tree">
|
||||
{rootNode && renderNodes([rootNode.id], 0)}
|
||||
|
||||
Reference in New Issue
Block a user