diff --git a/src/components/UIWin.jsx b/src/components/UIWin.jsx index dc1c5d4..72716f1 100644 --- a/src/components/UIWin.jsx +++ b/src/components/UIWin.jsx @@ -14,11 +14,18 @@ const UIWin = () => { const [Content, name] = COMPONENTS[windowType]; return ( - <> +
{(windowType) ? :

Loading

} - +
); }; diff --git a/src/components/Window.jsx b/src/components/Window.jsx index b45b6c0..6757d51 100644 --- a/src/components/Window.jsx +++ b/src/components/Window.jsx @@ -75,6 +75,32 @@ const Window = ({ id }) => { dispatch(closeWindow(id)); }, [dispatch]); + const { + xPos, yPos, + width, height, + } = position; + + const popUp = useCallback((evt) => { + let left; + let top; + try { + left = Math.round(window.top.screenX + xPos); + top = Math.round(window.top.screenY + yPos); + if (Number.isNaN(left) || Number.isNaN(top)) { + throw new Error('NaN'); + } + } catch { + left = 0; + top = 0; + } + window.lmao = window.open( + './win', + 'lol', + `popup=yes,width=${width},height=${height},left=${left},top=${top},toolbar=no,status=no,directories=no,menubar=no`, + ); + close(evt); + }, [xPos, yPos, width, height]); + useDrag( titleBarRef, focus, @@ -117,15 +143,8 @@ const Window = ({ id }) => { return null; } - const { - windowType, - title, - } = win; - const { - xPos, yPos, - width, height, - z, - } = position; + const { title, windowType } = win; + const { z } = position; const [Content, name] = COMPONENTS[windowType]; @@ -146,17 +165,26 @@ const Window = ({ id }) => {

{windowTitle}

+
G
{(showWindows) && (
{ > {windowTitle} + + G +