refac: prompt template variable made not required by default

This commit is contained in:
Timothy Jaeryang Baek
2025-09-15 11:18:31 -05:00
parent 5afa42b0d9
commit d5824b1b49
2 changed files with 43 additions and 28 deletions
@@ -84,7 +84,7 @@
<div class=" self-center text-xs font-medium">
{variable}
{#if variables[variable]?.required ?? true}
{#if variables[variable]?.required ?? false}
<span class=" text-gray-500">*{$i18n.t('required')}</span>
{/if}
</div>
@@ -134,7 +134,7 @@
placeholder={$i18n.t('Enter value (true/false)')}
bind:value={variableValues[variable]}
autocomplete="off"
required
required={variables[variable]?.required ?? false}
/>
</div>
{:else if variables[variable]?.type === 'color'}
@@ -159,7 +159,7 @@
placeholder={$i18n.t('Enter hex color (e.g. #FF0000)')}
bind:value={variableValues[variable]}
autocomplete="off"
required
required={variables[variable]?.required ?? false}
/>
</div>
{:else if variables[variable]?.type === 'date'}
@@ -170,7 +170,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
{...variableAttributes}
/>
{:else if variables[variable]?.type === 'datetime-local'}
@@ -181,7 +181,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
{...variableAttributes}
/>
{:else if variables[variable]?.type === 'email'}
@@ -192,7 +192,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
{...variableAttributes}
/>
{:else if variables[variable]?.type === 'month'}
@@ -203,7 +203,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
{...variableAttributes}
/>
{:else if variables[variable]?.type === 'number'}
@@ -214,7 +214,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
{...variableAttributes}
/>
{:else if variables[variable]?.type === 'range'}
@@ -235,7 +235,7 @@
placeholder={$i18n.t('Enter value')}
bind:value={variableValues[variable]}
autocomplete="off"
required
required={variables[variable]?.required ?? false}
/>
</div>
@@ -256,7 +256,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
{...variableAttributes}
/>
{:else if variables[variable]?.type === 'text'}
@@ -267,7 +267,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
{...variableAttributes}
/>
{:else if variables[variable]?.type === 'time'}
@@ -278,7 +278,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
{...variableAttributes}
/>
{:else if variables[variable]?.type === 'url'}
@@ -289,7 +289,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
{...variableAttributes}
/>
{:else if variables[variable]?.type === 'map'}
@@ -311,7 +311,7 @@
placeholder={$i18n.t('Enter coordinates (e.g. 51.505, -0.09)')}
bind:value={variableValues[variable]}
autocomplete="off"
required
required={variables[variable]?.required ?? false}
/>
</div>
{:else}
@@ -321,7 +321,7 @@
bind:value={variableValues[variable]}
autocomplete="off"
id="input-variable-{idx}"
required
required={variables[variable]?.required ?? false}
/>
{/if}
</div>