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

View File

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