diff --git a/poetry.lock b/poetry.lock index 7f93af4..d2c219d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2955,4 +2955,4 @@ h11 = ">=0.9.0,<1" [metadata] lock-version = "2.1" python-versions = ">=3.12,<4.0" -content-hash = "1f9b94a5d041223b4446f0e44eaa33307f96edd36bad4addef8b9512ff96cd78" +content-hash = "1f9b94a5d041223b4446f0e44eaa33307f96edd36bad4addef8b9512ff96cd78" \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f7b541a..d7263d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,4 +65,4 @@ django-silk = ">= 5.3.2" [build-system] requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +build-backend = "poetry.core.masonry.api" \ No newline at end of file diff --git a/unfold_studio/static/base/base_style.css b/unfold_studio/static/base/base_style.css index 5432b81..8cbd12d 100644 --- a/unfold_studio/static/base/base_style.css +++ b/unfold_studio/static/base/base_style.css @@ -355,4 +355,55 @@ form.new_story_form { form.new_story_form > div { display: flex; flex-direction: column; -} \ No newline at end of file +} + +.input-container button, +form button[type="submit"] { + background-color: #8e44ad; + color: white; + border: none; + padding: 8px 16px; + border-radius: 4px; + cursor: pointer; + font-family: inherit; + font-size: inherit; +} + +.input-container button:hover, +form button[type="submit"]:hover { + background-color: #2980b9; +} + +/* Style textarea for longer responses */ +.input-container textarea { + width: 350px; + min-height: 60px; + max-height: 200px; + padding: 8px; + font-size: 14px; + font-family: inherit; + border: 2px solid #bdc3c7; + border-radius: 4px; + box-sizing: border-box; + resize: vertical; + overflow-y: auto; +} + +.input-container textarea:focus { + border-color: #3498db; + outline: none; +} + +/* Keep flex styling only on the form for textarea and button layout */ +.input-container form { + display: flex; + flex-direction: column; + gap: 10px; + width: 100%; +} + +.input-container form button[type="submit"] { + align-self: flex-start; + width: auto; + margin-top: 0; +} diff --git a/unfold_studio/static/player.js b/unfold_studio/static/player.js index dbf1830..33992d5 100644 --- a/unfold_studio/static/player.js +++ b/unfold_studio/static/player.js @@ -260,13 +260,20 @@ InkPlayer.prototype = { createInputForm: function(formType, eventHandler, placeholder, variableName=null) { const formContainer = document.createElement("div"); formContainer.classList.add("input-container"); - + const formElement = document.createElement("form"); - const inputElement = document.createElement("input"); - inputElement.type = "text"; + const inputElement = document.createElement("textarea"); inputElement.placeholder = placeholder; inputElement.required = true; + inputElement.rows = 3; + inputElement.style.resize = "vertical"; + + // Auto-resize functionality + inputElement.addEventListener("input", function() { + this.style.height = "auto"; + this.style.height = this.scrollHeight + "px"; + }); const buttonElement = document.createElement("button"); buttonElement.type = "submit"; @@ -274,7 +281,7 @@ InkPlayer.prototype = { formElement.appendChild(inputElement); formElement.appendChild(buttonElement); - + formElement.addEventListener("submit", (event) => { event.preventDefault(); const userInput = inputElement.value.trim(); @@ -284,16 +291,15 @@ InkPlayer.prototype = { buttonElement.disabled = true; formElement.style.opacity = "0.5"; }); - + this.createStoryPlayRecord( this.getStoryPlayInstanceUUID(), formType, {"placeholder": placeholder, "variableName": variableName} ); - - formContainer.appendChild(formElement); - return formContainer + formContainer.appendChild(formElement); + return formContainer; }, handleUserInputForContinue: async function(userInput){ targetKnotName = this.currentTargetKnot;