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"
> >
<div>
<label htmlFor="entity-name" className="mb-1 block text-sm font-medium text-slate-200">
Entity Name
</label>
<input <input
placeholder="Name" id="entity-name"
value={form.name} value={form.name}
onChange={(e) => setForm({ ...form, name: e.target.value })} onChange={(e) => setForm({ ...form, name: e.target.value })}
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100" className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
required required
/> />
</div>
<div>
<label htmlFor="entity-email" className="mb-1 block text-sm font-medium text-slate-200">
Sender Email
</label>
<input <input
placeholder="Email" id="entity-email"
type="email" type="email"
value={form.email} value={form.email}
onChange={(e) => setForm({ ...form, email: e.target.value })} 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" className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
required required
/> />
</div>
<div>
<label htmlFor="entity-job-title" className="mb-1 block text-sm font-medium text-slate-200">
Job Title
</label>
<input <input
placeholder="Job Title" id="entity-job-title"
value={form.jobTitle} value={form.jobTitle}
onChange={(e) => setForm({ ...form, jobTitle: e.target.value })} onChange={(e) => setForm({ ...form, jobTitle: e.target.value })}
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100" className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
required required
/> />
</div>
<div>
<label htmlFor="entity-personality" className="mb-1 block text-sm font-medium text-slate-200">
Personality Notes
</label>
<textarea <textarea
placeholder="Personality" id="entity-personality"
value={form.personality} value={form.personality}
onChange={(e) => setForm({ ...form, personality: e.target.value })} 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" 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 <input
placeholder="Schedule Cron (e.g. 0 9 * * 1)" id="entity-context-window"
value={form.scheduleCron}
onChange={(e) => setForm({ ...form, scheduleCron: e.target.value })}
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" type="number"
placeholder="Context Window Days"
value={form.contextWindowDays} value={form.contextWindowDays}
onChange={(e) => setForm({ ...form, contextWindowDays: Number(e.target.value) })} 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" className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
min={1} min={1}
required 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"