@ngenux/ngage-whiteboarding 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -37051,6 +37051,14 @@ const Undo2 = createLucideIcon("Undo2", [
|
|
|
37051
37051
|
const TopToolbar = ({ queueAction, handleExportImage, handleClear, handleLockToggle, isAdmin = false, hasToolAccess = false, isGloballyUnlocked = false, shouldBeOpenByDefault = true, hasVideoBackground = false }) => {
|
|
37052
37052
|
const { state, dispatch } = useWhiteboard();
|
|
37053
37053
|
const [isVisible, setIsVisible] = useState(shouldBeOpenByDefault);
|
|
37054
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
37055
|
+
// Wait for context to be fully initialized before rendering
|
|
37056
|
+
// Check that state.userId is set to ensure context is fully ready
|
|
37057
|
+
useEffect(() => {
|
|
37058
|
+
if (state && state.userId) {
|
|
37059
|
+
setIsInitialized(true);
|
|
37060
|
+
}
|
|
37061
|
+
}, [state]);
|
|
37054
37062
|
const handleToggleVisibility = () => {
|
|
37055
37063
|
setIsVisible(!isVisible);
|
|
37056
37064
|
};
|
|
@@ -37112,6 +37120,10 @@ const TopToolbar = ({ queueAction, handleExportImage, handleClear, handleLockTog
|
|
|
37112
37120
|
}
|
|
37113
37121
|
}
|
|
37114
37122
|
};
|
|
37123
|
+
// Don't render until fully initialized to prevent race conditions
|
|
37124
|
+
if (!isInitialized) {
|
|
37125
|
+
return null;
|
|
37126
|
+
}
|
|
37115
37127
|
return (jsxs(Fragment, { children: [jsxs("div", { className: "absolute top-5 left-1/2 transform -translate-x-1/2 flex flex-col items-center z-10", children: [!isVisible && (jsx("button", { className: "w-10 h-10 flex items-center justify-center bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300", onClick: handleToggleVisibility, title: "Show Tools", children: jsx(ChevronDown, { size: 16, className: "text-current" }) })), isVisible && (jsx("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg", children: jsxs("div", { className: "flex items-center gap-1 p-1", children: [isAdmin && (jsx("button", { className: `w-10 h-10 flex items-center justify-center rounded transition-colors ${isGloballyUnlocked
|
|
37116
37128
|
? 'bg-green-100 dark:bg-green-900/50 text-green-600 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-900/70'
|
|
37117
37129
|
: 'bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600'}`, onClick: handleLockToggle, title: isGloballyUnlocked ? 'Whiteboard unlocked for all users - Click to lock' : 'Whiteboard locked - Click to unlock for all users', children: isGloballyUnlocked ? jsx(LockOpen, { size: 16, className: "text-current" }) : jsx(Lock, { size: 16, className: "text-current" }) })), jsx("button", { className: `w-10 h-10 flex items-center justify-center rounded ${hasToolAccess ? 'hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300' : 'opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-600'}`, onClick: handleUndo, disabled: !hasToolAccess, title: hasToolAccess ? 'Undo' : 'Access restricted', children: jsx(Undo2, { size: 16, className: "text-current" }) }), jsx("button", { className: `w-10 h-10 flex items-center justify-center rounded ${hasToolAccess ? 'hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300' : 'opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-600'}`, onClick: handleRedo, disabled: !hasToolAccess, title: hasToolAccess ? 'Redo' : 'Access restricted', children: jsx(Redo2, { size: 16, className: "text-current" }) }), jsx("div", { className: "w-px h-6 bg-gray-300 dark:bg-gray-600 mx-1" }), tools.map((tool) => (jsx("button", { className: `w-10 h-10 flex items-center justify-center rounded transition-colors ${!hasToolAccess
|
|
@@ -37129,6 +37141,14 @@ const LeftSidebar = ({ queueAction, hasToolAccess = false, shouldBeOpenByDefault
|
|
|
37129
37141
|
const [position, setPosition] = useState({ x: 20, y: 80 });
|
|
37130
37142
|
const [hasEverHadAccess, setHasEverHadAccess] = useState(hasToolAccess);
|
|
37131
37143
|
const [wasManuallyClosedAfterAccess, setWasManuallyClosedAfterAccess] = useState(false);
|
|
37144
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
37145
|
+
// Wait for context to be fully initialized before rendering
|
|
37146
|
+
// Check that state.userId is set to ensure context is fully ready
|
|
37147
|
+
useEffect(() => {
|
|
37148
|
+
if (state && state.userId) {
|
|
37149
|
+
setIsInitialized(true);
|
|
37150
|
+
}
|
|
37151
|
+
}, [state]);
|
|
37132
37152
|
// Set white as default stroke color when video background is active
|
|
37133
37153
|
useEffect(() => {
|
|
37134
37154
|
if (hasVideoBackground && state.color === '#000000') {
|
|
@@ -37249,6 +37269,10 @@ const LeftSidebar = ({ queueAction, hasToolAccess = false, shouldBeOpenByDefault
|
|
|
37249
37269
|
// Only update local state - don't broadcast opacity changes to other users
|
|
37250
37270
|
dispatch({ type: 'SET_OPACITY', payload: opacity });
|
|
37251
37271
|
};
|
|
37272
|
+
// Don't render until fully initialized to prevent race conditions
|
|
37273
|
+
if (!isInitialized) {
|
|
37274
|
+
return null;
|
|
37275
|
+
}
|
|
37252
37276
|
if (!isVisible) {
|
|
37253
37277
|
// Only show the sidebar toggle button if user has tool access
|
|
37254
37278
|
if (!hasToolAccess) {
|