This commit is contained in:
Adria Navarro 2025-04-17 12:30:03 +02:00
parent c790ea1af0
commit 5ebda593a5
2 changed files with 7 additions and 2 deletions

View File

@ -143,6 +143,7 @@
onSubmit={generateJs}
collapseOnEscKey={!suggestedCode}
on:escKey={rejectSuggestion}
readonly={!!suggestedCode}
/>
</div>

View File

@ -9,6 +9,7 @@
export let placeholder: string = ""
export let expandedOnly: boolean = false
export let collapseOnEscKey: boolean = true
export let readonly: boolean = false
const dispatch = createEventDispatcher()
@ -34,7 +35,7 @@
: expanded
$: creditsExceeded = $licensing.aiCreditsExceeded
$: disabled = !aiEnabled || creditsExceeded
$: disabled = !aiEnabled || creditsExceeded || readonly
$: animateBorder = !disabled && expanded
function resetExpand() {
@ -70,6 +71,9 @@
}
async function onPromptSubmit() {
if (readonly) {
return
}
promptLoading = true
try {
await onSubmit(promptText)
@ -163,7 +167,7 @@
? "#6E56FF"
: "var(--spectrum-global-color-gray-600)"}
size="S"
hoverable
hoverable={!readonly}
hoverColor="#6E56FF"
name={promptLoading ? "StopCircle" : "PlayCircle"}
on:click={onPromptSubmit}