fix: prompt editor layout - full-width inputs, left-aligned text (Issue #28)
All checks were successful
Deploy Development / deploy (push) Successful in 50s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s

- PromptEditModal: all inputs/textareas now full-width
- Labels positioned above fields (not inline)
- Text left-aligned (was right-aligned)
- Added resize:vertical for textareas
- Side-by-side comparison with word-wrap
- Follows app-wide form design pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lars 2026-03-24 20:53:15 +01:00
parent c8cf375399
commit 7a8a5aee98
2 changed files with 21 additions and 12 deletions

View File

@ -181,46 +181,52 @@ export default function PromptEditModal({ prompt, onSave, onClose }) {
</div> </div>
{/* Form Fields */} {/* Form Fields */}
<div style={{display:'grid', gap:16, marginBottom:24}}> <div style={{display:'grid', gap:20, marginBottom:24}}>
<div> <div>
<label className="form-label">Titel *</label> <label className="form-label" style={{display:'block', marginBottom:6}}>Titel *</label>
<input <input
className="form-input" className="form-input"
value={name} value={name}
onChange={e => setName(e.target.value)} onChange={e => setName(e.target.value)}
placeholder="z.B. Protein-Analyse" placeholder="z.B. Protein-Analyse"
style={{width:'100%', textAlign:'left'}}
/> />
</div> </div>
{!prompt?.id && ( {!prompt?.id && (
<div> <div>
<label className="form-label">Slug * (eindeutig, keine Leerzeichen)</label> <label className="form-label" style={{display:'block', marginBottom:6}}>
Slug * (eindeutig, keine Leerzeichen)
</label>
<input <input
className="form-input" className="form-input"
value={slug} value={slug}
onChange={e => setSlug(e.target.value)} onChange={e => setSlug(e.target.value)}
placeholder="z.B. protein_analyse" placeholder="z.B. protein_analyse"
style={{width:'100%', textAlign:'left'}}
/> />
</div> </div>
)} )}
<div> <div>
<label className="form-label">Beschreibung</label> <label className="form-label" style={{display:'block', marginBottom:6}}>Beschreibung</label>
<textarea <textarea
className="form-input" className="form-input"
value={description} value={description}
onChange={e => setDescription(e.target.value)} onChange={e => setDescription(e.target.value)}
rows={2} rows={2}
placeholder="Wofür ist dieser Prompt? (für Admin sichtbar)" placeholder="Wofür ist dieser Prompt? (für Admin sichtbar)"
style={{width:'100%', textAlign:'left', resize:'vertical'}}
/> />
</div> </div>
<div> <div>
<label className="form-label">Kategorie</label> <label className="form-label" style={{display:'block', marginBottom:6}}>Kategorie</label>
<select <select
className="form-select" className="form-select"
value={category} value={category}
onChange={e => setCategory(e.target.value)} onChange={e => setCategory(e.target.value)}
style={{width:'100%'}}
> >
{categories.map(cat => ( {categories.map(cat => (
<option key={cat.id} value={cat.id}>{cat.label}</option> <option key={cat.id} value={cat.id}>{cat.label}</option>
@ -229,14 +235,14 @@ export default function PromptEditModal({ prompt, onSave, onClose }) {
</div> </div>
<div> <div>
<label className="form-label">Template *</label> <label className="form-label" style={{display:'block', marginBottom:6}}>Template *</label>
<textarea <textarea
className="form-input" className="form-input"
value={template} value={template}
onChange={e => setTemplate(e.target.value)} onChange={e => setTemplate(e.target.value)}
rows={15} rows={15}
placeholder="Du bist ein Ernährungsexperte. Analysiere folgende Daten: {{nutrition_summary}}" placeholder="Du bist ein Ernährungsexperte. Analysiere folgende Daten: {{nutrition_summary}}"
style={{fontFamily:'monospace', fontSize:12}} style={{width:'100%', textAlign:'left', fontFamily:'monospace', fontSize:12, resize:'vertical'}}
/> />
<div style={{fontSize:11, color:'var(--text3)', marginTop:4}}> <div style={{fontSize:11, color:'var(--text3)', marginTop:4}}>
Nutze Platzhalter wie {`{{weight_aktuell}}`}, {`{{protein_avg}}`}, etc. Nutze Platzhalter wie {`{{weight_aktuell}}`}, {`{{protein_avg}}`}, etc.
@ -326,7 +332,8 @@ export default function PromptEditModal({ prompt, onSave, onClose }) {
<strong>Original:</strong> <strong>Original:</strong>
<pre style={{ <pre style={{
marginTop:4, padding:12, background:'var(--surface2)', marginTop:4, padding:12, background:'var(--surface2)',
borderRadius:8, fontSize:11, maxHeight:200, overflow:'auto' borderRadius:8, fontSize:11, maxHeight:200, overflow:'auto',
whiteSpace:'pre-wrap', wordBreak:'break-word'
}}> }}>
{template} {template}
</pre> </pre>
@ -335,7 +342,8 @@ export default function PromptEditModal({ prompt, onSave, onClose }) {
<strong>Optimiert:</strong> <strong>Optimiert:</strong>
<pre style={{ <pre style={{
marginTop:4, padding:12, background:'#d4edda', marginTop:4, padding:12, background:'#d4edda',
borderRadius:8, fontSize:11, maxHeight:200, overflow:'auto' borderRadius:8, fontSize:11, maxHeight:200, overflow:'auto',
whiteSpace:'pre-wrap', wordBreak:'break-word'
}}> }}>
{optimization.optimized_prompt} {optimization.optimized_prompt}
</pre> </pre>

View File

@ -79,7 +79,7 @@ export default function PromptGenerator({ onGenerated, onClose }) {
{/* Step 1: Goal */} {/* Step 1: Goal */}
<div style={{marginBottom:24}}> <div style={{marginBottom:24}}>
<label className="form-label"> <label className="form-label" style={{display:'block', marginBottom:6}}>
1 Was möchtest du analysieren? 1 Was möchtest du analysieren?
</label> </label>
<textarea <textarea
@ -88,6 +88,7 @@ export default function PromptGenerator({ onGenerated, onClose }) {
onChange={e => setGoal(e.target.value)} onChange={e => setGoal(e.target.value)}
rows={3} rows={3}
placeholder="Beispiel: Ich möchte wissen ob meine Proteinzufuhr ausreichend ist für Muskelaufbau und wie ich sie optimieren kann." placeholder="Beispiel: Ich möchte wissen ob meine Proteinzufuhr ausreichend ist für Muskelaufbau und wie ich sie optimieren kann."
style={{width:'100%', textAlign:'left', resize:'vertical'}}
/> />
</div> </div>
@ -145,7 +146,7 @@ export default function PromptGenerator({ onGenerated, onClose }) {
{/* Step 3: Desired Format */} {/* Step 3: Desired Format */}
<div style={{marginBottom:24}}> <div style={{marginBottom:24}}>
<label className="form-label"> <label className="form-label" style={{display:'block', marginBottom:6}}>
3 Gewünschtes Antwort-Format (optional) 3 Gewünschtes Antwort-Format (optional)
</label> </label>
<textarea <textarea
@ -154,7 +155,7 @@ export default function PromptGenerator({ onGenerated, onClose }) {
onChange={e => setExampleOutput(e.target.value)} onChange={e => setExampleOutput(e.target.value)}
rows={4} rows={4}
placeholder={'Beispiel:\n## Analyse\n[Bewertung]\n\n## Empfehlungen\n- Punkt 1\n- Punkt 2'} placeholder={'Beispiel:\n## Analyse\n[Bewertung]\n\n## Empfehlungen\n- Punkt 1\n- Punkt 2'}
style={{fontFamily:'monospace', fontSize:12}} style={{width:'100%', textAlign:'left', fontFamily:'monospace', fontSize:12, resize:'vertical'}}
/> />
</div> </div>