From 61b7e1cf3c36c031cdfb990b2b7652fcf0296463 Mon Sep 17 00:00:00 2001 From: Alex TYRODE Date: Wed, 28 May 2025 14:59:28 +0000 Subject: [PATCH 1/2] refactor: clean up useless comments --- src/frontend/src/pad/editors/HtmlEditor.tsx | 2 +- src/frontend/src/ui/MainMenu.tsx | 8 ++++---- src/frontend/src/ui/TabContextMenu.tsx | 4 ++-- src/frontend/src/ui/Tabs.tsx | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/pad/editors/HtmlEditor.tsx b/src/frontend/src/pad/editors/HtmlEditor.tsx index a4b82f4..78a368d 100644 --- a/src/frontend/src/pad/editors/HtmlEditor.tsx +++ b/src/frontend/src/pad/editors/HtmlEditor.tsx @@ -33,7 +33,7 @@ export const useHtmlEditor = ( element: NonDeleted | undefined, editorRef: React.RefObject, excalidrawAPI?: any, - isActive: boolean = true // New parameter to control if the hook is active + isActive: boolean = true ) => { // Always initialize these hooks regardless of isActive const [createNew, setCreateNew] = useState(false); diff --git a/src/frontend/src/ui/MainMenu.tsx b/src/frontend/src/ui/MainMenu.tsx index 10c8066..d416435 100644 --- a/src/frontend/src/ui/MainMenu.tsx +++ b/src/frontend/src/ui/MainMenu.tsx @@ -7,7 +7,7 @@ import { LogOut, SquarePlus, LayoutDashboard, User, Text, Settings, Terminal, Fi import md5 from 'crypto-js/md5'; // Components -import SettingsDialog from './SettingsDialog'; // Added import +import SettingsDialog from './SettingsDialog'; import { useLogout } from '../hooks/useLogout'; import { useAuthStatus } from '../hooks/useAuthStatus'; @@ -135,7 +135,7 @@ export const MainMenuConfig: React.FC = ({ setShowSettingsModal(true); }; - const handleCloseSettingsModal = () => { // Added handler to close settings modal + const handleCloseSettingsModal = () => { setShowSettingsModal(false); }; @@ -151,7 +151,7 @@ export const MainMenuConfig: React.FC = ({ const keycloakLogoutUrl = data.logout_url; const createIframeLoader = (url: string, debugName: string): Promise => { - return new Promise((resolve, reject) => { // Added reject for error handling + return new Promise((resolve, reject) => { const iframe = document.createElement("iframe"); iframe.style.display = "none"; iframe.src = url; @@ -204,7 +204,7 @@ export const MainMenuConfig: React.FC = ({ onClose={() => setShowAccountModal(false)} /> )} - {showSettingsModal && ( // Added conditional rendering for SettingsDialog + {showSettingsModal && ( void, onDelete: (padId: string) => void, // This is for deleteOwnedPad onUpdateSharingPolicy: (padId: string, policy: string) => void, - onLeaveSharedPad: (padId: string) => void, // Moved before optional param + onLeaveSharedPad: (padId: string) => void, sharingPolicy?: string ) { this.padId = padId; @@ -244,7 +244,7 @@ class TabActionManager implements ActionManager { console.debug('[pad.ws] User confirmed delete, calling onDelete'); this.onDelete(this.padId); // Calls original onDelete for owned pads } - } else if (action.name === 'leaveSharedPad') { // New action for leaving + } else if (action.name === 'leaveSharedPad') { console.debug('[pad.ws] Attempting to leave shared pad:', this.padId, this.padName); if (window.confirm(`Are you sure you want to leave "${this.padName}"? This will remove it from your list of open pads.`)) { this.onLeaveSharedPad(this.padId); // Calls the new handler diff --git a/src/frontend/src/ui/Tabs.tsx b/src/frontend/src/ui/Tabs.tsx index d7cdcbc..02af0ce 100644 --- a/src/frontend/src/ui/Tabs.tsx +++ b/src/frontend/src/ui/Tabs.tsx @@ -20,7 +20,7 @@ interface TabsProps { createNewPadAsync: () => Promise; renamePad: (args: { padId: string; newName: string }) => void; deletePad: (padId: string) => void; - leaveSharedPad: (padId: string) => void; // Added prop + leaveSharedPad: (padId: string) => void; updateSharingPolicy: (args: { padId: string; policy: string }) => void; selectTab: (tabId: string) => void; } @@ -470,7 +470,7 @@ const Tabs: React.FC = ({ } deletePad(padId); // Calls the prop for deleting owned pad }} - onLeaveSharedPad={(padId: string) => { // New prop for 'leaveSharedPad' + onLeaveSharedPad={(padId: string) => { leaveSharedPad(padId); // Calls the prop for leaving shared pad }} onUpdateSharingPolicy={(padId: string, policy: string) => { From 02cfd9123571a7e48e178babda6bdeaca4fc31a5 Mon Sep 17 00:00:00 2001 From: Alex TYRODE Date: Wed, 28 May 2025 15:00:48 +0000 Subject: [PATCH 2/2] refactor: remove DevTools component and related styles - Deleted the DevTools component and its associated SCSS file to streamline the codebase. - Updated the CustomEmbeddableRenderer to remove references to DevTools, enhancing clarity and maintainability. - Removed DevTools entry from the pad index file and MainMenu, simplifying the user interface. --- src/frontend/src/CustomEmbeddableRenderer.tsx | 7 +- src/frontend/src/pad/DevTools.scss | 86 ------------------- src/frontend/src/pad/DevTools.tsx | 47 ---------- src/frontend/src/pad/index.ts | 2 - src/frontend/src/ui/MainMenu.tsx | 22 ----- 5 files changed, 1 insertion(+), 163 deletions(-) delete mode 100644 src/frontend/src/pad/DevTools.scss delete mode 100644 src/frontend/src/pad/DevTools.tsx diff --git a/src/frontend/src/CustomEmbeddableRenderer.tsx b/src/frontend/src/CustomEmbeddableRenderer.tsx index 4023add..4eba265 100644 --- a/src/frontend/src/CustomEmbeddableRenderer.tsx +++ b/src/frontend/src/CustomEmbeddableRenderer.tsx @@ -9,7 +9,6 @@ import { ControlButton, Editor, Terminal, - DevTools, } from './pad'; import { ActionButton } from './pad/buttons'; import "./CustomEmbeddableRenderer.scss"; @@ -36,7 +35,7 @@ export const renderCustomEmbeddable = ( title = "HTML Editor"; break; case 'editor': - content = ; + content = ; title = "Code Editor"; break; case 'terminal': @@ -64,10 +63,6 @@ export const renderCustomEmbeddable = ( content = ; title = "Dashboard"; break; - case 'dev': - content = ; - title = "Dev Tools"; - break; default: title = "Untitled"; return null; diff --git a/src/frontend/src/pad/DevTools.scss b/src/frontend/src/pad/DevTools.scss deleted file mode 100644 index faaa2f7..0000000 --- a/src/frontend/src/pad/DevTools.scss +++ /dev/null @@ -1,86 +0,0 @@ -.dev-tools { - display: flex; - flex-direction: column; - height: 100%; - width: 100%; - overflow: hidden; - - &__content { - flex: 1; - overflow: hidden; - position: relative; - } - - &__collab-container { - display: flex; - height: 100%; - width: 100%; - gap: 8px; - } - - &__collab-events-wrapper { - display: flex; - flex-direction: column; - flex: 1; - gap: 8px; - overflow: hidden; - } - - &__collab-events { - border: 1px solid #333; - border-radius: 4px; - display: flex; - flex-direction: column; - background-color: #1e1e1e; - overflow: hidden; - - .dev-tools__collab-events-wrapper > & { - width: auto; - flex-basis: 0; - flex-grow: 1; - flex-shrink: 1; - min-width: 0; - } - } - - &__collab-events-header { - padding: 6px 10px; - background-color: #2d2d2d; - border-bottom: 1px solid #444; - font-size: 12px; - font-weight: 500; - color: #e0e0e0; - } - - &__collab-events-list { - flex: 1; - overflow-y: auto; - padding: 4px; - } - - &__collab-empty { - padding: 12px; - color: #a0a0a0; - font-size: 12px; - text-align: center; - font-style: italic; - } - - &__collab-details { - flex: 1; - display: flex; - flex-direction: column; - border: 1px solid #333; - border-radius: 4px; - overflow: hidden; - } - - &__editor-header { - padding: 6px 10px; - background-color: #2d2d2d; - border-bottom: 1px solid #444; - font-size: 12px; - font-weight: 500; - color: #e0e0e0; - } -} diff --git a/src/frontend/src/pad/DevTools.tsx b/src/frontend/src/pad/DevTools.tsx deleted file mode 100644 index d0080b6..0000000 --- a/src/frontend/src/pad/DevTools.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; -import MonacoEditor from '@monaco-editor/react'; -import './DevTools.scss'; - -interface DevToolsProps {} - -const DevTools: React.FC = () => { - return ( -
-
-
-
-
-
- Events -
-
-
- Event display area. -
-
-
-
-
-
Event Details
- -
-
-
-
- ); -}; - -export default DevTools; diff --git a/src/frontend/src/pad/index.ts b/src/frontend/src/pad/index.ts index 0c2bb78..4da81bb 100644 --- a/src/frontend/src/pad/index.ts +++ b/src/frontend/src/pad/index.ts @@ -5,11 +5,9 @@ export * from './Dashboard'; export * from './Terminal'; export * from './buttons'; export * from './editors'; -export * from './DevTools'; // Default exports export { default as ControlButton } from './buttons/ControlButton'; export { default as StateIndicator } from './StateIndicator'; export { default as Dashboard } from './Dashboard'; export { default as Terminal } from './Terminal'; -export { default as DevTools } from './DevTools'; \ No newline at end of file diff --git a/src/frontend/src/ui/MainMenu.tsx b/src/frontend/src/ui/MainMenu.tsx index d416435..0470edd 100644 --- a/src/frontend/src/ui/MainMenu.tsx +++ b/src/frontend/src/ui/MainMenu.tsx @@ -67,22 +67,6 @@ export const MainMenuConfig: React.FC = ({ }); }; - const handleDevToolsClick = () => { - if (!excalidrawAPI) return; - - const devToolsElement = ExcalidrawElementFactory.createEmbeddableElement({ - link: "!dev", - width: 800, - height: 500 - }); - - ExcalidrawElementFactory.placeInScene(devToolsElement, excalidrawAPI, { - mode: PlacementMode.NEAR_VIEWPORT_CENTER, - bufferPercentage: 10, - scrollToView: true - }); - }; - const handleInsertButtonClick = () => { if (!excalidrawAPI) return; @@ -262,12 +246,6 @@ export const MainMenuConfig: React.FC = ({ > Action Button - } - onClick={handleDevToolsClick} - > - Dev. Tools -