feat: improve form usability with auto-focus, character limits, and unsaved changes warnings for better user experience

This commit is contained in:
Usman Baig
2026-02-22 20:02:50 +01:00
parent 5d234b30d6
commit da0366603e
6 changed files with 96 additions and 2 deletions

View File

@@ -937,8 +937,13 @@ function MonitorForm({
value={formData.name}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
placeholder="e.g. API, Website, CDN"
autoFocus
maxLength={255}
className="w-full px-3 py-2 rounded-lg border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-brand-orange focus:border-transparent text-sm"
/>
{formData.name.length > 200 && (
<span className={`text-xs tabular-nums mt-1 ${formData.name.length > 240 ? 'text-amber-500' : 'text-neutral-400'}`}>{formData.name.length}/255</span>
)}
</div>
{/* URL with protocol dropdown + domain prefix */}