fix: standardize admin form inputs, validation, and sync with backend constraints

- Unified all inputs to use .input CSS class, consistent label styles, and btn-primary/btn-secondary buttons
- Fixed number inputs to use number | '' pattern allowing field clearing without default replacement
- Added field-level validation with inline error borders and messages
- Synced frontend constraints with backend Pydantic schemas (maxLength, min/max values)
- Fixed toggle switch dimensions across all admin forms
This commit is contained in:
c0mrade
2026-02-06 19:37:07 +03:00
parent 88d9377adb
commit 6e7eb36f76
13 changed files with 364 additions and 227 deletions

View File

@@ -675,7 +675,7 @@ export default function AdminBanSystem() {
onChange={(e) => setSearchQuery(e.target.value)}
onKeyDown={(e) => e.key === 'Enter' && handleSearch()}
placeholder={t('banSystem.users.searchPlaceholder')}
className="w-full rounded-lg border border-dark-700 bg-dark-800 py-2 pl-10 pr-4 text-dark-100 placeholder-dark-500 focus:border-accent-500 focus:outline-none"
className="input pl-10"
/>
</div>
<button
@@ -1333,7 +1333,7 @@ export default function AdminBanSystem() {
min={setting.min_value ?? undefined}
max={setting.max_value ?? undefined}
disabled={!setting.editable || settingLoading === setting.key}
className="w-24 rounded-lg border border-dark-700 bg-dark-900 px-3 py-1.5 text-sm text-dark-100 focus:border-accent-500 focus:outline-none disabled:opacity-50"
className="input w-24"
/>
) : setting.type === 'list' ? (
<div className="flex max-w-xs flex-wrap justify-end gap-1.5">
@@ -1353,7 +1353,7 @@ export default function AdminBanSystem() {
)}
{setting.editable && nodes && setting.key.includes('nodes') && (
<select
className="rounded border border-dark-700 bg-dark-900 px-2 py-1 text-xs text-dark-300 focus:border-accent-500 focus:outline-none"
className="input py-1 text-xs"
onChange={(e) => {
if (e.target.value) {
const currentList = Array.isArray(setting.value)