-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace custom controls with shadcn and add AddBlockDropdown (#118)
- Loading branch information
1 parent
8e3704d
commit 0637b3f
Showing
15 changed files
with
6,997 additions
and
8,414 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,11 @@ import { useReactFlowState } from "@/hooks/useReactFlowState"; | |
import { useLayoutState } from "@/hooks/useLayoutState"; | ||
import { updateNodesData } from "@/slices/reactFlowSlice"; | ||
import { useDispatch } from "react-redux"; | ||
import { GitBranch } from "lucide-react"; | ||
import { X } from "lucide-react"; | ||
import LogicNodePanelView from "./panelViews/LogicNodePanelView"; | ||
import { ICondition } from "@data-river/shared/interfaces/ICondition"; | ||
|
||
import { Button } from "@data-river/shared/ui/components/ui/button"; | ||
import { toggleRightPanelVisible } from "@/store"; | ||
const RightPanel = () => { | ||
const { isRightPanelVisible } = useLayoutState(); | ||
const { nodes, selectedNodeId } = useReactFlowState(); | ||
|
@@ -31,11 +32,6 @@ const RightPanel = () => { | |
); | ||
}; | ||
|
||
const handleDeleteNode = () => { | ||
// Implement node deletion logic here | ||
console.log("Delete node:", selectedNode?.id); | ||
}; | ||
|
||
const renderPanelView = () => { | ||
switch (selectedNode.data.block) { | ||
case "[email protected]": | ||
|
@@ -50,7 +46,6 @@ const RightPanel = () => { | |
} | ||
onConfigChange={handleConfigChange} | ||
inputs={selectedNode.data.inputs || {}} | ||
onDeleteNode={handleDeleteNode} | ||
/> | ||
); | ||
// Add cases for other node types here | ||
|
@@ -61,11 +56,17 @@ const RightPanel = () => { | |
|
||
return ( | ||
<div className="bg-background h-full w-full p-4 border-l border-border overflow-y-auto"> | ||
<div className="flex items-center mb-4"> | ||
<GitBranch className="w-5 h-5 mr-2 text-blue-500" /> | ||
<div className="flex items-center justify-between mb-4"> | ||
<h2 className="text-lg font-semibold"> | ||
{selectedNode.data.label} Settings | ||
</h2> | ||
<Button | ||
variant="outline" | ||
size="icon" | ||
onClick={() => dispatch(toggleRightPanelVisible())} | ||
> | ||
<X /> | ||
</Button> | ||
</div> | ||
{renderPanelView()} | ||
</div> | ||
|
61 changes: 32 additions & 29 deletions
61
packages/editor/src/components/controls/ActionToolsControls.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
71 changes: 71 additions & 0 deletions
71
packages/editor/src/components/controls/AddBlockDropdown.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,71 @@ | ||
import { TextCursorInput, Square, GitBranch, Plus } from "lucide-react"; | ||
|
||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuGroup, | ||
DropdownMenuItem, | ||
DropdownMenuLabel, | ||
DropdownMenuSeparator, | ||
DropdownMenuSub, | ||
DropdownMenuSubContent, | ||
DropdownMenuSubTrigger, | ||
DropdownMenuTrigger, | ||
} from "@data-river/shared/ui/components/ui/dropdown-menu"; | ||
|
||
interface AddBlockDropdownMenuProps { | ||
direction?: "up" | "down"; | ||
children: React.ReactNode; | ||
} | ||
|
||
export function AddBlockDropdownMenu({ | ||
direction = "down", | ||
children, | ||
}: AddBlockDropdownMenuProps) { | ||
return ( | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild>{children}</DropdownMenuTrigger> | ||
<DropdownMenuContent | ||
className="w-56" | ||
side={direction === "up" ? "top" : "bottom"} | ||
align="start" | ||
sideOffset={12} | ||
alignOffset={-8} | ||
> | ||
<DropdownMenuLabel>Add Block to Flow</DropdownMenuLabel> | ||
<DropdownMenuSeparator /> | ||
<DropdownMenuGroup> | ||
<DropdownMenuSub> | ||
<DropdownMenuSubTrigger> | ||
<TextCursorInput className="mr-2 h-4 w-4 " /> | ||
<span>Input</span> | ||
</DropdownMenuSubTrigger> | ||
<DropdownMenuSubContent> | ||
<DropdownMenuItem> | ||
<TextCursorInput className="mr-2 h-4 w-4 " /> | ||
<span>Input Node</span> | ||
</DropdownMenuItem> | ||
<DropdownMenuItem> | ||
<Square className="mr-2 h-4 w-4 " /> | ||
<span>Simple Input</span> | ||
</DropdownMenuItem> | ||
</DropdownMenuSubContent> | ||
</DropdownMenuSub> | ||
<DropdownMenuItem> | ||
<GitBranch className="mr-2 h-4 w-4 " /> | ||
<span>Logic</span> | ||
</DropdownMenuItem> | ||
<DropdownMenuItem> | ||
<Square className="mr-2 h-4 w-4 " /> | ||
<span>Output</span> | ||
</DropdownMenuItem> | ||
</DropdownMenuGroup> | ||
<DropdownMenuSeparator /> | ||
<DropdownMenuItem> | ||
<Plus className="mr-2 h-4 w-4" /> | ||
<span>Add Custom Block</span> | ||
</DropdownMenuItem> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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
24 changes: 16 additions & 8 deletions
24
packages/editor/src/components/controls/UndoRedoControls.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
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
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
Oops, something went wrong.