Skip to content

feat: add drag handles; remove Remirror's scrollbar #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ui/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,8 @@
.react-flow__handle {
z-index: 100;
}

/* Remove the right scrollbar on Remirror. */
.remirror-editor.ProseMirror {
overflow-y: hidden !important;
}
27 changes: 10 additions & 17 deletions ui/src/components/nodes/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import KeyboardDoubleArrowRightIcon from "@mui/icons-material/KeyboardDoubleArro
import PlayDisabledIcon from "@mui/icons-material/PlayDisabled";
import DeleteIcon from "@mui/icons-material/Delete";
import ViewComfyIcon from "@mui/icons-material/ViewComfy";
import DragIndicatorIcon from "@mui/icons-material/DragIndicator";

import { CopyToClipboard } from "react-copy-to-clipboard";
import Moveable from "react-moveable";
import { ResizableBox } from "react-resizable";
Expand Down Expand Up @@ -266,7 +268,9 @@ function MyFloatingToolbar({ id, layout, setLayout }) {
);

return (
<Box>
<Box
sx={{ display: "flex", alignItems: "center", justifyContent: "center" }}
>
{!isGuest && (
<Tooltip title="Run (shift-enter)">
<IconButton
Expand Down Expand Up @@ -348,6 +352,9 @@ function MyFloatingToolbar({ id, layout, setLayout }) {
<ViewComfyIcon fontSize="inherit" />
</IconButton>
</Tooltip>
<Box className="custom-drag-handle">
<DragIndicatorIcon fontSize="small" />
</Box>
</Box>
);
}
Expand Down Expand Up @@ -375,10 +382,6 @@ export const CodeNode = memo<NodeProps>(function ({
const pod = getPod(id);
const isGuest = useStore(store, (state) => state.role === "GUEST");
const isPodFocused = useStore(store, (state) => state.pods[id]?.focus);
const index = useStore(
store,
(state) => state.pods[id]?.result?.count || " "
);
const inputRef = useRef<HTMLInputElement>(null);
const updateView = useStore(store, (state) => state.updateView);
const isCutting = useStore(store, (state) => state.cuttingIds.has(id));
Expand Down Expand Up @@ -531,7 +534,7 @@ export const CodeNode = memo<NodeProps>(function ({
</Box>

{/* The header of code pods. */}
<Box className="custom-drag-handle">
<Box>
{devMode && (
<Box
sx={{
Expand Down Expand Up @@ -577,16 +580,6 @@ export const CodeNode = memo<NodeProps>(function ({
}}
></InputBase>
</Box>
<Box
sx={{
color: "#8b8282",
textAlign: "left",
paddingLeft: "5px",
fontSize: "12px",
}}
>
[{index}]
</Box>
<Box
sx={{
opacity: showToolbar ? 1 : 0,
Expand All @@ -600,7 +593,6 @@ export const CodeNode = memo<NodeProps>(function ({
zIndex: 250,
justifyContent: "center",
}}
className="nodrag"
>
<MyFloatingToolbar
id={id}
Expand All @@ -612,6 +604,7 @@ export const CodeNode = memo<NodeProps>(function ({
<Box
sx={{
height: "90%",
py: 1,
}}
>
<MyMonaco id={id} gitvalue="" />
Expand Down
14 changes: 6 additions & 8 deletions ui/src/components/nodes/Rich.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import DeleteIcon from "@mui/icons-material/Delete";
import ViewComfyIcon from "@mui/icons-material/ViewComfy";
import RectangleIcon from "@mui/icons-material/Rectangle";
import DisabledByDefaultIcon from "@mui/icons-material/DisabledByDefault";
import DragIndicatorIcon from "@mui/icons-material/DragIndicator";

import {
BoldExtension,
Expand Down Expand Up @@ -286,6 +287,9 @@ function MyFloatingToolbar({ id }: { id: string }) {
</IconButton>
</Tooltip>
)}
<Box className="custom-drag-handle">
<DragIndicatorIcon fontSize="small" />
</Box>
</>
);
}
Expand Down Expand Up @@ -455,7 +459,7 @@ export const RichNode = memo<Props>(function ({
isConnectable={isConnectable}
/>
</Box>
<Box className="custom-drag-handle">
<Box>
{devMode && (
<Box
sx={{
Expand All @@ -471,15 +475,9 @@ export const RichNode = memo<Props>(function ({
{pod.width}, h: {pod.height})
</Box>
)}
<Box
sx={{
height: "1em",
}}
></Box>
<Box
sx={{
position: "absolute",

top: "-24px",
width: "50%",
}}
Expand Down Expand Up @@ -521,8 +519,8 @@ export const RichNode = memo<Props>(function ({
background: "white",
zIndex: 250,
justifyContent: "center",
alignItems: "center",
}}
className="nodrag"
>
<MyFloatingToolbar id={id} />
</Box>
Expand Down
15 changes: 11 additions & 4 deletions ui/src/components/nodes/Scope.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import ContentCopyIcon from "@mui/icons-material/ContentCopy";
import PlayCircleOutlineIcon from "@mui/icons-material/PlayCircleOutline";
import ViewTimelineOutlinedIcon from "@mui/icons-material/ViewTimelineOutlined";
import CompressIcon from "@mui/icons-material/Compress";
import DragIndicatorIcon from "@mui/icons-material/DragIndicator";

import Moveable from "react-moveable";

import { useStore } from "zustand";
Expand Down Expand Up @@ -86,7 +88,12 @@ function MyFloatingToolbar({ id }: { id: string }) {
const autoLayout = useStore(store, (state) => state.autoLayout);
const autoForce = useStore(store, (state) => state.autoForce);
return (
<Box>
<Box
sx={{
display: "flex",
alignItems: "center",
}}
>
{!isGuest && (
<Tooltip title="Run (shift-enter)">
<IconButton
Expand Down Expand Up @@ -167,6 +174,9 @@ function MyFloatingToolbar({ id }: { id: string }) {
</IconButton>
</Tooltip>
)}
<Box className="custom-drag-handle">
<DragIndicatorIcon fontSize="small" />
</Box>
</Box>
);
}
Expand Down Expand Up @@ -247,7 +257,6 @@ export const ScopeNode = memo<NodeProps>(function ScopeNode({
zIndex: 250,
justifyContent: "center",
}}
className="nodrag"
>
<MyFloatingToolbar id={id} />
</Box>
Expand Down Expand Up @@ -285,7 +294,6 @@ export const ScopeNode = memo<NodeProps>(function ScopeNode({
<Box
// bgcolor={"rgb(225,225,225)"}
sx={{ display: "flex" }}
className="custom-drag-handle"
>
{devMode && (
<Box
Expand All @@ -295,7 +303,6 @@ export const ScopeNode = memo<NodeProps>(function ScopeNode({
userSelect: "text",
cursor: "auto",
}}
className="nodrag"
>
{id} at ({xPos}, {yPos}), w: {pod.width}, h: {pod.height} level:{" "}
{data.level}
Expand Down