updata:icon替换
This commit is contained in:
@@ -1,4 +1,14 @@
|
||||
import Icon from "../../components/common/Icon";
|
||||
import {
|
||||
BookOpen,
|
||||
Database,
|
||||
FileCode,
|
||||
FileText,
|
||||
Folder,
|
||||
Lock,
|
||||
Unlock,
|
||||
Upload,
|
||||
X,
|
||||
} from "lucide-react";
|
||||
import type { ScriptItem, ScriptType } from "../../services/api";
|
||||
|
||||
type ContextMenuState = {
|
||||
@@ -45,6 +55,7 @@ export function TreeContextMenu({
|
||||
if (!contextMenu) return null;
|
||||
|
||||
const isDataResource = !!contextMenu.script?.script_id.startsWith("data:");
|
||||
const LockToggleIcon = contextMenu.script?.is_locked ? Unlock : Lock;
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -71,7 +82,7 @@ export function TreeContextMenu({
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<Icon name="database" size={16} />
|
||||
<Database size={16} />
|
||||
复制 Jupyter 路径
|
||||
</button>
|
||||
{onRemoveResource && (
|
||||
@@ -85,7 +96,7 @@ export function TreeContextMenu({
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<Icon name="close" size={16} />
|
||||
<X size={16} />
|
||||
删除资源
|
||||
</button>
|
||||
)}
|
||||
@@ -101,7 +112,7 @@ export function TreeContextMenu({
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<Icon name="script" size={16} />
|
||||
<FileText size={16} />
|
||||
打开文件
|
||||
</button>
|
||||
<button
|
||||
@@ -113,10 +124,7 @@ export function TreeContextMenu({
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
name={contextMenu.script.is_locked ? "unlock" : "lock"}
|
||||
size={16}
|
||||
/>
|
||||
<LockToggleIcon size={16} />
|
||||
{contextMenu.script.is_locked ? "解锁文件" : "锁定文件"}
|
||||
</button>
|
||||
<button
|
||||
@@ -125,7 +133,7 @@ export function TreeContextMenu({
|
||||
role="menuitem"
|
||||
onClick={() => onRemoveScript(contextMenu.script!)}
|
||||
>
|
||||
<Icon name="close" size={16} />
|
||||
<X size={16} />
|
||||
删除文件
|
||||
</button>
|
||||
</>
|
||||
@@ -139,7 +147,7 @@ export function TreeContextMenu({
|
||||
className={menuItemClass}
|
||||
onClick={() => onOpenCreateDialog(contextMenu.path, "notebook")}
|
||||
>
|
||||
<Icon name="notebook" size={16} />
|
||||
<BookOpen size={16} />
|
||||
新建 Notebook
|
||||
</button>
|
||||
<button
|
||||
@@ -148,7 +156,7 @@ export function TreeContextMenu({
|
||||
className={menuItemClass}
|
||||
onClick={() => onOpenCreateDialog(contextMenu.path, "python")}
|
||||
>
|
||||
<Icon name="python" size={16} />
|
||||
<FileCode size={16} />
|
||||
新建 Python 文件
|
||||
</button>
|
||||
<button
|
||||
@@ -157,7 +165,7 @@ export function TreeContextMenu({
|
||||
className={menuItemClass}
|
||||
onClick={() => onOpenFolderDialog(contextMenu.path)}
|
||||
>
|
||||
<Icon name="folder" size={16} />
|
||||
<Folder size={16} />
|
||||
新建文件夹
|
||||
</button>
|
||||
<button
|
||||
@@ -166,7 +174,7 @@ export function TreeContextMenu({
|
||||
className={menuItemClass}
|
||||
onClick={() => onChooseUpload(contextMenu.path)}
|
||||
>
|
||||
<Icon name="upload" size={16} />
|
||||
<Upload size={16} />
|
||||
上传到此处
|
||||
</button>
|
||||
{contextMenu.kind === "directory" && (
|
||||
@@ -178,7 +186,7 @@ export function TreeContextMenu({
|
||||
role="menuitem"
|
||||
onClick={() => onRemoveDirectory(contextMenu.path)}
|
||||
>
|
||||
<Icon name="close" size={16} />
|
||||
<X size={16} />
|
||||
删除文件夹
|
||||
</button>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user