diff --git a/src/config/index.mjs b/src/config/index.mjs index 6f77d255..2ac93056 100644 --- a/src/config/index.mjs +++ b/src/config/index.mjs @@ -8,6 +8,11 @@ export const TriggerMode = { manually: 'Manually', } +export const DisplayMode = { + sidebar: 'Display in sidebar', + floatingToolbar: 'Display in floating toolbar', +} + export const ThemeMode = { light: 'Light', dark: 'Dark', @@ -202,6 +207,8 @@ export const defaultConfig = { /** @type {keyof TriggerMode}*/ triggerMode: 'manually', + /** @type {keyof DisplayMode}*/ + displayMode: 'sidebar', /** @type {keyof ThemeMode}*/ themeMode: 'auto', /** @type {keyof Models}*/ diff --git a/src/content-script/index.jsx b/src/content-script/index.jsx index e8ecf740..62b2b52c 100644 --- a/src/content-script/index.jsx +++ b/src/content-script/index.jsx @@ -70,11 +70,33 @@ async function mountComponent(siteConfig, userConfig) { unmountComponentAtNode(e) e.remove() }) + + const position = { + x: window.innerWidth - 300 - (Math.floor((20 / 100) * window.innerWidth)), + y: window.innerHeight / 2 - 200, + } + const toolbarContainer = createElementAtPosition(position.x, position.y) + toolbarContainer.className = 'chatgptbox-toolbar-container-not-queryable' + if (userConfig.displayMode === 'floatingToolbar') { + render( + , + toolbarContainer, + ) + return + } const container = document.createElement('div') container.id = 'chatgptbox-container' render( +