From cf791104c0b1608e37c3cf2d25dac7f6f58a1b66 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 18 Feb 2025 09:01:44 -0500
Subject: css fixes for gptPopup + close button

---
 src/client/views/OverlayView.tsx | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

(limited to 'src/client/views/OverlayView.tsx')

diff --git a/src/client/views/OverlayView.tsx b/src/client/views/OverlayView.tsx
index 5e9677b45..20931fc3d 100644
--- a/src/client/views/OverlayView.tsx
+++ b/src/client/views/OverlayView.tsx
@@ -18,6 +18,7 @@ import { ObservableReactComponent } from './ObservableReactComponent';
 import './OverlayView.scss';
 import { DefaultStyleProvider, returnEmptyDocViewList } from './StyleProvider';
 import { DocumentView, DocumentViewInternal } from './nodes/DocumentView';
+import { SnappingManager } from '../util/SnappingManager';
 
 export type OverlayDisposer = () => void;
 
@@ -27,12 +28,17 @@ export type OverlayElementOptions = {
     width?: number;
     height?: number;
     title?: string;
+    onClick?: (e: React.MouseEvent) => void;
+    isHidden?: () => boolean;
+    backgroundColor?: string;
 };
 
 export interface OverlayWindowProps {
     children: JSX.Element;
     overlayOptions: OverlayElementOptions;
-    onClick: () => void;
+    onClick: (e: React.MouseEvent) => void;
+    isHidden?: () => boolean;
+    backgroundColor?: string;
 }
 
 @observer
@@ -93,15 +99,17 @@ export class OverlayWindow extends ObservableReactComponent<OverlayWindowProps>
 
     render() {
         return (
-            <div className="overlayWindow-outerDiv" style={{ transform: `translate(${this.x}px, ${this.y}px)`, width: this.width, height: this.height }}>
-                <div className="overlayWindow-titleBar" onPointerDown={this.onPointerDown}>
+            <div
+                className="overlayWindow-outerDiv"
+                style={{ display: this.props.isHidden?.() ? 'none' : undefined, backgroundColor: this._props.backgroundColor, transform: `translate(${this.x}px, ${this.y}px)`, width: this.width, height: this.height }}>
+                <div className="overlayWindow-titleBar" onPointerDown={this.onPointerDown} style={{ backgroundColor: SnappingManager.userVariantColor, color: SnappingManager.userColor }}>
                     {this._props.overlayOptions.title || 'Untitled'}
                     <button type="button" onClick={this._props.onClick} className="overlayWindow-closeButton">
                         X
                     </button>
                 </div>
                 <div className="overlayWindow-content">{this.props.children}</div>
-                <div className="overlayWindow-resizeDragger" onPointerDown={this.onResizerPointerDown} />
+                <div className="overlayWindow-resizeDragger" style={{ backgroundColor: SnappingManager.userVariantColor }} onPointerDown={this.onResizerPointerDown} />
             </div>
         );
     }
@@ -166,7 +174,7 @@ export class OverlayView extends ObservableReactComponent<object> {
             if (index !== -1) this._elements.splice(index, 1);
         });
         const wincontents = (
-            <OverlayWindow onClick={() => remove(wincontents)} key={Utils.GenerateGuid()} overlayOptions={options}>
+            <OverlayWindow isHidden={options.isHidden} backgroundColor={options.backgroundColor} onClick={options.onClick ?? (() => remove(wincontents))} key={Utils.GenerateGuid()} overlayOptions={options}>
                 {contents}
             </OverlayWindow>
         );
-- 
cgit v1.2.3-70-g09d2

