@@ -66,6 +66,44 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
6666 * ** utils.js:** Uses utility functions for logging.
6767 * ** profile-switcher.js:** For managing profile switching within the floating panel.
6868
69+ ### ` floating-panel-ui.js `
70+
71+ * ** Purpose:** Contains all UI-related functionality for the floating panel.
72+ * ** Role:** Handles creation, layout, drag behavior, and button moving logic for the floating panel. Key functions:
73+ * ` createFloatingPanel() ` : Creates the panel DOM element with header, content container, and footer
74+ * ` makeDraggable() ` : Adds drag functionality to panel elements
75+ * ` positionPanelAtCursor() ` : Positions the panel relative to the cursor location
76+ * ` togglePanel() ` : Handles showing/hiding the panel and moving buttons between containers
77+ * ` restorePanelState() ` : Ensures the panel appears in the correct visibility state based on saved settings
78+ * Notable fixes:
79+ * Prevents double-toggling when panel is first created by avoiding ` loadPanelSettings() ` call
80+ * Only restores panel visibility if it doesn't match the desired state already
81+ * Maintains consistent state when summoning panel from toggle button
82+
83+ ### ` floating-panel-settings.js `
84+
85+ * ** Purpose:** Handles settings persistence and profile management for the floating panel.
86+ * ** Role:** Includes methods for loading/saving panel settings, debouncing saves, and profile switching. Key functions:
87+ * ` loadPanelSettings() ` : Retrieves settings from the service worker for the current hostname
88+ * ` savePanelSettings() ` : Sends updated settings to the service worker for storage
89+ * ` debouncedSavePanelSettings() ` : Waits 150ms before saving to reduce storage operations
90+ * ` loadAvailableProfiles() ` : Gets list of profiles from the service worker
91+ * ` switchToProfile() ` : Changes the current profile and refreshes floating panel content
92+
93+ ### Code File Dependencies for Floating Panel:
94+
95+ * ** Initialization Flow:**
96+ 1 . ` floating-panel.js ` : Defines the namespace and shared properties
97+ 2 . ` floating-panel-settings.js ` : Adds settings-related methods to the namespace
98+ 3 . ` floating-panel-ui.js ` : Adds UI-related methods to the namespace
99+ 4 . ` buttons-init.js ` : Calls ` initialize() ` and creates toggle button
100+
101+ * ** Panel Summoning Process:**
102+ 1 . Toggle button calls ` togglePanel(event) `
103+ 2 . First call creates panel without loading settings to avoid race conditions
104+ 3 . Panel is positioned and displayed immediately
105+ 4 . Settings are saved asynchronously
106+
69107### ` init.js `
70108
71109* ** Purpose:** Main initialization script for the content script.
0 commit comments