This commit is contained in:
Rizky 2024-01-23 19:24:08 +07:00
parent a78877d78d
commit 6a1a7cf126
1 changed files with 40 additions and 0 deletions

View File

@ -150,6 +150,29 @@ export const edPageTreeRender: NodeRender<PageItem> = (
)} )}
{item.id !== "root" && ( {item.id !== "root" && (
<> <>
<div
onClick={async (e) => {
e.stopPropagation();
if (confirm("Clone page ?")) {
local.render();
const page = (await db.page.findFirst({
where: { id: node.id as string },
})) as any;
delete page.id;
page.name = `${page.name} [Cloned]`;
page.url = `${page.url}-cloned`;
await db.page.create({
data: page,
});
await reloadPagePicker(p);
}
}}
className="btn transition-all bg-white flex items-center border px-1 hover:border-blue-300 hover:bg-blue-100"
>
<CopyIcon />
</div>
<div <div
className="btn transition-all bg-white flex items-center border px-1 hover:border-blue-300 hover:bg-blue-100" className="btn transition-all bg-white flex items-center border px-1 hover:border-blue-300 hover:bg-blue-100"
onClick={(e) => { onClick={(e) => {
@ -277,6 +300,23 @@ const FolderClose = () => (
</svg> </svg>
); );
const CopyIcon = () => (
<svg
width="12"
height="12"
viewBox="0 0 15 15"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z"
fill="currentColor"
fillRule="evenodd"
clipRule="evenodd"
></path>
</svg>
);
const EditIcon = () => ( const EditIcon = () => (
<svg <svg
width="12" width="12"