Skip to content

Commit 67dde75

Browse files
committed
Add Inline Profile Selector module settings and update documentation
1 parent e651b08 commit 67dde75

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

code-notes.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Profiles are explicitly excluded. Keys under currentProfile and profiles.* remai
2121
- Theme
2222
- UI popup state (firstOpen, collapsibles, lastOpenedSection)
2323
- Cross-Chat module global settings and stored prompt
24+
- Inline Profile Selector module settings
2425
- Floating panel per-host settings
2526
- Custom selectors per-site
2627
- Optional meta: schemaVersion, dev.debugLogging
@@ -50,6 +51,10 @@ Cross-Chat
5051
- saveStoredPrompt(text: string): Promise<void> (broadcasts crossChatPromptChanged)
5152
- clearStoredPrompt(): Promise<void> (broadcasts crossChatPromptChanged)
5253

54+
Inline Profile Selector
55+
- getInlineProfileSelectorSettings(): { enabled: boolean, placement: 'before' | 'after' }
56+
- saveInlineProfileSelectorSettings(settings): Promise<void> (broadcasts inlineProfileSelectorSettingsChanged)
57+
5358
Floating Panel
5459
- getFloatingPanelSettings(hostname: string): object | null
5560
- saveFloatingPanelSettings(hostname: string, settings: object): Promise<void> (broadcasts floatingPanelChanged)
@@ -69,7 +74,7 @@ Meta
6974
- setDebugLogging(enabled: boolean): Promise<void>
7075

7176
Broadcasts
72-
- uiThemeChanged, uiPopupChanged, crossChatChanged, crossChatPromptChanged, floatingPanelChanged, floatingPanelResetAll, floatingPanelReset, customSelectorsChanged
77+
- uiThemeChanged, uiPopupChanged, crossChatChanged, crossChatPromptChanged, inlineProfileSelectorSettingsChanged, floatingPanelChanged, floatingPanelResetAll, floatingPanelReset, customSelectorsChanged
7378

7479
## config.js Changes
7580

@@ -96,6 +101,9 @@ Updated message handlers:
96101
- saveStoredPrompt -> StateStore.saveStoredPrompt(text)
97102
- getStoredPrompt -> StateStore.getStoredPrompt()
98103
- clearStoredPrompt -> StateStore.clearStoredPrompt()
104+
- Inline Profile Selector module:
105+
- getInlineProfileSelectorSettings -> StateStore.getInlineProfileSelectorSettings()
106+
- saveInlineProfileSelectorSettings -> StateStore.saveInlineProfileSelectorSettings(settings)
99107

100108
Unchanged message handlers:
101109
- Profiles: getConfig, saveConfig, switchProfile, listProfiles, deleteProfile, createDefaultProfile
@@ -109,6 +117,7 @@ New schema (logical paths):
109117
- ui.theme: 'light' | 'dark' (mirrors darkTheme)
110118
- ui.popup: { firstOpen: boolean, lastOpenedSection?: string, collapsibles?: Record<id, boolean> }
111119
- modules.crossChat: { settings: { enabled, autosendCopy, autosendPaste, placement }, storedPrompt: string }
120+
- modules.inlineProfileSelector: { enabled: boolean, placement: 'before' | 'after' }
112121
- floatingPanel: { [hostname]: FloatingPanelSettings }
113122
- global.customSelectors: { [site]: SelectorsConfig }
114123
- state.schemaVersion: number
@@ -138,6 +147,29 @@ Read precedence and writes:
138147
- Dialogs: use .dialog with variants .dialog-confirmation and .dialog-error (see ['popup.html'](popup.html:284)).
139148
- Toasts: base .toast plus type classes toast-success/error/info from ['popup-page-scripts/popup-page-visuals.js'](popup-page-scripts/popup-page-visuals.js:19). In dark mode, neutral fallback applies only without a type class.
140149

150+
## Inline Profile Selector Module
151+
152+
The Inline Profile Selector module adds a dropdown menu directly in the button row of chat interfaces, allowing users to quickly switch between profiles without opening the extension popup.
153+
154+
### Features
155+
- Adds a dropdown selector in the button row that displays all available profiles
156+
- Can be positioned either before or after custom buttons
157+
- Automatically updates UI when profile is changed
158+
- Preserves state across page refreshes and navigation
159+
- Handles dark/light theme detection for appropriate styling
160+
161+
### Implementation
162+
- UI settings in popup: ['modules/popup-page-modules-inlineSelector.js'](modules/popup-page-modules-inlineSelector.js)
163+
- DOM creation: ['buttons-init.js'](buttons-init.js) (createInlineProfileSelector function)
164+
- Storage: ['modules/state-store.js'](modules/state-store.js) (inlineProfileSelector key)
165+
- Global config loading: ['init.js'](init.js) (loads settings during initialization)
166+
167+
### Integration Points
168+
- Initialization: Settings loaded in init.js before main UI initialization
169+
- Button Row: Rendered in generateAndAppendAllButtons based on placement setting
170+
- Profile Switching: Uses the same profile switching mechanism as the floating panel
171+
- UI Refresh: Leverages the centralized refresh helpers (__OCP_partialRefreshUI, __OCP_nukeAndRefresh)
172+
141173
## Future Adoption (Optional)
142174

143175
- ui.popup.firstOpen/collapsibles/lastOpenedSection are available for a future pass to persist popup section states.
@@ -151,10 +183,16 @@ Recommended checks:
151183
- UI theming:
152184
- .dialog and variants render correctly in light/dark.
153185
- Toasts show base + correct type classes; dark fallback applies when no type.
186+
- Inline Profile Selector:
187+
- Verify dropdown appears in correct position (before/after buttons)
188+
- Test profile switching works correctly
189+
- Confirm dark/light theme styling is applied properly
190+
- Check event propagation blocking prevents dropdown from closing immediately
154191

155192
## File References
156193

157194
- Service worker: ['config.js'](config.js)
158195
- State: ['modules/state-store.js'](modules/state-store.js)
159196
- Styles: ['common-ui-elements/common-style.css'](common-ui-elements/common-style.css), ['common-ui-elements/dark-theme.css'](common-ui-elements/dark-theme.css)
160197
- HTML: ['popup.html'](popup.html), ['welcome.html'](welcome.html)
198+
- Inline Profile Selector: ['modules/popup-page-modules-inlineSelector.js'](modules/popup-page-modules-inlineSelector.js)

0 commit comments

Comments
 (0)