Tweaks (vibe-kanban cf848f2d)

- Only show the circle in the bottom right hand corner if the site is inside an iframe
This commit is contained in:
Louis Knight-Webb
2025-09-26 12:46:48 +01:00
parent 147db5660e
commit 340a13f4ea
2 changed files with 22 additions and 8 deletions

View File

@@ -162,6 +162,8 @@ export function ClickToComponent({ editor = 'vscode', pathModifier }) {
(null)
)
const [isFramed, setIsFramed] = React.useState(false)
const vkIconUrl = new URL('./assets/vk-icon.png', import.meta.url).href
@@ -439,6 +441,17 @@ export function ClickToComponent({ editor = 'vscode', pathModifier }) {
[state, target, trigger]
)
// Detect if running in iframe
React.useEffect(function detectIframe() {
if (typeof window === 'undefined') return
try {
setIsFramed(window.self !== window.top)
} catch {
// Accessing window.top can throw in sandboxed contexts; assume framed
setIsFramed(true)
}
}, [])
// Send ready message to parent when component mounts
React.useEffect(function sendReadyMessage() {
if (
@@ -501,12 +514,14 @@ export function ClickToComponent({ editor = 'vscode', pathModifier }) {
}
</style>
<${FloatingPortal} key="click-to-component-portal">
<${TargetButton}
key="click-to-component-target-button"
active=${state === State.HOVER && trigger === Trigger.BUTTON}
onToggle=${toggleTargeting}
/>
</${FloatingPortal}
${isFramed && html`
<${FloatingPortal} key="click-to-component-portal">
<${TargetButton}
key="click-to-component-target-button"
active=${state === State.HOVER && trigger === Trigger.BUTTON}
onToggle=${toggleTargeting}
/>
</${FloatingPortal}>
`}
`
}

View File

@@ -1,6 +1,5 @@
{
"$schema": "https://turborepo.org/schema.json",
"baseBranch": "origin/main",
"pipeline": {
"build": {
"dependsOn": ["^build"],