void handleCollectionClick(collection.id)}
>
+
{collection.name}
))}
From cd1019af72745901aed545636ee7db0391daeea1 Mon Sep 17 00:00:00 2001
From: Isaac Roberts <119639439+madebyisaacr@users.noreply.github.com>
Date: Mon, 19 Jan 2026 10:00:35 -0500
Subject: [PATCH 5/8] Update icon color
---
plugins/hubspot/src/components/Icons.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/hubspot/src/components/Icons.tsx b/plugins/hubspot/src/components/Icons.tsx
index 55b81f38f..d20d9368d 100644
--- a/plugins/hubspot/src/components/Icons.tsx
+++ b/plugins/hubspot/src/components/Icons.tsx
@@ -67,7 +67,7 @@ export const DatabaseIcon = () => (
void handleCollectionClick(collection.id)}
>
From 849b30923a2ab37b78754bcf9fd78de3c06fdaa8 Mon Sep 17 00:00:00 2001
From: Isaac Roberts <119639439+madebyisaacr@users.noreply.github.com>
Date: Thu, 22 Jan 2026 13:06:20 -0500
Subject: [PATCH 7/8] Update collections array, add context menu
---
plugins/hubspot/src/pages/canvas/CMS.tsx | 69 +++++++++++++++---------
1 file changed, 45 insertions(+), 24 deletions(-)
diff --git a/plugins/hubspot/src/pages/canvas/CMS.tsx b/plugins/hubspot/src/pages/canvas/CMS.tsx
index cd7986707..0ea7eed3f 100644
--- a/plugins/hubspot/src/pages/canvas/CMS.tsx
+++ b/plugins/hubspot/src/pages/canvas/CMS.tsx
@@ -1,4 +1,4 @@
-import { framer, useIsAllowedTo } from "framer-plugin"
+import { type Collection, framer, useIsAllowedTo } from "framer-plugin"
import { useEffect, useState } from "react"
import { Button } from "../../components/Button"
import { CenteredSpinner } from "../../components/CenteredSpinner"
@@ -6,42 +6,57 @@ import { CMSCollectionIcon } from "../../components/Icons"
import { ScrollFadeContainer } from "../../components/ScrollFadeContainer"
export default function CMSPage() {
- const [collections, setCollections] = useState<{ id: string; name: string }[]>([])
+ const [collections, setCollections] = useState
([])
const [isLoading, setIsLoading] = useState(true)
const [isCreating, setIsCreating] = useState(false)
const isAllowedToCreateCollection = useIsAllowedTo("createManagedCollection")
- useEffect(() => {
- const loadCollections = async () => {
- try {
- const allCollections = await framer.getCollections()
- const thisPluginCollections = allCollections
- .filter(collection => collection.managedBy === "thisPlugin")
- .map(collection => ({
- id: collection.id,
- name: collection.name,
- }))
- setCollections(thisPluginCollections)
- } catch (error) {
- console.error("Failed to load collections:", error)
- framer.notify("Failed to load collections", { variant: "error" })
- } finally {
- setIsLoading(false)
- }
+ const loadCollections = async () => {
+ try {
+ const allCollections = await framer.getCollections()
+ const thisPluginCollections = allCollections.filter(collection => collection.managedBy === "thisPlugin")
+ setCollections(thisPluginCollections)
+ } catch (error) {
+ console.error("Failed to load collections:", error)
+ framer.notify("Failed to load collections", { variant: "error" })
+ } finally {
+ setIsLoading(false)
}
+ }
+ useEffect(() => {
void loadCollections()
}, [])
- const handleCollectionClick = async (collectionId: string) => {
+ const handleCollectionClick = (collectionId: string) => {
try {
- await framer.navigateTo(collectionId)
+ void framer.navigateTo(collectionId)
} catch (error) {
console.error("Failed to navigate to collection:", error)
framer.notify("Failed to open collection", { variant: "error" })
}
}
+ const handleCollectionContextMenu = (e: React.MouseEvent, collectionId: string) => {
+ e.preventDefault()
+ e.stopPropagation()
+
+ void framer.showContextMenu(
+ [
+ {
+ label: "Open Collection",
+ onAction: () => void handleCollectionClick(collectionId),
+ },
+ ],
+ {
+ location: {
+ x: e.clientX,
+ y: e.clientY,
+ },
+ }
+ )
+ }
+
const handleCreateCollection = async () => {
if (!isAllowedToCreateCollection) {
framer.notify("You are not allowed to create collections", { variant: "error" })
@@ -53,6 +68,7 @@ export default function CMSPage() {
const name = await findAvailableCollectionName("HubSpot")
const collection = await framer.createManagedCollection(name)
framer.notify("Created a new collection. Click Sync to sync data from HubSpot.")
+ void loadCollections()
await framer.navigateTo(collection.id)
} catch (error) {
console.error("Failed to create collection:", error)
@@ -73,11 +89,16 @@ export default function CMSPage() {
{collections.map(collection => (
void handleCollectionClick(collection.id)}
+ className="h-[30px] text-secondary hover:text-primary cursor-pointer px-[15px] flex flex-row items-center hover:bg-tertiary rounded-lg gap-3 select-none"
+ onClick={() => {
+ handleCollectionClick(collection.id)
+ }}
+ onContextMenu={e => {
+ handleCollectionContextMenu(e, collection.id)
+ }}
>
- {collection.name}
+ {collection.name}
))}
From 306ed0f0833361bae7e33f8cb6f4e0f2b3acaa04 Mon Sep 17 00:00:00 2001
From: Isaac Roberts <119639439+madebyisaacr@users.noreply.github.com>
Date: Thu, 22 Jan 2026 13:14:41 -0500
Subject: [PATCH 8/8] Refresh array
---
plugins/hubspot/src/pages/canvas/CMS.tsx | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/plugins/hubspot/src/pages/canvas/CMS.tsx b/plugins/hubspot/src/pages/canvas/CMS.tsx
index 0ea7eed3f..a972716d2 100644
--- a/plugins/hubspot/src/pages/canvas/CMS.tsx
+++ b/plugins/hubspot/src/pages/canvas/CMS.tsx
@@ -14,8 +14,8 @@ export default function CMSPage() {
const loadCollections = async () => {
try {
const allCollections = await framer.getCollections()
- const thisPluginCollections = allCollections.filter(collection => collection.managedBy === "thisPlugin")
- setCollections(thisPluginCollections)
+ const hubSpotCollections = allCollections.filter(collection => collection.managedBy === "thisPlugin")
+ setCollections(hubSpotCollections)
} catch (error) {
console.error("Failed to load collections:", error)
framer.notify("Failed to load collections", { variant: "error" })
@@ -25,7 +25,16 @@ export default function CMSPage() {
}
useEffect(() => {
+ const handleWindowFocus = () => {
+ void loadCollections()
+ }
+
+ window.addEventListener("focus", handleWindowFocus)
void loadCollections()
+
+ return () => {
+ window.removeEventListener("focus", handleWindowFocus)
+ }
}, [])
const handleCollectionClick = (collectionId: string) => {
@@ -45,7 +54,9 @@ export default function CMSPage() {
[
{
label: "Open Collection",
- onAction: () => void handleCollectionClick(collectionId),
+ onAction: () => {
+ handleCollectionClick(collectionId)
+ },
},
],
{