/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors
*
* SPDX-License-Identifier: EPL-2.0
*/
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
import MoreVertIcon from '@mui/icons-material/MoreVert';
import Box from '@mui/material/Box';
import Grow from '@mui/material/Grow';
import Stack from '@mui/material/Stack';
import { alpha, useTheme } from '@mui/material/styles';
import { SnackbarProvider } from 'notistack';
import { memo, useRef, useState } from 'react';
import { useResizeDetector } from 'react-resize-detector';
import TopBar from './TopBar';
import UpdateNotification from './UpdateNotification';
import EditorPane from './editor/EditorPane';
import GraphPane from './graph/GraphPane';
const DirectionalSplitPane = memo(function SplitPanel({
horizontalSplit,
}: {
horizontalSplit: boolean;
}): JSX.Element {
const theme = useTheme();
const stackRef = useRef(null);
const sliderRef = useRef(null);
const [resizing, setResizing] = useState(false);
const [fraction, setFraction] = useState(0.5);
const direction = horizontalSplit ? 'column' : 'row';
const axis = horizontalSplit ? 'height' : 'width';
const primarySize = `calc(${fraction * 100}% - 0.5px)`;
const secondarySize = `calc(${(1 - fraction) * 100}% - 0.5px)`;
return (
{
if (event.button !== 0) {
return;
}
sliderRef.current?.setPointerCapture(event.pointerId);
setResizing(true);
}}
onPointerUp={(event) => {
if (event.button !== 0) {
return;
}
sliderRef.current?.releasePointerCapture(event.pointerId);
setResizing(false);
}}
onPointerMove={(event) => {
if (!resizing) {
return;
}
const container = stackRef.current;
if (container === null) {
return;
}
const rect = container.getBoundingClientRect();
const newFraction = horizontalSplit
? (event.clientY - rect.top) / rect.height
: (event.clientX - rect.left) / rect.width;
setFraction(Math.min(0.9, Math.max(0.1, newFraction)));
}}
onDoubleClick={() => setFraction(0.5)}
>
{horizontalSplit ? : }
);
});
function SplitPane(): JSX.Element {
const { ref, width, height } = useResizeDetector();
const horizontalSplit =
width !== undefined && height !== undefined && height > width;
return (
);
}
export default function Refinery(): JSX.Element {
return (
);
}