Skip to content

Commit

Permalink
✨ 增加文件夹打开位置
Browse files Browse the repository at this point in the history
  • Loading branch information
Littlefean committed Nov 13, 2024
1 parent 50ebb8a commit ff7b3f8
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 8 deletions.
22 changes: 19 additions & 3 deletions src/components/ui/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function Dialog() {
// }
// });
// }, []);

const [isCopied, setIsCopied] = React.useState(false);
return (
<div
className={cn(
Expand Down Expand Up @@ -63,10 +63,26 @@ export default function Dialog() {
</div>
{dialog.code.trim() !== "" && (
<div className="flex flex-col gap-2">
<h2 className="text-lg font-bold">代码</h2>
<pre className="overflow-auto rounded-md bg-neutral-900 p-2 text-sm text-white">
{/* <h2 className="text-lg font-bold">代码</h2> */}
<pre
className="cursor-copy select-text overflow-auto rounded-md bg-neutral-900 p-2 text-sm text-white"
onClick={() => {
navigator.clipboard
.writeText(dialog.code)
.then(() => {
setIsCopied(true);
setTimeout(() => {
setIsCopied(false);
}, 1000);
})
.catch((err) => {
console.error("复制失败:", err);
});
}}
>
{dialog.code}
</pre>
{isCopied && <span>已复制</span>}
</div>
)}
{dialog.input && (
Expand Down
37 changes: 32 additions & 5 deletions src/pages/_app_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import {
SquareDashedMousePointer,
FileCode,
FileType,
Folder,
FolderCog,
FolderOpen,
} from "lucide-react";
import { useNavigate } from "react-router-dom";
import {
Expand Down Expand Up @@ -307,10 +310,34 @@ export default function AppMenu({
另存为
</Col>
</Row>
{/* <Row icon={<Plus />} title="创建">
<Col icon={<Cuboid />}>节点</Col>
<Col icon={<Image />}>图片</Col>
</Row> */}
<Row icon={<Folder />} title="位置">
<Col
icon={<FolderCog />}
onClick={() => {
dialog.show({
title: "数据文件夹位置",
type: "info",
code: "%APPDATA%/liren.project-graph",
content: "软件数据文件夹位置",
});
}}
>
打开软件数据文件夹
</Col>
<Col
icon={<FolderOpen />}
onClick={() => {
dialog.show({
title: "数据文件夹位置",
type: "info",
code: file,
content: "软件数据文件夹位置",
});
}}
>
打开此文档所在文件夹
</Col>
</Row>
<Row icon={<File />} title="导出">
<Col icon={<FileCode />} onClick={onSaveSVGNew}>
全部舞台导出SVG
Expand Down Expand Up @@ -422,7 +449,7 @@ function Col({
}: React.PropsWithChildren<{ icon: React.ReactNode; onClick?: () => void }>) {
return (
<div
className="flex w-max items-center gap-1 transition hover:opacity-80 active:scale-90"
className="flex w-max cursor-pointer items-center gap-1 transition hover:opacity-80 active:scale-90"
onClick={onClick}
>
{icon}
Expand Down

0 comments on commit ff7b3f8

Please sign in to comment.