mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-19 07:42:43 +00:00
### TL;DR Redesigned the browser extension UI with a dark theme and improved the Twitter bookmarks import experience with a new onboarding flow. ### What changed? - Added a new `RightArrow` icon component for UI navigation - Completely redesigned the popup UI with a dark theme and improved layout - Enhanced Twitter bookmarks import functionality: - Added an onboarding toast that appears the first time a user visits the bookmarks page - Implemented a persistent import intent system that automatically opens the import modal when navigating to the bookmarks page - Created a progress toast to show import status - Improved folder import UI - Updated the extension icon and added a new logo SVG - Improved the project selection modal with better styling
87 lines
2.3 KiB
TypeScript
87 lines
2.3 KiB
TypeScript
import { DOMAINS, MESSAGE_TYPES } from "../../utils/constants"
|
|
import { DOMUtils } from "../../utils/ui-components"
|
|
import { initializeChatGPT } from "./chatgpt"
|
|
import { initializeClaude } from "./claude"
|
|
import {
|
|
handleOpenSearchPanel,
|
|
initializeSelectionSearch,
|
|
} from "./selection-search"
|
|
import {
|
|
saveMemory,
|
|
setupGlobalKeyboardShortcut,
|
|
setupStorageListener,
|
|
} from "./shared"
|
|
import { initializeT3 } from "./t3"
|
|
import {
|
|
handleTwitterNavigation,
|
|
initializeTwitter,
|
|
openImportModal,
|
|
updateTwitterImportUI,
|
|
} from "./twitter"
|
|
|
|
export default defineContentScript({
|
|
matches: ["<all_urls>"],
|
|
main() {
|
|
// Setup global event listeners
|
|
browser.runtime.onMessage.addListener(async (message) => {
|
|
if (message.action === MESSAGE_TYPES.SHOW_TOAST) {
|
|
DOMUtils.showToast(message.state)
|
|
} else if (message.action === MESSAGE_TYPES.SAVE_MEMORY) {
|
|
await saveMemory()
|
|
} else if (message.action === MESSAGE_TYPES.OPEN_SEARCH_PANEL) {
|
|
handleOpenSearchPanel(message.data as string)
|
|
} else if (message.action === MESSAGE_TYPES.TWITTER_IMPORT_OPEN_MODAL) {
|
|
await openImportModal()
|
|
} else if (message.type === MESSAGE_TYPES.IMPORT_UPDATE) {
|
|
updateTwitterImportUI(message)
|
|
} else if (message.type === MESSAGE_TYPES.IMPORT_DONE) {
|
|
updateTwitterImportUI(message)
|
|
}
|
|
})
|
|
|
|
// Setup global keyboard shortcuts
|
|
setupGlobalKeyboardShortcut()
|
|
|
|
// Setup storage listener
|
|
setupStorageListener()
|
|
|
|
// Observer for dynamic content changes
|
|
const observeForDynamicChanges = () => {
|
|
const observer = new MutationObserver(() => {
|
|
if (DOMUtils.isOnDomain(DOMAINS.CHATGPT)) {
|
|
initializeChatGPT()
|
|
}
|
|
if (DOMUtils.isOnDomain(DOMAINS.CLAUDE)) {
|
|
initializeClaude()
|
|
}
|
|
if (DOMUtils.isOnDomain(DOMAINS.T3)) {
|
|
initializeT3()
|
|
}
|
|
if (DOMUtils.isOnDomain(DOMAINS.TWITTER)) {
|
|
handleTwitterNavigation()
|
|
}
|
|
})
|
|
|
|
observer.observe(document.body, {
|
|
childList: true,
|
|
subtree: true,
|
|
})
|
|
}
|
|
|
|
// Initialize platform-specific functionality
|
|
initializeChatGPT()
|
|
initializeClaude()
|
|
initializeT3()
|
|
initializeTwitter()
|
|
|
|
// Initialize universal selection search
|
|
initializeSelectionSearch()
|
|
|
|
// Start observing for dynamic changes
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", observeForDynamicChanges)
|
|
} else {
|
|
observeForDynamicChanges()
|
|
}
|
|
},
|
|
})
|