pass correct prop

This commit is contained in:
Peter Clement 2025-04-15 13:11:16 +01:00
parent c6493f2f99
commit 0709f68f47
2 changed files with 12 additions and 5 deletions

View File

@ -42,8 +42,11 @@
$: accountPortalAccess = $auth?.user?.accountPortalAccess $: accountPortalAccess = $auth?.user?.accountPortalAccess
$: accountPortal = $admin.accountPortalUrl $: accountPortal = $admin.accountPortalUrl
$: aiEnabled = !!$auth?.user?.llm $: aiEnabled = false
$: expanded = expandedOnly ? true : expanded $: expanded = expandedOnly ? true : expanded
$: if (expandedOnly) {
containerWidth = calculateExpandedWidth()
}
async function generateJs(prompt: string) { async function generateJs(prompt: string) {
if (!prompt.trim()) return if (!prompt.trim()) return
@ -90,14 +93,17 @@
animateBorder = false animateBorder = false
} }
function calculateExpandedWidth() {
return parentWidth
? `${Math.min(Math.max(parentWidth * 0.8, 300), 600)}px`
: "300px"
}
function toggleExpand() { function toggleExpand() {
if (!expanded) { if (!expanded) {
expanded = true expanded = true
animateBorder = true animateBorder = true
// Calculate width based on size of parent containerWidth = calculateExpandedWidth()
containerWidth = parentWidth
? `${Math.min(Math.max(parentWidth * 0.8, 300), 600)}px`
: "300px"
setTimeout(() => { setTimeout(() => {
promptInput?.focus() promptInput?.focus()
}, 250) }, 250)

View File

@ -469,6 +469,7 @@
{#if aiGenEnabled} {#if aiGenEnabled}
<AIGen <AIGen
expandedOnly={true}
{bindings} {bindings}
{value} {value}
parentWidth={editorWidth} parentWidth={editorWidth}