feat(frontend): simplify entity modal fields and add explicit labels

This commit is contained in:
2026-03-26 20:38:24 -03:00
parent c2ed557118
commit 0cbb92e5ff
2 changed files with 67 additions and 50 deletions

View File

@@ -5,8 +5,8 @@ export interface VirtualEntityResponse {
name: string name: string
email: string email: string
jobTitle: string jobTitle: string
personality: string personality: string | null
scheduleCron: string scheduleCron: string | null
contextWindowDays: number contextWindowDays: number
active: boolean active: boolean
createdAt: string createdAt: string
@@ -16,8 +16,8 @@ export interface VirtualEntityCreateDto {
name: string name: string
email: string email: string
jobTitle: string jobTitle: string
personality: string personality?: string
scheduleCron: string scheduleCron?: string
contextWindowDays: number contextWindowDays: number
} }

View File

@@ -18,7 +18,6 @@ export default function EntitiesPage() {
email: '', email: '',
jobTitle: '', jobTitle: '',
personality: '', personality: '',
scheduleCron: '',
contextWindowDays: 3, contextWindowDays: 3,
}) })
@@ -27,7 +26,7 @@ export default function EntitiesPage() {
onSuccess: (createdEntity) => { onSuccess: (createdEntity) => {
queryClient.invalidateQueries({ queryKey: ['entities'] }) queryClient.invalidateQueries({ queryKey: ['entities'] })
setDialogOpen(false) setDialogOpen(false)
setForm({ name: '', email: '', jobTitle: '', personality: '', scheduleCron: '', contextWindowDays: 3 }) setForm({ name: '', email: '', jobTitle: '', personality: '', contextWindowDays: 3 })
navigate(`/entities/${createdEntity.id}`) navigate(`/entities/${createdEntity.id}`)
}, },
}) })
@@ -93,50 +92,68 @@ export default function EntitiesPage() {
}} }}
className="space-y-3" className="space-y-3"
> >
<input <div>
placeholder="Name" <label htmlFor="entity-name" className="mb-1 block text-sm font-medium text-slate-200">
value={form.name} Entity Name
onChange={(e) => setForm({ ...form, name: e.target.value })} </label>
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100" <input
required id="entity-name"
/> value={form.name}
<input onChange={(e) => setForm({ ...form, name: e.target.value })}
placeholder="Email" className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
type="email" required
value={form.email} />
onChange={(e) => setForm({ ...form, email: e.target.value })} </div>
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100" <div>
required <label htmlFor="entity-email" className="mb-1 block text-sm font-medium text-slate-200">
/> Sender Email
<input </label>
placeholder="Job Title" <input
value={form.jobTitle} id="entity-email"
onChange={(e) => setForm({ ...form, jobTitle: e.target.value })} type="email"
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100" value={form.email}
required onChange={(e) => setForm({ ...form, email: e.target.value })}
/> className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
<textarea required
placeholder="Personality" />
value={form.personality} </div>
onChange={(e) => setForm({ ...form, personality: e.target.value })} <div>
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100" <label htmlFor="entity-job-title" className="mb-1 block text-sm font-medium text-slate-200">
/> Job Title
<input </label>
placeholder="Schedule Cron (e.g. 0 9 * * 1)" <input
value={form.scheduleCron} id="entity-job-title"
onChange={(e) => setForm({ ...form, scheduleCron: e.target.value })} value={form.jobTitle}
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100" onChange={(e) => setForm({ ...form, jobTitle: e.target.value })}
required className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
/> required
<input />
type="number" </div>
placeholder="Context Window Days" <div>
value={form.contextWindowDays} <label htmlFor="entity-personality" className="mb-1 block text-sm font-medium text-slate-200">
onChange={(e) => setForm({ ...form, contextWindowDays: Number(e.target.value) })} Personality Notes
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100" </label>
min={1} <textarea
required id="entity-personality"
/> value={form.personality}
onChange={(e) => setForm({ ...form, personality: e.target.value })}
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
/>
</div>
<div>
<label htmlFor="entity-context-window" className="mb-1 block text-sm font-medium text-slate-200">
Default Email Context Window (days)
</label>
<input
id="entity-context-window"
type="number"
value={form.contextWindowDays}
onChange={(e) => setForm({ ...form, contextWindowDays: Number(e.target.value) })}
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
min={1}
required
/>
</div>
<div className="flex justify-end gap-2 pt-2"> <div className="flex justify-end gap-2 pt-2">
<button <button
type="button" type="button"