[PR #633] [MERGED] feat: allow single-option preset variables as boolean toggles #4705

Closed
opened 2026-10-22 04:09:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/633
Author: @jake9000
Created: 5/10/2026
Status: ✅ Merged
Merged: 5/10/2026
Merged by: @SpicyMarinara

Base: main ← Head: add_bool


📝 Commits (1)

  • 003f1ad feat: allow single-option preset variables as boolean toggles

📊 Changes

3 files changed (+163 additions, -76 deletions)

View changed files

📝 packages/client/src/components/presets/ChoiceSelectionModal.tsx (+82 -30)
📝 packages/client/src/components/presets/PresetEditor.tsx (+79 -44)
📝 packages/shared/src/schemas/prompt.schema.ts (+2 -2)

📄 Description

  • Relax option minimum from 2 to 1 in createChoiceBlockSchema/updateChoiceBlockSchema
  • Show boolean badge + info panel in PresetEditor when a variable has 1 option
  • Render toggle switch in ChoiceSelectionModal for single-option variables
  • Style toggle card consistently with existing radio/multi-select cards

Linked issue

Closes #632

Why this change

  1. The preset builder allows you to set a blank value for a variable, but the Configure Preset Variables treats blank values as unselected and blocks you from confirming your choices.
  2. I ran into this because I wanted to make an on/off type option and there is no obvious way to do that.

What changed

  1. Added helper text is user has blanked out a variable's value so they know it is required.
  2. Reduced minimum option count from 2 to 1. If a variable only has one option, Configure Preset Variables will display it as a switch instead of a checkbox.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  1. Modified the built-in preset with a new boolean type variable
  2. Verified that it does not appear in the prompt peeker when toggled off
  3. Verified that it does appear in the prompt peeker when toggled on

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

image Screenshot_20260510_020220 image Screenshot_20260510_020244 Screenshot_20260510_020251 Screenshot_20260510_020313

Summary by CodeRabbit

Release Notes

  • New Features
    • Single-option choice variables now display as boolean toggle buttons with on/off controls instead of radio-style selectors
    • Single-option variables labeled as "Boolean Toggle" for clarity
    • Enhanced validation with inline error messages for empty option values
    • Adjusted option removal restrictions for improved usability

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/633 **Author:** [@jake9000](https://github.com/jake9000) **Created:** 5/10/2026 **Status:** ✅ Merged **Merged:** 5/10/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `add_bool` --- ### 📝 Commits (1) - [`003f1ad`](https://github.com/Pasta-Devs/Marinara-Engine/commit/003f1ad84cb2fa1f06d73ebe3d605ea985f2e4a1) feat: allow single-option preset variables as boolean toggles ### 📊 Changes **3 files changed** (+163 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/presets/ChoiceSelectionModal.tsx` (+82 -30) 📝 `packages/client/src/components/presets/PresetEditor.tsx` (+79 -44) 📝 `packages/shared/src/schemas/prompt.schema.ts` (+2 -2) </details> ### 📄 Description - Relax option minimum from 2 to 1 in createChoiceBlockSchema/updateChoiceBlockSchema - Show boolean badge + info panel in PresetEditor when a variable has 1 option - Render toggle switch in ChoiceSelectionModal for single-option variables - Style toggle card consistently with existing radio/multi-select cards ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #632 ## Why this change <!-- What user problem, bug, or goal does this solve? --> 1. The preset builder allows you to set a blank value for a variable, but the Configure Preset Variables treats blank values as unselected and blocks you from confirming your choices. 2. I ran into this because I wanted to make an on/off type option and there is no obvious way to do that. ## What changed 1. Added helper text is user has blanked out a variable's value so they know it is required. 2. Reduced minimum option count from 2 to 1. If a variable only has one option, Configure Preset Variables will display it as a switch instead of a checkbox. - ## Validation <!-- Required: include commands run and/or manual checks performed --> - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes 1. Modified the built-in preset with a new boolean type variable 3. Verified that it does not appear in the prompt peeker when toggled off 4. Verified that it does appear in the prompt peeker when toggled on - ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) <img width="750" height="313" alt="image" src="https://github.com/user-attachments/assets/30cf219b-d631-438a-853d-41e685866d5a" /> <img width="860" height="475" alt="Screenshot_20260510_020220" src="https://github.com/user-attachments/assets/d7f04a6f-57c1-4e9f-91f2-f8847c41ca6c" /> <img width="755" height="402" alt="image" src="https://github.com/user-attachments/assets/f8e18191-08df-47ed-8431-e5b9b37439a4" /> <img width="539" height="245" alt="Screenshot_20260510_020244" src="https://github.com/user-attachments/assets/5cbe1f03-c6f1-4a53-b29c-652a983d4879" /> <img width="539" height="242" alt="Screenshot_20260510_020251" src="https://github.com/user-attachments/assets/3a64bfe2-c022-47fd-a3fb-17c66973b695" /> <img width="557" height="357" alt="Screenshot_20260510_020313" src="https://github.com/user-attachments/assets/ce71c37f-d25b-4b46-91cc-77ff7a8d63b1" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Single-option choice variables now display as boolean toggle buttons with on/off controls instead of radio-style selectors * Single-option variables labeled as "Boolean Toggle" for clarity * Enhanced validation with inline error messages for empty option values * Adjusted option removal restrictions for improved usability [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/633) <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:58 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4705
No description provided.