-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
261 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {Button} from "@mantine/core" | ||
import {IconTrash} from "@tabler/icons-react" | ||
|
||
export default function DeleteButton() { | ||
const onClick = () => {} | ||
|
||
return ( | ||
<Button leftSection={<IconTrash />} onClick={onClick} variant={"default"}> | ||
Delete | ||
</Button> | ||
) | ||
} |
33 changes: 33 additions & 0 deletions
33
ui2/src/components/Commander/FolderNodeActions/FolderNodeActions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {Group} from "@mantine/core" | ||
import {useSelector} from "react-redux" | ||
import {selectSelectedNodeIds} from "@/slices/dualPanel" | ||
|
||
import type {RootState} from "@/app/types" | ||
import type {PanelMode} from "@/types" | ||
import ToggleSecondaryPanel from "@/components/DualPanel/ToggleSecondaryPanel" | ||
import DeleteButton from "@/components/Commander/DeleteButton" | ||
import NewFolderButton from "@/components/Commander/NewFolderButton" | ||
import UploadButton from "@/components/Commander/UploadButton" | ||
|
||
type Args = { | ||
mode: PanelMode | ||
} | ||
|
||
export default function FolderNodeActions({mode}: Args) { | ||
const selectedIds = useSelector((state: RootState) => | ||
selectSelectedNodeIds(state, mode) | ||
) as Array<string> | ||
|
||
return ( | ||
<Group justify="space-between"> | ||
<Group> | ||
<UploadButton /> | ||
<NewFolderButton mode={mode} /> | ||
{selectedIds.length > 0 && <DeleteButton />} | ||
</Group> | ||
<Group> | ||
<ToggleSecondaryPanel mode={mode} /> | ||
</Group> | ||
</Group> | ||
) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {ActionIcon} from "@mantine/core" | ||
import {IconFolderPlus} from "@tabler/icons-react" | ||
import {useSelector, useDispatch} from "react-redux" | ||
import {selectCurrentFolderID, folderAdded} from "@/slices/dualPanel" | ||
import create_new_folder from "@/components/modals/NewFolder" | ||
|
||
import type {RootState} from "@/app/types" | ||
import type {NodeType, PanelMode} from "@/types" | ||
|
||
type Args = { | ||
mode: PanelMode | ||
} | ||
|
||
export default function NewFolderButton({mode}: Args) { | ||
const dispatch = useDispatch() | ||
const currentFolderId = useSelector((state: RootState) => | ||
selectCurrentFolderID(state, mode) | ||
) | ||
|
||
const onNewFolder = () => { | ||
if (!currentFolderId) { | ||
console.error("Error: no current folder found") | ||
return | ||
} | ||
create_new_folder(currentFolderId).then((new_folder: NodeType) => { | ||
dispatch(folderAdded({node: new_folder, mode: mode})) | ||
}) | ||
} | ||
|
||
return ( | ||
<ActionIcon onClick={onNewFolder} size="lg" variant="default"> | ||
<IconFolderPlus size={18} /> | ||
</ActionIcon> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {ActionIcon, FileButton} from "@mantine/core" | ||
import {IconUpload} from "@tabler/icons-react" | ||
|
||
export default function UploadButton() { | ||
const onUpload = () => {} | ||
|
||
return ( | ||
<FileButton onChange={onUpload} multiple> | ||
{props => ( | ||
<ActionIcon {...props} size="lg" variant="default"> | ||
<IconUpload size={18} /> | ||
</ActionIcon> | ||
)} | ||
</FileButton> | ||
) | ||
} |
53 changes: 0 additions & 53 deletions
53
ui2/src/components/FolderNodeActions/FolderNodeActions.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import type {NodeType} from "@/types" | ||
import type {NodeType, PanelMode} from "@/types" | ||
import Document from "./Document/Document" | ||
import Folder from "./Folder/Folder" | ||
|
||
type Args = { | ||
node: NodeType | ||
mode: PanelMode | ||
onClick: (node: NodeType) => void | ||
} | ||
|
||
export default function Node({node, onClick}: Args) { | ||
export default function Node({node, mode, onClick}: Args) { | ||
if (node.ctype == "folder") { | ||
return <Folder onClick={onClick} node={node} /> | ||
return <Folder onClick={onClick} node={node} mode={mode} /> | ||
} | ||
|
||
return <Document onClick={onClick} node={node} /> | ||
return <Document onClick={onClick} node={node} mode={mode} /> | ||
} |
Oops, something went wrong.